mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Change params order and improve clientInit
This commit is contained in:
parent
64fe944b0f
commit
23e2617db8
@ -12,17 +12,13 @@ if (!hasInterface) exitWith {};
|
||||
["infoDisplayChanged", {
|
||||
// Selective UI Advanced
|
||||
// Defaults must be set in this EH to make sure controls are activated and advanced settings can be modified
|
||||
if (!GVAR(allowSelectiveUI)) then {
|
||||
private _force = [true, false] select (GVAR(allowSelectiveUI));
|
||||
{
|
||||
[_x, true] call FUNC(setAdvancedElement);
|
||||
[_x select 0, _x select 1, _x select 2, _force] call FUNC(setAdvancedElement);
|
||||
} forEach ELEMENTS_ADVANCED;
|
||||
} else {
|
||||
{
|
||||
[_x] call FUNC(setAdvancedElement);
|
||||
} forEach ELEMENTS_ADVANCED;
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
// On changing settings
|
||||
["SettingChanged", {
|
||||
params ["_name"];
|
||||
|
||||
@ -33,11 +29,11 @@ if (!hasInterface) exitWith {};
|
||||
|
||||
// Selective UI Advanced
|
||||
{
|
||||
_x params ["_element"];
|
||||
params ["_idd", "_elements", "_name"];
|
||||
|
||||
if (_name == _element) then {
|
||||
[_x] call FUNC(setAdvancedElement);
|
||||
TRACE_2("Setting Changed",_name,_element);
|
||||
if (_name == _name) then {
|
||||
[_idd, _elements, _name] call FUNC(setAdvancedElement);
|
||||
TRACE_2("Setting Changed",_name,_name);
|
||||
};
|
||||
} forEach ELEMENTS_ADVANCED;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -3,23 +3,22 @@
|
||||
* Sets advanced visible element of the UI using displays and controls.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Element info <ARRAY>
|
||||
* 0: Show/Hide Element OR Element Variable <BOOL/STRING>
|
||||
* 1: Element IDD <NUMBER>
|
||||
* 2: Element IDCs <ARRAY>
|
||||
* 1: Force change even when disallowed <BOOL>
|
||||
* 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)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
* Successfully Set <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [[show, 303, [188]], false] call ace_ui_fnc_setAdvancedElement
|
||||
* [303, [188], true, false] call ace_ui_fnc_setAdvancedElement
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_elementInfo", ["_force", false, [true]] ];
|
||||
params ["_idd", "_elements", "_show", ["_force", false, [true]] ];
|
||||
|
||||
if (_elementInfo in GVAR(elementsSet)) exitWith {};
|
||||
|
||||
@ -27,8 +26,6 @@ if (!_force && {!GVAR(allowSelectiveUI)}) exitWith {
|
||||
[LSTRING(Disallowed), 2] call EFUNC(common,displayTextStructured)
|
||||
};
|
||||
|
||||
_elementInfo params ["_show", "_idd", "_elements"];
|
||||
|
||||
// Get show/hide boolean from mission namespace if it's a string
|
||||
if (typeName _show == "STRING") then {
|
||||
_show = missionNamespace getVariable _show;
|
||||
|
@ -1,19 +1,18 @@
|
||||
/*
|
||||
* Author: Jonpas
|
||||
* Wrapper for setting advanced element visibility.
|
||||
* Setter for toggling advanced element visibility.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Set/Unset <BOOL> (default: true)
|
||||
* 1: Element info <ARRAY>
|
||||
* 0: Show/Hide Element OR Element Variable <BOOL/STRING>
|
||||
* 1: Element IDD <NUMBER>
|
||||
* 2: Element IDCs <ARRAY>
|
||||
* 1: Element IDD <NUMBER> (default: 0)
|
||||
* 2: Element IDCs <ARRAY> (default: [])
|
||||
* 3: Show/Hide Element OR Element ACE Settings Variable <BOOL/STRING> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [false] call ace_ui_fnc_setElementVisibility
|
||||
* [true, 300, [188], false] call ace_ui_fnc_setElementVisibility
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
@ -21,32 +20,28 @@
|
||||
|
||||
params [
|
||||
["_set", true, [true]],
|
||||
["_elementInfo", [true, 0, []], [[]], 3]
|
||||
];
|
||||
|
||||
_elementInfo params [
|
||||
["_show", false, [true, ""]],
|
||||
["_idd", 0, [0]],
|
||||
["_elements", [], [[]]]
|
||||
["_elements", [], [[]]],
|
||||
["_show", false, [true, ""]]
|
||||
];
|
||||
|
||||
if (_set) then {
|
||||
if ([_idd, _elements] in GVAR(elementsSet)) exitWith { TRACE_2("Element already set",_elementInfo,GVAR(elementsSet)); };
|
||||
if ([_idd, _elements] in GVAR(elementsSet)) exitWith { TRACE_3("Element already set",_idd,_elements,GVAR(elementsSet)); };
|
||||
|
||||
TRACE_2("Setting element",_elementInfo,GVAR(elementsSet));
|
||||
private _success = [_elementInfo] call FUNC(setAdvancedElement);
|
||||
TRACE_4("Setting element",_idd,_elements,_show,GVAR(elementsSet));
|
||||
private _success = [_idd, _elements, _show] call FUNC(setAdvancedElement);
|
||||
|
||||
if (_success) then {
|
||||
GVAR(elementsSet) pushBack [_idd, _elements];
|
||||
};
|
||||
} else {
|
||||
if ([_idd, _elements] in GVAR(elementsSet)) then {
|
||||
TRACE_2("Unsetting element",_elementInfo,GVAR(elementsSet));
|
||||
|
||||
TRACE_2("Toggling element",_elementInfo,GVAR(elementsSet));
|
||||
[_elementInfo] call FUNC(setAdvancedElement);
|
||||
TRACE_4("Setting element",_idd,_elements,_show,GVAR(elementsSet));
|
||||
[_idd, _elements, _show] call FUNC(setAdvancedElement);
|
||||
|
||||
private _index = GVAR(elementsSet) find [_idd, _elements];
|
||||
GVAR(elementsSet) deleteAt _index;
|
||||
};
|
||||
};
|
||||
|
||||
TRACE_1("Visibility set",GVAR(elementsSet));
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Sets basic visible elements of the UI using showHUD setter.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Force change even when disallowed <BOOL>
|
||||
* 0: Force change even when disallowed <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
|
@ -20,27 +20,27 @@
|
||||
// Elements
|
||||
#define ELEMENTS_BASIC [QGVAR(soldierVehicleWeaponInfo), QGVAR(vehicleRadar), QGVAR(vehicleCompass), QGVAR(commandMenu), QGVAR(groupBar)]
|
||||
|
||||
// Element, IDD, IDC
|
||||
// IDD, IDC, Element (must be string to compare to changed setting name)
|
||||
#define ELEMENTS_ADVANCED [ \
|
||||
[QGVAR(weaponName), 300, [118] ], \
|
||||
[QGVAR(weaponNameBackground), 300, [1001, 1008] ], \
|
||||
[QGVAR(firingMode), 300, [187, 1203] ], \
|
||||
[QGVAR(ammoType), 300, [155] ], \
|
||||
[QGVAR(ammoCount), 300, [184] ], \
|
||||
[QGVAR(magCount), 300, [185] ], \
|
||||
[QGVAR(throwableName), 300, [152] ], \
|
||||
[QGVAR(throwableCount), 300, [151] ], \
|
||||
[QGVAR(weaponLowerInfoBackground), 300, [1202] ], \
|
||||
[QGVAR(zeroing), 300, [168] ], \
|
||||
[QGVAR(stance), 303, [188, 1201] ], \
|
||||
[QGVAR(vehicleName), 300, [120] ], \
|
||||
[QGVAR(vehicleNameBackground), 300, [1000, 1013] ], \
|
||||
[QGVAR(vehicleFuelBar), 300, [113, 1202] ], \
|
||||
[QGVAR(vehicleSpeed), 300, [121, 1004, 1006] ], \
|
||||
[QGVAR(vehicleAltitude), 300, [122, 1005, 1014] ], \
|
||||
[QGVAR(vehicleDamage), 300, [111] ], \
|
||||
[QGVAR(vehicleInfoBackground), 300, [1200] ], \
|
||||
[QGVAR(vehicleGunnerWeapon), 300, [150] ] \
|
||||
[300, [118], QGVAR(weaponName)], \
|
||||
[300, [1001, 1008], QGVAR(weaponNameBackground)], \
|
||||
[300, [187, 1203], QGVAR(firingMode)], \
|
||||
[300, [155], QGVAR(ammoType)], \
|
||||
[300, [184], QGVAR(ammoCount)], \
|
||||
[300, [185], QGVAR(magCount)], \
|
||||
[300, [152], QGVAR(throwableName)], \
|
||||
[300, [151], QGVAR(throwableCount)], \
|
||||
[300, [1202], QGVAR(weaponLowerInfoBackground)], \
|
||||
[300, [168], QGVAR(zeroing)], \
|
||||
[303, [188, 1201], QGVAR(stance)], \
|
||||
[300, [120], QGVAR(vehicleName)], \
|
||||
[300, [1000, 1013], QGVAR(vehicleNameBackground)], \
|
||||
[300, [113, 1202], QGVAR(vehicleFuelBar)], \
|
||||
[300, [121, 1004, 1006], QGVAR(vehicleSpeed)], \
|
||||
[300, [122, 1005, 1014], QGVAR(vehicleAltitude)], \
|
||||
[300, [111], QGVAR(vehicleDamage)], \
|
||||
[300, [1200], QGVAR(vehicleInfoBackground)], \
|
||||
[300, [150], QGVAR(vehicleGunnerWeapon)] \
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user