UGCProjects/GZJ/Script/gamemode/Action_PlayerExit.lua
2025-01-08 22:46:12 +08:00

25 lines
765 B
Lua

local Action_PlayerExit = {
PlayerKey = 0,
}
function Action_PlayerExit:Execute(...)
UGCGameSystem.SendPlayerSettlement(self.PlayerKey);
local PlayerState = UGCGameSystem.GetPlayerStateByPlayerKey(self.PlayerKey)
if UGCGameSystem.GameState and PlayerState then
UE.Log("[Action_PlayerExit:Execute] PlayerName = "..PlayerState.PlayerName)
local PlayerData = UGCGameSystem.GameState.PlayerDataList[self.PlayerKey]
if PlayerData ~= nil then
PlayerData.IsOffline = true
end
local PlayerKeys = UGCTeamSystem.GetPlayerKeysByTeamID(PlayerState.TeamID)
if #PlayerKeys == 0 then
EventSystem:SendEvent(EventType.OnSendGameEnd, "AllPlayerExited")
end
end
return true
end
return Action_PlayerExit