Improve spectator pause menu emulation

Makes the fake pause menu closer to the real thing for UX purposes
This commit is contained in:
SilentSpike 2015-08-06 00:39:14 +01:00
parent c808021c7c
commit d1975a593d

View File

@ -457,10 +457,10 @@ switch (toLower _mode) do {
}; };
} forEach GVAR(unitList); } forEach GVAR(unitList);
}; };
// Other // Break from interface for escape menu
case "escape": { case "escape": {
_args params ["_display"]; _args params ["_display"];
private ["_dlg","_key","_index","_ctrl","_config"]; private "_dlg";
// Kill display // Kill display
_display closeDisplay 0; _display closeDisplay 0;
@ -474,7 +474,6 @@ switch (toLower _mode) do {
GVAR(mouse) = [false,false]; GVAR(mouse) = [false,false];
GVAR(mousePos) = [0.5,0.5]; GVAR(mousePos) = [0.5,0.5];
// Below is from EFUNC(common,disableUserInput)
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer); createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
disableSerialization; disableSerialization;
@ -484,30 +483,35 @@ switch (toLower _mode) do {
!(_key == 1) !(_key == 1)
}]; }];
for "_index" from 100 to 2000 do { // Disable save, respawn, options & manual buttons
(_dlg displayCtrl _index) ctrlEnable false; (_dlg displayCtrl 103) ctrlEnable false;
if !(alive player) then {
(_dlg displayCtrl 1010) ctrlEnable false;
}; };
(_dlg displayCtrl 101) ctrlEnable false;
(_dlg displayCtrl 122) ctrlEnable false;
_ctrl = _dlg displayctrl 103; // Initalize abort button (the "spawn" is a necessary evil)
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(while {dialog} do {closeDialog 0}; failMission 'LOSER';)]; (_dlg displayCtrl 104) ctrlAddEventHandler ["ButtonClick",{_this spawn {
_ctrl ctrlEnable true; disableSerialization;
_ctrl ctrlSetText "ABORT"; _display = ctrlparent (_this select 0);
_ctrl ctrlSetTooltip "Abort."; _abort = [localize "str_msg_confirm_return_lobby",nil,localize "str_disp_xbox_hint_yes",localize "str_disp_xbox_hint_no",_display,nil,true] call BIS_fnc_guiMessage;
if (_abort) then {_display closeDisplay 2; failMission "loser"};
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer); }}];
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1;)];
_ctrl ctrlEnable (call {_config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
_ctrl ctrlSetText "RESPAWN";
_ctrl ctrlSetTooltip "Respawn.";
// PFH to re-open display when menu closes // PFH to re-open display when menu closes
[{ [{
if !(isNull (findDisplay 49)) exitWith {}; if !(isNull (findDisplay 49)) exitWith {};
createDialog QGVAR(interface); // If still a spectator then re-enter the interface
[] call FUNC(transitionCamera); if (GVAR(isSet)) then {
createDialog QGVAR(interface);
[] call FUNC(transitionCamera);
};
[_this select 1] call CBA_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;
},0] call CBA_fnc_addPerFrameHandler; },0] call CBA_fnc_addPerFrameHandler;
true
}; };
}; };