Finalized server export category select

This commit is contained in:
Glowbal 2015-08-08 13:07:22 +02:00
parent c6af8aaeb6
commit e7a607ca35
10 changed files with 136 additions and 57 deletions

View File

@ -267,7 +267,7 @@
<Czech>Přidá možnost interakce pro otevření dvěří a umistňovat žebříky na budovy. (Poznámka: Použití této možnosti snižuje výkon při otevírání pomocí interakčního menu, zejména ve velkých městech.) </Czech>
<Spanish>Añade las acciones de interacción para la apertura de puertas y montaje de escaleras en los edificios. (Nota: Hay un coste de rendimiento al abrir el menú de interacción, especialmente en las ciudades)</Spanish>
</Key>
<Key ID="STR_ACE_Medical_Category_InteractionMenu">
<Key ID="STR_ACE_Interact_Menu_Category_InteractionMenu">
<English>Interaction Menu</English>
</Key>
</Package>

View File

@ -41,7 +41,6 @@ private ["_compiledConfig", "_name", "_typeName", "_isClientSetable", "_localize
if (GVAR(ClientSettingsExportIncluded) || !_isClientSetable) then {
_value = missionNamespace getvariable [_name, _defaultValue];
if (_typeName == "STRING") then {
_value = [_value, '"', "'"] call CBA_fnc_replace; // TODO improve the quotation replacement
_value = format['"%1"', _value];
};
if (_typeName == "BOOL") then {

View File

@ -24,4 +24,4 @@ _settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
_ctrlComboBox = (_settingsMenu displayCtrl 14);
GVAR(currentCategorySelection) = lbCurSel _ctrlComboBox;
[false] call ACE_optionsmenu_fnc_settingsMenuUpdateList;
[false] call FUNC(settingsMenuUpdateList);

View File

@ -16,12 +16,8 @@
#include "script_component.hpp"
private ["_settingsMenu"];
GVAR(currentCategorySelection) = lbCurSel 14;
disableSerialization;
_settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
_ctrlComboBox = (_settingsMenu displayCtrl 14);
GVAR(currentCategorySelection) = lbCurSel _ctrlComboBox;
systemChat format["Current selection: %1", GVAR(currentCategorySelection)];
[false] call FUNC(serverSettingsMenuUpdateList);

View File

@ -61,16 +61,19 @@ _menu = uiNamespace getvariable "ACE_serverSettingsMenu";
(_menu displayCtrl 1003) ctrlEnable false;
if (GVAR(ClientSettingsExportIncluded)) then {
(_settingsMenu displayCtrl 1102) ctrlSetText localize (LSTRING(exClientSettings));
(_settingsMenu displayCtrl 1102) ctrlSetText localize (CSTRING(exClientSettings));
} else {
(_settingsMenu displayCtrl 1102) ctrlSetText localize (LSTRING(inClientSettings));
(_settingsMenu displayCtrl 1102) ctrlSetText localize (CSTRING(inClientSettings));
};
lbClear (_menu displayCtrl 14);
{
if (_x == "") then {
_x = localize "STR_ACE_OptionsMenu_category_all";
};
(_menu displayCtrl 14) lbAdd if (isLocalized _x) then {localize _x} else {_x};
if (isLocalized _x) then {_x = localize _x};
(_menu displayCtrl 14) lbAdd _x;
} forEach GVAR(categories);
(_menu displayCtrl 14) lbSetCurSel 0; //All Catagoies
(_menu displayCtrl 14) lbSetCurSel GVAR(currentCategorySelection); //All Catagoies

View File

@ -53,13 +53,15 @@ if (GVAR(serverConfigGeneration) == 0) then {
(_menu displayCtrl 1102) ctrlShow false;
};
lbClear (_menu displayCtrl 14);
{
if (_x == "") then {
_x = localize "STR_ACE_OptionsMenu_category_all";
};
(_menu displayCtrl 14) lbAdd if (isLocalized _x) then {localize _x} else {_x};
if (isLocalized _x) then {_x = localize _x};
(_menu displayCtrl 14) lbAdd _x;
} forEach GVAR(categories);
(_menu displayCtrl 14) lbSetCurSel 0; //All Catagoies
(_menu displayCtrl 14) lbSetCurSel GVAR(currentCategorySelection); //All Catagoies

View File

@ -16,7 +16,7 @@
#include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor", "_expectedType"];
private ["_settingsMenu", "_ctrlList", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor", "_expectedType", "_filteredCollection", "_selectedCategory"];
disableSerialization;
_settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu';
@ -29,16 +29,24 @@ _collection = switch (GVAR(optionMenu_openTab)) do {
default {[]};
};
if (count _collection > 0) then {
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
_filteredCollection = [];
{
if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then {
_filteredCollection pushBack _x;
};
} forEach _collection;
if (count _filteredCollection > 0) then {
_settingIndex = (lbCurSel _ctrlList);
if (_settingIndex > (count _collection)) then {
_settingIndex = count _collection - 1;
if (_settingIndex > (count _filteredCollection)) then {
_settingIndex = count _filteredCollection - 1;
};
if (_settingIndex < 0) then {
_settingIndex = 0;
};
_setting = _collection select _settingIndex;
_setting = _filteredCollection select _settingIndex;
_entryName = _setting select 0;
_localizedName = _setting select 3;

View File

@ -16,7 +16,7 @@
#include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue"];
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"];
DEFAULT_PARAM(0,_updateKeyView,true);
disableSerialization;
@ -24,55 +24,67 @@ _settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu';
_ctrlList = _settingsMenu displayCtrl 200;
lbclear _ctrlList;
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
systemChat format["_selectedCategory: %1", _selectedCategory];
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_SERVER_OPTIONS): {
{
if ((_x select 3) != "") then {
_ctrlList lbadd (_x select 3);
} else {
_ctrlList lbadd (_x select 0);
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
if ((_x select 3) != "") then {
_ctrlList lbadd (_x select 3);
} else {
_ctrlList lbadd (_x select 0);
};
_settingsValue = _x select 9;
// Created disable/enable options for bools
_settingsText = if ((_x select 1) == "BOOL") then {
[(localize LSTRING(Disabled)), (localize LSTRING(Enabled))] select _settingsValue;
} else {
(_x select 5) select _settingsValue;
};
_ctrlList lbadd (_settingsText);
};
_settingsValue = _x select 9;
// Created disable/enable options for bools
_settingsText = if ((_x select 1) == "BOOL") then {
[(localize LSTRING(Disabled)), (localize LSTRING(Enabled))] select _settingsValue;
} else {
(_x select 5) select _settingsValue;
};
_ctrlList lbadd (_settingsText);
}foreach GVAR(serverSideOptions);
};
case (MENU_TAB_SERVER_COLORS): {
{
_color = +(_x select 9);
{
_color set [_forEachIndex, ((round (_x * 100))/100)];
} forEach _color;
_settingsColor = str _color;
if ((_x select 3) != "") then {
_ctrlList lbadd (_x select 3);
} else {
_ctrlList lbadd (_x select 0);
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
_color = +(_x select 9);
{
_color set [_forEachIndex, ((round (_x * 100))/100)];
} forEach _color;
_settingsColor = str _color;
if ((_x select 3) != "") then {
_ctrlList lbadd (_x select 3);
} else {
_ctrlList lbadd (_x select 0);
};
_ctrlList lbadd (_settingsColor);
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 9)];
};
_ctrlList lbadd (_settingsColor);
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 9)];
}foreach GVAR(serverSideColors);
};
case (MENU_TAB_SERVER_VALUES): {
{
if ((_x select 3) != "") then {
_ctrlList lbadd (_x select 3);
} else {
_ctrlList lbadd (_x select 0);
if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then {
if ((_x select 3) != "") then {
_ctrlList lbadd (_x select 3);
} else {
_ctrlList lbadd (_x select 0);
};
_settingsValue = _x select 9;
if (typeName _settingsValue != "STRINg") then {
_settingsValue = format["%1", _settingsValue];
};
_ctrlList lbadd (_settingsValue);
};
_settingsValue = _x select 9;
if (typeName _settingsValue != "STRINg") then {
_settingsValue = format["%1", _settingsValue];
};
_ctrlList lbadd (_settingsValue);
}foreach GVAR(serverSideValues);
};
};

View File

@ -16,7 +16,7 @@
#include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue"];
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView", "_settingsValue", "_selectedCategory"];
DEFAULT_PARAM(0,_updateKeyView,true);
disableSerialization;

View File

@ -0,0 +1,59 @@
/*
* Author: Glowbal
* Parse the string for quotation marks, so it can be used for config export.
*
* Arguments:
* 0: string <STRING>
*
* Return Value:
* parsed string <STRING>
*
* Example:
* [] call ACE_optionsmenu_fnc_stringEscape
*
* Public: No
*/
private ["_str", "_array", "_maxIndex"];
_str = _this;
_isEven = {
params ["_array", "_index"];
private [ "_count"];
_count = 0;
{
if (_forEachIndex <= _index && {_x == 39}) then {
_count = _count + 1;
};
}foreach _array;
_count %2 == 0;
};
// reg: 34
// single: 39
_array = toArray _str;
{
if (_x == 34) then {
_array set [_foreachIndex, 39];
};
}foreach _array;
_maxIndex = count _array;
for "_i" from 0 to _maxIndex /* step +1 */ do {
if (((_i + 1) < _maxIndex - 1) && {_array select _i == 39 && (_array select (_i + 1)) == 39}) then {
if ([_array, _i] call _isEven) then {
_array deleteAt _i;
_i = _i - 1;
_maxIndex = _maxIndex - 1;
};
};
};
{
if (_x == 34) then {
_array set [_foreachIndex, 39];
};
}foreach _array;
toString _array;