2015-03-06 17:15:32 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2015-03-14 18:10:25 +00:00
|
|
|
* Updates the setting when the client has selected a new value. Saves to profilenamespace.
|
2015-03-06 17:15:32 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-03-14 18:10:25 +00:00
|
|
|
* 0: Update the keylist as well <BOOL>
|
2015-03-06 17:15:32 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-03-14 18:10:25 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [false] call ACE_optionsmenu_fnc_settingsMenuUpdateList
|
2015-03-06 17:15:32 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2015-01-21 11:43:58 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-11 09:15:55 +00:00
|
|
|
private ["_settingName", "_added", "_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"];
|
2015-01-21 22:27:53 +00:00
|
|
|
DEFAULT_PARAM(0,_updateKeyView,true);
|
2015-01-21 11:43:58 +00:00
|
|
|
|
2015-01-21 23:29:42 +00:00
|
|
|
disableSerialization;
|
|
|
|
_settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
|
2015-01-21 11:43:58 +00:00
|
|
|
_ctrlList = _settingsMenu displayCtrl 200;
|
2015-01-21 22:27:53 +00:00
|
|
|
|
2015-08-11 09:15:55 +00:00
|
|
|
lnbClear _ctrlList;
|
2015-01-21 11:43:58 +00:00
|
|
|
|
2015-08-07 19:14:45 +00:00
|
|
|
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
|
|
|
|
|
2015-01-21 11:43:58 +00:00
|
|
|
switch (GVAR(optionMenu_openTab)) do {
|
2015-03-06 17:15:32 +00:00
|
|
|
case (MENU_TAB_OPTIONS): {
|
|
|
|
{
|
2015-08-10 22:19:30 +00:00
|
|
|
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
|
2015-08-11 09:15:55 +00:00
|
|
|
_settingName = (_x select 3);
|
2015-08-07 19:14:45 +00:00
|
|
|
_settingsValue = _x select 9;
|
2015-02-03 03:44:34 +00:00
|
|
|
|
2015-08-07 19:14:45 +00:00
|
|
|
// Created disable/enable options for bools
|
|
|
|
_settingsText = if ((_x select 1) == "BOOL") then {
|
2015-08-08 17:39:14 +00:00
|
|
|
[(localize ELSTRING(common,No)), (localize ELSTRING(common,Yes))] select _settingsValue;
|
2015-08-07 19:14:45 +00:00
|
|
|
} else {
|
2015-11-28 07:57:15 +00:00
|
|
|
private _values = _x select 5;
|
|
|
|
if !((!isNil "_values") && {_values isEqualType []} && {_settingsValue >= 0} && {_settingsValue < (count _values)}) exitWith {
|
|
|
|
ACE_LOGERROR_3("Setting (%1) has bad values (%2) for index (%3)", _settingName, _values, _settingsValue);
|
|
|
|
"ERROR"
|
|
|
|
};
|
|
|
|
_values select _settingsValue;
|
2015-08-07 19:14:45 +00:00
|
|
|
};
|
2015-08-11 09:15:55 +00:00
|
|
|
_added = _ctrlList lnbAddRow [_settingName, _settingsText];
|
|
|
|
_ctrlList lnbSetValue [[_added, 0], _forEachIndex];
|
2015-03-06 17:15:32 +00:00
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach GVAR(clientSideOptions);
|
2015-03-06 17:15:32 +00:00
|
|
|
};
|
|
|
|
case (MENU_TAB_COLORS): {
|
2015-08-07 19:14:45 +00:00
|
|
|
{
|
2015-08-10 22:19:30 +00:00
|
|
|
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
|
2015-08-07 19:14:45 +00:00
|
|
|
_color = +(_x select 9);
|
|
|
|
{
|
|
|
|
_color set [_forEachIndex, ((round (_x * 100))/100)];
|
|
|
|
} forEach _color;
|
|
|
|
_settingsColor = str _color;
|
2015-08-11 09:15:55 +00:00
|
|
|
_settingName = (_x select 3);
|
|
|
|
|
|
|
|
_added = _ctrlList lnbAddRow [_settingName, _settingsColor];
|
2015-08-15 08:21:03 +00:00
|
|
|
_ctrlList lnbSetColor [[_added, 1], (_x select 9)];
|
2015-08-11 09:15:55 +00:00
|
|
|
_ctrlList lnbSetValue [[_added, 0], _forEachIndex];
|
2015-08-07 19:14:45 +00:00
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
}forEach GVAR(clientSideColors);
|
2015-03-06 17:15:32 +00:00
|
|
|
};
|
2015-01-21 11:43:58 +00:00
|
|
|
};
|
|
|
|
if (_updateKeyView) then {
|
2015-03-06 17:15:32 +00:00
|
|
|
[] call FUNC(settingsMenuUpdateKeyView);
|
2015-01-21 22:27:53 +00:00
|
|
|
};
|