Differential D2810 Diff 13519 ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
Show First 20 Lines • Show All 644 Lines • ▼ Show 20 Lines | GuiInterface.prototype.GetBattleState = function(player) | ||||
return cmpBattleDetection.GetState(); | return cmpBattleDetection.GetState(); | ||||
}; | }; | ||||
/** | /** | ||||
* Returns a list of ongoing attacks against the player. | * Returns a list of ongoing attacks against the player. | ||||
*/ | */ | ||||
GuiInterface.prototype.GetIncomingAttacks = function(player) | GuiInterface.prototype.GetIncomingAttacks = function(player) | ||||
{ | { | ||||
return QueryPlayerIDInterface(player, IID_AttackDetection).GetIncomingAttacks(); | let cmpAttackDetection = QueryPlayerIDInterface(player, IID_AttackDetection); | ||||
if (!cmpAttackDetection) | |||||
return []; | |||||
return cmpAttackDetection.GetIncomingAttacks(); | |||||
}; | }; | ||||
/** | /** | ||||
* Used to show a red square over GUI elements you can't yet afford. | * Used to show a red square over GUI elements you can't yet afford. | ||||
*/ | */ | ||||
GuiInterface.prototype.GetNeededResources = function(player, data) | GuiInterface.prototype.GetNeededResources = function(player, data) | ||||
{ | { | ||||
return QueryPlayerIDInterface(data.player !== undefined ? data.player : player).GetNeededResources(data.cost); | let cmpPlayer = QueryPlayerIDInterface(data.player !== undefined ? data.player : player); | ||||
return cmpPlayer ? cmpPlayer.GetNeededResources(data.cost) : {}; | |||||
}; | }; | ||||
/** | /** | ||||
* State of the templateData (player dependent): true when some template values have been modified | * State of the templateData (player dependent): true when some template values have been modified | ||||
* and need to be reloaded by the gui. | * and need to be reloaded by the gui. | ||||
*/ | */ | ||||
GuiInterface.prototype.OnTemplateModification = function(msg) | GuiInterface.prototype.OnTemplateModification = function(msg) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
let n = this.notifications; | let n = this.notifications; | ||||
this.notifications = []; | this.notifications = []; | ||||
return n; | return n; | ||||
}; | }; | ||||
GuiInterface.prototype.GetAvailableFormations = function(player, wantedPlayer) | GuiInterface.prototype.GetAvailableFormations = function(player, wantedPlayer) | ||||
{ | { | ||||
return QueryPlayerIDInterface(wantedPlayer).GetFormations(); | let cmpPlayer = QueryPlayerIDInterface(wantedPlayer); | ||||
if (!cmpPlayer) | |||||
return []; | |||||
return cmpPlayer.GetFormations(); | |||||
}; | }; | ||||
GuiInterface.prototype.GetFormationRequirements = function(player, data) | GuiInterface.prototype.GetFormationRequirements = function(player, data) | ||||
{ | { | ||||
return GetFormationRequirements(data.formationTemplate); | return GetFormationRequirements(data.formationTemplate); | ||||
}; | }; | ||||
GuiInterface.prototype.CanMoveEntsIntoFormation = function(player, data) | GuiInterface.prototype.CanMoveEntsIntoFormation = function(player, data) | ||||
▲ Show 20 Lines • Show All 1,173 Lines • ▼ Show 20 Lines | for (let ent of traders) | ||||
} | } | ||||
} | } | ||||
return { "landTrader": landTrader, "shipTrader": shipTrader }; | return { "landTrader": landTrader, "shipTrader": shipTrader }; | ||||
}; | }; | ||||
GuiInterface.prototype.GetTradingGoods = function(player) | GuiInterface.prototype.GetTradingGoods = function(player) | ||||
{ | { | ||||
return QueryPlayerIDInterface(player).GetTradingGoods(); | let cmpPlayer = QueryPlayerIDInterface(player); | ||||
if (!cmpPlayer) | |||||
return []; | |||||
return cmpPlayer.GetTradingGoods(); | |||||
}; | }; | ||||
GuiInterface.prototype.OnGlobalEntityRenamed = function(msg) | GuiInterface.prototype.OnGlobalEntityRenamed = function(msg) | ||||
{ | { | ||||
this.renamedEntities.push(msg); | this.renamedEntities.push(msg); | ||||
}; | }; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator