Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/functions_global_object.js
// We want to pass callback functions for the different buttons in a convenient way. | // We want to pass callback functions for the different buttons in a convenient way. | ||||
// Because passing functions accross compartment boundaries is a pain, we just store them here together with some optional arguments. | // Because passing functions accross compartment boundaries is a pain, we just store them here together with some optional arguments. | ||||
// The messageBox page will return the code of the pressed button and the according function will be called. | // The messageBox page will return the code of the pressed button and the according function will be called. | ||||
var g_MessageBoxBtnFunctions = []; | var g_MessageBoxBtnFunctions = []; | ||||
var g_MessageBoxCallbackArgs = []; | var g_MessageBoxCallbackArgs = []; | ||||
/* | |||||
* Options dialog window is shown. | |||||
bb: Identifier whether the Options window is shown | |||||
*/ | |||||
var g_OptionsShown = false; | |||||
Not Done Inline ActionsCan the variable be definitioned down right before the function? Or must it be here in head. : ) ffffffff: Can the variable be definitioned down right before the function? Or must it be here in head. : ) | |||||
Not Done Inline Actionsmust be in head bb: must be in head | |||||
var g_MessageBoxCallbackFunction = function(btnCode) | var g_MessageBoxCallbackFunction = function(btnCode) | ||||
{ | { | ||||
if (btnCode !== undefined && g_MessageBoxBtnFunctions[btnCode]) | if (btnCode !== undefined && g_MessageBoxBtnFunctions[btnCode]) | ||||
{ | { | ||||
// Cache the variables to make it possible to call a messageBox from a callback function. | // Cache the variables to make it possible to call a messageBox from a callback function. | ||||
let callbackFunction = g_MessageBoxBtnFunctions[btnCode]; | let callbackFunction = g_MessageBoxBtnFunctions[btnCode]; | ||||
let callbackArgs = g_MessageBoxCallbackArgs[btnCode]; | let callbackArgs = g_MessageBoxCallbackArgs[btnCode]; | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
let extendedSimState = Engine.GuiInterfaceCall("GetExtendedSimulationState"); | let extendedSimState = Engine.GuiInterfaceCall("GetExtendedSimulationState"); | ||||
return { | return { | ||||
"timeElapsed": extendedSimState.timeElapsed, | "timeElapsed": extendedSimState.timeElapsed, | ||||
"playerStates": extendedSimState.players, | "playerStates": extendedSimState.players, | ||||
"mapSettings": Engine.GetInitAttributes().settings | "mapSettings": Engine.GetInitAttributes().settings | ||||
}; | }; | ||||
} | } | ||||
function showOptions() | |||||
{ | |||||
if (!g_OptionsShown) | |||||
Engine.PushGuiPage("page_options.xml"); | |||||
} | |||||
Not Done Inline Actionsfunction even more ugly than the setting in xml bb: function even more ugly than the setting in xml |
Wildfire Games · Phabricator
Identifier whether the Options window is shown