Merge pull request #260 from KoffeinFlummi/serverConfig

Server Config support
This commit is contained in:
Glowbal 2015-04-06 01:42:33 +02:00
commit befb52e855
23 changed files with 961 additions and 67 deletions

View File

@ -15,52 +15,38 @@
GVAR(settings) = [];
// Load settings from main config
_countOptions = count (configFile >> "ACE_Settings");
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = (configFile >> "ACE_Settings") select _index;
_parseConfigForSettings = {
private ["_config", "_countOptions", "_optionEntry", "_index"];
[_optionEntry] call FUNC(setSettingFromConfig);
};
// Check if all settings should be forced
if (GVAR(forceAllSettings)) then {
{
_x set [6, true];
} forEach GVAR(settings);
};
// @todo
// Load settings from server userconfig only if the ACE_ServerSettings is loaded
/*if (isClass (configFile >> "CfgPatches" >> "ACE_ServerSettings")) then {
DFUNC(serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp";
if !(isNil DFUNC(serverUserConfig)) then {
[] call FUNC(serverUserConfig);
_config = _this select 0;
_countOptions = count _config;
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = _config select _index;
[_optionEntry] call FUNC(setSettingFromConfig);
};
// Check if all settings should be forced
if (GVAR(forceAllSettings)) then {
{
if !(missionNamespace getVariable format ["%1_forced", _x]) then {
missionNamespace setVariable format ["%1_forced", _x, true];
publicVariable format ["%1_forced", _name];
};
} forEach GVAR(settingsList);
_x set [6, true];
} forEach GVAR(settings);
};
};*/
// Load settings from mission config
_countOptions = count (missionConfigFile >> "ACE_Settings");
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = (missionConfigFile >> "ACE_Settings") select _index;
[_optionEntry] call FUNC(setSettingFromConfig);
};
// Check if all settings should be forced
if (GVAR(forceAllSettings)) then {
{
_x set [6, true];
} forEach GVAR(settings);
};
// Order is this way because:
// ACE_Settings should never force any setting by default. Loading it first ensures that all settings from ACE_Settings exist.
// This way, ACE_ServerSettings will override ACE_Settings, even if no force is used.
// Mission settings will override the server config settings, if no force is used.
// This ensures that all settings are of their correct type, in case an outdated or corrupt server config is used , as well as have their correct localized display name and description
// Regular config
[configFile >> "ACE_Settings"] call _parseConfigForSettings;
// Server config
[configFile >> "ACE_ServerSettings"] call _parseConfigForSettings;
// mission side settings
[missionConfigFile >> "ACE_Settings"] call _parseConfigForSettings;
// Publish all settings data
publicVariable QGVAR(settings);
// Publish all setting values

View File

@ -0,0 +1,28 @@
class CfgVehicles {
class ACE_Module;
// TODO localization for all the modules
class ACE_moduleAllowConfigExport: ACE_Module {
scope = 2;
displayName = "Allow Config Export [ACE]";
//icon = "";
category = "ACE";
function = QUOTE(DFUNC(moduleAllowConfigExport));
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
author = "$STR_ACE_Common_ACETeam";
class Arguments {
class allowconfigurationExport {
displayName = "Allow";
description = "Allow export of all settings to a server config formatted.";
typeName = "BOOL";
defaultValue = 1;
};
};
class ModuleDescription {
description = "When allowed, you have access to the settings modification and export in SP. Clicking export will place the formated config on your clipboard.";
sync[] = {};
};
};
};

View File

@ -6,12 +6,27 @@ PREP(onListBoxSettingsChanged);
PREP(onListBoxShowSelectionChanged);
PREP(onSettingsMenuOpen);
PREP(onSliderPosChanged);
PREP(onServerSaveInputField);
PREP(onServerSettingsMenuOpen);
PREP(onServerListBoxShowSelectionChanged);
PREP(resetSettings);
PREP(serverResetSettings);
PREP(settingsMenuUpdateKeyView);
PREP(settingsMenuUpdateList);
PREP(serverSettingsMenuUpdateKeyView);
PREP(serverSettingsMenuUpdateList);
PREP(updateSetting);
PREP(exportSettings);
PREP(toggleIncludeClientSettings);
PREP(moduleAllowConfigExport);
GVAR(clientSideOptions) = [];
GVAR(clientSideColors) = [];
GVAR(serverConfigGeneration) = 0;
GVAR(ClientSettingsExportIncluded) = false;
GVAR(serverSideOptions) = [];
GVAR(serverSideColors) = [];
GVAR(serverSideValues) = [];
ADDON = true;

