ACE3/addons/ui/XEH_clientInit.sqf

42 lines
1.5 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
// Exit on Headless
2015-10-28 22:23:02 +00:00
if (!hasInterface) exitWith {};
2016-05-24 13:13:11 +00:00
["ace_settingsInitialized", {
// Initial settings
[false] call FUNC(setElements);
2015-10-28 22:23:02 +00:00
// On load and entering/exiting a vehicle
["ace_infoDisplayChanged", {
2015-10-28 22:23:02 +00:00
// Selective UI Advanced
// Defaults must be set in this EH to make sure controls are activated and advanced settings can be modified
private _force = [true, false] select (GVAR(allowSelectiveUI));
{
private _name = configName _x;
[_name, missionNamespace getVariable (format [QGVAR(%1), _name]), false, _force] call FUNC(setAdvancedElement);
} forEach ("true" configClasses (configFile >> "ACE_UI"));
// 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;
GVAR(interfaceInitialized) = true;
};
2016-06-03 00:59:18 +00:00
}] call CBA_fnc_addEventHandler;
// On changing settings
["ace_settingChanged", {
2015-10-28 22:23:02 +00:00
params ["_name"];
if (_name in ELEMENTS_BASIC) then {
[true] call FUNC(setElements);
} else {
if (isClass (configFile >> "ACE_UI" >> _name select [7])) then {
[_name select [7], missionNamespace getVariable _name, true] call FUNC(setAdvancedElement);
};
2015-10-28 22:23:02 +00:00
};
}] call CBA_fnc_addEventHandler;
2015-10-28 22:23:02 +00:00
}] call CBA_fnc_addEventHandler;