Add category to options menu. Initial work.

This commit is contained in:
Glowbal 2015-08-07 21:14:45 +02:00
parent 50adc7c096
commit d125b9ad9c
14 changed files with 169 additions and 39 deletions

View File

@ -65,7 +65,8 @@ if (isNil _name) then {
localizedDescription,
possibleValues,
isForced,
defaultValue
defaultValue,
category
];*/
_settingData = [
_name,
@ -75,7 +76,8 @@ if (isNil _name) then {
getText (_optionEntry >> "description"),
getArray (_optionEntry >> "values"),
getNumber (_optionEntry >> "force") > 0,
_value
_value,
getText (_optionEntry >> "category")
];
//Strings in the values array won't be localized from the config, so just do that now:

View File

@ -3,12 +3,14 @@ class ACE_Settings {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(AlwaysUseCursorSelfInteraction);
};
class GVAR(cursorKeepCentered) {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(cursorKeepCentered);
description = CSTRING(cursorKeepCenteredDescription);
};
@ -16,18 +18,21 @@ class ACE_Settings {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(AlwaysUseCursorInteraction);
};
class GVAR(UseListMenu) {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(UseListMenu);
};
class GVAR(colorTextMax) {
value[] = {1, 1, 1, 1};
typeName = "COLOR";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(ColorTextMax);
};
class GVAR(colorTextMin) {
@ -40,18 +45,21 @@ class ACE_Settings {
value[] = {0, 0, 0, 1};
typeName = "COLOR";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(ColorShadowMax);
};
class GVAR(colorShadowMin) {
value[] = {0, 0, 0, 0.25};
typeName = "COLOR";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(ColorShadowMin);
};
class GVAR(textSize) {
value = 2;
typeName = "SCALAR";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(textSize);
values[] = {"$str_very_small", "$str_small", "$str_medium", "$str_large", "$str_very_large"};
};
@ -59,6 +67,7 @@ class ACE_Settings {
value = 2;
typeName = "SCALAR";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(shadowSetting);
description = CSTRING(shadowSettingDescription);
values[] = {"$STR_A3_OPTIONS_DISABLED", "$STR_A3_OPTIONS_ENABLED", CSTRING(shadowOutline)};
@ -67,12 +76,14 @@ class ACE_Settings {
value = 1;
typeName = "BOOL";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(ActionOnKeyRelease);
};
class GVAR(menuBackground) {
value = 0;
typeName = "SCALAR";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(background);
values[] = {"$STR_A3_OPTIONS_DISABLED", CSTRING(backgroundBlur), CSTRING(backgroundBlack)};
};
@ -80,6 +91,7 @@ class ACE_Settings {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
category = "Interaction Menu";
displayName = CSTRING(addBuildingActions);
description = CSTRING(addBuildingActionsDescription);
};

View File

@ -1,94 +1,116 @@
class ACE_Settings {
class GVAR(level) {
category = "medical";
value = 1;
typeName = "SCALAR";
values[] = {"Disabled", "Basic", "Advanced"};
};
class GVAR(medicSetting) {
category = "medical";
value = 1;
typeName = "SCALAR";
values[] = {"Disabled", "Normal", "Advanced"};
};
class GVAR(enableFor) {
category = "medical";
value = 0;
typeName = "SCALAR";
values[] = {"Players only", "Players and AI"};
};
class GVAR(enableOverdosing) {
category = "medical";
typeName = "BOOL";
value = 1;
};
class GVAR(bleedingCoefficient) {
category = "medical";
typeName = "SCALAR";
value = 1;
};
class GVAR(painCoefficient) {
category = "medical";
typeName = "SCALAR";
value = 1;
};
class GVAR(enableAirway) {
category = "medical";
typeName = "BOOL";
value = false;
};
class GVAR(enableFractures) {
category = "medical";
typeName = "BOOL";
value = false;
};
class GVAR(enableAdvancedWounds) {
category = "medical";
typeName = "BOOL";
value = false;
};
class GVAR(enableVehicleCrashes) {
category = "medical";
typeName = "BOOL";
value = 1;
};
class GVAR(enableScreams) {
category = "medical";
typeName = "BOOL";
value = 1;
};
class GVAR(playerDamageThreshold) {
category = "medical";
typeName = "SCALAR";
value = 1;
};
class GVAR(AIDamageThreshold) {
category = "medical";
typeName = "SCALAR";
value = 1;
};
class GVAR(enableUnconsciousnessAI) {
category = "medical";
value = 1;
typeName = "SCALAR";
values[] = {"Disabled", "50/50", "Enabled"};
};
class GVAR(remoteControlledAI) {
category = "medical";
typeName = "BOOL";
value = 1;
};
class GVAR(preventInstaDeath) {
category = "medical";
typeName = "BOOL";
value = 0;
};
class GVAR(enableRevive) {
category = "medical";
typeName = "SCALAR";
value = 0;
values[] = {"Disabled", "Players only", "Players and AI"};
};
class GVAR(maxReviveTime) {
category = "medical";
typeName = "SCALAR";
value = 120;
};
class GVAR(amountOfReviveLives) {
category = "medical";
typeName = "SCALAR";
value = -1;
};
class GVAR(allowDeadBodyMovement) {
category = "medical";
typeName = "BOOL";
value = 0;
};
class GVAR(allowLitterCreation) {
category = "medical";
typeName = "BOOL";
value = 1;
};
class GVAR(litterSimulationDetail) {
category = "medical";
displayName = CSTRING(litterSimulationDetail);
description = CSTRING(litterSimulationDetail_Desc);
typeName = "SCALAR";
@ -100,40 +122,48 @@ class ACE_Settings {
isClientSettable = 1;
};
class GVAR(litterCleanUpDelay) {
category = "medical";
typeName = "SCALAR";
value = 0;
};
class GVAR(medicSetting_PAK) {
category = "medical";
typeName = "SCALAR";
value = 1;
values[] = {"Anyone", "Medics only", "Doctors only"};
};
class GVAR(medicSetting_SurgicalKit) {
category = "medical";
typeName = "SCALAR";
value = 1;
values[] = {"Anyone", "Medics only", "Doctors only"};
};
class GVAR(consumeItem_PAK) {
category = "medical";
typeName = "SCALAR";
value = 0;
values[] = {"No", "Yes"};
};
class GVAR(consumeItem_SurgicalKit) {
category = "medical";
typeName = "SCALAR";
value = 0;
values[] = {"No", "Yes"};
};
class GVAR(useLocation_PAK) {
category = "medical";
typeName = "SCALAR";
value = 3;
values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"};
};
class GVAR(useLocation_SurgicalKit) {
category = "medical";
typeName = "SCALAR";
value = 2;
values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"};
};
class GVAR(useCondition_PAK) {
category = "medical";
displayName = CSTRING(AdvancedMedicalSettings_useCondition_PAK_DisplayName);
description = CSTRING(AdvancedMedicalSettings_useCondition_PAK_Description);
typeName = "SCALAR";
@ -141,6 +171,7 @@ class ACE_Settings {
values[] = {"Anytime", "Stable"};
};
class GVAR(useCondition_SurgicalKit) {
category = "medical";
displayName = CSTRING(AdvancedMedicalSettings_useCondition_SurgicalKit_DisplayName);
description = CSTRING(AdvancedMedicalSettings_useCondition_SurgicalKit_Description);
typeName = "SCALAR";
@ -148,20 +179,24 @@ class ACE_Settings {
values[] = {"Anytime", "Stable"};
};
class GVAR(keepLocalSettingsSynced) {
category = "medical";
typeName = "BOOL";
value = 1;
};
class GVAR(healHitPointAfterAdvBandage) {
category = "medical";
displayName = CSTRING(healHitPointAfterAdvBandage);
typeName = "BOOL";
value = 0;
};
class GVAR(painIsOnlySuppressed) {
category = "medical";
displayName = CSTRING(painIsOnlySuppressed);
typeName = "BOOL";
value = 1;
};
class GVAR(painEffectType) {
category = "medical";
displayName = CSTRING(painEffectType);
typeName = "SCALAR";
value = 0;
@ -169,15 +204,18 @@ class ACE_Settings {
isClientSettable = 1;
};
class GVAR(allowUnconsciousAnimationOnTreatment) {
category = "medical";
typeName = "BOOL";
value = 0;
};
class GVAR(moveUnitsFromGroupOnUnconscious) {
category = "medical";
typeName = "BOOL";
value = 0;
};
class GVAR(menuTypeStyle) {
category = "medical";
displayName = CSTRING(menuTypeDisplay);
description = CSTRING(menuTypeDescription);
typeName = "SCALAR";

View File

@ -1,5 +1,10 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};

View File

@ -0,0 +1,11 @@
#include "script_component.hpp"
["SettingsInitialized", {
{
if !(_x select 8 in GVAR(categories)) then {
GVAR(categories) pushback (_x select 8);
diag_log format["Category: %1", _x];
};
}foreach EGVAR(common,settings);
}] call EFUNC(common,addEventHandler);

View File

@ -10,6 +10,7 @@ PREP(onSliderPosChanged);
PREP(onServerSaveInputField);
PREP(onServerSettingsMenuOpen);
PREP(onServerListBoxShowSelectionChanged);
PREP(onCategorySelectChanged);
PREP(resetSettings);
PREP(serverResetSettings);
PREP(settingsMenuUpdateKeyView);
@ -29,5 +30,7 @@ GVAR(ClientSettingsExportIncluded) = false;
GVAR(serverSideOptions) = [];
GVAR(serverSideColors) = [];
GVAR(serverSideValues) = [];
GVAR(categories) = [];
GVAR(currentCategorySelection) = 0;
ADDON = true;

View File

@ -0,0 +1,27 @@
/*
* Author: Glowbal
* Changes which category is selected
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ACE_optionsmenu_fnc_onCategorySelectChanged
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingsMenu"];
disableSerialization;
_settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
_ctrlComboBox = (_settingsMenu displayCtrl 14);
GVAR(currentCategorySelection) = lbCurSel _ctrlComboBox;
[false] call ACE_optionsmenu_fnc_settingsMenuUpdateList;

View File

@ -52,3 +52,10 @@ if (GVAR(serverConfigGeneration) == 0) then {
(_menu displayCtrl 1102) ctrlEnable false;
(_menu displayCtrl 1102) ctrlShow false;
};
{
if (_x == "") then {
_x = "All Categories";
};
(_menu displayCtrl 14) lbAdd _x;
} forEach GVAR(categories);

View File

@ -52,7 +52,7 @@ if (count _collection > 0) then {
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_SERVER_OPTIONS): {
_possibleValues = _setting select 5;
_settingsValue = _setting select 8;
_settingsValue = _setting select 9;
// Created disable/enable options for bools
if ((_setting select 1) == "BOOL") then {
lbClear 400;
@ -66,14 +66,14 @@ if (count _collection > 0) then {
(_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue;
};
case (MENU_TAB_SERVER_COLORS): {
_currentColor = _setting select 8;
_currentColor = _setting select 9;
{
sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))];
} forEach [410, 411, 412, 413];
};
case (MENU_TAB_SERVER_VALUES): {
// TODO implement
_settingsValue = _setting select 8;
_settingsValue = _setting select 9;
// Created disable/enable options for bools
_expectedType = switch (_setting select 1) do {

View File

@ -33,7 +33,7 @@ switch (GVAR(optionMenu_openTab)) do {
_ctrlList lbadd (_x select 0);
};
_settingsValue = _x select 8;
_settingsValue = _x select 9;
// Created disable/enable options for bools
_settingsText = if ((_x select 1) == "BOOL") then {
@ -47,7 +47,7 @@ switch (GVAR(optionMenu_openTab)) do {
};
case (MENU_TAB_SERVER_COLORS): {
{
_color = +(_x select 8);
_color = +(_x select 9);
{
_color set [_forEachIndex, ((round (_x * 100))/100)];
} forEach _color;
@ -58,7 +58,7 @@ switch (GVAR(optionMenu_openTab)) do {
_ctrlList lbadd (_x select 0);
};
_ctrlList lbadd (_settingsColor);
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 8)];
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 9)];
}foreach GVAR(serverSideColors);
};
case (MENU_TAB_SERVER_VALUES): {
@ -68,7 +68,7 @@ switch (GVAR(optionMenu_openTab)) do {
} else {
_ctrlList lbadd (_x select 0);
};
_settingsValue = _x select 8;
_settingsValue = _x select 9;
if (typeName _settingsValue != "STRINg") then {
_settingsValue = format["%1", _settingsValue];
};

View File

@ -37,8 +37,19 @@ if (count _collection > 0) then {
if (_settingIndex < 0) then {
_settingIndex = 0;
};
diag_log format["_collection: %1", _collection];
_setting = _collection select _settingIndex;
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
if !(_selectedCategory == "All Categories" || _selectedCategory == (_setting select 8)) exitwith {
systemChat format["INCORRECT CATEGORY: %1 != %2", _selectedCategory, _setting];
diag_log format["INCORRECT CATEGORY: %1 != %2", _selectedCategory, _setting];
lbClear 400;
(_settingsMenu displayCtrl 250) ctrlSetText "No settings available";
(_settingsMenu displayCtrl 251) ctrlSetText "No settings available";
(_settingsMenu displayCtrl 300) ctrlSetText "No settings available";
};
_entryName = _setting select 0;
_localizedName = _setting select 3;
_localizedDescription = _setting select 4;
@ -51,7 +62,7 @@ if (count _collection > 0) then {
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
_possibleValues = _setting select 5;
_settingsValue = _setting select 8;
_settingsValue = _setting select 9;
// Created disable/enable options for bools
if ((_setting select 1) == "BOOL") then {
@ -66,7 +77,7 @@ if (count _collection > 0) then {
(_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue;
};
case (MENU_TAB_COLORS): {
_currentColor = _setting select 8;
_currentColor = _setting select 9;
{
sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))];
} forEach [410, 411, 412, 413];

View File

@ -25,33 +25,37 @@ _ctrlList = _settingsMenu displayCtrl 200;
lbclear _ctrlList;
_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection);
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
{
_ctrlList lbadd (_x select 3);
if (_selectedCategory == "All Categories" || _selectedCategory == (_X select 8)) then {
_ctrlList lbadd (_x select 3);
_settingsValue = _x select 9;
_settingsValue = _x select 8;
// 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;
// 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);
};
_ctrlList lbadd (_settingsText);
}foreach GVAR(clientSideOptions);
};
case (MENU_TAB_COLORS): {
{
_color = +(_x select 8);
{
_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 8)];
{
if (_selectedCategory == "All Categories" || _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);
};
};

View File

@ -32,7 +32,7 @@ switch (_type) do {
_newValue = [false, true] select _newValue;
};
if !((_x select 8) isEqualTo _newValue) then {
if !((_x select 9) isEqualTo _newValue) then {
_changed = true;
_x set [8, _newValue];
} ;
@ -42,7 +42,7 @@ switch (_type) do {
};
case (MENU_TAB_COLORS): {
{
if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then {
if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then {
_changed = true;
_x set [8, _newValue];
};
@ -56,7 +56,7 @@ switch (_type) do {
_newValue = [false, true] select _newValue;
};
if !((_x select 8) isEqualTo _newValue) then {
if !((_x select 9) isEqualTo _newValue) then {
_changed = true;
_x set [8, _newValue];
} ;
@ -66,7 +66,7 @@ switch (_type) do {
};
case (MENU_TAB_SERVER_COLORS): {
{
if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then {
if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then {
_changed = true;
_x set [8, _newValue];
};
@ -74,7 +74,7 @@ switch (_type) do {
};
case (MENU_TAB_SERVER_VALUES): {
{
if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then {
if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then {
_changed = true;
_x set [8, _newValue];
};

View File

@ -77,10 +77,20 @@ class ACE_settingsMenu {
idc = 13;
x = X_PART(2);
y = Y_PART(3.4);
w = W_PART(30);
w = W_PART(15);
h = H_PART(1);
text = "";
};
class categorySelection: ACE_gui_comboBoxBase {
idc = 14;
x = X_PART(15);
y = Y_PART(3.4);
w = W_PART(9);
h = H_PART(1);
text = "";
onLBSelChanged = QUOTE( call FUNC(onCategorySelectChanged));
SizeEx = H_PART(0.9);
};
class selectionAction_1: ACE_gui_buttonBase {
idc = 1000;
text = CSTRING(TabOptions);