View File

@ -2,7 +2,7 @@
class CfgPatches {
class ADDON {
units[] = {};
units[] = {"ACE_moduleAllowConfigExport"};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
@ -25,3 +25,5 @@ class CfgAddons {
#include "gui\define.hpp"
#include "gui\settingsMenu.hpp"
#include "gui\pauseMenu.hpp"
#include "CFgVehicles.hpp"

View File

@ -0,0 +1,61 @@
/*
* Author: Glowbal
* Export all config settings with their current values.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ACE_optionsmenu_fnc_exportSettings
*
* Public: No
*/
#include "script_component.hpp"
_compiledConfig = "
";
{
/*_settingData = [
_name,
_typeName,
_isClientSetable,
_localizedName,
_localizedDescription,
_possibleValues,
_isForced,
_defaultValue
];*/
_name = _x select 0;
_typeName = _x select 1;
_isClientSetable = _x select 2;
_localizedName = _x select 3;
_localizedDescription = _x select 4;
_possibleValues = _x select 5;
_defaultValue = _x select 6;
if (GVAR(ClientSettingsExportIncluded) || !_isClientSetable) then {
_value = missionNamespace getvariable [_name, _defaultValue];
if (_typeName == "STRING") then { // I dont think we have string values, but just in case
_value = format['"%1"', _value];
};
if (_typeName == "BOOL") then {
_value = if (typeOf _value == "BOOL" && {_value}) then {1} else {0};
};
_compiledConfigEntry = format ["
class %1 {
value = %2;
typeName = %3;
force = 1;
};", _name, _value, format['"%1"', _typeName]];
_compiledConfig = _compiledConfig + _compiledConfigEntry;
};
} forEach EGVAR(common,settings);
copyToClipboard format["%1",_compiledConfig];
["STR_ACE_OptionsMenu_settingsExported"] call EFUNC(common,displayTextStructured);

View File

@ -0,0 +1,25 @@
/*
* Author: Glowbal
*
*
* Arguments:
* none
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_logic"];
_logic = _this select 0;
if (isMultiplayer) exitwith {};
if (_logic getvariable ["allowconfigurationExport", false]) then {
GVAR(serverConfigGeneration) = 1;
} else {
GVAR(serverConfigGeneration) = 0;
};

View File

@ -24,11 +24,18 @@ _rightDropDownIndex = lbCurSel 400; //Index of right drop down
if (_rightDropDownIndex < 0) then {_rightDropDownIndex = 0;};
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideOptions)))) then {
_settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0;
[MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
};
[false] call FUNC(settingsMenuUpdateList);
};
case (MENU_TAB_OPTIONS): {
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(clientSideOptions)))) then {
_settingIndex = (GVAR(clientSideOptions) select _settingIndex) select 0;
[MENU_TAB_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
};
[false] call FUNC(settingsMenuUpdateList);
};
case (MENU_TAB_SERVER_OPTIONS): {
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideOptions)))) then {
_settingIndex = (GVAR(serverSideOptions) select _settingIndex) select 0;
[MENU_TAB_SERVER_OPTIONS, _settingIndex, _rightDropDownIndex] call FUNC(updateSetting);
};
[false] call FUNC(serverSettingsMenuUpdateList);
};
};

View File

@ -0,0 +1,88 @@
/*
* Author: Glowbal
* Changes which tab is open (options or colors)
*
* Arguments:
* The tab to open (defined in script_component) <NUMBER>
*
* Return Value:
* None
*
* Example:
* [MENU_TAB_COLORS] call ACE_optionsmenu_fnc_onListBoxShowSelectionChanged
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingsMenu", "_localizedHeader"];
PARAMS_1(_openTab);
GVAR(optionMenu_openTab) = _openTab;
disableSerialization;
_settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu';
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_SERVER_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;
(_settingsMenu displayCtrl 400) ctrlShow true;
(_settingsMenu displayCtrl 410) ctrlShow false;
(_settingsMenu displayCtrl 411) ctrlShow false;
(_settingsMenu displayCtrl 412) ctrlShow false;
(_settingsMenu displayCtrl 413) ctrlShow false;
(_settingsMenu displayCtrl 414) ctrlShow false;
(_settingsMenu displayCtrl 415) ctrlShow false;
(_settingsMenu displayCtrl 416) ctrlShow false;
(_settingsMenu displayCtrl 416) ctrlEnable false;
};
case (MENU_TAB_SERVER_COLORS): {
_localizedHeader = format ["%1: %2", (localize "STR_ACE_OptionsMenu_OpenConfigMenu"), (localize "STR_ACE_OptionsMenu_TabColors")];
ctrlSetText [13, _localizedHeader];
lbClear 400;
(_settingsMenu displayCtrl 301) ctrlShow false;
(_settingsMenu displayCtrl 400) ctrlShow false;
(_settingsMenu displayCtrl 410) ctrlShow true;
(_settingsMenu displayCtrl 411) ctrlShow true;
(_settingsMenu displayCtrl 412) ctrlShow true;
(_settingsMenu displayCtrl 413) ctrlShow true;
(_settingsMenu displayCtrl 410) sliderSetRange [0, 255];
(_settingsMenu displayCtrl 411) sliderSetRange [0, 255];
(_settingsMenu displayCtrl 412) sliderSetRange [0, 255];
(_settingsMenu displayCtrl 413) sliderSetRange [0, 255];
(_settingsMenu displayCtrl 414) ctrlShow false;
(_settingsMenu displayCtrl 415) ctrlShow false;
(_settingsMenu displayCtrl 416) ctrlShow false;
(_settingsMenu displayCtrl 416) ctrlEnable false;
};
case (MENU_TAB_SERVER_VALUES): {
_localizedHeader = format ["%1: %2", (localize "STR_ACE_OptionsMenu_OpenConfigMenu"), (localize "STR_ACE_OptionsMenu_TabValues")];
ctrlSetText [13, _localizedHeader];
lbClear 400;
(_settingsMenu displayCtrl 301) ctrlShow false;
(_settingsMenu displayCtrl 400) ctrlShow false;
(_settingsMenu displayCtrl 410) ctrlShow false;
(_settingsMenu displayCtrl 411) ctrlShow false;
(_settingsMenu displayCtrl 412) ctrlShow false;
(_settingsMenu displayCtrl 413) ctrlShow false;
(_settingsMenu displayCtrl 414) ctrlShow true;
(_settingsMenu displayCtrl 415) ctrlShow true;
(_settingsMenu displayCtrl 416) ctrlShow true;
(_settingsMenu displayCtrl 416) ctrlEnable true;
};
};
[true] call FUNC(serverSettingsMenuUpdateList);

View File

@ -0,0 +1,43 @@
/*
* Author: Glowbal
* Called when the listbox selection is changed for an options (eg: chaning a setting from false to true)
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ACE_optionsmenu_fnc_onListBoxSettingsChanged
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingIndex", "_inputText"];
_settingIndex = lbCurSel 200; //Index of left list
_inputText = ctrlText 414; //Index of right drop down
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_SERVER_VALUES): {
if ((_settingIndex >= 0) && (_settingIndex < (count GVAR(serverSideValues)))) then {
try {
_setting = (GVAR(serverSideValues) select _settingIndex);
_settingName = _setting select 0;
_convertedValue = switch (toUpper (_setting select 1)) do {
case "STRING": {format ['"%1"', _inputText]};
case "ARRAY": {format [call compile "[%1]", _inputText]};
case "SCALAR": {parseNumber _inputText;};
default {throw "Error"};
};
[MENU_TAB_SERVER_VALUES, _settingName, _convertedValue] call FUNC(updateSetting);
} catch {
};
};
[false] call FUNC(serverSettingsMenuUpdateList);
};
};

View File

@ -0,0 +1,66 @@
/*
* Author: Glowbal
* Called from the onLoad of ACE_settingsMenu dialog.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [onLoadEvent] call ACE_optionsmenu_fnc_onSettingsMenuOpen
*
* Public: No
*/
#include "script_component.hpp"
if (GVAR(serverConfigGeneration) == 0 || isMultiplayer) exitwith {closeDialog 145246;};
// Filter only user setable setting
GVAR(serverSideOptions) = [];
GVAR(serverSideColors) = [];
GVAR(serverSideValues) = [];
{
_name = _x select 0;
_typeName = _x select 1;
_isClientSetable = _x select 2;
_localizedName = _x select 3;
_localizedDescription = _x select 4;
_possibleValues = _x select 5;
_defaultValue = _x select 6;
// Exclude client side options if they are not included for the export
if (!(_isClientSetable) || GVAR(ClientSettingsExportIncluded)) then {
// Append the current value to the setting metadata
_setting = + _x;
_setting pushBack (missionNamespace getVariable (_x select 0));
// Categorize the setting according to types
// @todo: allow the user to modify other types of parameters?
if ((_typeName == "SCALAR" && count _possibleValues > 0) || (_x select 1) == "BOOL") then {
GVAR(serverSideOptions) pushBack _setting;
};
if (_typeName == "COLOR") then {
GVAR(serverSideColors) pushBack _setting;
};
if ((_typeName == "SCALAR" && count _possibleValues == 0) || _typeName == "ARRAY" || _typeName == "STRING") then {
GVAR(serverSideValues) pushBack _setting;
};
};
} forEach EGVAR(common,settings);
//Delay a frame
[{ [MENU_TAB_SERVER_OPTIONS] call FUNC(onServerListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame);
private "_menu";
disableSerialization;
_menu = uiNamespace getvariable "ACE_serverSettingsMenu";
(_menu displayCtrl 1003) ctrlEnable false;
if (GVAR(ClientSettingsExportIncluded)) then {
(_settingsMenu displayCtrl 1102) ctrlSetText localize ("STR_ACE_OptionsMenu_exClientSettings");
} else {
(_settingsMenu displayCtrl 1102) ctrlSetText localize ("STR_ACE_OptionsMenu_inClientSettings");
};

View File

@ -16,6 +16,10 @@
#include "script_component.hpp"
if (isMultiplayer /* || !(GVAR(allowServerConfigGeneration))*/) exitwith {
closeDialog 0;
};
// Filter only user setable setting
GVAR(clientSideOptions) = [];
GVAR(clientSideColors) = [];
@ -45,3 +49,8 @@ disableSerialization;
_menu = uiNamespace getvariable "ACE_settingsMenu";
(_menu displayCtrl 1002) ctrlEnable false;
(_menu displayCtrl 1003) ctrlEnable false;
if (GVAR(serverConfigGeneration) == 0) then {
(_menu displayCtrl 1102) ctrlEnable false;
(_menu displayCtrl 1102) ctrlShow false;
};

View File

@ -34,5 +34,18 @@ switch (GVAR(optionMenu_openTab)) do {
};
[false] call FUNC(settingsMenuUpdateList);
};
case (MENU_TAB_SERVER_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_SERVER_COLORS, _settingIndex, _newColor] call FUNC(updateSetting);
};
[false] call FUNC(serverSettingsMenuUpdateList);
};
default {};
};

View File

@ -0,0 +1,43 @@
/*
* Author: Glowbal
* Resets all server settings to default.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ACE_optionsmenu_fnc_onListBoxSettingsChanged
*
* Public: No
*/
#include "script_component.hpp"
private ["_name", "_default", "_lastSelected"];
{
_name = _x select 0;
_default = _x select 7;
[MENU_TAB_SERVER_OPTIONS, _name, _default] call FUNC(updateSetting);
} forEach GVAR(serverSideOptions);
{
_name = _x select 0;
_default = _x select 7;
[MENU_TAB_SERVER_COLORS, _name, _default] call FUNC(updateSetting);
} forEach GVAR(serverSideColors);
{
_name = _x select 0;
_default = _x select 7;
[MENU_TAB_SERVER_VALUES, _name, _default] call FUNC(updateSetting);
} forEach GVAR(serverSideVakyes);
_lastSelected = lbCurSel 200;
[GVAR(optionMenu_openTab)] call FUNC(onserverListBoxShowSelectionChanged);
if (_lastSelected != -1) then {
lbSetCurSel [200, _lastSelected];
};

View File

@ -0,0 +1,94 @@
/*
* Author: Glowbal
* Updates the right half of the option menu for the currently selected option.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ACE_optionsmenu_fnc_settingsMenuUpdateKeyView
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_collection", "_settingIndex", "_setting", "_entryName", "_localizedName", "_localizedDescription", "_possibleValues", "_settingsValue", "_currentColor"];
disableSerialization;
_settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu';
_ctrlList = _settingsMenu displayCtrl 200;
_collection = switch (GVAR(optionMenu_openTab)) do {
case MENU_TAB_SERVER_OPTIONS: {GVAR(serverSideOptions)};
case MENU_TAB_SERVER_COLORS: {GVAR(serverSideColors)};
case MENU_TAB_SERVER_VALUES: {GVAR(serverSideValues)};
default {[]};
};
if (count _collection > 0) then {
_settingIndex = (lbCurSel _ctrlList);
if (_settingIndex > (count _collection)) then {
_settingIndex = count _collection - 1;
};
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_SERVER_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_SERVER_COLORS): {
_currentColor = _setting select 8;
{
sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))];
} forEach [410, 411, 412, 413];
};
case (MENU_TAB_SERVER_VALUES): {
// TODO implement
_settingsValue = _setting select 8;
// Created disable/enable options for bools
_expectedType = switch (_setting select 1) do {
case "STRING": {"STR_ACE_OptionsMenu_stringType"};
case "ARRAY": {"STR_ACE_OptionsMenu_arrayType"};
case "SCALAR": {"STR_ACE_OptionsMenu_scalarType"};
default {"STR_ACE_optionsMenu_unknownType"};
};
(_settingsMenu displayCtrl 414) ctrlSetText format["%1", _settingsValue];
(_settingsMenu displayCtrl 415) ctrlSetText format[localize _expectedType];
};
};
} else { //no settings in list:
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

@ -0,0 +1,81 @@
/*
* Author: Glowbal
* Updates the setting when the client has selected a new value. Saves to profilenamespace.
*
* Arguments:
* 0: Update the keylist as well <BOOL>
*
* Return Value:
* None
*
* Example:
* [false] call ACE_optionsmenu_fnc_settingsMenuUpdateList
*
* Public: No
*/
#include "script_component.hpp"
private ["_settingsMenu", "_ctrlList", "_settingsText", "_color", "_settingsColor", "_updateKeyView"];
DEFAULT_PARAM(0,_updateKeyView,true);
disableSerialization;
_settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu';
_ctrlList = _settingsMenu displayCtrl 200;
lbclear _ctrlList;
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);
};
_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(serverSideOptions);
};
case (MENU_TAB_SERVER_COLORS): {
{
_color = +(_x select 8);
{
_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 8)];
}foreach GVAR(serverSideColors);
};
case (MENU_TAB_SERVER_VALUES): {
{
if ((_x select 3) != "") then {
_ctrlList lbadd (_x select 3);
} else {
_ctrlList lbadd (_x select 0);
};
_settingsValue = _x select 8;
if (typeName _settingsValue != "STRINg") then {
_settingsValue = format["%1", _settingsValue];
};
_ctrlList lbadd (_settingsValue);
}foreach GVAR(serverSideValues);
};
};
if (_updateKeyView) then {
[] call FUNC(serverSettingsMenuUpdateKeyView);
};

