Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/minimap/MiniMapPanel.js
/** | /** | ||||
* This class is concerned with managing the different elements of the minimap panel. | * This class is concerned with managing the different elements of the minimap panel. | ||||
*/ | */ | ||||
class MiniMapPanel | class MiniMapPanel | ||||
{ | { | ||||
constructor(playerViewControl, diplomacyColors, idleWorkerClasses) | constructor(playerViewControl, diplomacyColors, idleWorkerClasses) | ||||
{ | { | ||||
this.diplomacyColorsButton = new MiniMapDiplomacyColorsButton(diplomacyColors); | this.diplomacyColorsButton = new MiniMapDiplomacyColorsButton(diplomacyColors); | ||||
this.idleWorkerButton = new MiniMapIdleWorkerButton(playerViewControl, idleWorkerClasses); | this.idleWorkerButton = new MiniMapIdleWorkerButton(playerViewControl, idleWorkerClasses); | ||||
this.flareButton = new MiniMapFlareButton(playerViewControl); | this.flareButton = new MiniMapFlareButton(playerViewControl); | ||||
this.miniMap = new MiniMap(); | this.miniMap = new MiniMap(); | ||||
this.setCivBackgroundTexture(); | |||||
} | } | ||||
flare(target, playerID) | flare(target, playerID) | ||||
{ | { | ||||
return this.miniMap.flare(target, playerID); | return this.miniMap.flare(target, playerID); | ||||
} | } | ||||
isMouseOverMiniMap() | isMouseOverMiniMap() | ||||
{ | { | ||||
return this.miniMap.isMouseOverMiniMap(); | return this.miniMap.isMouseOverMiniMap(); | ||||
} | } | ||||
setCivBackgroundTexture() | |||||
{ | |||||
const playerId = Engine.GetPlayerID(); | |||||
// Spectator and Gaia player get the athenian's UI. | |||||
Freagarach: Doesn't `gaia` have the civ `gaia` as well? | |||||
Done Inline ActionsNot sure what observers have. I think it's a good default? Stan: Not sure what observers have. I think it's a good default? | |||||
Done Inline ActionsAn 'observer' background? ;) (All-seeing eye. ^^ ) Freagarach: An 'observer' background? ;) (All-seeing eye. ^^ ) | |||||
Done Inline ActionsI mean as a civ :) Stan: I mean as a civ :) | |||||
Not Done Inline ActionsYeah, I guess one can make it playerCiv = "observer" and then the rest but check if playerId > -1? Freagarach: Yeah, I guess one can make it `playerCiv = "observer"` and then the rest but check if `playerId… | |||||
Done Inline ActionsWe don't have an observer background yet though. Stan: We don't have an observer background yet though. | |||||
// WIP ToDo, maybe we could have a background for observers. | |||||
// 0 A.D. logo maybe. | |||||
Not Done Inline ActionsThis could also be g_CivData[g_Players[playerID].civ].Name Having a named function looks cleaner tho. Idk if one is faster/more expensive than the other marder: This could also be `g_CivData[g_Players[playerID].civ].Name`
Having a named function looks… | |||||
Done Inline ActionsThe latter is more expensive. And more code. But prettier ^^ Stan: The latter is more expensive. And more code. But prettier ^^ | |||||
let playerCiv = "athen"; | |||||
if (playerId > 0) | |||||
playerCiv = Engine.GuiInterfaceCall("GetPlayerCiv"); | |||||
const backgroundObject = Engine.GetGUIObjectByName("minimapBackgroundTexture"); | |||||
// WIP ToDo Remove this. | |||||
if (!backgroundObject) | |||||
return; | |||||
backgroundObject.sprite = "minimapBackground_" + playerCiv; | |||||
} | |||||
} | } |
Wildfire Games · Phabricator
Doesn't gaia have the civ gaia as well?