Merge pull request #171 from KoffeinFlummi/SettingsMenuImprovements

Settings menu improvements & fixes
This commit is contained in:
Glowbal 2015-03-15 00:49:48 +01:00
commit 74874904ed
10 changed files with 123 additions and 113 deletions

View File

@ -6,8 +6,8 @@ class CfgPatches {
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"Combat Space Enhancement"};
authorUrl = "http://csemod.com";
author[] = {"Glowbal", "PabstMirror"};
authorUrl = "http://github.com/Glowbal";
VERSION_CONFIG;
};
};
@ -24,4 +24,4 @@ class CfgAddons {
#include "CfgEventHandlers.hpp"
#include "gui\define.hpp"
#include "gui\settingsMenu.hpp"
#include "gui\pauseMenu.hpp"
#include "gui\pauseMenu.hpp"

View File

@ -13,6 +13,7 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingIndex", "_rightDropDownIndex"];

View File

@ -13,6 +13,7 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingsMenu", "_localizedHeader"];

View File

@ -13,6 +13,7 @@
*
* Public: No
*/
#include "script_component.hpp"
// Filter only user setable setting
@ -38,3 +39,9 @@ GVAR(clientSideColors) = [];
//Delay a frame
[{ [MENU_TAB_OPTIONS] call FUNC(onListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame);
private "_menu";
disableSerialization;
_menu = uiNamespace getvariable "ACE_settingsMenu";
(_menu displayCtrl 1002) ctrlEnable false;
(_menu displayCtrl 1003) ctrlEnable false;

View File

@ -13,23 +13,26 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_newColor", "_settingIndex"];
_newColor = [];
{
_newColor pushBack ((sliderPosition _x) / 255);
} forEach [410, 411, 412, 413];
_settingIndex = lbCurSel 200;
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_COLORS): {
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideColors)))) then {
_settingIndex = (GVAR(clientSideColors) select _settingIndex) select 0;
[MENU_TAB_COLORS, _settingIndex, _newColor] call FUNC(updateSetting);
case (MENU_TAB_COLORS): {
_newColor = [];
{
_newColor pushBack ((sliderPosition _x) / 255);
} forEach [410, 411, 412, 413];
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideColors)))) then {
_settingIndex = (GVAR(clientSideColors) select _settingIndex) select 0;
[MENU_TAB_COLORS, _settingIndex, _newColor] call FUNC(updateSetting);
};
[false] call FUNC(settingsMenuUpdateList);
};
[false] call FUNC(settingsMenuUpdateList);
};
default {};
};

View File

@ -13,6 +13,7 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_name", "_default", "_lastSelected"];

View File

