Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/gamesetup.js
Show All 12 Lines | |||||
/** | /** | ||||
* Offer users to select playable civs only. | * Offer users to select playable civs only. | ||||
* Load unselectable civs as they could appear in scenario maps. | * Load unselectable civs as they could appear in scenario maps. | ||||
*/ | */ | ||||
const g_CivData = loadCivData(false, false); | const g_CivData = loadCivData(false, false); | ||||
/** | /** | ||||
* Store civilization code and page (structree or history) opened in civilization info. | |||||
elexis: Could mention the purpose too (so the same civ and page is opened again when clicking on the… | |||||
Not Done Inline Actionswhat ffffffff: what | |||||
Not Done Inline ActionsYes, omg sorry. :( ffffffff: Yes, omg sorry. :( | |||||
*/ | |||||
var g_CivInfo = { | |||||
"code": "", | |||||
"page": "page_civinfo.xml" | |||||
}; | |||||
/** | |||||
* Highlight the "random" dropdownlist item. | * Highlight the "random" dropdownlist item. | ||||
*/ | */ | ||||
var g_ColorRandom = "orange"; | var g_ColorRandom = "orange"; | ||||
Not Done Inline ActionsUnused variable. s0600204: Unused variable. | |||||
/** | /** | ||||
* Color for regular dropdownlist items. | * Color for regular dropdownlist items. | ||||
*/ | */ | ||||
var g_ColorRegular = "white"; | var g_ColorRegular = "white"; | ||||
/** | /** | ||||
* Color for "Unassigned"-placeholder item in the dropdownlist. | * Color for "Unassigned"-placeholder item in the dropdownlist. | ||||
▲ Show 20 Lines • Show All 1,066 Lines • ▼ Show 20 Lines | function init(attribs) | ||||
// Replace empty playername when entering a singleplayermatch for the first time | // Replace empty playername when entering a singleplayermatch for the first time | ||||
if (!g_IsNetworked) | if (!g_IsNetworked) | ||||
saveSettingAndWriteToUserConfig("playername.singleplayer", singleplayerName()); | saveSettingAndWriteToUserConfig("playername.singleplayer", singleplayerName()); | ||||
initDefaults(); | initDefaults(); | ||||
supplementDefaults(); | supplementDefaults(); | ||||
setTimeout(displayGamestateNotifications, 1000); | setTimeout(displayGamestateNotifications, 1000); | ||||
Engine.GetGUIObjectByName("civInfoButton").tooltip = sprintf( | |||||
translate("%(hotkey1)s / %(hotkey2)s: View civilization info / structure tree"), { | |||||
"hotkey1": colorizeHotkey("%(hotkey)s", "civinfo"), | |||||
"hotkey2": colorizeHotkey("%(hotkey)s", "structree") | |||||
}); | |||||
s0600204Unsubmitted Not Done Inline ActionsThere is a similar tooltip later on in session.js. Whilst this has hotkey1 / hotkey2: name1 / name2, the one later is press hotkey1 to open name1 \n press hotkey2 to open name2. This is inconsistent, so please decide on one way or the other. Could also add a "Click to reopen whichever was last viewed" (or something to that effect) so the user knows what pressing the button will do. Also, most other tooltips refer to the civinfo page as "History". s0600204: There is a similar tooltip later on in `session.js`. Whilst this has !!hotkey1 / hotkey2: name1… | |||||
} | } | ||||
function initDefaults() | function initDefaults() | ||||
{ | { | ||||
// Remove gaia from both arrays | // Remove gaia from both arrays | ||||
g_DefaultPlayerData = clone(g_Settings.PlayerDefaults.slice(1)); | g_DefaultPlayerData = clone(g_Settings.PlayerDefaults.slice(1)); | ||||
let aiDifficulty = +Engine.ConfigDB_GetValue("user", "gui.gamesetup.aidifficulty"); | let aiDifficulty = +Engine.ConfigDB_GetValue("user", "gui.gamesetup.aidifficulty"); | ||||
▲ Show 20 Lines • Show All 1,551 Lines • ▼ Show 20 Lines | for (let name in dropdown) | ||||
if (priority === undefined) | if (priority === undefined) | ||||
continue; | continue; | ||||
autocomplete[priority] = (autocomplete[priority] || []).concat(dropdown[name].labels()); | autocomplete[priority] = (autocomplete[priority] || []).concat(dropdown[name].labels()); | ||||
} | } | ||||
g_Autocomplete = Object.keys(autocomplete).sort().reverse().reduce((all, priority) => all.concat(autocomplete[priority]), []); | g_Autocomplete = Object.keys(autocomplete).sort().reverse().reduce((all, priority) => all.concat(autocomplete[priority]), []); | ||||
} | } | ||||
function storeCivInfoPage(data) | |||||
{ | |||||
g_CivInfo.code = data.civ; | |||||
g_CivInfo.page = data.page; | |||||
Not Done Inline ActionsIs there any time that this function is called where data (or its attributes) is not defined? s0600204: Is there any time that this function is called where `data` (or its attributes) is not defined? | |||||
Not Done Inline ActionsWould be more readable if it were two statements rather than the destructuring assignment elexis: Would be more readable if it were two statements rather than the destructuring assignment | |||||
Not Done Inline ActionsYes, sorry. Really wasn't not there when writing that code. :( ffffffff: Yes, sorry. Really wasn't not there when writing that code. :( | |||||
} |
Wildfire Games · Phabricator
Could mention the purpose too (so the same civ and page is opened again when clicking on the button again?)