fix MenuClosed event may not fire on menu type replacement

This commit is contained in:
commy2 2020-02-23 11:59:14 +01:00
parent 7069cb82c9
commit a6373e936d
3 changed files with 8 additions and 1 deletions

View File

@ -105,6 +105,7 @@ format ["%1 (%2)", (localize LSTRING(SelfInteractKey)), localize ELSTRING(common
if (_menuBackgroundSetting == 1) exitWith {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);};
if (_menuBackgroundSetting == 2) exitWith {0 cutRsc [QGVAR(menuBackground), "PLAIN", 1, false];};
}] call CBA_fnc_addEventHandler;
["ace_interactMenuClosed", {
params ["_menuType"];
private _menuBackgroundSetting = [GVAR(menuBackground), GVAR(menuBackgroundSelf)] select _menuType;

View File

@ -36,6 +36,12 @@ if (_menuType == 0) then {
GVAR(keyDownSelfAction) = true;
};
GVAR(keyDownTime) = diag_tickTime;
// Raise MenuClosed event whenever one type is replaced with another, because KeyUp code is not guaranteed.
if (GVAR(openedMenuType) != -1) then {
["ace_interactMenuClosed", [GVAR(openedMenuType)]] call CBA_fnc_localEvent;
};
GVAR(openedMenuType) = _menuType;
GVAR(lastTimeSearchedActions) = -1000;
GVAR(ParsedTextCached) = [];

View File

@ -24,7 +24,7 @@ if (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then {
(findDisplay 91919) closeDisplay 2;
};
if(GVAR(actionSelected)) then {
if (GVAR(actionSelected)) then {
this = GVAR(selectedTarget);
private _player = ACE_Player;