ACE3/addons/optionsmenu/functions/fnc_serverSettingsMenuUpdateList.sqf

94 lines
3.2 KiB
Plaintext
Raw Normal View History

2015-04-05 00:17:43 +00:00
/*
* 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"
params [["_updateKeyView", true, [true]]];
2015-04-05 00:17:43 +00:00
disableSerialization;
private _settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu';
private _ctrlList = _settingsMenu displayCtrl 200;
2015-04-05 00:17:43 +00:00
2015-08-11 09:15:55 +00:00
lnbClear _ctrlList;
private _selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
2015-04-05 00:17:43 +00:00
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_SERVER_OPTIONS): {
{
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
private _settingName = if ((_x select 3) != "") then {
2015-08-11 09:15:55 +00:00
(_x select 3);
} else {
2015-08-11 09:15:55 +00:00
(_x select 0);
};
2015-04-05 00:17:43 +00:00
private _settingsValue = _x select 9;
2015-04-05 00:17:43 +00:00
// Created disable/enable options for bools
private _settingsText = if ((_x select 1) == "BOOL") then {
[(localize ELSTRING(common,No)), (localize ELSTRING(common,Yes))] select _settingsValue;
} else {
(_x select 5) select _settingsValue;
};
2015-04-05 00:17:43 +00:00
private _added = _ctrlList lnbAddRow [_settingName, _settingsText];
2015-08-11 09:15:55 +00:00
_ctrlList lnbSetValue [[_added, 0], _forEachIndex];
};
2015-11-30 16:23:48 +00:00
}forEach GVAR(serverSideOptions);
2015-04-05 00:17:43 +00:00
};
case (MENU_TAB_SERVER_COLORS): {
{
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
private _color = +(_x select 9);
{
_color set [_forEachIndex, ((round (_x * 100))/100)];
} forEach _color;
private _settingsColor = str _color;
private _settingName = if ((_x select 3) != "") then {
2015-08-11 09:15:55 +00:00
(_x select 3);
} else {
2015-08-11 09:15:55 +00:00
(_x select 0);
};
2015-08-11 09:15:55 +00:00
private _added = _ctrlList lnbAddRow [_settingName, _settingsColor];
_ctrlList lnbSetColor [[_added, 1], (_x select 9)];
2015-08-11 09:15:55 +00:00
_ctrlList lnbSetValue [[_added, 0], _forEachIndex];
2015-04-05 00:17:43 +00:00
};
2015-11-30 16:23:48 +00:00
}forEach GVAR(serverSideColors);
2015-04-05 00:17:43 +00:00
};
case (MENU_TAB_SERVER_VALUES): {
{
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
private _settingName = if ((_x select 3) != "") then {
2015-08-11 09:15:55 +00:00
(_x select 3);
} else {
2015-08-11 09:15:55 +00:00
(_x select 0);
};
private _settingsValue = _x select 9;
if (!(_settingsValue isEqualType "")) then {
_settingsValue = format["%1", _settingsValue];
};
private _added = _ctrlList lnbAddRow [_settingName, _settingsValue];
2015-08-11 09:15:55 +00:00
_ctrlList lnbSetValue [[_added, 0], _forEachIndex];
2015-04-05 00:17:43 +00:00
};
2015-11-30 16:23:48 +00:00
}forEach GVAR(serverSideValues);
2015-04-05 00:17:43 +00:00
};
};
if (_updateKeyView) then {
[] call FUNC(serverSettingsMenuUpdateKeyView);
};