com.xmobitea.changx.gn-unity 1.0.1 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/Editor/GNServerSettingsEditor.cs +81 -5
  2. package/Runtime/Common/GNArray.cs +50 -27
  3. package/Runtime/Common/GNData.cs +3 -9
  4. package/Runtime/Common/GNHashtable.cs +30 -28
  5. package/Runtime/Common/IGNData.cs +2 -2
  6. package/Runtime/Config/GNServerSettings.cs +21 -28
  7. package/Runtime/Constant/Commands.cs +14 -3
  8. package/Runtime/Constant/ErrorCode/FileUploadInfoErrorCode.cs +1 -1
  9. package/Runtime/Entity/InvalidMember.cs +3 -1
  10. package/Runtime/Entity/OperationEvent.cs +36 -5
  11. package/Runtime/Entity/OperationHelper.cs +29 -0
  12. package/Runtime/Entity/OperationHelper.cs.meta +11 -0
  13. package/Runtime/Entity/OperationRequest.cs +30 -38
  14. package/Runtime/Entity/OperationResponse.cs +50 -20
  15. package/Runtime/Entity/Request/CreateNewFileUploadInfoOperationRequest.cs +5 -3
  16. package/Runtime/Entity/Request/CustomOperationRequest.cs +10 -8
  17. package/Runtime/Entity/Request/DebugOperationRequest.cs +5 -3
  18. package/Runtime/Entity/Request/EnterDisplayNameOperationRequest.cs +5 -3
  19. package/Runtime/Entity/Request/FetchAllDataOperationRequest.cs +4 -2
  20. package/Runtime/Entity/Request/FetchSparkPlayerOperationRequest.cs +4 -2
  21. package/Runtime/Entity/Request/GetAppConfigOperationRequest.cs +5 -3
  22. package/Runtime/Entity/Request/GetFileUploadInfoOperationRequest.cs +5 -3
  23. package/Runtime/Entity/Request/LoginOperationRequest.cs +40 -44
  24. package/Runtime/Entity/Request/LogoutOperationRequest.cs +5 -3
  25. package/Runtime/Entity/Request/RegisterAccountOperationRequest.cs +5 -3
  26. package/Runtime/Entity/Request/RegisterSocketOperationRequest.cs +5 -3
  27. package/Runtime/Entity/Request/TemplateOperationRequest.cs +5 -3
  28. package/Runtime/Entity/Response/CreateNewFileUploadInfoOperationResponse.cs +12 -8
  29. package/Runtime/Entity/Response/CustomOperationResponse.cs +16 -9
  30. package/Runtime/Entity/Response/DebugOperationResponse.cs +12 -8
  31. package/Runtime/Entity/Response/EnterDisplayNameOperationResponse.cs +9 -5
  32. package/Runtime/Entity/Response/FetchAllDataOperationResponse.cs +12 -8
  33. package/Runtime/Entity/Response/FetchSparkPlayerOperationResponse.cs +24 -20
  34. package/Runtime/Entity/Response/GetAppConfigOperationResponse.cs +8 -4
  35. package/Runtime/Entity/Response/GetFileUploadInfoOperationResponse.cs +19 -15
  36. package/Runtime/Entity/Response/LoginOperationResponse.cs +11 -7
  37. package/Runtime/Entity/Response/LogoutOperationResponse.cs +7 -2
  38. package/Runtime/Entity/Response/PublicAddressGetRandomMessageOperationResponse.cs +8 -4
  39. package/Runtime/Entity/Response/RegisterAccountOperationResponse.cs +13 -1
  40. package/Runtime/Entity/Response/RegisterSocketOperationResponse.cs +13 -1
  41. package/Runtime/Entity/Response/TemplateOperationResponse.cs +8 -4
  42. package/Runtime/GNNetwork.cs +74 -9
  43. package/Runtime/GNNetworkApi.cs +2 -0
  44. package/Runtime/Helper/CodeHelper.cs +2 -0
  45. package/Runtime/Helper/ParseGNHelper.cs +2 -0
  46. package/Runtime/Logger/GNDebug.cs +7 -6
  47. package/Runtime/Networking/Handler/IServerEventHandler.cs +3 -0
  48. package/Runtime/Networking/Handler/OnDebugEventHandler.cs +3 -2
  49. package/Runtime/Networking/HttpPeer.cs +56 -64
  50. package/Runtime/Networking/IPeer.cs +5 -50
  51. package/Runtime/Networking/NetworkingPeer.cs +46 -19
  52. package/Runtime/Networking/NetworkingPeerAPI.cs +86 -44
  53. package/Runtime/Networking/NetworkingPeerBase.cs +184 -24
  54. package/Runtime/Networking/NetworkingPeerSocketV2.cs +70 -102
  55. package/Runtime/Networking/NetworkingPeerSocketV3.cs +68 -99
  56. package/Runtime/Networking/OperationPending.cs +58 -0
  57. package/Runtime/Networking/OperationPending.cs.meta +11 -0
  58. package/Runtime/Networking/PeerBase.cs +48 -38
  59. package/Runtime/Networking/SocketPeer.cs +55 -26
  60. package/package.json +4 -2
