15 if (!json || variableName.IsEmpty() || value.IsEmpty())
18 Print(
string.Format(
"store: %1 = %2 (%3)", variableName, value,
type));
26 bool bValue = ToBool(value);
27 json.StoreBoolean(variableName, bValue);
34 int iValue = value.ToInt();
35 json.StoreInteger(variableName, iValue);
42 int fValue = value.ToFloat();
43 json.StoreFloat(variableName, fValue);
50 json.StoreString(variableName, value);
57 protected static bool ToBool(
string value)
59 return value ==
"1" || value ==
"true";
63 static bool StringToBool(
string str)
67 case "true":
return true;
68 case "false":
return false;
69 case "1":
return true;
70 case "0":
return false;
77 static string BoolToString(
bool boolean)
100 protected const string DEFAULT_CONFIG_NAME =
"Server setup";
103 [
Attribute(
"config", UIWidgets.EditBox,
"Group tag name for base server configuration")]
104 protected string m_sCategoryConfig;
106 [
Attribute(
"", UIWidgets.EditBox,
"Group tag name for generic game settings")]
107 protected string m_sCategoryGameConfig;
109 [
Attribute(
"", UIWidgets.EditBox,
"Group tag name for specific game (scenario) properties")]
110 protected string m_sCategoryGameProperties;
113 protected string m_sConfigName;
117 protected ref DSGameConfig m_DSGameConfig =
new DSGameConfig();
118 protected ref DSGameProperties m_DSGameProperties =
new DSGameProperties();
119 protected ref array<DSMod> m_aMods = {};
122 protected ref array<ref Tuple2<string, ref SCR_WidgetListEntry>> m_aDSConfigEntries = {};
126 void DefineEntriesMap(array<ref SCR_WidgetListEntry> entries)
128 for (
int i = 0, count = entries.Count(); i < count; i++)
130 m_aDSConfigEntries.Insert(
131 new Tuple2<string, ref SCR_WidgetListEntry>(
132 entries[i].GetGroupTag(),
147 for (
int i = 0, count = m_aDSConfigEntries.Count(); i < count; i++)
150 if (m_aDSConfigEntries[i].param1 != tag)
158 entry.GetPropertyName(),
159 entry.ValueAsString(),
180 for (
int i = 0, count = m_aDSConfigEntries.Count(); i < count; i++)
199 protected string DefaultConfigName()
201 string name = DEFAULT_CONFIG_NAME;