Added hold and release functionality for CMS menu.

This commit is contained in:
Thomas Kooi 2015-01-18 23:44:32 +01:00
parent 920453e150
commit 5745408647
4 changed files with 43 additions and 6 deletions

View File

@ -51,14 +51,41 @@ call FUNC(handleDisplayEffects);
// Keybindings
GVAR(keyPressed) = false;
["ACE3",
localize "STR_ACE_OPEN_CMS_MENU_DESC",
{ [] call FUNC(openMenu) },
{ if (!GVAR(keyPressed)) then {
GVAR(keyPressed) = true;
GVAR(timeMenuOpened) = time;
[] call FUNC(openMenu);
true;
} else {
false;
};
},
[ 0, [false, false, false]],
false,
"keydown"] call cba_fnc_registerKeybind;
["ACE3",
localize "STR_ACE_OPEN_CMS_MENU_DESC",
{
GVAR(keyPressed) = false;
if (time - GVAR(timeMenuOpened) >= (0.25*accTime)) then {
disableSerialization;
_display = uiNamespace getVariable QGVAR(medicalMenu);
if (!isnil "_display") then {
closeDialog 314412;
};
};
false;
},
[ 0, [false, false, false]],
false,
"keyUp"] call cba_fnc_registerKeybind;
// Adding the treatment options for all available medical equipment.

View File

@ -73,3 +73,5 @@ setMousePosition [ 0.4, 0.4];
((_this select 0) displayCtrl 2000) ctrlSetBackgroundColor (_status select 2);
}, [_display]] call BIS_fnc_addStackedEventHandler;
["Medical_onMenuOpen", [ACE_player, _interactionTarget]] call ace_common_fnc_localEvent;

View File

@ -10,6 +10,18 @@
#include "script_component.hpp"
if (dialog) exitwith {
disableSerialization;
private "_display";
_display = uiNamespace getVariable QGVAR(medicalMenu);
if (!isnil "_display") then {
closeDialog 314412;
};
};
private ["_interactionTarget"];
_interactionTarget = objNull;
if (count _this > 0) then {
@ -30,5 +42,3 @@ if (isNull _interactionTarget) then {
};
GVAR(INTERACTION_TARGET) = _interactionTarget;
createDialog QGVAR(medicalMenu);
["Medical_onMenuOpened", [ACE_player, _interactionTarget]] call ace_common_fnc_localEvent;

View File

@ -18,8 +18,6 @@ _bodyPartN = [_bodyPartText] call FUNC(getBodyPartNumber);
if (_bodyPartN < 0 || _bodyPartN > 5) exitwith {};
systemChat format["updateUIInfo %1", _this];
_openWounds = [_targetObj,QGVAR(openWounds)] call EFUNC(common,getDefinedVariable);
_bandagedWounds = [_targetObj,QGVAR(bandagedWounds)] call EFUNC(common,getDefinedVariable);
_fractures = [_targetObj,QGVAR(fractures)] call EFUNC(common,getDefinedVariable);