Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/EndGameManager.js
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | EndGameManager.prototype.MarkPlayersAsWon = function(winningPlayers, victoryString, defeatString) | ||||
for (let playerID of defeatedPlayers) | for (let playerID of defeatedPlayers) | ||||
QueryPlayerIDInterface(playerID).SetState("defeated", undefined); | QueryPlayerIDInterface(playerID).SetState("defeated", undefined); | ||||
let cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); | let cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); | ||||
cmpGUIInterface.PushNotification({ | cmpGUIInterface.PushNotification({ | ||||
"type": "won", | "type": "won", | ||||
"players": [winningPlayers[0]], | "players": [winningPlayers[0]], | ||||
"allies" : winningPlayers, | "allies": winningPlayers, | ||||
"message": victoryString(winningPlayers.length) | "message": victoryString(winningPlayers.length) | ||||
}); | }); | ||||
if (defeatedPlayers.length) | if (defeatedPlayers.length) | ||||
cmpGUIInterface.PushNotification({ | cmpGUIInterface.PushNotification({ | ||||
"type": "defeat", | "type": "defeat", | ||||
"players": [defeatedPlayers[0]], | "players": [defeatedPlayers[0]], | ||||
"allies" : defeatedPlayers, | "allies": defeatedPlayers, | ||||
"message": defeatString(defeatedPlayers.length) | "message": defeatString(defeatedPlayers.length) | ||||
}); | }); | ||||
this.skipAlliedVictoryCheck = false; | this.skipAlliedVictoryCheck = false; | ||||
}; | }; | ||||
EndGameManager.prototype.SetAlliedVictory = function(flag) | EndGameManager.prototype.SetAlliedVictory = function(flag) | ||||
{ | { | ||||
Show All 38 Lines | for (let playerID of allies) | ||||
let cmpPlayer = QueryPlayerIDInterface(playerID); | let cmpPlayer = QueryPlayerIDInterface(playerID); | ||||
if (cmpPlayer) | if (cmpPlayer) | ||||
cmpPlayer.SetState("won", undefined); | cmpPlayer.SetState("won", undefined); | ||||
} | } | ||||
cmpGuiInterface.PushNotification({ | cmpGuiInterface.PushNotification({ | ||||
"type": "won", | "type": "won", | ||||
"players": [allies[0]], | "players": [allies[0]], | ||||
"allies" : allies, | "allies": allies, | ||||
"message": markForPluralTranslation( | "message": markForPluralTranslation( | ||||
"%(lastPlayer)s has won (last player alive).", | "%(lastPlayer)s has won (last player alive).", | ||||
"%(players)s and %(lastPlayer)s have won (last players alive).", | "%(players)s and %(lastPlayer)s have won (last players alive).", | ||||
allies.length) | allies.length) | ||||
}); | }); | ||||
} | } | ||||
else | else | ||||
this.lastManStandingMessage = cmpGuiInterface.AddTimeNotification({ | this.lastManStandingMessage = cmpGuiInterface.AddTimeNotification({ | ||||
Show All 21 Lines |
Wildfire Games · Phabricator