mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Common - Fix disableUserInput blocking already open Zeus display (#7757)
This commit is contained in:
parent
00fa94e636
commit
553bba8ece
@ -1,4 +1,5 @@
|
||||
#include "script_component.hpp"
|
||||
#include "\a3\ui_f_curator\ui\defineresincldesign.inc"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Disables key input. ESC can still be pressed to open the menu.
|
||||
@ -15,6 +16,8 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#define IDD_TEAMSWITCH 632
|
||||
|
||||
params ["_state"];
|
||||
TRACE_1("disableUserInput",_state);
|
||||
|
||||
@ -32,69 +35,71 @@ if (_state) then {
|
||||
openMap false;
|
||||
};
|
||||
|
||||
closeDialog 0;
|
||||
createDialog QGVAR(DisableMouse_Dialog);
|
||||
if (isNull findDisplay IDD_INTERRUPT && {isNull findDisplay IDD_RSCDISPLAYCURATOR} && {isNull findDisplay IDD_TEAMSWITCH}) then {
|
||||
closeDialog 0;
|
||||
createDialog QGVAR(DisableMouse_Dialog);
|
||||
|
||||
private _dlg = uiNamespace getVariable QGVAR(dlgDisableMouse);
|
||||
private _display = uiNamespace getVariable QGVAR(dlgDisableMouse);
|
||||
|
||||
_dlg displayAddEventHandler ["KeyDown", {
|
||||
params ["", "_key"];
|
||||
_display displayAddEventHandler ["KeyDown", {
|
||||
params ["", "_key"];
|
||||
|
||||
if (_key == 1 && {alive player}) then {
|
||||
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
|
||||
if (_key == 1 && {alive player}) then {
|
||||
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
|
||||
|
||||
disableSerialization;
|
||||
disableSerialization;
|
||||
|
||||
private _dlg = findDisplay 49;
|
||||
private _dlg = findDisplay 49;
|
||||
|
||||
for "_index" from 100 to 2000 do {
|
||||
(_dlg displayCtrl _index) ctrlEnable false;
|
||||
for "_index" from 100 to 2000 do {
|
||||
(_dlg displayCtrl _index) ctrlEnable false;
|
||||
};
|
||||
|
||||
private _ctrl = _dlg displayctrl 103;
|
||||
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(while {!isNull (uiNamespace getVariable [ARR_2(QUOTE(QGVAR(dlgDisableMouse)),displayNull)])} do {closeDialog 0}; failMission 'LOSER'; [false] call DFUNC(disableUserInput);)];
|
||||
_ctrl ctrlEnable true;
|
||||
_ctrl ctrlSetText "ABORT";
|
||||
_ctrl ctrlSetTooltip "Abort.";
|
||||
|
||||
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
|
||||
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
|
||||
_ctrl ctrlEnable (call {private _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
|
||||
_ctrl ctrlSetText "RESPAWN";
|
||||
_ctrl ctrlSetTooltip "Respawn.";
|
||||
};
|
||||
|
||||
private _ctrl = _dlg displayctrl 103;
|
||||
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(while {!isNull (uiNamespace getVariable [ARR_2(QUOTE(QGVAR(dlgDisableMouse)),displayNull)])} do {closeDialog 0}; failMission 'LOSER'; [false] call DFUNC(disableUserInput);)];
|
||||
_ctrl ctrlEnable true;
|
||||
_ctrl ctrlSetText "ABORT";
|
||||
_ctrl ctrlSetTooltip "Abort.";
|
||||
if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then {
|
||||
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
||||
|
||||
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
|
||||
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
|
||||
_ctrl ctrlEnable (call {private _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
|
||||
_ctrl ctrlSetText "RESPAWN";
|
||||
_ctrl ctrlSetTooltip "Respawn.";
|
||||
};
|
||||
|
||||
if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then {
|
||||
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
||||
|
||||
private _acc = accTime;
|
||||
teamSwitch;
|
||||
setAccTime _acc;
|
||||
};
|
||||
|
||||
if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then {
|
||||
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
||||
openCuratorInterface;
|
||||
};
|
||||
|
||||
if (_key in actionKeys "ShowMap" && {player getVariable ["ACE_canSwitchUnits", false]}) then {
|
||||
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
||||
openMap true;
|
||||
};
|
||||
|
||||
if (isServer || {serverCommandAvailable "#kick"}) then {
|
||||
if (!(_key in (actionKeys "DefaultAction" + actionKeys "Throw")) && {_key in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) then {
|
||||
_key = 0;
|
||||
private _acc = accTime;
|
||||
teamSwitch;
|
||||
setAccTime _acc;
|
||||
};
|
||||
};
|
||||
|
||||
_key > 0
|
||||
}];
|
||||
if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then {
|
||||
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
||||
openCuratorInterface;
|
||||
};
|
||||
|
||||
_dlg displayAddEventHandler ["KeyUp", {true}];
|
||||
if (_key in actionKeys "ShowMap" && {player getVariable ["ACE_canSwitchUnits", false]}) then {
|
||||
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
|
||||
openMap true;
|
||||
};
|
||||
|
||||
if (isServer || {serverCommandAvailable "#kick"}) then {
|
||||
if (!(_key in (actionKeys "DefaultAction" + actionKeys "Throw")) && {_key in (actionKeys "Chat" + actionKeys "PrevChannel" + actionKeys "NextChannel")}) then {
|
||||
_key = 0;
|
||||
};
|
||||
};
|
||||
|
||||
_key > 0
|
||||
}];
|
||||
|
||||
_display displayAddEventHandler ["KeyUp", {true}];
|
||||
};
|
||||
|
||||
GVAR(disableInputPFH) = [{
|
||||
if (isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) && {!visibleMap && isNull findDisplay 49 && isNull findDisplay 312 && isNull findDisplay 632}) then {
|
||||
if (isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) && {!visibleMap && {isNull findDisplay IDD_INTERRUPT} && {isNull findDisplay IDD_RSCDISPLAYCURATOR} && {isNull findDisplay IDD_TEAMSWITCH}}) then {
|
||||
[GVAR(disableInputPFH)] call CBA_fnc_removePerFrameHandler;
|
||||
GVAR(disableInputPFH) = nil;
|
||||
[true] call FUNC(disableUserInput);
|
||||
|
Loading…
Reference in New Issue
Block a user