From 0838a726f41d2556fb2cea8f52d44078aaa57343 Mon Sep 17 00:00:00 2001 From: "Jonathan M. Lane" Date: Tue, 2 Apr 2019 21:39:08 -0300 Subject: [PATCH] Added earplugs icon from Annex & Invade https://github.com/auQuiksilver/Apex-Framework --- functions/earPro/fn_initEarPro.sqf | 56 ++++++++++++++++++++--------- includes/ui/earpro_ca.paa | Bin 0 -> 1522 bytes 2 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 includes/ui/earpro_ca.paa diff --git a/functions/earPro/fn_initEarPro.sqf b/functions/earPro/fn_initEarPro.sqf index 021e1d2..97f12d4 100644 --- a/functions/earPro/fn_initEarPro.sqf +++ b/functions/earPro/fn_initEarPro.sqf @@ -1,21 +1,39 @@ /* ASG_fnc_initEarPro - by: Diffusion9 - - Adds a keyDown eventHandler that watched the 'End' key, or UserAction 1 in the Custom Action menu. + by: Diffusion9 and jmlane + + Adds a keyDown eventHandler that watched the 'End' key (0xCF), or UserAction 1 in the Custom Action menu. This should be run locally on the player. - + EXEC TYPE: Call INPUT: Nothing OUTPUT: Nothing */ +if !(isNull (uiNamespace getVariable ['ASG_earPro_ctrl', controlNull])) exitWith {}; #include "\A3\Ui_F\hpp\defineDIKCodes.inc" -if (!isNil "earPro_handler") exitWith {true}; +waitUntil {!(isNull findDisplay 46)}; + +call { + disableSerialization; -earPro_handler = findDisplay 46 displayAddEventHandler ["keyDown", { - params ['_display', '_key', '_shift', '_ctrl','_alt']; + private _earProCtrl = findDisplay 46 ctrlCreate ['RscPictureKeepAspect', -1]; + _earProCtrl ctrlShow FALSE; + _earProCtrl ctrlSetText 'includes\ui\earpro_ca.paa'; + _earProCtrl ctrlSetPosition [ + ((0.95 * safezoneW) + safezoneX), + ((0.39 * safezoneH) + safezoneY), + 0.075, + 0.075 + ]; + _earProCtrl ctrlSetTextColor [0.8,0.8,0.8,1]; + _earProCtrl ctrlCommit 0; + uiNamespace setVariable ['ASG_earPro_ctrl', _earProCtrl]; +}; + +findDisplay 46 displayAddEventHandler ["keyDown", { + params ['_display', '_key', '_shift', '_ctrl', '_alt']; private ['_conditions']; // IF CUSTOM KEY IS UNDEFINED if (actionKeys 'User1' isEqualTo []) then { @@ -24,14 +42,18 @@ earPro_handler = findDisplay 46 displayAddEventHandler ["keyDown", { _conditions = (_key in actionKeys 'User1') }; // ENABLE / DISABLE EARPLUGS - if _conditions then { - if (missionNamespace getVariable ['earPlugs_state', false]) then { - .1 fadeSound 1; - earPlugs_state = false; - } else { - 1 fadeSound .04; - earPlugs_state = true; - }; - }; + if _conditions then { + if (missionNamespace getVariable ['ASG_earPro_active', false]) then { + .1 fadeSound 1; + ASG_earPro_active = false; + uiNamespace getVariable ['ASG_earPro_ctrl', controlNull] ctrlShow false; + } else { + if !(isStreamFriendlyUIEnabled) then { + uiNamespace getVariable ['ASG_earPro_ctrl', controlNull] ctrlShow true; + }; + 1 fadeSound .04; + ASG_earPro_active = true; + }; + }; + false }]; -earPro_handler diff --git a/includes/ui/earpro_ca.paa b/includes/ui/earpro_ca.paa new file mode 100644 index 0000000000000000000000000000000000000000..21afef85d63cb9f44f68ec7077df7b6739dabb93 GIT binary patch literal 1522 zcmZSm@9ypx;_M#g$il$D@a)+$Q!qcm(HF%34+J2-yQ7aAh|dVbAbzl$o4*5)-2lYx zK#4w928OFZOgd0tP+(vH84Up-3t?;!O)dUJ2G2<7j)pY@aA{Oj8|pZ<401mg?OwwJQrmJCAKiZwf&P=Rtbv<{o?b-%p345REgkM&_D_wn z(T(~EF!LF195`olUI89{x}N>Kx3}fO)uX3(k=btV?BWpqN4F1MJ+=7)3<8kS1!6GF z8_&SeK2HS3m)HmNgS4X#jIVOWEQf_d1|CcvkGAD5IhJz