View File

@ -0,0 +1,18 @@
/*
* Author: Glowbal
*
*
* Arguments:
* none
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
GVAR(ClientSettingsExportIncluded) = !(GVAR(ClientSettingsExportIncluded));
[] call FUNC(onServerSettingsMenuOpen);

View File

@ -24,33 +24,71 @@ PARAMS_3(_type,_name,_newValue);
_changed = false;
switch (_type) do {
case (MENU_TAB_OPTIONS): {
{
if ((_x select 0) == _name) then {
case (MENU_TAB_OPTIONS): {
{
if ((_x select 0) == _name) then {
if ((_x select 1) == "BOOL") then {
_newValue = [false, true] select _newValue;
};
if !((_x select 8) isEqualTo _newValue) then {
_changed = true;
_x set [8, _newValue];
} ;
if ((_x select 1) == "BOOL") then {
_newValue = [false, true] select _newValue;
};
if !((_x select 8) isEqualTo _newValue) then {
} foreach GVAR(clientSideOptions);
};
case (MENU_TAB_COLORS): {
{
if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then {
_changed = true;
_x set [8, _newValue];
} ;
};
} foreach GVAR(clientSideOptions);
};
} foreach GVAR(clientSideColors);
};
case (MENU_TAB_COLORS): {
{
if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then {
_changed = true;
_x set [8, _newValue];
};
} foreach GVAR(clientSideColors);
case (MENU_TAB_SERVER_OPTIONS): {
{
if ((_x select 0) == _name) then {
if ((_x select 1) == "BOOL") then {
_newValue = [false, true] select _newValue;
};
if !((_x select 8) isEqualTo _newValue) then {
_changed = true;
_x set [8, _newValue];
} ;
};
} foreach GVAR(serverSideOptions);
};
case (MENU_TAB_SERVER_COLORS): {
{
if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then {
_changed = true;
_x set [8, _newValue];
};
} foreach GVAR(serverSideColors);
};
case (MENU_TAB_SERVER_VALUES): {
{
if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then {
_changed = true;
_x set [8, _newValue];
};
} foreach GVAR(serverSideValues);
};
};
if (_changed) then {
profileNamespace setVariable [_name, _newValue];
[_name, _newValue] call EFUNC(common,setSetting);
if (GVAR(serverConfigGeneration) > 0) then {
if !(isMultiplayer) then {
missionNamespace setvariable [_name, _newValue];
};
} else {
profileNamespace setVariable [_name, _newValue];
[_name, _newValue] call EFUNC(common,setSetting);
};
};

View File

@ -228,5 +228,211 @@ class ACE_settingsMenu {
x = 26.1 * (SIZEX / 40) + OFFSETX;
action = QUOTE([] call FUNC(resetSettings));
};
class action_exportServerConfig: actionClose {
idc = 1102;
text = "$STR_ACE_OptionsMenu_OpenExport";
x = 1 * (SIZEX / 40) + OFFSETX;
action = QUOTE(if (GVAR(serverConfigGeneration) > 0) then {createDialog 'ACE_serverSettingsMenu'; });
};
};
};
};
class ACE_serverSettingsMenu: ACE_settingsMenu {
onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_serverSettingsMenu', _this select 0)]; [] call FUNC(onServerSettingsMenuOpen););
onUnload = QUOTE(uiNamespace setVariable [ARR_2('ACE_serverSettingsMenu', nil)];);
class controls: controls {
class HeaderName {
idc = 1;
type = CT_STATIC;
x = 1 * UNITX + OFFSETX;
y = 1 * UNITY + OFFSETY;
w = 38 * UNITX;
h = 1 * UNITY;
style = ST_LEFT + ST_SHADOW;
font = "PuristaMedium";
SizeEx = (UNITY * 1);
colorText[] = {0.95, 0.95, 0.95, 0.75};
colorBackground[] = {0,0,0,0};
text = "$STR_ACE_OptionsMenu_OpenConfigMenu";
};
class labelSubHeader: ACE_gui_staticBase {
idc = 13;
x = 2 * UNITX + OFFSETX;
y = 3.4 * UNITY + OFFSETY;
w = 30 * UNITX;
h = 1 * UNITY;
text = "";
};
class selectionAction_1: ACE_gui_buttonBase {
idc = 1000;
text = "$STR_ACE_OptionsMenu_TabOptions";
x = 1 * UNITX + OFFSETX;
y = 2.1 * UNITY + OFFSETY;
w = 9.5 * UNITX;
h = 1 * UNITY;
animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)";
animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.8)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
color[] = {1, 1, 1, 1};
color2[] = {0,0,0, 1};
colorBackgroundFocused[] = {1,1,1,1};
colorBackground[] = {1,1,1,1};
colorbackground2[] = {1,1,1,1};
colorDisabled[] = {1,1,1,1};
colorFocused[] = {0,0,0,1};
periodFocus = 1;
periodOver = 1;
action = QUOTE([MENU_TAB_SERVER_OPTIONS] call FUNC(onServerListBoxShowSelectionChanged););
};
class selectionAction_2: selectionAction_1 {
idc = 1001;
text = "$STR_ACE_OptionsMenu_TabColors";
x = 10.5 * UNITX + OFFSETX;
action = QUOTE([MENU_TAB_SERVER_COLORS] call FUNC(onServerListBoxShowSelectionChanged););
};
class selectionAction_3: selectionAction_1 {
idc = 1002;
text = "$STR_ACE_OptionsMenu_TabValues";
x = 20 * UNITX + OFFSETX;
action = QUOTE([MENU_TAB_SERVER_VALUES] call FUNC(onServerListBoxShowSelectionChanged););
};
class selectionAction_4: selectionAction_1 {
idc = 1003;
text = "";
x = 29.5 * UNITX + OFFSETX;
action = "";
};
class listBoxSettingsList: ACE_gui_listNBox {
idc = 200;
x = 2 * UNITX + OFFSETX;
y = 5.5 * UNITY + OFFSETY;
w = 23 * UNITX;
h = 15 * UNITY;
SizeEx = (UNITY * 0.8);
colorBackground[] = {0, 0, 0, 0.9};
colorSelectBackground[] = {0, 0, 0, 0.9};
columns[] = {0.0, 0.6};
onLBSelChanged = QUOTE(_this call FUNC(serverSettingsMenuUpdateKeyView));
};
class labelTitle: ACE_gui_staticBase {
idc = 250;
x = 27.1 * UNITX + OFFSETX;
y = 5.1 * UNITY + OFFSETY;
w = 11 * UNITX;
h = 1 * UNITY;
text = "";
SizeEx = (UNITY *1);
};
class labelKey: ACE_gui_staticBase { //Variable Name
idc = 300;
x = 27.1 * UNITX + OFFSETX;
y = 6.2 * UNITY + OFFSETY;
w = 11 * UNITX;
h = 1 * UNITY;
text = "";
SizeEx = (UNITY * 0.65);
};
class Label2: labelKey {
idc = 301;
y = 7.3 * UNITY + OFFSETY;
text = "$STR_ACE_OptionsMenu_Setting";
SizeEx = (UNITY * 1);
};
class comboBox1: ACE_gui_comboBoxBase {
idc = 400;
x = 31.1 * UNITX + OFFSETX;
y = 7.3 * UNITY + OFFSETY;
w = 7 * UNITX;
h = 1 * UNITY;
onLBSelChanged = QUOTE( call FUNC(onListBoxSettingsChanged));
SizeEx = (UNITY * 0.9);
};
class sliderBar1: RscXSliderH {
idc = 410;
x = 27.1 * UNITX + OFFSETX;
y = 7.3 * UNITY + OFFSETY;
w = 11 * UNITX;
h = 0.75 * UNITY;
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 * UNITY + OFFSETY;
color[] = {0,1,0,0.4};
colorActive[] = {0,1,0,1};
};
class sliderBar3: sliderBar1 {
idc = 412;
y = 9.1 * UNITY + OFFSETY;
color[] = {0,0,1,0.4};
colorActive[] = {0,0,1,1};
};
class sliderBar4: sliderBar1 {
idc = 413;
y = 10 * UNITY + OFFSETY;
color[] = {1,1,1,0.4};
colorActive[] = {1,1,1,1};
};
class inputField1: ACE_gui_editBase {
idc = 414;
x = 27.1 * UNITX + OFFSETX;
y = 7.3 * UNITY + OFFSETY;
w = 11 * UNITX;
h = 0.75 * UNITY;
};
class inputFieldTypeLabel: ACE_gui_staticBase {
idc = 415;
x = 27.1 * UNITX + OFFSETX;
y = 8.2 * UNITY + OFFSETY;
w = 11 * UNITX;
h = 0.75 * UNITY;
text = "";
style = ST_LEFT + ST_MULTI;
lineSpacing = 1;
SizeEx = (UNITY * 0.8);
};
class saveInputButton: selectionAction_1 {
idc = 416;
text = "$STR_ACE_OptionsMenu_SaveInput";
x = 27.1 * UNITX + OFFSETX;
y = 9.1 * UNITY + OFFSETY;
w = 11 * UNITX;
h = 1 * UNITY;
action = QUOTE([] call FUNC(onServerSaveInputField););
};
class labelDesc: ACE_gui_staticBase {
idc = 251;
x = 27.1 * UNITX + OFFSETX;
y = 11 * UNITY + OFFSETY;
w = 11 * UNITX;
h = 11 * UNITY;
text = "";
style = ST_LEFT + ST_MULTI;
lineSpacing = 1;
SizeEx = (UNITY * 0.8);
};
class actionClose;
class action_reset: actionClose {
idc = 1100;
text = "$STR_ACE_OptionsMenu_ResetAll";
x = 26.1 * (SIZEX / 40) + OFFSETX;
action = QUOTE([] call FUNC(serverResetSettings));
};
class action_exportServerConfig: actionClose {
idc = 1101;
text = "$STR_ACE_OptionsMenu_Export";
x = 1 * (SIZEX / 40) + OFFSETX;
action = QUOTE([] call FUNC(exportSettings));
};
class action_toggleIncludeClientSettings: actionClose {
idc = 1102;
text = "$STR_ACE_OptionsMenu_inClientSettings";
x = 9 * (SIZEX / 40) + OFFSETX;
action = QUOTE([] call FUNC(toggleIncludeClientSettings));
};
};
};

View File

@ -17,3 +17,6 @@
#define MENU_TAB_OPTIONS 0
#define MENU_TAB_COLORS 1
#define MENU_TAB_SERVER_OPTIONS 10
#define MENU_TAB_SERVER_COLORS 11
#define MENU_TAB_SERVER_VALUES 12

View File

@ -39,6 +39,9 @@
<Hungarian>Opciók</Hungarian>
<Italian>Opzioni</Italian>
</Key>
<Key ID="STR_ACE_OptionsMenu_TabValues">
<English>Values</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_Enabled">
<English>Yes</English>
<German>Ja</German>
@ -70,5 +73,35 @@
<Russian>Yстановки:</Russian>
<Spanish>Ajuste:</Spanish>
</Key>
<Key ID="STR_ACE_OptionsMenu_Export">
<English>Export</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_OpenExport">
<English>Open Export Menu</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_stringType">
<English>String input.</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_arrayType">
<English>Array. Seperate elements by using ,.</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_scalarType">
<English>Number</English>
</Key>
<Key ID="STR_ACE_optionsMenu_unknownType">
<English>Uknown input type</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_SaveInput">
<English>Save input</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_inClientSettings">
<English>Include Client Settings</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_exClientSettings">
<English>Exclude Client Settings</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_settingsExported">
<English>Settings exported to clipboard</English>
</Key>
</Package>
</Project>

View File

@ -0,0 +1,17 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"Glowbal"};
authorUrl = "https://github.com/Glowbal/";
VERSION_CONFIG;
};
};
class ACE_ServerSettings {
#include "\userconfig\ace\serverconfig.hpp"
};

View File

@ -0,0 +1,12 @@
#define COMPONENT serverconfig
#include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_SERVERCONFIG
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_SERVERCONFIG
#define DEBUG_SETTINGS DEBUG_SETTINGS_SERVERCONFIG
#endif
#include "\z\ace\Addons\main\script_macros.hpp"

View File

@ -0,0 +1,6 @@
// Example:
class ACE_common_forceAllSettings {
value = 0;
typeName = "BOOL";
};