Differential D2483 Diff 10778 binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CivInfoButton.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CivInfoButton.js
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
class CivInfoButton | |||||
{ | |||||
constructor() | |||||
{ | |||||
this.civInfo = { | |||||
"civ": "", | |||||
"page": "page_civinfo.xml" | |||||
}; | |||||
let civInfoButton = Engine.GetGUIObjectByName("civInfoButton"); | |||||
civInfoButton.onPress = this.onPress.bind(this); | |||||
civInfoButton.tooltip = | |||||
sprintf(translate(this.Tooltip), { | |||||
"hotkey_civinfo": colorizeHotkey("%(hotkey)s", "civinfo"), | |||||
"hotkey_structree": colorizeHotkey("%(hotkey)s", "structree") | |||||
}); | |||||
Engine.SetGlobalHotkey("structree", this.openPage.bind(this, "page_structree.xml")); | |||||
Engine.SetGlobalHotkey("civinfo", this.openPage.bind(this, "page_civinfo.xml")); | |||||
} | |||||
onPress() | |||||
{ | |||||
this.openPage(this.civInfo.page); | |||||
} | |||||
openPage(page) | |||||
{ | |||||
Engine.PushGuiPage( | |||||
page, | |||||
{ "civ": this.civInfo.civ }, | |||||
this.storeCivInfoPage.bind(this)); | |||||
} | |||||
storeCivInfoPage(data) | |||||
{ | |||||
if (data.nextPage) | |||||
Engine.PushGuiPage( | |||||
data.nextPage, | |||||
{ "civ": data.civ }, | |||||
this.storeCivInfoPage.bind(this)); | |||||
else | |||||
this.civInfo = data; | |||||
} | |||||
} | |||||
CivInfoButton.prototype.Tooltip = | |||||
translate("%(hotkey_civinfo)s / %(hotkey_structree)s: View History / Structure Tree\nLast opened will be reopened on click."); |
Wildfire Games · Phabricator