@ -13,6 +13,7 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor"];
@ -22,58 +23,58 @@ _settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
_ctrlList = _settingsMenu displayCtrl 200;
_collection = switch (GVAR(optionMenu_openTab)) do {
case MENU_TAB_OPTIONS: {GVAR(clientSideOptions)};
case MENU_TAB_COLORS: {GVAR(clientSideColors)};
default {[]};
case MENU_TAB_OPTIONS: {GVAR(clientSideOptions)};
case MENU_TAB_COLORS: {GVAR(clientSideColors)};
default {[]};
};
if (count _collection > 0) then {
_settingIndex = (lbCurSel _ctrlList);
if (_settingIndex > (count _collection)) then {
_settingIndex = count _collection - 1;
};
if (_settingIndex < 0) exitwith {
_settingIndex = 0;
};
_setting = _collection select _settingIndex;
_entryName = _setting select 0;
_localizedName = _setting select 3;
_localizedDescription = _setting select 4;
if (_localizedName == "") then {_localizedName = _entryName;};
(_settingsMenu displayCtrl 250) ctrlSetText _localizedName;
(_settingsMenu displayCtrl 251) ctrlSetText _localizedDescription;
(_settingsMenu displayCtrl 300) ctrlSetText _entryName;
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
_possibleValues = _setting select 5;
_settingsValue = _setting select 8;
// Created disable/enable options for bools
if ((_setting select 1) == "BOOL") then {
lbClear 400;
lbAdd [400, (localize "STR_ACE_OptionsMenu_Disabled")];
lbAdd [400, (localize "STR_ACE_OptionsMenu_Enabled")];
_settingsValue = [0, 1] select _settingsValue;
} else {
lbClear 400;
{ lbAdd [400, _x]; } foreach _possibleValues;
};
(_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue;
_settingIndex = (lbCurSel _ctrlList);
if (_settingIndex > (count _collection)) then {
_settingIndex = count _collection - 1;
};
case (MENU_TAB_COLORS): {
_currentColor = _setting select 8;
{
sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))];
} forEach [410, 411, 412, 413];
if (_settingIndex < 0) then {
_settingIndex = 0;
};
_setting = _collection select _settingIndex;
_entryName = _setting select 0;
_localizedName = _setting select 3;
_localizedDescription = _setting select 4;
if (_localizedName == "") then {_localizedName = _entryName;};
(_settingsMenu displayCtrl 250) ctrlSetText _localizedName;
(_settingsMenu displayCtrl 251) ctrlSetText _localizedDescription;
(_settingsMenu displayCtrl 300) ctrlSetText _entryName;
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
_possibleValues = _setting select 5;
_settingsValue = _setting select 8;
// Created disable/enable options for bools
if ((_setting select 1) == "BOOL") then {
lbClear 400;
lbAdd [400, (localize "STR_ACE_OptionsMenu_Disabled")];
lbAdd [400, (localize "STR_ACE_OptionsMenu_Enabled")];
_settingsValue = [0, 1] select _settingsValue;
} else {
lbClear 400;
{ lbAdd [400, _x]; } foreach _possibleValues;
};
(_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue;
};
case (MENU_TAB_COLORS): {
_currentColor = _setting select 8;
{
sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))];
} forEach [410, 411, 412, 413];
};
};
};
} else { //no settings in list:
lbClear 400;
(_settingsMenu displayCtrl 250) ctrlSetText _localizedName;
(_settingsMenu displayCtrl 251) ctrlSetText _localizedDescription;
(_settingsMenu displayCtrl 300) ctrlSetText _entryName;
lbClear 400;
(_settingsMenu displayCtrl 250) ctrlSetText "No settings available";
(_settingsMenu displayCtrl 251) ctrlSetText "No settings available";
(_settingsMenu displayCtrl 300) ctrlSetText "No settings available";
};

View File

@ -13,6 +13,7 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView"];
@ -25,35 +26,35 @@ _ctrlList = _settingsMenu displayCtrl 200;
lbclear _ctrlList;
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
case (MENU_TAB_OPTIONS): {
{
_ctrlList lbadd (_x select 3);
_settingsValue = _x select 8;
// Created disable/enable options for bools
_settingsText = if ((_x select 1) == "BOOL") then {
[(localize "STR_ACE_OptionsMenu_Disabled"), (localize "STR_ACE_OptionsMenu_Enabled")] select _settingsValue;
} else {
(_x select 5) select _settingsValue;
};
_ctrlList lbadd (_settingsText);
}foreach GVAR(clientSideOptions);
};
case (MENU_TAB_COLORS): {
{
_ctrlList lbadd (_x select 3);
_settingsValue = _x select 8;
// Created disable/enable options for bools
_settingsText = if ((_x select 1) == "BOOL") then {
[(localize "STR_ACE_OptionsMenu_Disabled"), (localize "STR_ACE_OptionsMenu_Enabled")] select _settingsValue;
} else {
(_x select 5) select _settingsValue;
};
_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)];
}foreach GVAR(clientSideColors);
};
_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)];
}foreach GVAR(clientSideColors);
};
};
if (_updateKeyView) then {
[] call FUNC(settingsMenuUpdateKeyView);
[] call FUNC(settingsMenuUpdateKeyView);
};

View File

@ -15,6 +15,7 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_changed"];

View File

