mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Color Sliders
This commit is contained in:
parent
0ae940fdfb
commit
92bbfd92d1
@ -2,6 +2,7 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(addClientSideColor);
|
||||
PREP(addClientSideOptions);
|
||||
PREP(loadFromProfile);
|
||||
PREP(onListBoxSettingsChanged);
|
||||
|
18
addons/optionsmenu/functions/fnc_addClientSideColor.sqf
Normal file
18
addons/optionsmenu/functions/fnc_addClientSideColor.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* fnc_addClientSideColor.sqf
|
||||
* @Descr: N/A
|
||||
* @Author: PabstMirror
|
||||
*
|
||||
* @Arguments: []
|
||||
* @Return:
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_4(_name,_localizedName,_localizedDescription,_defaultValue);
|
||||
|
||||
GVAR(clientSideColors) pushBack [_name, _localizedName, _localizedDescription, [], _defaultValue];
|
||||
|
||||
//Get the current setting from profile (or default) and set it:
|
||||
_currentValue = [MENU_TAB_COLORS, _name, _defaultValue] call FUNC(loadFromProfile);
|
||||
[MENU_TAB_COLORS, _name, _currentValue] call FUNC(updateSetting);
|
@ -9,25 +9,22 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_settingsMenu", "_optionSelected", "_onChangeCode", "_selectedSetting", "_nameOfSetting"];
|
||||
private ["_settingsMenu", "_rightDropDownIndex", "_onChangeCode", "_settingIndex", "_settingIndex"];
|
||||
disableSerialization;
|
||||
_settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
|
||||
|
||||
_optionSelected = lbCurSel 400;
|
||||
_selectedSetting = lbCurSel 200;
|
||||
|
||||
if (_optionSelected < 0) then {_optionSelected = 0;};
|
||||
_settingIndex = lbCurSel 200; //Index of left list
|
||||
_rightDropDownIndex = lbCurSel 400; //Index of right drop down
|
||||
|
||||
if (_rightDropDownIndex < 0) then {_rightDropDownIndex = 0;};
|
||||
|
||||
switch (GVAR(optionMenu_openTab)) do {
|
||||
case (MENU_TAB_OPTIONS): {
|
||||
if (_selectedSetting > (count GVAR(clientSideOptions))) then {
|
||||
_selectedSetting = (count GVAR(clientSideOptions)) - 1;
|
||||
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideOptions)))) then {
|
||||
_settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0;
|
||||
[MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
|
||||
};
|
||||
if (_selectedSetting < 0) then {
|
||||
_selectedSetting = 0;
|
||||
};
|
||||
_nameOfSetting = (GVAR(clientSideOptions) select _selectedSetting) select 0;
|
||||
[MENU_TAB_OPTIONS, _nameOfSetting, _optionSelected] call FUNC(updateSetting);
|
||||
[false] call FUNC(settingsMenuUpdateList);
|
||||
};
|
||||
};
|
||||
|
@ -9,40 +9,20 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
systemChat format ["slide %1", _this];
|
||||
|
||||
|
||||
disableSerialization;
|
||||
_slider = _this select 0;
|
||||
_pos = _this select 1;
|
||||
_idc = ctrlIDC _slider;
|
||||
|
||||
_index = _idc % 4; //[410, 411, 412, 413];
|
||||
|
||||
_settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
|
||||
_optionSelected = lbCurSel 400;
|
||||
|
||||
// switch (GVAR(optionMenu_openTab)) do {
|
||||
// case (MENU_TAB_COLORS): {
|
||||
// if (_selectedSetting > (count GVAR(clientSideColors))) then {
|
||||
// _selectedSetting = (count GVAR(clientSideColors)) - 1;
|
||||
// };
|
||||
// if (_selectedSetting < 0) then {
|
||||
// _selectedSetting = 0;
|
||||
// };
|
||||
// _nameOfSetting = (GVAR(clientSideColors) select _selectedSetting) select 0;
|
||||
// [MENU_TAB_COLORS, _nameOfSetting, _optionSelected] call FUNC(updateSetting);
|
||||
// [false] call FUNC(settingsMenuUpdateList);
|
||||
// };
|
||||
// };
|
||||
|
||||
|
||||
// private ["_settingsMenu", "_optionSelected", "_onChangeCode", "_selectedSetting", "_nameOfSetting"];
|
||||
//
|
||||
|
||||
//
|
||||
// _selectedSetting = lbCurSel 200;
|
||||
|
||||
// if (_optionSelected < 0) then {_optionSelected = 0;};
|
||||
private ["_newColor", "_settingIndex"];
|
||||
_newColor = [];
|
||||
{
|
||||
_newColor pushBack (sliderPosition _x);
|
||||
} 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);
|
||||
};
|
||||
[false] call FUNC(settingsMenuUpdateList);
|
||||
};
|
||||
};
|
||||
|
@ -11,27 +11,21 @@
|
||||
|
||||
private ["_type", "_collection", "_default", "_lastSelected"];
|
||||
|
||||
|
||||
{
|
||||
_type = _x;
|
||||
_collection = [];
|
||||
switch (_type) do {
|
||||
case (MENU_TAB_OPTIONS): {_collection = GVAR(clientSideOptions);};
|
||||
case (MENU_TAB_COLORS): {_collection = GVAR(clientSideColors);};
|
||||
};
|
||||
|
||||
{
|
||||
_name = _x select 0;
|
||||
_default = _x select 5;
|
||||
|
||||
systemChat format ["Reseting %1 to %2", _name, _default];
|
||||
[_type, _name, _default] call FUNC(updateSetting);
|
||||
} forEach _collection;
|
||||
|
||||
} forEach [MENU_TAB_OPTIONS, MENU_TAB_COLORS];
|
||||
_name = _x select 0;
|
||||
_default = _x select 5;
|
||||
[MENU_TAB_OPTIONS, _name, _default] call FUNC(updateSetting);
|
||||
} forEach GVAR(clientSideOptions);
|
||||
|
||||
{
|
||||
_name = _x select 0;
|
||||
_default = _x select 4;
|
||||
[MENU_TAB_COLORS, _name, _default] call FUNC(updateSetting);
|
||||
} forEach GVAR(clientSideColors);
|
||||
|
||||
_lastSelected = lbCurSel 200;
|
||||
[GVAR(optionMenu_openTab)] call FUNC(onListBoxShowSelectionChanged);
|
||||
if (_lastSelected != -1) then {
|
||||
lbSetCurSel [200, _lastSelected];
|
||||
lbSetCurSel [200, _lastSelected];
|
||||
};
|
||||
|
@ -12,26 +12,27 @@
|
||||
private ["_nameSelected", "_saved"];
|
||||
PARAMS_2(_type,_name);
|
||||
|
||||
_typeString = "";
|
||||
_collection = [];
|
||||
switch (_type) do {
|
||||
case (MENU_TAB_OPTIONS): {
|
||||
_typeString = "option";
|
||||
_collection = GVAR(clientSideOptions);
|
||||
{
|
||||
_nameSelected = _x select 0;
|
||||
if (_nameSelected == _name) exitwith {
|
||||
profileNamespace setvariable [(format ["ace_option_%1", _name]), (_x select 4)];
|
||||
_saved = true;
|
||||
systemChat str [(format ["ace_option_%1", _name]), (_x select 4)];
|
||||
};
|
||||
}foreach GVAR(clientSideOptions);
|
||||
};
|
||||
case (MENU_TAB_COLORS): {
|
||||
_typeString = "color";
|
||||
_collection = [];
|
||||
{
|
||||
_nameSelected = _x select 0;
|
||||
if (_nameSelected == _name) exitwith {
|
||||
profileNamespace setvariable [(format ["ace_color_%1", _name]), (_x select 3)];
|
||||
_saved = true;
|
||||
systemChat str [(format ["ace_color_%1", _name]), (_x select 3)];
|
||||
};
|
||||
}foreach GVAR(clientSideColors);
|
||||
};
|
||||
};
|
||||
|
||||
_saved = false;
|
||||
{
|
||||
_nameSelected = _x select 0;
|
||||
if (_nameSelected == _name) exitwith {
|
||||
profileNamespace setvariable [(format ["ace_%1_%2", _typeString, _name]), (_x select 4)];
|
||||
_saved = true;
|
||||
};
|
||||
}foreach GVAR(clientSideOptions);
|
||||
|
||||
_saved
|
||||
|
@ -17,19 +17,20 @@ _ctrlList = _settingsMenu displayCtrl 200;
|
||||
|
||||
_collection = switch (GVAR(optionMenu_openTab)) do {
|
||||
case MENU_TAB_OPTIONS: {GVAR(clientSideOptions)};
|
||||
case MENU_TAB_COLORS: {GVAR(clientSideColors)};
|
||||
default {[]};
|
||||
};
|
||||
|
||||
if (count _collection > 0) then {
|
||||
_selectedSetting = (lbCurSel _ctrlList);
|
||||
if (_selectedSetting > (count _collection)) then {
|
||||
_selectedSetting = count _collection - 1;
|
||||
_settingIndex = (lbCurSel _ctrlList);
|
||||
if (_settingIndex > (count _collection)) then {
|
||||
_settingIndex = count _collection - 1;
|
||||
};
|
||||
|
||||
if (_selectedSetting < 0) exitwith {
|
||||
_selectedSetting = 0;
|
||||
if (_settingIndex < 0) exitwith {
|
||||
_settingIndex = 0;
|
||||
};
|
||||
_setting = _collection select _selectedSetting;
|
||||
_setting = _collection select _settingIndex;
|
||||
|
||||
_entryName = _setting select 0;
|
||||
_localizedName = _setting select 1;
|
||||
@ -38,57 +39,29 @@ if (count _collection > 0) then {
|
||||
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 3;
|
||||
_settingsValue = _setting select 4;
|
||||
|
||||
lbClear 400;
|
||||
_settingsText = (_possibleValues select _settingsValue); // expecting: value [[any, TEXT (DESCRIPTION)]]
|
||||
(_settingsMenu displayCtrl 300) ctrlSetText _entryName;
|
||||
{
|
||||
lbAdd [400, _x];
|
||||
} foreach _possibleValues;
|
||||
{ lbAdd [400, _x]; } foreach _possibleValues;
|
||||
|
||||
(_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue;
|
||||
|
||||
};
|
||||
case (MENU_TAB_COLORS): {
|
||||
|
||||
_currentColor = _setting select 3;
|
||||
|
||||
systemChat format ["here %1", _currentColor];
|
||||
{
|
||||
systemChat str [_x, (_currentColor select _forEachIndex)];
|
||||
sliderSetPosition [_x, (_currentColor select _forEachIndex)];
|
||||
} forEach [410, 411, 412, 413];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// if (GVAR(optionMenu_openTab) != MENU_TAB_OPTIONS) then {
|
||||
// _keybinding = _setting select 1;
|
||||
|
||||
// _keyCode = _keybinding select 0;
|
||||
// _shiftPressed = _keybinding select 1;
|
||||
// _ctrlPressed = _keybinding select 2;
|
||||
// _altPressed = _keybinding select 3;
|
||||
|
||||
// _keyBindingText = keyName _keyCode;
|
||||
// if (_keyBindingText == '""') then {
|
||||
// _keyBindingText = "No key assigned";
|
||||
// };
|
||||
// (_settingsMenu displayCtrl 300) ctrlSetText ("Key: " + _keyBindingText);
|
||||
|
||||
// lbClear 400;
|
||||
// lbadd [400, "No"];
|
||||
// lbadd [400, "Yes"];
|
||||
// lbadd [400, "Ignore"];
|
||||
// (_settingsMenu displayCtrl 400) lbSetCurSel _shiftPressed;
|
||||
// (_settingsMenu displayCtrl 401) lbSetCurSel _ctrlPressed;
|
||||
// (_settingsMenu displayCtrl 402) lbSetCurSel _altPressed;
|
||||
// } else {
|
||||
// _possibleValues = _setting select 1;
|
||||
// _settingsValue = _setting select 2;
|
||||
|
||||
// lbClear 400;
|
||||
|
||||
// _settingsText = (_possibleValues select _settingsValue); // expecting: value [[any, TEXT (DESCRIPTION)]]
|
||||
// (_settingsMenu displayCtrl 300) ctrlSetText ("Setting: " + _settingsText);
|
||||
// {
|
||||
// lbAdd [400, _x];
|
||||
// } foreach _possibleValues;
|
||||
|
||||
// (_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue;
|
||||
// };
|
||||
};
|
@ -26,7 +26,21 @@ case (MENU_TAB_OPTIONS): {
|
||||
_ctrlList lbadd (_settingsText);
|
||||
}foreach GVAR(clientSideOptions);
|
||||
};
|
||||
case (MENU_TAB_COLORS): {
|
||||
{
|
||||
_color = +(_x select 3);
|
||||
{
|
||||
_color set [_forEachIndex, ((round (_x * 100))/100)];
|
||||
} forEach _color;
|
||||
|
||||
_settingsColor = str _color;
|
||||
_ctrlList lbadd (_x select 1);
|
||||
_ctrlList lbadd (_settingsColor);
|
||||
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 3)];
|
||||
}foreach GVAR(clientSideColors);
|
||||
};
|
||||
};
|
||||
if (_updateKeyView) then {
|
||||
systemChat "Hare";
|
||||
[] call FUNC(settingsMenuUpdateKeyView);
|
||||
};
|
@ -11,26 +11,30 @@
|
||||
|
||||
PARAMS_3(_type,_name,_newValue);
|
||||
|
||||
private ["_changed", "_collection"];
|
||||
private ["_changed"];
|
||||
|
||||
_changed = false;
|
||||
_collection = [];
|
||||
|
||||
switch (_type) do {
|
||||
case (MENU_TAB_OPTIONS): {_collection = GVAR(clientSideOptions);};
|
||||
case (MENU_TAB_COLORS): {_collection = GVAR(clientSideColors);};
|
||||
};
|
||||
|
||||
systemChat format ["%1: %2", _name, count _collection];
|
||||
|
||||
{
|
||||
if ((_x select 0) == _name) then {
|
||||
if (!((_x select 4) isEqualTo _newValue)) then {
|
||||
_changed = true;
|
||||
_x set [4, _newValue]; //Change current Value
|
||||
};
|
||||
case (MENU_TAB_OPTIONS): {
|
||||
{
|
||||
if ((_x select 0) == _name) then {
|
||||
if (!((_x select 4) isEqualTo _newValue)) then {
|
||||
_changed = true;
|
||||
_x set [4, _newValue];
|
||||
};
|
||||
};
|
||||
} foreach GVAR(clientSideOptions);
|
||||
};
|
||||
} foreach _collection;
|
||||
case (MENU_TAB_COLORS): {
|
||||
{
|
||||
if (((_x select 0) == _name) && {!((_x select 3) isEqualTo _newValue)}) then {
|
||||
_changed = true;
|
||||
_x set [3, _newValue];
|
||||
};
|
||||
} foreach GVAR(clientSideColors);
|
||||
};
|
||||
};
|
||||
|
||||
systemChat format ["%1: %2", _name, _changed];
|
||||
|
||||
|
@ -190,29 +190,31 @@ class ACE_settingsMenu {
|
||||
|
||||
class sliderBar1: RscXSliderH {
|
||||
idc = 410;
|
||||
x = "31.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
|
||||
x = "28.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
|
||||
y = "7.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
|
||||
w = "7 * (((safezoneW / safezoneH) min 1.2) / 40)";
|
||||
w = "10 * (((safezoneW / safezoneH) min 1.2) / 40)";
|
||||
h = "0.75 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
|
||||
onSliderPosChanged = QUOTE(_this call FUNC(onSliderPosChanged));
|
||||
color[] = {1,0,0,0.4};
|
||||
colorActive[] = {1,0,0,1};
|
||||
};
|
||||
class sliderBar2: sliderBar1 {
|
||||
idc = 411;
|
||||
y = "8.2 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
|
||||
h = "0.75 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
|
||||
onSliderPosChanged = QUOTE(_this call FUNC(onSliderPosChanged));
|
||||
color[] = {0,1,0,0.4};
|
||||
colorActive[] = {0,1,0,1};
|
||||
};
|
||||
class sliderBar3: sliderBar1 {
|
||||
idc = 412;
|
||||
y = "9.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
|
||||
h = "0.75 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
|
||||
onSliderPosChanged = QUOTE(_this call FUNC(onSliderPosChanged));
|
||||
color[] = {0,0,1,0.4};
|
||||
colorActive[] = {0,0,1,1};
|
||||
};
|
||||
class sliderBar4: sliderBar1 {
|
||||
idc = 413;
|
||||
y = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
|
||||
h = "0.75 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
|
||||
onSliderPosChanged = QUOTE(_this call FUNC(onSliderPosChanged));
|
||||
color[] = {1,1,1,0.4};
|
||||
colorActive[] = {1,1,1,1};
|
||||
};
|
||||
|
||||
|
||||
@ -260,15 +262,13 @@ class ACE_settingsMenu {
|
||||
text = "Fix Animation";
|
||||
x = "7.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
|
||||
// action = "if ([player] call ACE_fnc_canInteract && {animationState player == 'deadState' || animationState player == 'unconscious'} && {(vehicle player == player)}) then { [player, 'amovppnemstpsnonwnondnon'] call ACE_fnc_broadcastAnim; };";
|
||||
action = "hint 'todo???'";
|
||||
};
|
||||
|
||||
class action_reset: actionClose {
|
||||
idc = 1100;
|
||||
text = "Reset All";
|
||||
x = "7.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
|
||||
y = "22.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
|
||||
w = "6 * (((safezoneW / safezoneH) min 1.2) / 40)";
|
||||
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
|
||||
x = "14 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
|
||||
action = QUOTE([] call FUNC(resetSettings));
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user