ACE3/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf

65 lines
2.0 KiB
Plaintext
Raw Normal View History

/*
* Author: Glowbal
* Updates the setting when the client has selected a new value. Saves to profilenamespace.
*
* Arguments:
* 0: Update the keylist as well <BOOL>
*
* Return Value:
* None
*
* Example:
* [false] call ACE_optionsmenu_fnc_settingsMenuUpdateList
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"];
2015-01-21 22:27:53 +00:00
DEFAULT_PARAM(0,_updateKeyView,true);
2015-01-21 23:29:42 +00:00
disableSerialization;
_settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
_ctrlList = _settingsMenu displayCtrl 200;
2015-01-21 22:27:53 +00:00
lbclear _ctrlList;
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
{
2015-08-07 20:08:52 +00:00
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
_ctrlList lbadd (_x select 3);
_settingsValue = _x select 9;
// Created disable/enable options for bools
_settingsText = if ((_x select 1) == "BOOL") then {
[(localize ELSTRING(common,No)), (localize ELSTRING(common,Yes))] select _settingsValue;
} else {
(_x select 5) select _settingsValue;
};
_ctrlList lbadd (_settingsText);
};
}foreach GVAR(clientSideOptions);
};
case (MENU_TAB_COLORS): {
{
2015-08-07 20:08:52 +00:00
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
_color = +(_x select 9);
{
_color set [_forEachIndex, ((round (_x * 100))/100)];
} forEach _color;
_settingsColor = str _color;
_ctrlList lbadd (_x select 3);
_ctrlList lbadd (_settingsColor);
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 9)];
};
}foreach GVAR(clientSideColors);
};
};
if (_updateKeyView) then {
[] call FUNC(settingsMenuUpdateKeyView);
2015-01-21 22:27:53 +00:00
};