Changeset 25966 for ps/trunk/binaries/data/mods/mod/gui/msgbox/msgbox.js
- Timestamp:
- Oct 17, 2021, 12:58:51 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/mod/gui/msgbox/msgbox.js
r22676 r25966 25 25 let captions = data.buttonCaptions || [translate("OK")]; 26 26 27 // Set button captions and visibility28 27 let mbButton = []; 29 captions.forEach((caption, i) => { 30 mbButton[i] = Engine.GetGUIObjectByName("mbButton" + (i + 1)); 31 mbButton[i].caption = caption; 32 mbButton[i].hidden = false; 33 mbButton[i].onPress = () => { 34 Engine.PopGuiPage(i); 35 }; 36 37 // Convention: Cancel is the first button 38 if (i == 0) 39 mbCancelHotkey.onPress = mbButton[i].onPress; 40 }); 41 42 // Distribute buttons horizontally 43 let y1 = "100%-46"; 44 let y2 = "100%-18"; 45 switch (captions.length) 46 { 47 case 1: 48 mbButton[0].size = "18 " + y1 + " 100%-18 " + y2; 49 break; 50 case 2: 51 mbButton[0].size = "18 " + y1 + " 50%-5 " + y2; 52 mbButton[1].size = "50%+5 " + y1 + " 100%-18 " + y2; 53 break; 54 case 3: 55 mbButton[0].size = "18 " + y1 + " 33%-5 " + y2; 56 mbButton[1].size = "33%+5 " + y1 + " 66%-5 " + y2; 57 mbButton[2].size = "66%+5 " + y1 + " 100%-18 " + y2; 58 break; 59 } 28 setButtonCaptionsAndVisibitily(mbButton, captions, mbCancelHotkey, "mbButton"); 29 distributeButtonsHorizontally(mbButton, captions); 60 30 }
Note:
See TracChangeset
for help on using the changeset viewer.