@ -4,7 +4,7 @@ class ACE_settingsMenu {
onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_settingsMenu', _this select 0)]; [] call FUNC(onSettingsMenuOpen););
onUnload = QUOTE(uiNamespace setVariable [ARR_2('ACE_settingsMenu', nil)]; saveProfileNamespace;);
#define SIZEX ((0.70 * safezoneW) max 1.0)
#define SIZEX (((safezoneW / safezoneH) min 1.2))
#define SIZEY (SIZEX / 1.2)
#define UNITX (SIZEX / 40)
#define UNITY (SIZEY / 25)
@ -42,6 +42,10 @@ class ACE_settingsMenu {
x = 26.1 * UNITX + OFFSETX;
w = 12.9 * UNITX;
};
class RightBackgroundHeader: RightBackground {
h = 1.4 * UNITY;
colorBackground[] = {0,0,0,1};
};
};
class controls {
@ -85,7 +89,7 @@ class ACE_settingsMenu {
colorBackgroundFocused[] = {1,1,1,1};
colorBackground[] = {1,1,1,1};
colorbackground2[] = {1,1,1,1};
colorDisabled[] = {0.5,0.5,0.5,0.8};
colorDisabled[] = {1,1,1,1};
colorFocused[] = {0,0,0,1};
periodFocus = 1;
periodOver = 1;
@ -99,13 +103,13 @@ class ACE_settingsMenu {
};
class selectionAction_3: selectionAction_1 {
idc = 1002;
text = "---";
text = "";
x = 20 * UNITX + OFFSETX;
action = "";
};
class selectionAction_4: selectionAction_1 {
idc = 1003;
text = "---";
text = "";
x = 29.5 * UNITX + OFFSETX;
action = "";
};
@ -115,7 +119,7 @@ class ACE_settingsMenu {
y = 5.5 * UNITY + OFFSETY;
w = 23 * UNITX;
h = 15 * UNITY;
SizeEx = (UNITY * 0.7);
SizeEx = (UNITY * 0.8);
colorBackground[] = {0, 0, 0, 0.9};
colorSelectBackground[] = {0, 0, 0, 0.9};
columns[] = {0.0, 0.6};
@ -128,7 +132,7 @@ class ACE_settingsMenu {
w = 11 * UNITX;
h = 1 * UNITY;
text = "";
SizeEx = (UNITY * 0.75);
SizeEx = (UNITY *1);
};
class labelKey: ACE_gui_staticBase { //Variable Name
idc = 300;
@ -137,13 +141,13 @@ class ACE_settingsMenu {
w = 11 * UNITX;
h = 1 * UNITY;
text = "";
SizeEx = (UNITY * 0.60);
SizeEx = (UNITY * 0.65);
};
class Label2: labelKey {
idc = 301;
y = 7.3 * UNITY + OFFSETY;
text = "$STR_ACE_OptionsMenu_Setting";
SizeEx = (UNITY * 0.75);
SizeEx = (UNITY * 1);
};
class comboBox1: ACE_gui_comboBoxBase {
idc = 400;
@ -152,7 +156,7 @@ class ACE_settingsMenu {
w = 7 * UNITX;
h = 1 * UNITY;
onLBSelChanged = QUOTE( call FUNC(onListBoxSettingsChanged));
SizeEx = (UNITY * 0.75);
SizeEx = (UNITY * 0.9);
};
class sliderBar1: RscXSliderH {
idc = 410;
@ -191,15 +195,16 @@ class ACE_settingsMenu {
text = "";
style = ST_LEFT + ST_MULTI;
lineSpacing = 1;
SizeEx = (UNITY * 0.60);
SizeEx = (UNITY * 0.8);
};
class actionClose: ACE_gui_buttonBase {
idc = 10;
text = "$STR_DISP_CLOSE";
x = 1 * UNITX + OFFSETX;
y = 22.3 * UNITY + OFFSETY;
w = 6 * UNITX;
w = 7.5 * UNITX;
h = 1 * UNITY;
style = ST_LEFT;
animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.8)";
animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.5)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
@ -217,21 +222,10 @@ class ACE_settingsMenu {
periodOver = 1;
action = "closedialog 0;";
};
//probably use this for the export to hpp button:
/* class action_animation: actionClose {
idc = 1100;
text = "$STR_ACE_OptionsMenu_FixAnimation";
x = 7.5 * UNITX + OFFSETX;
// action = "if ([player] call ACE_fnc_canInteract && {animationState player == 'deadState' || animationState player == 'unconscious'} && {(vehicle player == player)}) then { [player, 'amovppnemstpsnonwnondnon'] call ACE_fnc_broadcastAnim; };";
action = QUOTE(_this call FUNC(k,rgr));
}; */
class action_reset: actionClose {
idc = 1100;
text = "$STR_ACE_OptionsMenu_ResetAll";
x = 14 * (SIZEX / 40) + OFFSETX;
x = 26.1 * (SIZEX / 40) + OFFSETX;
action = QUOTE([] call FUNC(resetSettings));
};
};