Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/mod/gui/msgbox/msgbox.js
Show All 23 Lines | function init(data) | ||||
let captions = data.buttonCaptions || [translate("OK")]; | let captions = data.buttonCaptions || [translate("OK")]; | ||||
// Set button captions and visibility | // Set button captions and visibility | ||||
let mbButton = []; | let mbButton = []; | ||||
captions.forEach((caption, i) => { | captions.forEach((caption, i) => { | ||||
mbButton[i] = Engine.GetGUIObjectByName("mbButton" + (i + 1)); | mbButton[i] = Engine.GetGUIObjectByName("mbButton" + (i + 1)); | ||||
let action = function() | let action = () => { | ||||
{ | Engine.PopGuiPage(i); | ||||
if (data.callback) | |||||
Engine.PopGuiPageCB(i); | |||||
else | |||||
Engine.PopGuiPage(); | |||||
}; | }; | ||||
mbButton[i].caption = caption; | mbButton[i].caption = caption; | ||||
mbButton[i].onPress = action; | mbButton[i].onPress = action; | ||||
mbButton[i].hidden = false; | mbButton[i].hidden = false; | ||||
// Convention: Cancel is the first button | // Convention: Cancel is the first button | ||||
if (i == 0) | if (i == 0) | ||||
Show All 22 Lines |
Wildfire Games · Phabricator