2015-07-15 03:51:13 +00:00
|
|
|
#include "script_component.hpp"
|
2024-08-22 17:13:54 +00:00
|
|
|
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
|
2015-07-15 03:51:13 +00:00
|
|
|
|
|
|
|
// Exit on Headless
|
2015-10-28 22:23:02 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
2015-07-15 03:51:13 +00:00
|
|
|
|
2016-08-18 17:07:05 +00:00
|
|
|
// Compile and cache config UI
|
2024-06-11 15:34:32 +00:00
|
|
|
GVAR(configCache) = createHashMap;
|
2016-08-18 17:07:05 +00:00
|
|
|
call FUNC(compileConfigUI);
|
|
|
|
|
|
|
|
// Scripted API namespace
|
2024-06-11 15:34:32 +00:00
|
|
|
GVAR(elementsSet) = createHashMap;
|
2016-08-18 17:07:05 +00:00
|
|
|
|
|
|
|
// Attach all event handlers where UI has to be updated
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
2016-03-06 14:41:17 +00:00
|
|
|
// Initial settings
|
2016-06-18 09:32:56 +00:00
|
|
|
[false] call FUNC(setElements);
|
2015-10-28 22:23:02 +00:00
|
|
|
|
2015-07-15 03:51:13 +00:00
|
|
|
// On load and entering/exiting a vehicle
|
2016-05-24 16:58:27 +00:00
|
|
|
["ace_infoDisplayChanged", {
|
2015-10-28 22:23:02 +00:00
|
|
|
// Selective UI Advanced
|
2016-03-06 14:41:17 +00:00
|
|
|
// Defaults must be set in this EH to make sure controls are activated and advanced settings can be modified
|
2016-03-08 17:40:23 +00:00
|
|
|
{
|
2024-03-28 13:11:26 +00:00
|
|
|
[_x, missionNamespace getVariable (format [QGVAR(%1), _x]), false, !GVAR(allowSelectiveUI)] call FUNC(setAdvancedElement);
|
2024-06-11 15:34:32 +00:00
|
|
|
} forEach (keys GVAR(configCache));
|
2016-06-02 12:32:39 +00:00
|
|
|
|
|
|
|
// Execute local event for when it's safe to modify UI through this API
|
|
|
|
// infoDisplayChanged can execute multiple times, make sure it only happens once
|
|
|
|
if (!GVAR(interfaceInitialized)) then {
|
2016-06-03 01:05:03 +00:00
|
|
|
[QGVAR(InterfaceInitialized), []] call CBA_fnc_localEvent;
|
2016-06-02 12:32:39 +00:00
|
|
|
GVAR(interfaceInitialized) = true;
|
|
|
|
};
|
2016-06-03 00:59:18 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2015-07-15 03:51:13 +00:00
|
|
|
|
2016-03-08 17:40:23 +00:00
|
|
|
// On changing settings
|
2021-04-20 21:26:48 +00:00
|
|
|
["CBA_SettingChanged", {
|
|
|
|
params ["_name", "_value"];
|
2021-10-09 20:32:53 +00:00
|
|
|
if (_name select [0, 7] != "ace_ui_") exitWith {};
|
2015-10-28 22:23:02 +00:00
|
|
|
|
|
|
|
if (_name in ELEMENTS_BASIC) then {
|
2016-06-18 09:32:56 +00:00
|
|
|
[true] call FUNC(setElements);
|
2016-06-02 12:32:39 +00:00
|
|
|
} else {
|
2024-03-07 21:08:13 +00:00
|
|
|
private _nameNoPrefix = toLowerANSI (_name select [7]);
|
2024-06-11 15:34:32 +00:00
|
|
|
if (_nameNoPrefix in GVAR(configCache)) then {
|
2021-04-20 21:26:48 +00:00
|
|
|
[_nameNoPrefix, _value, true] call FUNC(setAdvancedElement);
|
2016-06-04 19:20:10 +00:00
|
|
|
};
|
2015-10-28 22:23:02 +00:00
|
|
|
};
|
2016-05-22 15:29:05 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
2021-10-05 16:47:24 +00:00
|
|
|
|
2024-06-23 23:12:30 +00:00
|
|
|
[QUOTE(ADDON), "AnimChanged", LINKFUNC(onAnimChanged), true] call EFUNC(common,addPlayerEH);
|
2024-08-22 17:13:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
["ACE3 Common", QGVAR(hideHud), localize LSTRING(hideHud), {
|
|
|
|
GVAR(hideHud) = !(missionNamespace getVariable [QGVAR(hideHud), false]);
|
|
|
|
[QGVAR(hideHud), [GVAR(hideHud)]] call CBA_fnc_localEvent;
|
|
|
|
|
|
|
|
private _mask = [];
|
|
|
|
if (GVAR(hideHud)) then { _mask resize [10, false] };
|
|
|
|
[QGVAR(hideHud), _mask] call EFUNC(common,showHud);
|
|
|
|
|
|
|
|
if (missionNamespace getVariable [QGVAR(hideHud_hideChat), true]) then {
|
|
|
|
showChat !GVAR(hideHud);
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!isNil "diwako_dui_main_toggled_off") then {
|
|
|
|
diwako_dui_main_toggled_off = GVAR(hideHud); // ref https://github.com/diwako/diwako_dui/wiki/Hiding-DUI-for-cutscenes
|
|
|
|
};
|
|
|
|
true
|
|
|
|
},
|
|
|
|
{false},
|
|
|
|
[DIK_F12, [false, true, false]], false] call CBA_fnc_addKeybind; // ctrl+f12
|