25 lines
765 B
Lua
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
|