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

49 lines
1.4 KiB
Lua
Raw 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 = 30.;
}
-- 触发器激活时将执行Action的Execute
function EventAction_GameEnd:Execute(...)
if UGCGameSystem.IsServer() then
-- 停止请求玩家加入
UGCGameSystem.StopPlayerJoin()
self:SendUGCModeBattleResult()
else
end
return true
end
-- 结算、关闭DS
function EventAction_GameEnd:SendUGCModeBattleResult()
-- 向所有玩家发送结束协议
local AllPlayerStates = UGCGameSystem.GetAllPlayerState()
for _, PlayerState in pairs(AllPlayerStates) do
if PlayerState then
UGCGameSystem.SendPlayerSettlement(PlayerState.PlayerKey);
UGCLogSystem.Log("[EventAction_GameEnd_SendUGCModeBattleResult] SendPlayerSettlement %d", PlayerState.PlayerKey)
else
UGCLogSystem.LogError("[EventAction_GameEnd_SendUGCModeBattleResult] PlayerState 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