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

47 lines
1.3 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
-- 显示结束界面UI
UGCGameSystem.GameState:ShowSimplePlayModeUI(WidgetConfig.EUIType.Settlement)
-- 发送结束协议等关闭操作
self:SendUGCModeBattleResult()
else
end
return true
end
-- 结算、关闭DS
function EventAction_GameEnd:SendUGCModeBattleResult()
-- 保存成就数据
UGCEventSystem.SendEvent(EventEnum.AchievementSettlement)
-- 向所有玩家发送结束协议
local AllPC = UGCGameSystem.GetAllPlayerController()
for _, PC in pairs(AllPC) do
if PC then
UGCGameSystem.SendPlayerSettlement(PC.PlayerKey);
UGCLogSystem.Log("[EventAction_GameEnd_SendUGCModeBattleResult] SendPlayerSettlement %s", tostring(PC.PlayerKey))
else
UGCLogSystem.LogError("[EventAction_GameEnd_SendUGCModeBattleResult] PC is nil !")
end
end
-- 延迟关闭DS
UGCEventSystem.SetTimer(
UGCGameSystem.GameState,
function()
UGCGameSystem.SendModeCustomEvent("GameEndAgreement")
UGCLogSystem.Log("[EventAction_GameEnd_SendUGCModeBattleResult] Close DS Finsh")
end,
self.DelayOffDS
)
end
return EventAction_GameEnd