Read from config

This commit is contained in:
PabstMirror 2015-01-21 17:29:42 -06:00
parent fe4a0b9be8
commit 2b62c170fd
9 changed files with 72 additions and 5 deletions

View File

@ -29,6 +29,6 @@ EXPLODE_2_PVT(_this,_func,_params);
// Execute the function
_funcParams call _func;
},
_interval,
0,
[_this, diag_frameno]
] call CBA_fnc_addPerFrameHandler

View File

@ -1 +1,7 @@
#include "script_component.hpp"
[] spawn {
sleep 1;
[] call FUNC(addFromConfig);
};

View File

@ -4,6 +4,7 @@ ADDON = false;
PREP(addClientSideColor);
PREP(addClientSideOptions);
PREP(addFromConfig);
PREP(loadFromProfile);
PREP(onListBoxSettingsChanged);
PREP(onListBoxShowSelectionChanged);

View File

@ -19,6 +19,25 @@ class CfgAddons {
};
};
};
//PARAMS_4(_name,_localizedName,_localizedDescription,_defaultValue);
class ACE_Options {
class GVAR(testOption) {
displayName = "Config Test";
description = "Config Description";
default = 1;
values[] = {"Yeah", "Naa"};
};
};
class ACE_Colors {
class GVAR(testColor) {
displayName = "Color Config Test";
description = "Color Config Description";
default[] = {0,1,2,3};
};
};
#include "CfgEventHandlers.hpp"
#include "gui\define.hpp"

View File

@ -0,0 +1,40 @@
/**
* fnc_addFromConfig.sqf
* @Descr: N/A
* @Author: PabstMirror
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
systemChat format ["Reding From config"];
if (isClass (configFile >> "ACE_Options")) then {
_countOptions = count (configFile >> "ACE_Options");
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = (configFile >> "ACE_Options") select _index;
_name = configName _optionEntry;
_displayName = getText (_optionEntry >> "displayName");
_description = getText (_optionEntry >> "description");
_default = getNumber (_optionEntry >> "default");
_choices = getArray (_optionEntry >> "values");
if ((count _choices) == 0) then {
_choices = ["Aye", "Nay"];
};
[_name, _displayName, _description, _choices, _default] call FUNC(addClientSideOptions);
};
};
// class ACE_Options {
// GVAR(testOption) {
// displayName = "Config Test";
// description = "Config Description"
// default = 1;
// values[] = {"Yeah", "Naa"};
// };
// };

View File

@ -21,7 +21,6 @@ switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
_localizedHeader = format ["%1: %2", (localize "STR_ACE_OptionsMenu_OpenConfigMenu"), (localize "STR_ACE_OptionsMenu_TabOptions")];
ctrlSetText [13, _localizedHeader];
lbClear 400;
(_settingsMenu displayCtrl 301) ctrlShow true;

View File

@ -9,4 +9,5 @@
*/
#include "script_component.hpp"
[MENU_TAB_OPTIONS] call FUNC(onListBoxShowSelectionChanged);
//Delay a frame
[{ [MENU_TAB_OPTIONS] call FUNC(onListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame);

View File

@ -12,7 +12,8 @@
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView"];
DEFAULT_PARAM(0,_updateKeyView,true);
disableSerialization
disableSerialization;
_settingsMenu = uiNamespace getVariable 'ACE_settingsMenu';
_ctrlList = _settingsMenu displayCtrl 200;
lbclear _ctrlList;

View File

@ -107,7 +107,7 @@ class ACE_settingsMenu {
x = "2 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "5.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "23 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
h = "15 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)";
colorBackground[] = {0, 0, 0, 0.9};
colorSelectBackground[] = {0, 0, 0, 0.9};