com.xmobitea.changx.gn-unity 2.0.2 → 2.3.0
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.
- package/Editor/GNServerSettingsEditor.cs +42 -322
- package/Runtime/Common/GNArray.cs +120 -35
- package/Runtime/Common/GNData.cs +19 -6
- package/Runtime/Common/GNHashtable.cs +174 -11
- package/Runtime/Common/IGNData.cs +11 -2
- package/Runtime/Config/GNServerSettings.cs +136 -92
- package/Runtime/Constant/Commands.cs +82 -19
- package/Runtime/Constant/EnumType/GoogleLoginType.cs +5 -5
- package/Runtime/Constant/EnumType/GroupStatus.cs +7 -7
- package/Runtime/Constant/EnumType/ItemType.cs +5 -5
- package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs +6 -6
- package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs +2 -2
- package/Runtime/Constant/EnumType/OwnerType.cs +3 -2
- package/Runtime/Constant/EnumType/PushPlatformType.cs +10 -0
- package/Runtime/Constant/EnumType/PushPlatformType.cs.meta +11 -0
- package/Runtime/Constant/EnumType/RequestType.cs +1 -0
- package/Runtime/Constant/EnumType/StoreReceiveType.cs +13 -0
- package/Runtime/Constant/EnumType/StoreReceiveType.cs.meta +11 -0
- package/Runtime/Constant/ErrorCode/GNErrorCode.cs +53 -48
- package/Runtime/Constant/EventCode.cs +29 -2
- package/Runtime/Constant/OperationCode.cs +249 -211
- package/Runtime/Constant/ParameterCode/GNParameterCode.cs +610 -466
- package/Runtime/Constant/ReturnCode.cs +50 -2
- package/Runtime/Entity/DataMember.cs +221 -3
- package/Runtime/Entity/GNMetadata.cs +46 -1
- package/Runtime/Entity/InvalidMember.cs +24 -5
- package/Runtime/Entity/Models/AuthenticateModels.cs +251 -207
- package/Runtime/Entity/Models/AuthenticateRequestModels.cs +153 -131
- package/Runtime/Entity/Models/AuthenticateResponseModels.cs +61 -51
- package/Runtime/Entity/Models/CharacterPlayerModels.cs +985 -849
- package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs +957 -885
- package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs +165 -150
- package/Runtime/Entity/Models/CloudScriptModels.cs +185 -0
- package/Runtime/Entity/Models/CloudScriptModels.cs.meta +11 -0
- package/Runtime/Entity/Models/CloudScriptRequestModels.cs +134 -0
- package/Runtime/Entity/Models/CloudScriptRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/CloudScriptResponseModels.cs +34 -0
- package/Runtime/Entity/Models/CloudScriptResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/ContentModels.cs +150 -153
- package/Runtime/Entity/Models/ContentRequestModels.cs +129 -129
- package/Runtime/Entity/Models/ContentResponseModels.cs +24 -24
- package/Runtime/Entity/Models/DashboardModels.cs +1684 -1156
- package/Runtime/Entity/Models/DashboardRequestModels.cs +220 -147
- package/Runtime/Entity/Models/DashboardResponseModels.cs +92 -57
- package/Runtime/Entity/Models/GamePlayerModels.cs +1073 -933
- package/Runtime/Entity/Models/GamePlayerRequestModels.cs +939 -867
- package/Runtime/Entity/Models/GamePlayerResponseModels.cs +162 -147
- package/Runtime/Entity/Models/GenericModels.cs +102 -102
- package/Runtime/Entity/Models/GroupModels.cs +812 -676
- package/Runtime/Entity/Models/GroupRequestModels.cs +741 -669
- package/Runtime/Entity/Models/GroupResponseModels.cs +129 -114
- package/Runtime/Entity/Models/InventoryModels.cs +667 -558
- package/Runtime/Entity/Models/InventoryRequestModels.cs +626 -579
- package/Runtime/Entity/Models/InventoryResponseModels.cs +109 -99
- package/Runtime/Entity/Models/MasterPlayerModels.cs +1882 -1340
- package/Runtime/Entity/Models/MasterPlayerRequestModels.cs +1643 -1253
- package/Runtime/Entity/Models/MasterPlayerResponseModels.cs +293 -213
- package/Runtime/Entity/Models/MultiplayerModels.cs +293 -223
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs +199 -149
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs +10 -0
- package/Runtime/Entity/Models/StoreInventoryModels.cs +514 -323
- package/Runtime/Entity/Models/StoreInventoryRequestModels.cs +236 -165
- package/Runtime/Entity/Models/StoreInventoryResponseModels.cs +45 -30
- package/Runtime/Entity/OperationEvent.cs +43 -7
- package/Runtime/Entity/OperationHelper.cs +18 -2
- package/Runtime/Entity/OperationRequest.cs +80 -37
- package/Runtime/Entity/OperationResponse.cs +111 -63
- package/Runtime/Entity/Request/CustomOperationRequest.cs +53 -2
- package/Runtime/Entity/Response/CustomOperationResponse.cs +25 -4
- package/Runtime/GNNetwork.cs +333 -21
- package/Runtime/GNNetworkApi.cs +25 -13
- package/Runtime/GNNetworkAuthenticateApi.cs +531 -98
- package/Runtime/GNNetworkCharacterPlayerApi.cs +1587 -762
- package/Runtime/GNNetworkCloudScriptApi.cs +181 -0
- package/Runtime/GNNetworkCloudScriptApi.cs.meta +11 -0
- package/Runtime/GNNetworkContentApi.cs +238 -132
- package/Runtime/GNNetworkDashboardApi.cs +278 -117
- package/Runtime/GNNetworkGamePlayerApi.cs +1558 -747
- package/Runtime/GNNetworkGroupApi.cs +1228 -582
- package/Runtime/GNNetworkInventoryApi.cs +1048 -507
- package/Runtime/GNNetworkMasterPlayerApi.cs +2586 -1067
- package/Runtime/GNNetworkMultiplayerApi.cs +328 -147
- package/Runtime/GNNetworkStoreInventoryApi.cs +388 -162
- package/Runtime/Helper/CodeHelper.cs +45 -3
- package/Runtime/Helper/ConverterService.cs +240 -85
- package/Runtime/Logger/GNDebug.cs +46 -3
- package/Runtime/Networking/AuthenticateStatus.cs +30 -8
- package/Runtime/Networking/Handler/IServerEventHandler.cs +8 -8
- package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs +31 -2
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs +24 -3
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs +24 -2
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs +24 -2
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs +21 -2
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs +20 -2
- package/Runtime/Networking/Http/HttpPeer.cs +68 -25
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs +44 -4
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs +63 -40
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs +43 -13
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs +72 -39
- package/Runtime/Networking/IPeer.cs +24 -2
- package/Runtime/Networking/NetworkingPeer.cs +64 -10
- package/Runtime/Networking/NetworkingPeerAPI.cs +20 -21
- package/Runtime/Networking/OperationPending.cs +79 -15
- package/Runtime/Networking/PeerBase.cs +86 -23
- package/Runtime/Networking/Socket/NetworkingPeerSocketV2.cs +57 -18
- package/Runtime/Networking/Socket/NetworkingPeerSocketV3.cs +70 -10
- package/Runtime/Networking/Socket/NetworkingSocketPeerBase.cs +165 -23
- package/Runtime/Networking/Socket/SocketPeer.cs +63 -12
- package/Runtime/Unity/ServiceCoroutine.cs +10 -0
- package/Runtime/Unity/ServiceCoroutine.cs.meta +11 -0
- package/Runtime/Unity/ServiceUpdate.cs +14 -1
- package/package.json +1 -1
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
{
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.IO;
|
|
5
|
-
using System.Text;
|
|
6
5
|
|
|
7
6
|
using UnityEditor;
|
|
8
7
|
|
|
@@ -37,23 +36,23 @@
|
|
|
37
36
|
|
|
38
37
|
private void OnEnable()
|
|
39
38
|
{
|
|
40
|
-
this.serverAddress = serializedObject.FindProperty("serverAddress");
|
|
41
|
-
this.serverPort = serializedObject.FindProperty("serverPort");
|
|
42
|
-
this.useSsl = serializedObject.FindProperty("useSsl");
|
|
43
|
-
this.useSocket = serializedObject.FindProperty("useSocket");
|
|
44
|
-
this.useHttp = serializedObject.FindProperty("useHttp");
|
|
45
|
-
this.sendRate = serializedObject.FindProperty("sendRate");
|
|
46
|
-
this.reconnectDelay = serializedObject.FindProperty("reconnectDelay");
|
|
47
|
-
this.pingInterval = serializedObject.FindProperty("pingInterval");
|
|
48
|
-
this.pingTimout = serializedObject.FindProperty("pingTimeout");
|
|
49
|
-
this.peerSocketVersion = serializedObject.FindProperty("peerSocketVersion");
|
|
39
|
+
this.serverAddress = this.serializedObject.FindProperty("serverAddress");
|
|
40
|
+
this.serverPort = this.serializedObject.FindProperty("serverPort");
|
|
41
|
+
this.useSsl = this.serializedObject.FindProperty("useSsl");
|
|
42
|
+
this.useSocket = this.serializedObject.FindProperty("useSocket");
|
|
43
|
+
this.useHttp = this.serializedObject.FindProperty("useHttp");
|
|
44
|
+
this.sendRate = this.serializedObject.FindProperty("sendRate");
|
|
45
|
+
this.reconnectDelay = this.serializedObject.FindProperty("reconnectDelay");
|
|
46
|
+
this.pingInterval = this.serializedObject.FindProperty("pingInterval");
|
|
47
|
+
this.pingTimout = this.serializedObject.FindProperty("pingTimeout");
|
|
48
|
+
this.peerSocketVersion = this.serializedObject.FindProperty("peerSocketVersion");
|
|
50
49
|
//this.gnServerSourcePath = serializedObject.FindProperty("gnServerSourcePath");
|
|
51
|
-
this.httpRequestType = serializedObject.FindProperty("httpRequestType");
|
|
50
|
+
this.httpRequestType = this.serializedObject.FindProperty("httpRequestType");
|
|
52
51
|
//postType = serializedObject.FindProperty("postType");
|
|
53
|
-
this.logType = serializedObject.FindProperty("logType");
|
|
54
|
-
this.adminSecretKey = serializedObject.FindProperty("adminSecretKey");
|
|
55
|
-
this.serverSecretKey = serializedObject.FindProperty("serverSecretKey");
|
|
56
|
-
this.clientSecretKey = serializedObject.FindProperty("clientSecretKey");
|
|
52
|
+
this.logType = this.serializedObject.FindProperty("logType");
|
|
53
|
+
this.adminSecretKey = this.serializedObject.FindProperty("adminSecretKey");
|
|
54
|
+
this.serverSecretKey = this.serializedObject.FindProperty("serverSecretKey");
|
|
55
|
+
this.clientSecretKey = this.serializedObject.FindProperty("clientSecretKey");
|
|
57
56
|
|
|
58
57
|
var fields = typeof(OperationCode).GetFields();
|
|
59
58
|
|
|
@@ -78,17 +77,37 @@
|
|
|
78
77
|
EditorGUILayout.PropertyField(this.serverAddress);
|
|
79
78
|
EditorGUILayout.PropertyField(this.serverPort);
|
|
80
79
|
EditorGUILayout.PropertyField(this.useSsl);
|
|
81
|
-
EditorGUILayout.PropertyField(this.useSocket);
|
|
82
|
-
EditorGUILayout.PropertyField(this.useHttp);
|
|
83
80
|
EditorGUILayout.PropertyField(this.sendRate);
|
|
84
|
-
EditorGUILayout.
|
|
85
|
-
|
|
86
|
-
EditorGUILayout.PropertyField(this.
|
|
87
|
-
|
|
81
|
+
EditorGUILayout.Space(10);
|
|
82
|
+
|
|
83
|
+
EditorGUILayout.PropertyField(this.useHttp);
|
|
84
|
+
if (this.useHttp.boolValue)
|
|
85
|
+
{
|
|
86
|
+
EditorGUILayout.PropertyField(this.httpRequestType);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
EditorGUILayout.Space(10);
|
|
90
|
+
|
|
91
|
+
EditorGUILayout.PropertyField(this.useSocket);
|
|
92
|
+
|
|
93
|
+
if (this.useSocket.boolValue)
|
|
94
|
+
{
|
|
95
|
+
#if UNITY_USING_BEST_HTTP
|
|
96
|
+
EditorGUILayout.PropertyField(this.reconnectDelay);
|
|
97
|
+
EditorGUILayout.PropertyField(this.pingInterval);
|
|
98
|
+
EditorGUILayout.PropertyField(this.pingTimout);
|
|
99
|
+
EditorGUILayout.PropertyField(this.peerSocketVersion);
|
|
100
|
+
#else
|
|
101
|
+
EditorGUILayout.LabelField("GN Unity Client current only support BEST_HTTP/2 to handle socket");
|
|
102
|
+
EditorGUILayout.LabelField("You must import BEST_HTTP/2 package");
|
|
103
|
+
EditorGUILayout.LabelField("\tand define UNITY_USING_BEST_HTTP on Project Settings/Player");
|
|
104
|
+
EditorGUILayout.LabelField("\t\t-> Scripting Define Symbols");
|
|
105
|
+
#endif
|
|
106
|
+
}
|
|
107
|
+
|
|
88
108
|
EditorGUILayout.Space(20);
|
|
89
109
|
|
|
90
110
|
//EditorGUILayout.PropertyField(this.gnServerSourcePath);
|
|
91
|
-
EditorGUILayout.PropertyField(this.httpRequestType);
|
|
92
111
|
//EditorGUILayout.PropertyField(postType);
|
|
93
112
|
EditorGUILayout.PropertyField(this.logType);
|
|
94
113
|
|
|
@@ -138,304 +157,5 @@
|
|
|
138
157
|
{
|
|
139
158
|
Application.OpenURL("https://github.com/XmobiTea-Family/GN-server");
|
|
140
159
|
}
|
|
141
|
-
|
|
142
|
-
//[MenuItem("XmobiTea GN/Sync Server Folder")]
|
|
143
|
-
//private static void SyncServerFolder()
|
|
144
|
-
//{
|
|
145
|
-
// Debug.Log("Sync Server Folder");
|
|
146
|
-
|
|
147
|
-
// SyncConstantFolder();
|
|
148
|
-
// SyncEnumTypeFolder();
|
|
149
|
-
// SyncParameterCodeFolder();
|
|
150
|
-
// SyncErrorCodeFolder();
|
|
151
|
-
|
|
152
|
-
// AssetDatabase.Refresh();
|
|
153
|
-
//}
|
|
154
|
-
|
|
155
|
-
//private static void SyncEnumTypeFolder()
|
|
156
|
-
//{
|
|
157
|
-
// var gnServerSettings = GetSettings();
|
|
158
|
-
// var dir = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/enumType";
|
|
159
|
-
|
|
160
|
-
// var allPathFiles = Directory.GetFiles(dir, "*.ts");
|
|
161
|
-
// for (var i = 0; i < allPathFiles.Length; i++)
|
|
162
|
-
// {
|
|
163
|
-
// GenerateEnumTypeFile(allPathFiles[i]);
|
|
164
|
-
// }
|
|
165
|
-
//}
|
|
166
|
-
|
|
167
|
-
//private static void GenerateEnumTypeFile(string dirPath)
|
|
168
|
-
//{
|
|
169
|
-
// const string Template = "$name = $code,";
|
|
170
|
-
|
|
171
|
-
// var fileInfo = new FileInfo(dirPath);
|
|
172
|
-
|
|
173
|
-
// var allLines = File.ReadAllLines(dirPath);
|
|
174
|
-
|
|
175
|
-
// var fileName = fileInfo.Name.Replace(".ts", string.Empty);
|
|
176
|
-
|
|
177
|
-
// var stringBuilder = new StringBuilder();
|
|
178
|
-
|
|
179
|
-
// stringBuilder.AppendLine("// The file auto generate, please dont change it");
|
|
180
|
-
// stringBuilder.AppendLine();
|
|
181
|
-
// stringBuilder.AppendLine("namespace XmobiTea.GN.Constant");
|
|
182
|
-
// stringBuilder.AppendLine("{");
|
|
183
|
-
// stringBuilder.AppendLine(" public enum " + fileName);
|
|
184
|
-
// stringBuilder.AppendLine(" {");
|
|
185
|
-
// // Value0 = 0,
|
|
186
|
-
// for (var i = 0; i < allLines.Length; i++)
|
|
187
|
-
// {
|
|
188
|
-
// var line = allLines[i].Trim();
|
|
189
|
-
// if (string.IsNullOrEmpty(line)) continue;
|
|
190
|
-
// if (line.Contains("import")) continue;
|
|
191
|
-
// if (line.Contains("export class")) continue;
|
|
192
|
-
// if (line.Contains("export enum")) continue;
|
|
193
|
-
// if (line.Contains("{")) continue;
|
|
194
|
-
// if (line.Contains("}")) continue;
|
|
195
|
-
// if (line.Contains("//")) continue;
|
|
196
|
-
|
|
197
|
-
// var lineSpl0s = line.Split(',');
|
|
198
|
-
// var lineSpl01s = lineSpl0s[0].Split('=');
|
|
199
|
-
|
|
200
|
-
// var code = lineSpl01s[1].Trim();
|
|
201
|
-
// var name = lineSpl01s[0].Trim();
|
|
202
|
-
|
|
203
|
-
// stringBuilder.AppendLine(" " + Template.Replace("$name", name).Replace("$code", code));
|
|
204
|
-
// }
|
|
205
|
-
|
|
206
|
-
// stringBuilder.AppendLine(" }");
|
|
207
|
-
// stringBuilder.AppendLine("}");
|
|
208
|
-
|
|
209
|
-
// WriteFile(fileName + ".cs", Application.dataPath + "/XmobiTea-constance/GN/Scripts/Constant/EnumType", stringBuilder);
|
|
210
|
-
//}
|
|
211
|
-
|
|
212
|
-
//private static void SyncParameterCodeFolder()
|
|
213
|
-
//{
|
|
214
|
-
// var gnServerSettings = GetSettings();
|
|
215
|
-
// var dir = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/parameterCode";
|
|
216
|
-
|
|
217
|
-
// var allPathFiles = Directory.GetFiles(dir, "*.ts");
|
|
218
|
-
// for (var i = 0; i < allPathFiles.Length; i++)
|
|
219
|
-
// {
|
|
220
|
-
// GenerateParameterCodeFile(allPathFiles[i]);
|
|
221
|
-
// }
|
|
222
|
-
//}
|
|
223
|
-
|
|
224
|
-
//private static void GenerateParameterCodeFile(string dirPath)
|
|
225
|
-
//{
|
|
226
|
-
// const string Template = "public const string $name = $code;";
|
|
227
|
-
|
|
228
|
-
// var fileInfo = new FileInfo(dirPath);
|
|
229
|
-
|
|
230
|
-
// var allLines = File.ReadAllLines(dirPath);
|
|
231
|
-
|
|
232
|
-
// var fileName = fileInfo.Name.Replace(".ts", string.Empty);
|
|
233
|
-
|
|
234
|
-
// if (fileName.Contains(".ext"))
|
|
235
|
-
// {
|
|
236
|
-
// fileName = fileName.Replace(".ext", string.Empty);
|
|
237
|
-
// }
|
|
238
|
-
|
|
239
|
-
// var stringBuilder = new StringBuilder();
|
|
240
|
-
|
|
241
|
-
// stringBuilder.AppendLine("// The file auto generate, please dont change it");
|
|
242
|
-
// stringBuilder.AppendLine();
|
|
243
|
-
// stringBuilder.AppendLine("namespace XmobiTea.GN.Constant");
|
|
244
|
-
// stringBuilder.AppendLine("{");
|
|
245
|
-
// stringBuilder.AppendLine(" public partial class " + fileName);
|
|
246
|
-
// stringBuilder.AppendLine(" {");
|
|
247
|
-
// // Value0 = 0,
|
|
248
|
-
// for (var i = 0; i < allLines.Length; i++)
|
|
249
|
-
// {
|
|
250
|
-
// var line = allLines[i].Trim();
|
|
251
|
-
// if (string.IsNullOrEmpty(line)) continue;
|
|
252
|
-
// if (line.Contains("import")) continue;
|
|
253
|
-
// if (line.Contains("export class")) continue;
|
|
254
|
-
// if (line.Contains("export enum")) continue;
|
|
255
|
-
// if (line.Contains("{")) continue;
|
|
256
|
-
// if (line.Contains("}")) continue;
|
|
257
|
-
// if (line.Contains("//")) continue;
|
|
258
|
-
|
|
259
|
-
// var lineSpl0s = line.Split('=');
|
|
260
|
-
// var lineSpl01s = lineSpl0s[0].Split(' ');
|
|
261
|
-
// var lineSpl013s = lineSpl01s[3].Split(':');
|
|
262
|
-
|
|
263
|
-
// var code = lineSpl0s[1].Split(';')[0].Trim();
|
|
264
|
-
// var name = lineSpl013s[0];
|
|
265
|
-
|
|
266
|
-
// stringBuilder.AppendLine(" " + Template.Replace("$name", name).Replace("$code", code));
|
|
267
|
-
// }
|
|
268
|
-
|
|
269
|
-
// stringBuilder.AppendLine(" }");
|
|
270
|
-
// stringBuilder.AppendLine("}");
|
|
271
|
-
|
|
272
|
-
// WriteFile(fileName + ".cs", Application.dataPath + "/XmobiTea-constance/GN/Scripts/Constant/ParameterCode", stringBuilder);
|
|
273
|
-
//}
|
|
274
|
-
|
|
275
|
-
//private static void SyncErrorCodeFolder()
|
|
276
|
-
//{
|
|
277
|
-
// var gnServerSettings = GetSettings();
|
|
278
|
-
// var dir = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/errorCode";
|
|
279
|
-
|
|
280
|
-
// var allPathFiles = Directory.GetFiles(dir, "*.ts");
|
|
281
|
-
// for (var i = 0; i < allPathFiles.Length; i++)
|
|
282
|
-
// {
|
|
283
|
-
// GenerateErrorCodeFile(allPathFiles[i]);
|
|
284
|
-
// }
|
|
285
|
-
//}
|
|
286
|
-
|
|
287
|
-
//private static void GenerateErrorCodeFile(string dirPath)
|
|
288
|
-
//{
|
|
289
|
-
// const string Template = "public const int $name = $code;";
|
|
290
|
-
|
|
291
|
-
// var fileInfo = new FileInfo(dirPath);
|
|
292
|
-
|
|
293
|
-
// var allLines = File.ReadAllLines(dirPath);
|
|
294
|
-
|
|
295
|
-
// var fileName = fileInfo.Name.Replace(".ts", string.Empty);
|
|
296
|
-
|
|
297
|
-
// if (fileName.Contains(".ext"))
|
|
298
|
-
// {
|
|
299
|
-
// fileName = fileName.Replace(".ext", string.Empty);
|
|
300
|
-
// }
|
|
301
|
-
|
|
302
|
-
// var stringBuilder = new StringBuilder();
|
|
303
|
-
|
|
304
|
-
// stringBuilder.AppendLine("// The file auto generate, please dont change it");
|
|
305
|
-
// stringBuilder.AppendLine();
|
|
306
|
-
// stringBuilder.AppendLine("namespace XmobiTea.GN.Constant");
|
|
307
|
-
// stringBuilder.AppendLine("{");
|
|
308
|
-
// stringBuilder.AppendLine(" public partial class " + fileName);
|
|
309
|
-
// stringBuilder.AppendLine(" {");
|
|
310
|
-
// // Value0 = 0,
|
|
311
|
-
// for (var i = 0; i < allLines.Length; i++)
|
|
312
|
-
// {
|
|
313
|
-
// var line = allLines[i].Trim();
|
|
314
|
-
// if (string.IsNullOrEmpty(line)) continue;
|
|
315
|
-
// if (line.Contains("import")) continue;
|
|
316
|
-
// if (line.Contains("export class")) continue;
|
|
317
|
-
// if (line.Contains("export enum")) continue;
|
|
318
|
-
// if (line.Contains("{")) continue;
|
|
319
|
-
// if (line.Contains("}")) continue;
|
|
320
|
-
// if (line.Contains("//")) continue;
|
|
321
|
-
|
|
322
|
-
// var lineSpl0s = line.Split('=');
|
|
323
|
-
// var lineSpl01s = lineSpl0s[0].Split(' ');
|
|
324
|
-
// var lineSpl013s = lineSpl01s[3].Split(':');
|
|
325
|
-
|
|
326
|
-
// var code = lineSpl0s[1].Split(';')[0].Trim();
|
|
327
|
-
// var name = lineSpl013s[0];
|
|
328
|
-
|
|
329
|
-
// stringBuilder.AppendLine(" " + Template.Replace("$name", name).Replace("$code", code));
|
|
330
|
-
// }
|
|
331
|
-
|
|
332
|
-
// stringBuilder.AppendLine(" }");
|
|
333
|
-
// stringBuilder.AppendLine("}");
|
|
334
|
-
|
|
335
|
-
// WriteFile(fileName + ".cs", Application.dataPath + "/XmobiTea-constance/GN/Scripts/Constant/ErrorCode", stringBuilder);
|
|
336
|
-
//}
|
|
337
|
-
|
|
338
|
-
//private static void SyncConstantFolder()
|
|
339
|
-
//{
|
|
340
|
-
// GenerateOperationCode();
|
|
341
|
-
// GenerateEventCode();
|
|
342
|
-
//}
|
|
343
|
-
|
|
344
|
-
//private static void GenerateOperationCode()
|
|
345
|
-
//{
|
|
346
|
-
// const string Template = "public const int $name = $code;";
|
|
347
|
-
|
|
348
|
-
// var gnServerSettings = GetSettings();
|
|
349
|
-
// var dirPath = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/OperationCode.ext.ts";
|
|
350
|
-
// var allLines = File.ReadAllLines(dirPath);
|
|
351
|
-
|
|
352
|
-
// var stringBuilder = new StringBuilder();
|
|
353
|
-
|
|
354
|
-
// stringBuilder.AppendLine("// The file auto generate, please dont change it");
|
|
355
|
-
// stringBuilder.AppendLine();
|
|
356
|
-
// stringBuilder.AppendLine("namespace XmobiTea.GN.Constant");
|
|
357
|
-
// stringBuilder.AppendLine("{");
|
|
358
|
-
// stringBuilder.AppendLine(" public partial class OperationCode");
|
|
359
|
-
// stringBuilder.AppendLine(" {");
|
|
360
|
-
|
|
361
|
-
// for (var i = 0; i < allLines.Length; i++)
|
|
362
|
-
// {
|
|
363
|
-
// var line = allLines[i].Trim();
|
|
364
|
-
// if (string.IsNullOrEmpty(line)) continue;
|
|
365
|
-
// if (line.Contains("import")) continue;
|
|
366
|
-
// if (line.Contains("export class")) continue;
|
|
367
|
-
// if (line.Contains("export enum")) continue;
|
|
368
|
-
// if (line.Contains("{")) continue;
|
|
369
|
-
// if (line.Contains("}")) continue;
|
|
370
|
-
// if (line.Contains("//")) continue;
|
|
371
|
-
|
|
372
|
-
// var lineSpl0s = line.Split('=');
|
|
373
|
-
// var lineSpl01s = lineSpl0s[0].Split(' ');
|
|
374
|
-
// var lineSpl013s = lineSpl01s[3].Split(':');
|
|
375
|
-
|
|
376
|
-
// var code = lineSpl0s[1].Split(';')[0].Trim();
|
|
377
|
-
// var name = lineSpl013s[0];
|
|
378
|
-
|
|
379
|
-
// stringBuilder.AppendLine(" " + Template.Replace("$name", name).Replace("$code", code));
|
|
380
|
-
// }
|
|
381
|
-
|
|
382
|
-
// stringBuilder.AppendLine(" }");
|
|
383
|
-
// stringBuilder.AppendLine("}");
|
|
384
|
-
// WriteFile("OperationCode.cs", Application.dataPath + "/XmobiTea-constance/GN/Scripts/Constant", stringBuilder);
|
|
385
|
-
//}
|
|
386
|
-
|
|
387
|
-
//private static void GenerateEventCode()
|
|
388
|
-
//{
|
|
389
|
-
// const string Template = "public const int $name = $code;";
|
|
390
|
-
|
|
391
|
-
// var gnServerSettings = GetSettings();
|
|
392
|
-
// var dirPath = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/EventCode.ext.ts";
|
|
393
|
-
// var allLines = File.ReadAllLines(dirPath);
|
|
394
|
-
|
|
395
|
-
// var stringBuilder = new StringBuilder();
|
|
396
|
-
|
|
397
|
-
// stringBuilder.AppendLine("// The file auto generate, please dont change it");
|
|
398
|
-
// stringBuilder.AppendLine();
|
|
399
|
-
// stringBuilder.AppendLine("namespace XmobiTea.GN.Constant");
|
|
400
|
-
// stringBuilder.AppendLine("{");
|
|
401
|
-
// stringBuilder.AppendLine(" public partial class EventCode");
|
|
402
|
-
// stringBuilder.AppendLine(" {");
|
|
403
|
-
|
|
404
|
-
// for (var i = 0; i < allLines.Length; i++)
|
|
405
|
-
// {
|
|
406
|
-
// var line = allLines[i].Trim();
|
|
407
|
-
// if (string.IsNullOrEmpty(line)) continue;
|
|
408
|
-
// if (line.Contains("import")) continue;
|
|
409
|
-
// if (line.Contains("export class")) continue;
|
|
410
|
-
// if (line.Contains("export enum")) continue;
|
|
411
|
-
// if (line.Contains("{")) continue;
|
|
412
|
-
// if (line.Contains("}")) continue;
|
|
413
|
-
// if (line.Contains("//")) continue;
|
|
414
|
-
|
|
415
|
-
// var lineSpl0s = line.Split('=');
|
|
416
|
-
// var lineSpl01s = lineSpl0s[0].Split(' ');
|
|
417
|
-
// var lineSpl013s = lineSpl01s[3].Split(':');
|
|
418
|
-
|
|
419
|
-
// var code = lineSpl0s[1].Split(';')[0].Trim();
|
|
420
|
-
// var name = lineSpl013s[0];
|
|
421
|
-
|
|
422
|
-
// stringBuilder.AppendLine(" " + Template.Replace("$name", name).Replace("$code", code));
|
|
423
|
-
// }
|
|
424
|
-
|
|
425
|
-
// stringBuilder.AppendLine(" }");
|
|
426
|
-
// stringBuilder.AppendLine("}");
|
|
427
|
-
// WriteFile("EventCode.cs", Application.dataPath + "/XmobiTea-constance/GN/Scripts/Constant", stringBuilder);
|
|
428
|
-
//}
|
|
429
|
-
|
|
430
|
-
//private static void WriteFile(string fileNameWithExtension, string dirPath, StringBuilder contentBuilder)
|
|
431
|
-
//{
|
|
432
|
-
// if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath);
|
|
433
|
-
// var filePath = Path.Combine(dirPath, fileNameWithExtension);
|
|
434
|
-
|
|
435
|
-
// if (File.Exists(filePath)) File.Delete(filePath);
|
|
436
|
-
// File.WriteAllText(filePath, contentBuilder.ToString());
|
|
437
|
-
|
|
438
|
-
// Debug.Log("Create file path " + fileNameWithExtension + " at " + filePath + " success.");
|
|
439
|
-
//}
|
|
440
160
|
}
|
|
441
161
|
}
|