2016-03-08 17:12:01 +00:00
|
|
|
/*
|
|
|
|
* Author: Jonpas
|
2016-03-08 17:40:23 +00:00
|
|
|
* Setter for toggling advanced element visibility.
|
2016-03-08 17:12:01 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Set/Unset <BOOL> (default: true)
|
2016-03-08 17:40:23 +00:00
|
|
|
* 1: Element IDD <NUMBER> (default: 0)
|
|
|
|
* 2: Element IDCs <ARRAY> (default: [])
|
|
|
|
* 3: Show/Hide Element OR Element ACE Settings Variable <BOOL/STRING> (default: false)
|
2016-03-08 17:12:01 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2016-03-08 17:40:23 +00:00
|
|
|
* [true, 300, [188], false] call ace_ui_fnc_setElementVisibility
|
2016-03-08 17:12:01 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
params [
|
|
|
|
["_set", true, [true]],
|
|
|
|
["_idd", 0, [0]],
|
2016-03-08 17:40:23 +00:00
|
|
|
["_elements", [], [[]]],
|
|
|
|
["_show", false, [true, ""]]
|
2016-03-08 17:12:01 +00:00
|
|
|
];
|
|
|
|
|
2016-03-08 17:42:37 +00:00
|
|
|
private _return = false;
|
|
|
|
|
2016-03-08 17:12:01 +00:00
|
|
|
if (_set) then {
|
2016-03-08 17:40:23 +00:00
|
|
|
if ([_idd, _elements] in GVAR(elementsSet)) exitWith { TRACE_3("Element already set",_idd,_elements,GVAR(elementsSet)); };
|
2016-03-08 17:12:01 +00:00
|
|
|
|
2016-03-08 17:40:23 +00:00
|
|
|
TRACE_4("Setting element",_idd,_elements,_show,GVAR(elementsSet));
|
|
|
|
private _success = [_idd, _elements, _show] call FUNC(setAdvancedElement);
|
2016-03-08 17:12:01 +00:00
|
|
|
|
|
|
|
if (_success) then {
|
|
|
|
GVAR(elementsSet) pushBack [_idd, _elements];
|
2016-03-08 17:42:37 +00:00
|
|
|
_return = true;
|
2016-03-08 17:12:01 +00:00
|
|
|
};
|
|
|
|
} else {
|
|
|
|
if ([_idd, _elements] in GVAR(elementsSet)) then {
|
2016-03-08 17:40:23 +00:00
|
|
|
TRACE_4("Setting element",_idd,_elements,_show,GVAR(elementsSet));
|
|
|
|
[_idd, _elements, _show] call FUNC(setAdvancedElement);
|
2016-03-08 17:12:01 +00:00
|
|
|
|
|
|
|
private _index = GVAR(elementsSet) find [_idd, _elements];
|
|
|
|
GVAR(elementsSet) deleteAt _index;
|
2016-03-08 17:42:37 +00:00
|
|
|
_return = true;
|
2016-03-08 17:12:01 +00:00
|
|
|
};
|
|
|
|
};
|
2016-03-08 17:40:23 +00:00
|
|
|
|
2016-03-08 17:42:37 +00:00
|
|
|
TRACE_2("Visibility set",_return,GVAR(elementsSet));
|
|
|
|
_return
|