2025-01-04 23:00:19 +08:00

49 lines
1.4 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

local EventAction_GameEnd = {
DelayOffDS = 3.;
}
-- 触发器激活时将执行Action的Execute
function EventAction_GameEnd:Execute(...)
if UGCGameSystem.IsServer() then
-- 停止请求玩家加入
UGCGameSystem.StopPlayerJoin()
self:SendUGCModeBattleResult()
else
end
return true
end
-- 结算、关闭DS
function EventAction_GameEnd:SendUGCModeBattleResult()
-- 保存成就数据
UGCEventSystem.SendEvent(EventEnum.AchievementSettlement)
-- 向所有玩家发送结束协议
local AllPlayerStates = UGCGameSystem.GetAllPlayerState()
for _, PlayeState in pairs(AllPlayerStates) do
if PlayeState then
UGCGameSystem.SendPlayerSettlement(PlayeState.PlayerKey);
UGCLogSystem.Log("[EventAction_GameEnd_SendUGCModeBattleResult] SendPlayerSettlement %d", PlayeState.PlayerKey)
else
UGCLogSystem.LogError("[EventAction_GameEnd_SendUGCModeBattleResult] PlayeState is nil !")
end
end
-- 延迟关闭DS
UGCEventSystem.SetTimer(
UGCGameSystem.GameState,
function()
UGCGameSystem.SendModeCustomEvent("GameEndAgreement")
UGCLogSystem.Log("[EventAction_GameEnd_SendUGCModeBattleResult] Close DS Finsh")
end,
self.DelayOffDS
)
--local AllPawn = UGCGameSystem.GetAllPlayerPawn()
--for i, PlayerPawn in pairs(AllPawn) do
-- PlayerPawn:K2_DestroyActor()
--end
end
return EventAction_GameEnd