9 public bool GetBool(
int id)
11 return this.GetInt(
id,
null) != 0;
15 public void SetBool(
int id,
bool enable)
17 this.SetInt(
id, enable ? 1 : 0);
21 public int GetInt(
int id,
int? defaultInt =
null)
24 if (this.mapInt.TryGetValue(
id, out result))
28 return defaultInt.GetValueOrDefault();
32 public void AddInt(
int id,
int value)
34 this.SetInt(
id, this.GetInt(
id,
null) + value);
38 public void SetInt(
int id,
int value = 0)
42 if (this.mapInt.ContainsKey(
id))
44 this.mapInt.Remove(
id);
48 this.mapInt[id] = value;
52 public string GetStr(
int id,
string defaultStr =
null)
55 if (this.mapStr.TryGetValue(
id, out result))
63 public void SetStr(
int id,
string value =
null)
67 if (this.mapStr.ContainsKey(
id))
69 this.mapStr.Remove(
id);
73 this.mapStr[id] = value;
77 public T GetObj<T>(
int id)
79 if (this.mapObj ==
null)
84 if (this.mapObj.TryGetValue(
id, out obj) && obj is T)
86 return (T)((object)obj);
92 public void SetObj(
int id,
object o)
94 if (this.mapObj ==
null)
96 this.mapObj =
new Dictionary<int, object>();
100 if (this.mapObj.ContainsKey(
id))
102 this.mapObj.Remove(
id);
110 public T SetObj<T>(
int id,
object o)
112 if (this.mapObj ==
null)
114 this.mapObj =
new Dictionary<int, object>();
118 if (this.mapStr.ContainsKey(
id))
120 this.mapObj.Remove(
id);
125 return (T)((object)o);
129 [JsonProperty(PropertyName =
"X")]
130 public Dictionary<int, object> mapObj =
new Dictionary<int, object>();
133 [JsonProperty(PropertyName =
"Y")]
134 public Dictionary<int, int> mapInt =
new Dictionary<int, int>();
137 [JsonProperty(PropertyName =
"Z")]
138 public Dictionary<int, string> mapStr =
new Dictionary<int, string>();