2015-10-28 22:23:02 +00:00
|
|
|
/*
|
|
|
|
* Author: Jonpas
|
|
|
|
* Sets advanced visible element of the UI using displays and controls.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2016-03-08 17:40:23 +00:00
|
|
|
* 0: Element IDD <NUMBER>
|
|
|
|
* 1: Element IDCs <ARRAY>
|
|
|
|
* 2: Show/Hide Element OR Element ACE Settings Variable <BOOL/STRING>
|
|
|
|
* 3: Force change even when disallowed <BOOL> (default: false)
|
2015-10-28 22:23:02 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2016-03-08 17:40:23 +00:00
|
|
|
* Successfully Set <BOOL>
|
2015-10-28 22:23:02 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2016-03-08 17:40:23 +00:00
|
|
|
* [303, [188], true, false] call ace_ui_fnc_setAdvancedElement
|
2015-10-28 22:23:02 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-03-08 17:40:23 +00:00
|
|
|
params ["_idd", "_elements", "_show", ["_force", false, [true]] ];
|
2015-10-28 22:23:02 +00:00
|
|
|
|
2016-03-08 17:12:01 +00:00
|
|
|
if (_elementInfo in GVAR(elementsSet)) exitWith {};
|
|
|
|
|
2016-03-06 14:41:17 +00:00
|
|
|
if (!_force && {!GVAR(allowSelectiveUI)}) exitWith {
|
|
|
|
[LSTRING(Disallowed), 2] call EFUNC(common,displayTextStructured)
|
|
|
|
};
|
|
|
|
|
2015-10-28 22:23:02 +00:00
|
|
|
// Get show/hide boolean from mission namespace if it's a string
|
|
|
|
if (typeName _show == "STRING") then {
|
|
|
|
_show = missionNamespace getVariable _show;
|
|
|
|
};
|
|
|
|
_show = [1, 0] select _show;
|
|
|
|
|
|
|
|
// Disable/Enable elements
|
2016-03-08 17:12:01 +00:00
|
|
|
private _success = false;
|
2015-10-28 22:23:02 +00:00
|
|
|
{
|
2016-03-06 11:50:16 +00:00
|
|
|
private _idc = _x;
|
2015-10-28 22:23:02 +00:00
|
|
|
|
|
|
|
// Loop through IGUI displays as they can be present several times for some reason
|
|
|
|
{
|
|
|
|
if (_idd == ctrlIDD _x) then {
|
|
|
|
TRACE_3("Setting Element Visibility",_show,_idd,_idc);
|
|
|
|
|
|
|
|
(_x displayCtrl _idc) ctrlSetFade _show;
|
|
|
|
(_x displayCtrl _idc) ctrlCommit 0;
|
2016-03-08 17:12:01 +00:00
|
|
|
|
|
|
|
_success = true;
|
2015-10-28 22:23:02 +00:00
|
|
|
};
|
|
|
|
} forEach (uiNamespace getVariable "IGUI_displays");
|
|
|
|
} forEach _elements;
|
2016-03-08 17:12:01 +00:00
|
|
|
|
|
|
|
_success
|