@@ -1,5 +1,6 @@
1
1
  namespace XmobiTea.GN.Editor
2
2
  {
3
+ using System.Collections.Generic;
3
4
  using System.IO;
4
5
  using System.Text;
5
6
 
@@ -7,6 +8,7 @@
7
8
 
8
9
  using UnityEngine;
9
10
  using XmobiTea.GN.Config;
11
+ using XmobiTea.GN.Constant;
10
12
  using Debug = UnityEngine.Debug;
11
13
 
12
14
  [CustomEditor(typeof(GNServerSettings))]
@@ -25,9 +27,12 @@
25
27
  SerializedProperty codeCanSendNotAuthorized;
26
28
  SerializedProperty gnServerSourcePath;
27
29
  SerializedProperty httpRequestType;
28
- SerializedProperty postType;
29
30
  SerializedProperty logType;
30
31
 
32
+ private Dictionary<int, string> operationCodeFieldDict;
33
+
34
+ Color m_Color = Color.white;
35
+
31
36
  private void OnEnable()
32
37
  {
33
38
  serverAddress = serializedObject.FindProperty("_serverAddress");
@@ -43,14 +48,29 @@
43
48
  codeCanSendNotAuthorized = serializedObject.FindProperty("_codeCanSendNotAuthorized");
44
49
  gnServerSourcePath = serializedObject.FindProperty("_gnServerSourcePath");
45
50
  httpRequestType = serializedObject.FindProperty("_httpRequestType");
46
- postType = serializedObject.FindProperty("_postType");
51
+ //postType = serializedObject.FindProperty("_postType");
47
52
  logType = serializedObject.FindProperty("_logType");
53
+
54
+ var fields = typeof(OperationCode).GetFields();
55
+
56
+ if (operationCodeFieldDict == null) operationCodeFieldDict = new Dictionary<int, string>();
57
+ else operationCodeFieldDict.Clear();
58
+
59
+ for (var i = 0; i < fields.Length; i++)
60
+ {
61
+ var field = fields[i];
62
+
63
+ operationCodeFieldDict[(int)field.GetValue(null)] = field.Name;
64
+ }
48
65
  }
49
66
 
50
67
  public override void OnInspectorGUI()
51
68
  {
52
69
  serializedObject.Update();
53
70
 
71
+ EditorGUILayout.LabelField($"GN Unity Client SDK Version v{GNNetwork.GetClientSdkVersion()}");
72
+ EditorGUILayout.Space(20);
73
+
54
74
  EditorGUILayout.PropertyField(serverAddress);
55
75
  EditorGUILayout.PropertyField(serverPort);
56
76
  EditorGUILayout.PropertyField(useSsl);
@@ -61,10 +81,66 @@
61
81
  EditorGUILayout.PropertyField(pingInterval);
62
82
  EditorGUILayout.PropertyField(pingTimout);
63
83
  EditorGUILayout.PropertyField(peerSocketVersion);
64
- EditorGUILayout.PropertyField(codeCanSendNotAuthorized);
84
+ EditorGUILayout.Space(20);
85
+
86
+ EditorGUILayout.BeginVertical();
87
+ EditorGUILayout.LabelField($"Code Can Send Not Authorized size is {codeCanSendNotAuthorized.arraySize}");
88
+
89
+ //scrollPosition = GUILayout.BeginScrollView(scrollPosition);
90
+
91
+
92
+ for (var i = 0; i < codeCanSendNotAuthorized.arraySize; i++)
93
+ {
94
+ var serializedProperty = codeCanSendNotAuthorized.GetArrayElementAtIndex(i);
95
+
96
+ var operationCodeName = string.Empty;
97
+
98
+ if (operationCodeFieldDict.ContainsKey(serializedProperty.intValue)) operationCodeName = $"({serializedProperty.intValue}) {operationCodeFieldDict[serializedProperty.intValue]}";
99
+ else operationCodeName = "Choose an operation code";
100
+
101
+ EditorGUILayout.BeginHorizontal();
102
+
103
+ if (EditorGUILayout.DropdownButton(new GUIContent(operationCodeName), FocusType.Passive))
104
+ {
105
+ var operationCodeMenu = new GenericMenu();
106
+ operationCodeMenu.AddItem(new GUIContent("None"), !operationCodeFieldDict.ContainsKey(serializedProperty.intValue), id =>
107
+ {
108
+ serializedProperty.intValue = (int)id;
109
+ if (serializedObject.hasModifiedProperties) serializedObject.ApplyModifiedProperties();
110
+ }, int.MinValue);
111
+ operationCodeMenu.AddSeparator("");
112
+
113
+ foreach (var c in operationCodeFieldDict)
114
+ {
115
+ operationCodeMenu.AddItem(new GUIContent($"({c.Key}) {c.Value}"), serializedProperty.intValue == c.Key, id =>
116
+ {
117
+ serializedProperty.intValue = (int)id;
118
+ if (serializedObject.hasModifiedProperties) serializedObject.ApplyModifiedProperties();
119
+ }, c.Key);
120
+ }
121
+
122
+ operationCodeMenu.ShowAsContext();
123
+ }
124
+
125
+ if (GUILayout.Button("-", GUILayout.MaxWidth(50)))
126
+ {
127
+ codeCanSendNotAuthorized.DeleteArrayElementAtIndex(i);
128
+ }
129
+
130
+ EditorGUILayout.EndHorizontal();
131
+ }
132
+
133
+ if (GUILayout.Button("+"))
134
+ {
135
+ codeCanSendNotAuthorized.arraySize += 1;
136
+ }
137
+
138
+ EditorGUILayout.EndVertical();
139
+ EditorGUILayout.Space(20);
140
+
65
141
  EditorGUILayout.PropertyField(gnServerSourcePath);
66
142
  EditorGUILayout.PropertyField(httpRequestType);
67
- EditorGUILayout.PropertyField(postType);
143
+ //EditorGUILayout.PropertyField(postType);
68
144
  EditorGUILayout.PropertyField(logType);
69
145
 
70
146
  if (serializedObject.hasModifiedProperties) serializedObject.ApplyModifiedProperties();
@@ -98,7 +174,7 @@
98
174
  }
99
175
 
100
176
  [MenuItem("XmobiTea GN/About GN")]
101
- private static void AboutEUNfox()
177
+ private static void AboutGN()
102
178
  {
103
179
  Application.OpenURL("https://gn.xmobitea.com");
104
180
  }
@@ -54,37 +54,37 @@
54
54
 
55
55
  public void Add(object value)
56
56
  {
57
- originArray.Add(CreateUseDataFromOriginData(value));
57
+ this.originArray.Add(CreateUseDataFromOriginData(value));
58
58
  }
59
59
 
60
60
  public ICollection<object> Values()
61
61
  {
62
- return originArray;
62
+ return this.originArray;
63
63
  }
64
64
 
65
65
  public void Clear()
66
66
  {
67
- originArray.Clear();
67
+ this.originArray.Clear();
68
68
  }
69
69
 
70
70
  public bool Remove(int index)
71
71
  {
72
- originArray.RemoveAt(index);
72
+ this.originArray.RemoveAt(index);
73
73
 
74
74
  return true;
75
75
  }
76
76
 
77
77
  public int Count()
78
78
  {
79
- return originArray.Count;
79
+ return this.originArray.Count;
80
80
  }
81
81
 
82
82
  protected object Get<T>(int k, T defaultValue = default(T))
83
83
  {
84
- if (k < 0 || k > originArray.Count - 1) return defaultValue;
84
+ if (k < 0 || k > this.originArray.Count - 1) return defaultValue;
85
+
86
+ var value = this.originArray[k];
85
87
 
86
- var value = originArray[k];
87
-
88
88
  if (value == null) return defaultValue;
89
89
 
90
90
  if (value is T t)
@@ -97,11 +97,11 @@
97
97
 
98
98
  public T[] ToArray<T>()
99
99
  {
100
- var answer = new T[originArray.Count];
100
+ var answer = new T[this.originArray.Count];
101
101
 
102
- for (var i = 0; i < originArray.Count; i++)
102
+ for (var i = 0; i < this.originArray.Count; i++)
103
103
  {
104
- answer[i] = (T)Get<T>(i);
104
+ answer[i] = (T)this.CustomGet(i);
105
105
  }
106
106
 
107
107
  return answer;
@@ -111,67 +111,88 @@
111
111
  {
112
112
  var answer = new List<T>();
113
113
 
114
- for (var i = 0; i < originArray.Count; i++)
114
+ for (var i = 0; i < this.originArray.Count; i++)
115
115
  {
116
- answer.Add((T)Get<T>(i));
116
+ answer.Add((T)this.CustomGet(i));
117
117
  }
118
118
 
119
119
  return answer;
120
120
  }
121
121
 
122
+ private object CustomGet(int k)
123
+ {
124
+ var obj = this.Get<object>(k);
125
+ if (obj == null) return null;
126
+
127
+ var objType = obj.GetType();
128
+ if (objType == typeof(byte)) return this.GetByte(k);
129
+ else if (objType == typeof(sbyte)) return this.GetSByte(k);
130
+ else if (objType == typeof(short)) return this.GetShort(k);
131
+ else if (objType == typeof(int)) return this.GetInt(k);
132
+ else if (objType == typeof(float)) return this.GetFloat(k);
133
+ else if (objType == typeof(long)) return this.GetLong(k);
134
+ else if (objType == typeof(double)) return this.GetDouble(k);
135
+ else if (objType == typeof(bool)) return this.GetBool(k);
136
+ else if (objType == typeof(string)) return this.GetString(k);
137
+ else if (objType == typeof(GNArray) || objType == typeof(System.Collections.IList)) return this.GetGNArray(k);
138
+ else if (objType == typeof(GNHashtable) || objType == typeof(System.Collections.IDictionary)) return this.GetGNHashtable(k);
139
+
140
+ return obj;
141
+ }
142
+
122
143
  public byte GetByte(int k, byte defaultValue = 0)
123
144
  {
124
- return Convert.ToByte(Get(k, defaultValue));
145
+ return Convert.ToByte(this.Get(k, defaultValue));
125
146
  }
126
147
 
127
148
  public sbyte GetSByte(int k, sbyte defaultValue = 0)
128
149
  {
129
- return Convert.ToSByte(Get(k, defaultValue));
150
+ return Convert.ToSByte(this.Get(k, defaultValue));
130
151
  }
131
152
 
132
153
  public short GetShort(int k, short defaultValue = 0)
133
154
  {
134
- return Convert.ToInt16(Get(k, defaultValue));
155
+ return Convert.ToInt16(this.Get(k, defaultValue));
135
156
  }
136
157
 
137
158
  public int GetInt(int k, int defaultValue = 0)
138
159
  {
139
- return Convert.ToInt32(Get(k, defaultValue));
160
+ return Convert.ToInt32(this.Get(k, defaultValue));
140
161
  }
141
162
 
142
163
  public float GetFloat(int k, float defaultValue = 0)
143
164
  {
144
- return Convert.ToSingle(Get(k, defaultValue));
165
+ return Convert.ToSingle(this.Get(k, defaultValue));
145
166
  }
146
167
 
147
168
  public long GetLong(int k, long defaultValue = 0)
148
169
  {
149
- return Convert.ToInt64(Get(k, defaultValue));
170
+ return Convert.ToInt64(this.Get(k, defaultValue));
150
171
  }
151
172
 
152
173
  public double GetDouble(int k, double defaultValue = 0)
153
174
  {
154
- return Convert.ToDouble(Get(k, defaultValue));
175
+ return Convert.ToDouble(this.Get(k, defaultValue));
155
176
  }
156
177
 
157
178
  public bool GetBool(int k, bool defaultValue = false)
158
179
  {
159
- return Convert.ToBoolean(Get(k, defaultValue));
180
+ return Convert.ToBoolean(this.Get(k, defaultValue));
160
181
  }
161
182
 
162
183
  public string GetString(int k, string defaultValue = null)
163
184
  {
164
- return Convert.ToString(Get(k, defaultValue));
185
+ return Convert.ToString(this.Get(k, defaultValue));
165
186
  }
166
187
 
167
188
  public object GetObject(int k, object defaultValue = null)
168
189
  {
169
- return Get(k, defaultValue);
190
+ return this.Get(k, defaultValue);
170
191
  }
171
192
 
172
193
  public T[] GetArray<T>(int k, T[] defaultValue = null)
173
194
  {
174
- var value0 = GetGNArray(k);
195
+ var value0 = this.GetGNArray(k);
175
196
  if (value0 != null)
176
197
  {
177
198
  return value0.ToArray<T>();
@@ -182,7 +203,7 @@
182
203
 
183
204
  public IList<T> GetList<T>(int k, IList<T> defaultValue = null)
184
205
  {
185
- var value0 = GetGNArray(k);
206
+ var value0 = this.GetGNArray(k);
186
207
  if (value0 != null)
187
208
  {
188
209
  return value0.ToList<T>();
@@ -193,12 +214,12 @@
193
214
 
194
215
  public GNArray GetGNArray(int k, GNArray defaultValue = null)
195
216
  {
196
- return (GNArray)Get(k, defaultValue);
217
+ return (GNArray)this.Get(k, defaultValue);
197
218
  }
198
219
 
199
220
  public GNHashtable GetGNHashtable(int k, GNHashtable defaultValue = null)
200
221
  {
201
- return (GNHashtable)Get(k, defaultValue);
222
+ return (GNHashtable)this.Get(k, defaultValue);
202
223
  }
203
224
 
204
225
  public override object ToData()
@@ -234,5 +255,7 @@
234
255
  stringBuilder.Append("]");
235
256
  return stringBuilder.ToString();
236
257
  }
258
+
237
259
  }
260
+
238
261
  }
@@ -1,8 +1,5 @@
1
1
  namespace XmobiTea.GN.Common
2
2
  {
3
- using System;
4
- using System.Collections.Generic;
5
-
6
3
  public class GNData : IGNData
7
4
  {
8
5
  protected static object CreateUseDataFromOriginData(object value)
@@ -11,12 +8,7 @@
11
8
 
12
9
  if (value is System.Collections.IList list)
13
10
  {
14
- var answer = new GNArray();
15
-
16
- for (var i = 0; i < list.Count; i++)
17
- {
18
- answer.Add(list[i]);
19
- }
11
+ var answer = new GNArray.Builder().AddAll(list).Build();
20
12
 
21
13
  return answer;
22
14
  }
@@ -44,5 +36,7 @@
44
36
  }
45
37
 
46
38
  public virtual object ToData() { return null; }
39
+
47
40
  }
41
+
48
42
  }
@@ -12,7 +12,7 @@
12
12
 
13
13
  public Builder Add(string key, object value)
14
14
  {
15
- originObject[key] = value;
15
+ this.originObject[key] = value;
16
16
 
17
17
  return this;
18
18
  }
@@ -24,7 +24,7 @@
24
24
  {
25
25
  if (key is string keyStr)
26
26
  {
27
- Add(keyStr, dict[key]);
27
+ this.Add(keyStr, dict[key]);
28
28
  }
29
29
  }
30
30
 
@@ -46,7 +46,7 @@
46
46
 
47
47
  public Builder()
48
48
  {
49
- originObject = new Dictionary<string, object>();
49
+ this.originObject = new Dictionary<string, object>();
50
50
  }
51
51
  }
52
52
 
@@ -59,44 +59,44 @@
59
59
 
60
60
  public void Add(string key, object value)
61
61
  {
62
- originObject[key] = CreateUseDataFromOriginData(value);
62
+ this.originObject[key] = CreateUseDataFromOriginData(value);
63
63
  }
64
64
 
65
65
  public ICollection<object> Values()
66
66
  {
67
- return originObject.Values;
67
+ return this.originObject.Values;
68
68
  }
69
69
 
70
70
  public ICollection<string> Keys()
71
71
  {
72
- return originObject.Keys;
72
+ return this.originObject.Keys;
73
73
  }
74
74
 
75
75
  public bool ContainsKey(string key)
76
76
  {
77
- return originObject.ContainsKey(key);
77
+ return this.originObject.ContainsKey(key);
78
78
  }
79
79
 
80
80
  public void Clear()
81
81
  {
82
- originObject.Clear();
82
+ this.originObject.Clear();
83
83
  }
84
84
 
85
85
  public bool Remove(string key)
86
86
  {
87
- return originObject.Remove(key);
87
+ return this.originObject.Remove(key);
88
88
  }
89
89
 
90
90
  public int Count()
91
91
  {
92
- return originObject.Count;
92
+ return this.originObject.Count;
93
93
  }
94
94
 
95
95
  protected object Get<T>(string k, T defaultValue = default(T))
96
96
  {
97
- if (originObject.ContainsKey(k))
97
+ if (this.originObject.ContainsKey(k))
98
98
  {
99
- var value = originObject[k];
99
+ var value = this.originObject[k];
100
100
 
101
101
  if (value == null) return defaultValue;
102
102
 
@@ -113,57 +113,57 @@
113
113
 
114
114
  public byte GetByte(string k, byte defaultValue = 0)
115
115
  {
116
- return Convert.ToByte(Get(k, defaultValue));
116
+ return Convert.ToByte(this.Get(k, defaultValue));
117
117
  }
118
118
 
119
119
  public sbyte GetSByte(string k, sbyte defaultValue = 0)
120
120
  {
121
- return Convert.ToSByte(Get(k, defaultValue));
121
+ return Convert.ToSByte(this.Get(k, defaultValue));
122
122
  }
123
123
 
124
124
  public short GetShort(string k, short defaultValue = 0)
125
125
  {
126
- return Convert.ToInt16(Get(k, defaultValue));
126
+ return Convert.ToInt16(this.Get(k, defaultValue));
127
127
  }
128
128
 
129
129
  public int GetInt(string k, int defaultValue = 0)
130
130
  {
131
- return Convert.ToInt32(Get(k, defaultValue));
131
+ return Convert.ToInt32(this.Get(k, defaultValue));
132
132
  }
133
133
 
134
134
  public float GetFloat(string k, float defaultValue = 0)
135
135
  {
136
- return Convert.ToSingle(Get(k, defaultValue));
136
+ return Convert.ToSingle(this.Get(k, defaultValue));
137
137
  }
138
138
 
139
139
  public long GetLong(string k, long defaultValue = 0)
140
140
  {
141
- return Convert.ToInt64(Get(k, defaultValue));
141
+ return Convert.ToInt64(this.Get(k, defaultValue));
142
142
  }
143
143
 
144
144
  public double GetDouble(string k, double defaultValue = 0)
145
145
  {
146
- return Convert.ToDouble(Get(k, defaultValue));
146
+ return Convert.ToDouble(this.Get(k, defaultValue));
147
147
  }
148
148
 
149
149
  public bool GetBool(string k, bool defaultValue = false)
150
150
  {
151
- return Convert.ToBoolean(Get(k, defaultValue));
151
+ return Convert.ToBoolean(this.Get(k, defaultValue));
152
152
  }
153
153
 
154
154
  public string GetString(string k, string defaultValue = null)
155
155
  {
156
- return Convert.ToString(Get(k, defaultValue));
156
+ return Convert.ToString(this.Get(k, defaultValue));
157
157
  }
158
158
 
159
159
  public object GetObject(string k, object defaultValue = null)
160
160
  {
161
- return Get(k, defaultValue);
161
+ return this.Get(k, defaultValue);
162
162
  }
163
163
 
164
164
  public T[] GetArray<T>(string k, T[] defaultValue = null)
165
165
  {
166
- var value0 = GetGNArray(k);
166
+ var value0 = this.GetGNArray(k);
167
167
  if (value0 != null)
168
168
  {
169
169
  return value0.ToArray<T>();
@@ -174,7 +174,7 @@
174
174
 
175
175
  public IList<T> GetList<T>(string k, IList<T> defaultValue = null)
176
176
  {
177
- var value0 = GetGNArray(k);
177
+ var value0 = this.GetGNArray(k);
178
178
  if (value0 != null)
179
179
  {
180
180
  return value0.ToList<T>();
@@ -185,19 +185,19 @@
185
185
 
186
186
  public GNArray GetGNArray(string k, GNArray defaultValue = null)
187
187
  {
188
- return (GNArray)Get(k, defaultValue);
188
+ return (GNArray)this.Get(k, defaultValue);
189
189
  }
190
190
 
191
191
  public GNHashtable GetGNHashtable(string k, GNHashtable defaultValue = null)
192
192
  {
193
- return (GNHashtable)Get(k, defaultValue);
193
+ return (GNHashtable)this.Get(k, defaultValue);
194
194
  }
195
195
 
196
196
  public override object ToData()
197
197
  {
198
198
  var answer = new Dictionary<string, object>();
199
199
 
200
- foreach (var c in originObject)
200
+ foreach (var c in this.originObject)
201
201
  {
202
202
  answer.Add(c.Key, CreateGNDataFromUseData(c.Value));
203
203
  }
@@ -211,7 +211,7 @@
211
211
  stringBuilder.Append("{");
212
212
 
213
213
  var i = 0;
214
- foreach (var c in originObject)
214
+ foreach (var c in this.originObject)
215
215
  {
216
216
  if (i != 0) stringBuilder.Append(",");
217
217
 
@@ -227,5 +227,7 @@
227
227
  stringBuilder.Append("}");
228
228
  return stringBuilder.ToString();
229
229
  }
230
+
230
231
  }
232
+
231
233
  }
@@ -1,9 +1,9 @@
1
1
  namespace XmobiTea.GN.Common
2
2
  {
3
- using System.Collections.Generic;
4
-
5
3
  public interface IGNData
6
4
  {
7
5
  object ToData();
6
+
8
7
  }
8
+
9
9
  }
@@ -19,12 +19,6 @@
19
19
  HTTPRequest = 1,
20
20
  }
21
21
 
22
- public enum PostType
23
- {
24
- Json,
25
- MsgPack
26
- }
27
-
28
22
  //[CreateAssetMenu(fileName = GNServerSettings.ResourcesPath, menuName = "GN/GNServerSettings", order = 1)]
29
23
  public class GNServerSettings : ScriptableObject
30
24
  {
@@ -32,79 +26,78 @@
32
26
 
33
27
  [SerializeField]
34
28
  private string _serverAddress = "127.0.0.1";
35
- public string serverAddress => _serverAddress;
29
+ public string serverAddress => this._serverAddress;
36
30
 
37
31
  [SerializeField]
38
32
  private int _serverPort = 2202;
39
- public int serverPort => _serverPort;
33
+ public int serverPort => this._serverPort;
40
34
 
41
35
  [SerializeField]
42
36
  private bool _useSsl = false;
43
- public bool useSsl => _useSsl;
37
+ public bool useSsl => this._useSsl;
44
38
 
45
39
  [SerializeField]
46
40
  private bool _useSocket = true;
47
- public bool useSocket => _useSocket;
41
+ public bool useSocket => this._useSocket;
48
42
 
49
43
  [SerializeField]
50
44
  private bool _useHttp = true;
51
- public bool useHttp => _useHttp;
45
+ public bool useHttp => this._useHttp;
52
46
 
53
47
  [SerializeField]
54
48
  private int _sendRate = 20;
55
- public int sendRate => _sendRate;
49
+ public int sendRate => this._sendRate;
56
50
 
57
51
  [SerializeField]
58
52
  private int _reconnectDelay = 5000;
59
- public int reconnectDelay => _reconnectDelay;
53
+ public int reconnectDelay => this._reconnectDelay;
60
54
 
61
55
  [SerializeField]
62
56
  private float _pingInterval = 20000;
63
- public float pingInterval => _pingInterval;
57
+ public float pingInterval => this._pingInterval;
64
58
 
65
59
  [SerializeField]
66
60
  private float _pingTimeout = 20000;
67
- public float pingTimeout => _pingTimeout;
61
+ public float pingTimeout => this._pingTimeout;
68
62
 
69
63
  [SerializeField]
70
64
  private PeerSocketVersion _peerSocketVersion = PeerSocketVersion.V3;
71
- public PeerSocketVersion peerSocketVersion => _peerSocketVersion;
65
+ public PeerSocketVersion peerSocketVersion => this._peerSocketVersion;
72
66
 
73
67
  [SerializeField]
74
68
  private List<int> _codeCanSendNotAuthorized = new List<int>() { OperationCode.Debug, OperationCode.GetAppConfig, OperationCode.Login, OperationCode.RegisterAccount };
75
- public List<int> codeCanSendNotAuthorized => _codeCanSendNotAuthorized;
69
+ public List<int> codeCanSendNotAuthorized => this._codeCanSendNotAuthorized;
76
70
 
77
71
  [SerializeField]
78
72
  private string _gnServerSourcePath = "Template_GN-server";
79
- public string gnServerSourcePath => _gnServerSourcePath;
73
+ public string gnServerSourcePath => this._gnServerSourcePath;
80
74
 
81
75
  [SerializeField]
82
76
  private HttpRequestType _httpRequestType = HttpRequestType.HTTPRequest;
83
- public HttpRequestType httpRequestType => _httpRequestType;
84
-
85
- [SerializeField]
86
- private PostType _postType = PostType.MsgPack;
87
- public PostType postType => _postType;
77
+ public HttpRequestType httpRequestType => this._httpRequestType;
88
78
 
89
79
  [SerializeField]
90
80
  private GN.Logger.LogType _logType = GN.Logger.LogType.All;
91
- public GN.Logger.LogType logType => _logType;
81
+ public GN.Logger.LogType logType => this._logType;
92
82
 
93
83
  public string SocketUrl
94
84
  {
95
85
  get
96
86
  {
97
- if (_serverPort < 0) return string.Format((_useSsl ? "https" : "http") + "://{0}", _serverAddress);
98
- else return string.Format((_useSsl ? "https" : "http") + "://{0}:{1}", _serverAddress, _serverPort);
87
+ if (this._serverPort < 0) return string.Format((this._useSsl ? "https" : "http") + "://{0}", this._serverAddress);
88
+ else return string.Format((this._useSsl ? "https" : "http") + "://{0}:{1}", this._serverAddress, this._serverPort);
99
89
  }
100
90
  }
91
+
101
92
  public string HttpUrl
102
93
  {
103
94
  get
104
95
  {
105
- if (_serverPort < 0) return string.Format((_useSsl ? "https" : "http") + "://{0}", _serverAddress);
106
- else return string.Format((_useSsl ? "https" : "http") + "://{0}:{1}", _serverAddress, _serverPort);
96
+ if (this._serverPort < 0) return string.Format((this._useSsl ? "https" : "http") + "://{0}", this._serverAddress);
97
+ else return string.Format((this._useSsl ? "https" : "http") + "://{0}:{1}", this._serverAddress, this._serverPort);
107
98
  }
108
99
  }
100
+
109
101
  }
102
+
110
103
  }