com.xmobitea.changx.gn-unity 1.0.7 → 2.0.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 +48 -94
- package/Runtime/Common/GNArray.cs +122 -81
- package/Runtime/Common/GNData.cs +13 -7
- package/Runtime/Common/GNHashtable.cs +71 -63
- package/Runtime/Common/IGNData.cs +3 -1
- package/Runtime/Config/GNServerSettings.cs +112 -45
- package/Runtime/Constant/Commands.cs +3 -0
- package/Runtime/Constant/EnumType/FriendStatus.cs +6 -4
- package/Runtime/Constant/EnumType/GoogleLoginType.cs +2 -0
- package/Runtime/Constant/EnumType/GroupStatus.cs +12 -0
- package/Runtime/Constant/EnumType/{UserRoleType.cs.meta → GroupStatus.cs.meta} +1 -1
- package/Runtime/Constant/EnumType/InvalidMemberType.cs +17 -15
- package/Runtime/Constant/EnumType/ItemType.cs +10 -0
- package/Runtime/Constant/EnumType/{LoginType.cs.meta → ItemType.cs.meta} +1 -1
- package/Runtime/Constant/EnumType/MatchmakingMemberStatus.cs +11 -0
- package/Runtime/Constant/{ErrorCode/DebugErrorCode.cs.meta → EnumType/MatchmakingMemberStatus.cs.meta} +11 -11
- package/Runtime/Constant/EnumType/MatchmakingTicketStatus.cs +13 -0
- package/Runtime/Constant/EnumType/{PlatformType.cs.meta → MatchmakingTicketStatus.cs.meta} +11 -11
- package/Runtime/Constant/EnumType/OwnerType.cs +12 -0
- package/Runtime/Constant/EnumType/OwnerType.cs.meta +11 -0
- package/Runtime/Constant/EnumType/PermissionDataItem.cs +10 -0
- package/Runtime/Constant/EnumType/PermissionDataItem.cs.meta +11 -0
- package/Runtime/Constant/EnumType/RequestRole.cs +11 -0
- package/Runtime/Constant/EnumType/RequestRole.cs.meta +7 -0
- package/Runtime/Constant/EnumType/RequestType.cs +19 -0
- package/Runtime/Constant/EnumType/RequestType.cs.meta +11 -0
- package/Runtime/Constant/ErrorCode/GNErrorCode.cs +54 -0
- package/Runtime/Constant/ErrorCode/GNErrorCode.cs.meta +7 -0
- package/Runtime/Constant/EventCode.cs +10 -1
- package/Runtime/Constant/OperationCode.cs +212 -14
- package/Runtime/Constant/ParameterCode/GNParameterCode.cs +470 -0
- package/Runtime/Constant/ParameterCode/GNParameterCode.cs.meta +11 -0
- package/Runtime/Constant/ParameterCode/ParameterCode.cs +2 -0
- package/Runtime/Constant/ReturnCode.cs +13 -7
- package/Runtime/Entity/DataMember.cs +124 -0
- package/Runtime/Entity/DataMember.cs.meta +11 -0
- package/Runtime/Entity/GNMetadata.cs +27 -0
- package/Runtime/Entity/GNMetadata.cs.meta +11 -0
- package/Runtime/Entity/InvalidMember.cs +8 -3
- package/Runtime/Entity/Models/AuthenticateModels.cs +316 -0
- package/Runtime/Entity/Models/AuthenticateModels.cs.meta +11 -0
- package/Runtime/Entity/Models/AuthenticateRequestModels.cs +186 -0
- package/Runtime/Entity/Models/AuthenticateRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/AuthenticateResponseModels.cs +90 -0
- package/Runtime/Entity/Models/AuthenticateResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/CharacterPlayerModels.cs +1208 -0
- package/Runtime/Entity/Models/CharacterPlayerModels.cs.meta +11 -0
- package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs +1233 -0
- package/Runtime/Entity/Models/CharacterPlayerRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs +254 -0
- package/Runtime/Entity/Models/CharacterPlayerResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/ContentModels.cs +223 -0
- package/Runtime/Entity/Models/ContentModels.cs.meta +11 -0
- package/Runtime/Entity/Models/ContentRequestModels.cs +185 -0
- package/Runtime/Entity/Models/ContentRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/ContentResponseModels.cs +44 -0
- package/Runtime/Entity/Models/ContentResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/DashboardModels.cs +1696 -0
- package/Runtime/Entity/Models/DashboardModels.cs.meta +11 -0
- package/Runtime/Entity/Models/DashboardRequestModels.cs +208 -0
- package/Runtime/Entity/Models/DashboardRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/DashboardResponseModels.cs +99 -0
- package/Runtime/Entity/Models/DashboardResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/GamePlayerModels.cs +1326 -0
- package/Runtime/Entity/Models/GamePlayerModels.cs.meta +11 -0
- package/Runtime/Entity/Models/GamePlayerRequestModels.cs +1208 -0
- package/Runtime/Entity/Models/GamePlayerRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/GamePlayerResponseModels.cs +249 -0
- package/Runtime/Entity/Models/GamePlayerResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/GenericModels.cs +154 -0
- package/Runtime/Entity/Models/GenericModels.cs.meta +11 -0
- package/Runtime/Entity/Models/GroupModels.cs +957 -0
- package/Runtime/Entity/Models/GroupModels.cs.meta +11 -0
- package/Runtime/Entity/Models/GroupRequestModels.cs +933 -0
- package/Runtime/Entity/Models/GroupRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/GroupResponseModels.cs +194 -0
- package/Runtime/Entity/Models/GroupResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/InventoryModels.cs +789 -0
- package/Runtime/Entity/Models/InventoryModels.cs.meta +11 -0
- package/Runtime/Entity/Models/InventoryRequestModels.cs +810 -0
- package/Runtime/Entity/Models/InventoryRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/InventoryResponseModels.cs +169 -0
- package/Runtime/Entity/Models/InventoryResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/MasterPlayerModels.cs +1907 -0
- package/Runtime/Entity/Models/MasterPlayerModels.cs.meta +11 -0
- package/Runtime/Entity/Models/MasterPlayerRequestModels.cs +1744 -0
- package/Runtime/Entity/Models/MasterPlayerRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/MasterPlayerResponseModels.cs +359 -0
- package/Runtime/Entity/Models/MasterPlayerResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/MultiplayerModels.cs +323 -0
- package/Runtime/Entity/Models/MultiplayerModels.cs.meta +11 -0
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs +208 -0
- package/Runtime/Entity/Models/MultiplayerRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs +49 -0
- package/Runtime/Entity/Models/MultiplayerResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models/StoreInventoryModels.cs +474 -0
- package/Runtime/Entity/Models/StoreInventoryModels.cs.meta +11 -0
- package/Runtime/Entity/Models/StoreInventoryRequestModels.cs +235 -0
- package/Runtime/Entity/Models/StoreInventoryRequestModels.cs.meta +11 -0
- package/Runtime/Entity/Models/StoreInventoryResponseModels.cs +54 -0
- package/Runtime/Entity/Models/StoreInventoryResponseModels.cs.meta +11 -0
- package/Runtime/Entity/Models.meta +8 -0
- package/Runtime/Entity/OperationEvent.cs +14 -9
- package/Runtime/Entity/OperationHelper.cs +13 -7
- package/Runtime/Entity/OperationRequest.cs +20 -20
- package/Runtime/Entity/OperationResponse.cs +27 -17
- package/Runtime/Entity/Request/CustomOperationRequest.cs +37 -7
- package/Runtime/Entity/Response/CustomOperationResponse.cs +34 -11
- package/Runtime/GNNetwork.cs +80 -83
- package/Runtime/GNNetworkApi.cs +7 -115
- package/Runtime/GNNetworkAuthenticateApi.cs +110 -0
- package/Runtime/GNNetworkAuthenticateApi.cs.meta +11 -0
- package/Runtime/GNNetworkCharacterPlayerApi.cs +766 -0
- package/Runtime/GNNetworkCharacterPlayerApi.cs.meta +11 -0
- package/Runtime/GNNetworkContentApi.cs +136 -0
- package/Runtime/GNNetworkContentApi.cs.meta +11 -0
- package/Runtime/GNNetworkDashboardApi.cs +121 -0
- package/Runtime/GNNetworkDashboardApi.cs.meta +11 -0
- package/Runtime/GNNetworkGamePlayerApi.cs +751 -0
- package/Runtime/GNNetworkGamePlayerApi.cs.meta +11 -0
- package/Runtime/GNNetworkGroupApi.cs +586 -0
- package/Runtime/GNNetworkGroupApi.cs.meta +11 -0
- package/Runtime/GNNetworkInventoryApi.cs +511 -0
- package/Runtime/GNNetworkInventoryApi.cs.meta +11 -0
- package/Runtime/GNNetworkMasterPlayerApi.cs +1071 -0
- package/Runtime/GNNetworkMasterPlayerApi.cs.meta +11 -0
- package/Runtime/GNNetworkMultiplayerApi.cs +151 -0
- package/Runtime/GNNetworkMultiplayerApi.cs.meta +11 -0
- package/Runtime/GNNetworkStoreInventoryApi.cs +166 -0
- package/Runtime/GNNetworkStoreInventoryApi.cs.meta +11 -0
- package/Runtime/Helper/CodeHelper.cs +44 -23
- package/Runtime/Helper/ConverterService.cs +452 -0
- package/Runtime/Helper/ConverterService.cs.meta +11 -0
- package/Runtime/Logger/GNDebug.cs +4 -4
- package/Runtime/Networking/AuthenticateStatus.cs +35 -0
- package/Runtime/Networking/AuthenticateStatus.cs.meta +11 -0
- package/Runtime/Networking/Handler/IServerEventHandler.cs +14 -2
- package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs +32 -0
- package/Runtime/Networking/Handler/OnCharacterPlayerFriendUpdateEventHandler.cs.meta +11 -0
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs +33 -0
- package/Runtime/Networking/Handler/OnCharacterPlayerGroupUpdateEventHandler.cs.meta +11 -0
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs +32 -0
- package/Runtime/Networking/Handler/OnGamePlayerFriendUpdateEventHandler.cs.meta +11 -0
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs +32 -0
- package/Runtime/Networking/Handler/OnGamePlayerGroupUpdateEventHandler.cs.meta +11 -0
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs +29 -0
- package/Runtime/Networking/Handler/OnGroupMemberUpdateEventHandler.cs.meta +11 -0
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs +29 -0
- package/Runtime/Networking/Handler/OnGroupMessageUpdateEventHandler.cs.meta +11 -0
- package/Runtime/Networking/Http/HttpPeer.cs +176 -0
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs +25 -0
- package/Runtime/Networking/Http/NetworkingHttpPeerBase.cs.meta +11 -0
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs +373 -0
- package/Runtime/Networking/Http/NetworkingPeerHttpClientRequest.cs.meta +11 -0
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs +207 -0
- package/Runtime/Networking/Http/NetworkingPeerHttpRequest.cs.meta +11 -0
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs +188 -0
- package/Runtime/Networking/Http/NetworkingPeerUnityWebRequest.cs.meta +11 -0
- package/Runtime/Networking/Http.meta +8 -0
- package/Runtime/Networking/IPeer.cs +6 -5
- package/Runtime/Networking/NetworkingPeer.cs +81 -52
- package/Runtime/Networking/NetworkingPeerAPI.cs +23 -311
- package/Runtime/Networking/OperationPending.cs +47 -10
- package/Runtime/Networking/PeerBase.cs +87 -84
- package/Runtime/Networking/{NetworkingPeerSocketV2.cs → Socket/NetworkingPeerSocketV2.cs} +44 -41
- package/Runtime/Networking/{NetworkingPeerSocketV3.cs → Socket/NetworkingPeerSocketV3.cs} +43 -40
- package/Runtime/Networking/{NetworkingPeerBase.cs → Socket/NetworkingSocketPeerBase.cs} +41 -49
- package/Runtime/Networking/Socket/SocketPeer.cs +193 -0
- package/Runtime/Networking/Socket.meta +8 -0
- package/Runtime/Unity/ServiceUpdate.cs +20 -0
- package/Runtime/Unity/ServiceUpdate.cs.meta +11 -0
- package/Runtime/Unity.meta +8 -0
- package/Runtime/XmobiTea.GN.runtime.asmdef +1 -2
- package/package.json +2 -4
- package/Runtime/Constant/EnumType/LoginType.cs +0 -14
- package/Runtime/Constant/EnumType/PlatformType.cs +0 -12
- package/Runtime/Constant/EnumType/UserRoleType.cs +0 -12
- package/Runtime/Constant/ErrorCode/DebugErrorCode.cs +0 -7
- package/Runtime/Constant/ErrorCode/EnterDisplayNameErrorCode.cs +0 -7
- package/Runtime/Constant/ErrorCode/EnterDisplayNameErrorCode.cs.meta +0 -11
- package/Runtime/Constant/ErrorCode/FetchAllDataErrorCode.cs +0 -8
- package/Runtime/Constant/ErrorCode/FetchAllDataErrorCode.cs.meta +0 -11
- package/Runtime/Constant/ErrorCode/FetchSparkPlayerErrorCode.cs +0 -8
- package/Runtime/Constant/ErrorCode/FetchSparkPlayerErrorCode.cs.meta +0 -11
- package/Runtime/Constant/ErrorCode/FileUploadInfoErrorCode.cs +0 -9
- package/Runtime/Constant/ErrorCode/FileUploadInfoErrorCode.cs.meta +0 -11
- package/Runtime/Constant/ErrorCode/GetAppConfigErrorCode.cs +0 -7
- package/Runtime/Constant/ErrorCode/GetAppConfigErrorCode.cs.meta +0 -11
- package/Runtime/Constant/ErrorCode/LoginErrorCode.cs +0 -14
- package/Runtime/Constant/ErrorCode/LoginErrorCode.cs.meta +0 -11
- package/Runtime/Constant/ErrorCode/RegisterSocketErrorCode.cs +0 -7
- package/Runtime/Constant/ErrorCode/RegisterSocketErrorCode.cs.meta +0 -11
- package/Runtime/Constant/ParameterCode/DebugParameterCode.cs +0 -11
- package/Runtime/Constant/ParameterCode/DebugParameterCode.cs.meta +0 -11
- package/Runtime/Constant/ParameterCode/EnterDisplayNameParameterCode.cs +0 -8
- package/Runtime/Constant/ParameterCode/EnterDisplayNameParameterCode.cs.meta +0 -11
- package/Runtime/Constant/ParameterCode/FetchAllDataParameterCode.cs +0 -11
- package/Runtime/Constant/ParameterCode/FetchAllDataParameterCode.cs.meta +0 -11
- package/Runtime/Constant/ParameterCode/FetchSparkPlayerParameterCode.cs +0 -19
- package/Runtime/Constant/ParameterCode/FetchSparkPlayerParameterCode.cs.meta +0 -11
- package/Runtime/Constant/ParameterCode/FileUploadInfoParameterCode.cs +0 -15
- package/Runtime/Constant/ParameterCode/FileUploadInfoParameterCode.cs.meta +0 -11
- package/Runtime/Constant/ParameterCode/GetAppConfigParameterCode.cs +0 -8
- package/Runtime/Constant/ParameterCode/GetAppConfigParameterCode.cs.meta +0 -11
- package/Runtime/Constant/ParameterCode/LoginParameterCode.cs +0 -22
- package/Runtime/Constant/ParameterCode/LoginParameterCode.cs.meta +0 -11
- package/Runtime/Constant/ParameterCode/RegisterSocketParameterCode.cs +0 -7
- package/Runtime/Constant/ParameterCode/RegisterSocketParameterCode.cs.meta +0 -11
- package/Runtime/Entity/Request/CreateNewFileUploadInfoOperationRequest.cs +0 -21
- package/Runtime/Entity/Request/CreateNewFileUploadInfoOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/DebugOperationRequest.cs +0 -25
- package/Runtime/Entity/Request/DebugOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/EnterDisplayNameOperationRequest.cs +0 -21
- package/Runtime/Entity/Request/EnterDisplayNameOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/FetchAllDataOperationRequest.cs +0 -19
- package/Runtime/Entity/Request/FetchAllDataOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/FetchSparkPlayerOperationRequest.cs +0 -19
- package/Runtime/Entity/Request/FetchSparkPlayerOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/GetAppConfigOperationRequest.cs +0 -21
- package/Runtime/Entity/Request/GetAppConfigOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/GetFileUploadInfoOperationRequest.cs +0 -21
- package/Runtime/Entity/Request/GetFileUploadInfoOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/LoginOperationRequest.cs +0 -140
- package/Runtime/Entity/Request/LoginOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/LogoutOperationRequest.cs +0 -19
- package/Runtime/Entity/Request/LogoutOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/RegisterAccountOperationRequest.cs +0 -22
- package/Runtime/Entity/Request/RegisterAccountOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/RegisterSocketOperationRequest.cs +0 -21
- package/Runtime/Entity/Request/RegisterSocketOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Request/TemplateOperationRequest.cs +0 -21
- package/Runtime/Entity/Request/TemplateOperationRequest.cs.meta +0 -11
- package/Runtime/Entity/Response/CreateNewFileUploadInfoOperationResponse.cs +0 -32
- package/Runtime/Entity/Response/CreateNewFileUploadInfoOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/DebugOperationResponse.cs +0 -33
- package/Runtime/Entity/Response/DebugOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/EnterDisplayNameOperationResponse.cs +0 -26
- package/Runtime/Entity/Response/EnterDisplayNameOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/FetchAllDataOperationResponse.cs +0 -35
- package/Runtime/Entity/Response/FetchAllDataOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/FetchSparkPlayerOperationResponse.cs +0 -59
- package/Runtime/Entity/Response/FetchSparkPlayerOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/GetAppConfigOperationResponse.cs +0 -24
- package/Runtime/Entity/Response/GetAppConfigOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/GetFileUploadInfoOperationResponse.cs +0 -56
- package/Runtime/Entity/Response/GetFileUploadInfoOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/LoginOperationResponse.cs +0 -34
- package/Runtime/Entity/Response/LoginOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/LogoutOperationResponse.cs +0 -27
- package/Runtime/Entity/Response/LogoutOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/PublicAddressGetRandomMessageOperationResponse.cs +0 -24
- package/Runtime/Entity/Response/PublicAddressGetRandomMessageOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/RegisterAccountOperationResponse.cs +0 -23
- package/Runtime/Entity/Response/RegisterAccountOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/RegisterSocketOperationResponse.cs +0 -23
- package/Runtime/Entity/Response/RegisterSocketOperationResponse.cs.meta +0 -11
- package/Runtime/Entity/Response/TemplateOperationResponse.cs +0 -24
- package/Runtime/Entity/Response/TemplateOperationResponse.cs.meta +0 -11
- package/Runtime/Networking/Handler/OnDebugEventHandler.cs +0 -17
- package/Runtime/Networking/Handler/OnDebugEventHandler.cs.meta +0 -11
- package/Runtime/Networking/HttpPeer.cs +0 -497
- package/Runtime/Networking/SocketPeer.cs +0 -179
- /package/Runtime/Networking/{HttpPeer.cs.meta → Http/HttpPeer.cs.meta} +0 -0
- /package/Runtime/Networking/{NetworkingPeerSocketV2.cs.meta → Socket/NetworkingPeerSocketV2.cs.meta} +0 -0
- /package/Runtime/Networking/{NetworkingPeerSocketV3.cs.meta → Socket/NetworkingPeerSocketV3.cs.meta} +0 -0
- /package/Runtime/Networking/{NetworkingPeerBase.cs.meta → Socket/NetworkingSocketPeerBase.cs.meta} +0 -0
- /package/Runtime/Networking/{SocketPeer.cs.meta → Socket/SocketPeer.cs.meta} +0 -0
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
SerializedProperty pingInterval;
|
|
25
25
|
SerializedProperty pingTimout;
|
|
26
26
|
SerializedProperty peerSocketVersion;
|
|
27
|
-
SerializedProperty codeCanSendNotAuthorized;
|
|
28
27
|
SerializedProperty gnServerSourcePath;
|
|
29
28
|
SerializedProperty httpRequestType;
|
|
30
29
|
SerializedProperty logType;
|
|
30
|
+
SerializedProperty adminSecretKey;
|
|
31
|
+
SerializedProperty serverSecretKey;
|
|
32
|
+
SerializedProperty clientSecretKey;
|
|
31
33
|
|
|
32
34
|
private Dictionary<int, string> operationCodeFieldDict;
|
|
33
35
|
|
|
@@ -35,115 +37,67 @@
|
|
|
35
37
|
|
|
36
38
|
private void OnEnable()
|
|
37
39
|
{
|
|
38
|
-
serverAddress = serializedObject.FindProperty("
|
|
39
|
-
serverPort = serializedObject.FindProperty("
|
|
40
|
-
useSsl = serializedObject.FindProperty("
|
|
41
|
-
useSocket = serializedObject.FindProperty("
|
|
42
|
-
useHttp = serializedObject.FindProperty("
|
|
43
|
-
sendRate = serializedObject.FindProperty("
|
|
44
|
-
reconnectDelay = serializedObject.FindProperty("
|
|
45
|
-
pingInterval = serializedObject.FindProperty("
|
|
46
|
-
pingTimout = serializedObject.FindProperty("
|
|
47
|
-
peerSocketVersion = serializedObject.FindProperty("
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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");
|
|
50
|
+
this.gnServerSourcePath = serializedObject.FindProperty("gnServerSourcePath");
|
|
51
|
+
this.httpRequestType = serializedObject.FindProperty("httpRequestType");
|
|
52
|
+
//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");
|
|
53
57
|
|
|
54
58
|
var fields = typeof(OperationCode).GetFields();
|
|
55
59
|
|
|
56
|
-
if (operationCodeFieldDict == null) operationCodeFieldDict = new Dictionary<int, string>();
|
|
57
|
-
else operationCodeFieldDict.Clear();
|
|
60
|
+
if (this.operationCodeFieldDict == null) this.operationCodeFieldDict = new Dictionary<int, string>();
|
|
61
|
+
else this.operationCodeFieldDict.Clear();
|
|
58
62
|
|
|
59
63
|
for (var i = 0; i < fields.Length; i++)
|
|
60
64
|
{
|
|
61
65
|
var field = fields[i];
|
|
62
66
|
|
|
63
|
-
operationCodeFieldDict[(int)field.GetValue(null)] = field.Name;
|
|
67
|
+
this.operationCodeFieldDict[(int)field.GetValue(null)] = field.Name;
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
public override void OnInspectorGUI()
|
|
68
72
|
{
|
|
69
|
-
serializedObject.Update();
|
|
73
|
+
this.serializedObject.Update();
|
|
70
74
|
|
|
71
|
-
EditorGUILayout.LabelField($"GN Unity Client SDK Version v{GNNetwork.
|
|
75
|
+
EditorGUILayout.LabelField($"GN Unity Client SDK Version v{GNNetwork.getClientSdkVersion()}");
|
|
72
76
|
EditorGUILayout.Space(20);
|
|
73
77
|
|
|
74
|
-
EditorGUILayout.PropertyField(serverAddress);
|
|
75
|
-
EditorGUILayout.PropertyField(serverPort);
|
|
76
|
-
EditorGUILayout.PropertyField(useSsl);
|
|
77
|
-
EditorGUILayout.PropertyField(useSocket);
|
|
78
|
-
EditorGUILayout.PropertyField(useHttp);
|
|
79
|
-
EditorGUILayout.PropertyField(sendRate);
|
|
80
|
-
EditorGUILayout.PropertyField(reconnectDelay);
|
|
81
|
-
EditorGUILayout.PropertyField(pingInterval);
|
|
82
|
-
EditorGUILayout.PropertyField(pingTimout);
|
|
83
|
-
EditorGUILayout.PropertyField(peerSocketVersion);
|
|
78
|
+
EditorGUILayout.PropertyField(this.serverAddress);
|
|
79
|
+
EditorGUILayout.PropertyField(this.serverPort);
|
|
80
|
+
EditorGUILayout.PropertyField(this.useSsl);
|
|
81
|
+
EditorGUILayout.PropertyField(this.useSocket);
|
|
82
|
+
EditorGUILayout.PropertyField(this.useHttp);
|
|
83
|
+
EditorGUILayout.PropertyField(this.sendRate);
|
|
84
|
+
EditorGUILayout.PropertyField(this.reconnectDelay);
|
|
85
|
+
EditorGUILayout.PropertyField(this.pingInterval);
|
|
86
|
+
EditorGUILayout.PropertyField(this.pingTimout);
|
|
87
|
+
EditorGUILayout.PropertyField(this.peerSocketVersion);
|
|
84
88
|
EditorGUILayout.Space(20);
|
|
85
89
|
|
|
86
|
-
EditorGUILayout.
|
|
87
|
-
EditorGUILayout.
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
}
|
|
90
|
+
EditorGUILayout.PropertyField(this.gnServerSourcePath);
|
|
91
|
+
EditorGUILayout.PropertyField(this.httpRequestType);
|
|
92
|
+
//EditorGUILayout.PropertyField(postType);
|
|
93
|
+
EditorGUILayout.PropertyField(this.logType);
|
|
137
94
|
|
|
138
|
-
EditorGUILayout.EndVertical();
|
|
139
95
|
EditorGUILayout.Space(20);
|
|
96
|
+
EditorGUILayout.PropertyField(this.adminSecretKey);
|
|
97
|
+
EditorGUILayout.PropertyField(this.serverSecretKey);
|
|
98
|
+
EditorGUILayout.PropertyField(this.clientSecretKey);
|
|
140
99
|
|
|
141
|
-
|
|
142
|
-
EditorGUILayout.PropertyField(httpRequestType);
|
|
143
|
-
//EditorGUILayout.PropertyField(postType);
|
|
144
|
-
EditorGUILayout.PropertyField(logType);
|
|
145
|
-
|
|
146
|
-
if (serializedObject.hasModifiedProperties) serializedObject.ApplyModifiedProperties();
|
|
100
|
+
if (this.serializedObject.hasModifiedProperties) this.serializedObject.ApplyModifiedProperties();
|
|
147
101
|
}
|
|
148
102
|
|
|
149
103
|
[MenuItem("XmobiTea GN/Open Settings")]
|
|
@@ -201,7 +155,7 @@
|
|
|
201
155
|
private static void SyncEnumTypeFolder()
|
|
202
156
|
{
|
|
203
157
|
var gnServerSettings = GetSettings();
|
|
204
|
-
var dir = Application.dataPath + "/../../" + gnServerSettings.
|
|
158
|
+
var dir = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/enumType";
|
|
205
159
|
|
|
206
160
|
var allPathFiles = Directory.GetFiles(dir, "*.ts");
|
|
207
161
|
for (var i = 0; i < allPathFiles.Length; i++)
|
|
@@ -258,7 +212,7 @@
|
|
|
258
212
|
private static void SyncParameterCodeFolder()
|
|
259
213
|
{
|
|
260
214
|
var gnServerSettings = GetSettings();
|
|
261
|
-
var dir = Application.dataPath + "/../../" + gnServerSettings.
|
|
215
|
+
var dir = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/parameterCode";
|
|
262
216
|
|
|
263
217
|
var allPathFiles = Directory.GetFiles(dir, "*.ts");
|
|
264
218
|
for (var i = 0; i < allPathFiles.Length; i++)
|
|
@@ -321,7 +275,7 @@
|
|
|
321
275
|
private static void SyncErrorCodeFolder()
|
|
322
276
|
{
|
|
323
277
|
var gnServerSettings = GetSettings();
|
|
324
|
-
var dir = Application.dataPath + "/../../" + gnServerSettings.
|
|
278
|
+
var dir = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/errorCode";
|
|
325
279
|
|
|
326
280
|
var allPathFiles = Directory.GetFiles(dir, "*.ts");
|
|
327
281
|
for (var i = 0; i < allPathFiles.Length; i++)
|
|
@@ -392,7 +346,7 @@
|
|
|
392
346
|
const string Template = "public const int $name = $code;";
|
|
393
347
|
|
|
394
348
|
var gnServerSettings = GetSettings();
|
|
395
|
-
var dirPath = Application.dataPath + "/../../" + gnServerSettings.
|
|
349
|
+
var dirPath = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/OperationCode.ext.ts";
|
|
396
350
|
var allLines = File.ReadAllLines(dirPath);
|
|
397
351
|
|
|
398
352
|
var stringBuilder = new StringBuilder();
|
|
@@ -435,7 +389,7 @@
|
|
|
435
389
|
const string Template = "public const int $name = $code;";
|
|
436
390
|
|
|
437
391
|
var gnServerSettings = GetSettings();
|
|
438
|
-
var dirPath = Application.dataPath + "/../../" + gnServerSettings.
|
|
392
|
+
var dirPath = Application.dataPath + "/../../" + gnServerSettings.getGNServerSourcePath() + "/src/common/constant/EventCode.ext.ts";
|
|
439
393
|
var allLines = File.ReadAllLines(dirPath);
|
|
440
394
|
|
|
441
395
|
var stringBuilder = new StringBuilder();
|
|
@@ -4,86 +4,122 @@
|
|
|
4
4
|
using System.Collections.Generic;
|
|
5
5
|
using System.Text;
|
|
6
6
|
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// The GNData array, it store Array can be use to request or response
|
|
9
|
+
/// </summary>
|
|
7
10
|
public class GNArray : GNData
|
|
8
11
|
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// Builder for GNArray
|
|
14
|
+
/// </summary>
|
|
9
15
|
public class Builder
|
|
10
16
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
/// <summary>
|
|
18
|
+
/// The origin array
|
|
19
|
+
/// </summary>
|
|
20
|
+
private List<object> array;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Add a value to origin array
|
|
24
|
+
/// </summary>
|
|
25
|
+
/// <param name="value">The value type must is string, bool, number, Map or Array</param>
|
|
26
|
+
/// <returns></returns>
|
|
27
|
+
public Builder add(object value)
|
|
14
28
|
{
|
|
15
|
-
|
|
29
|
+
this.array.Add(value);
|
|
16
30
|
|
|
17
31
|
return this;
|
|
18
32
|
}
|
|
19
33
|
|
|
20
|
-
|
|
34
|
+
/// <summary>
|
|
35
|
+
/// Add some values to origin array
|
|
36
|
+
/// </summary>
|
|
37
|
+
/// <param name="list">The element value type must is type string, bool, number, Map or Array</param>
|
|
38
|
+
/// <returns></returns>
|
|
39
|
+
public Builder addAll(System.Collections.IList list)
|
|
21
40
|
{
|
|
22
41
|
foreach (var o in list)
|
|
23
42
|
{
|
|
24
|
-
|
|
43
|
+
this.add(o);
|
|
25
44
|
}
|
|
26
45
|
|
|
27
46
|
return this;
|
|
28
47
|
}
|
|
29
48
|
|
|
30
|
-
|
|
49
|
+
/// <summary>
|
|
50
|
+
/// Build GNArray
|
|
51
|
+
/// </summary>
|
|
52
|
+
/// <returns></returns>
|
|
53
|
+
public GNArray build()
|
|
31
54
|
{
|
|
32
55
|
var awnser = new GNArray();
|
|
33
56
|
|
|
34
|
-
foreach (var o in
|
|
57
|
+
foreach (var o in this.array)
|
|
35
58
|
{
|
|
36
|
-
awnser.
|
|
59
|
+
awnser.add(o);
|
|
37
60
|
}
|
|
38
61
|
|
|
39
62
|
return awnser;
|
|
40
63
|
}
|
|
41
64
|
|
|
65
|
+
/// <summary>
|
|
66
|
+
/// Constructor for GNArray builder
|
|
67
|
+
/// </summary>
|
|
42
68
|
public Builder()
|
|
43
69
|
{
|
|
44
|
-
|
|
70
|
+
this.array = new List<object>();
|
|
45
71
|
}
|
|
46
72
|
}
|
|
47
73
|
|
|
48
|
-
|
|
74
|
+
/// <summary>
|
|
75
|
+
/// The GN array
|
|
76
|
+
/// </summary>
|
|
77
|
+
private List<object> array;
|
|
49
78
|
|
|
79
|
+
/// <summary>
|
|
80
|
+
/// The constructor for GNArray
|
|
81
|
+
/// </summary>
|
|
50
82
|
public GNArray()
|
|
51
83
|
{
|
|
52
|
-
this.
|
|
84
|
+
this.array = new List<object>();
|
|
53
85
|
}
|
|
54
86
|
|
|
55
|
-
|
|
87
|
+
/// <summary>
|
|
88
|
+
/// Add a value
|
|
89
|
+
/// </summary>
|
|
90
|
+
/// <param name="value">The </param>
|
|
91
|
+
public void add(object value)
|
|
56
92
|
{
|
|
57
|
-
this.
|
|
93
|
+
this.array.Add(GNData.createUseDataFromOriginData(value));
|
|
58
94
|
}
|
|
59
95
|
|
|
60
|
-
public ICollection<object>
|
|
96
|
+
public ICollection<object> values()
|
|
61
97
|
{
|
|
62
|
-
return this.
|
|
98
|
+
return this.array;
|
|
63
99
|
}
|
|
64
100
|
|
|
65
|
-
public void
|
|
101
|
+
public void clear()
|
|
66
102
|
{
|
|
67
|
-
this.
|
|
103
|
+
this.array.Clear();
|
|
68
104
|
}
|
|
69
105
|
|
|
70
|
-
public bool
|
|
106
|
+
public bool remove(int index)
|
|
71
107
|
{
|
|
72
|
-
this.
|
|
108
|
+
this.array.RemoveAt(index);
|
|
73
109
|
|
|
74
110
|
return true;
|
|
75
111
|
}
|
|
76
112
|
|
|
77
|
-
public int
|
|
113
|
+
public int count()
|
|
78
114
|
{
|
|
79
|
-
return this.
|
|
115
|
+
return this.array.Count;
|
|
80
116
|
}
|
|
81
117
|
|
|
82
|
-
protected object
|
|
118
|
+
protected object get<T>(int k, T defaultValue = default(T))
|
|
83
119
|
{
|
|
84
|
-
if (k < 0 || k > this.
|
|
120
|
+
if (k < 0 || k > this.array.Count - 1) return defaultValue;
|
|
85
121
|
|
|
86
|
-
var value = this.
|
|
122
|
+
var value = this.array[k];
|
|
87
123
|
|
|
88
124
|
if (value == null) return defaultValue;
|
|
89
125
|
|
|
@@ -95,155 +131,155 @@
|
|
|
95
131
|
return value;
|
|
96
132
|
}
|
|
97
133
|
|
|
98
|
-
public T[]
|
|
134
|
+
public T[] toArray<T>()
|
|
99
135
|
{
|
|
100
|
-
var answer = new T[this.
|
|
136
|
+
var answer = new T[this.array.Count];
|
|
101
137
|
|
|
102
|
-
for (var i = 0; i < this.
|
|
138
|
+
for (var i = 0; i < this.array.Count; i++)
|
|
103
139
|
{
|
|
104
|
-
answer[i] = (T)this.
|
|
140
|
+
answer[i] = (T)this.customGet(i);
|
|
105
141
|
}
|
|
106
142
|
|
|
107
143
|
return answer;
|
|
108
144
|
}
|
|
109
145
|
|
|
110
|
-
public IList<T>
|
|
146
|
+
public IList<T> toList<T>()
|
|
111
147
|
{
|
|
112
148
|
var answer = new List<T>();
|
|
113
149
|
|
|
114
|
-
for (var i = 0; i < this.
|
|
150
|
+
for (var i = 0; i < this.array.Count; i++)
|
|
115
151
|
{
|
|
116
|
-
answer.Add((T)this.
|
|
152
|
+
answer.Add((T)this.customGet(i));
|
|
117
153
|
}
|
|
118
154
|
|
|
119
155
|
return answer;
|
|
120
156
|
}
|
|
121
157
|
|
|
122
|
-
private object
|
|
158
|
+
private object customGet(int k)
|
|
123
159
|
{
|
|
124
|
-
var obj = this.
|
|
160
|
+
var obj = this.get<object>(k);
|
|
125
161
|
if (obj == null) return null;
|
|
126
162
|
|
|
127
163
|
var objType = obj.GetType();
|
|
128
|
-
if (objType == typeof(byte)) return this.
|
|
129
|
-
else if (objType == typeof(sbyte)) return this.
|
|
130
|
-
else if (objType == typeof(short)) return this.
|
|
131
|
-
else if (objType == typeof(int)) return this.
|
|
132
|
-
else if (objType == typeof(float)) return this.
|
|
133
|
-
else if (objType == typeof(long)) return this.
|
|
134
|
-
else if (objType == typeof(double)) return this.
|
|
135
|
-
else if (objType == typeof(bool)) return this.
|
|
136
|
-
else if (objType == typeof(string)) return this.
|
|
137
|
-
else if (objType == typeof(GNArray) || objType == typeof(System.Collections.IList)) return this.
|
|
138
|
-
else if (objType == typeof(GNHashtable) || objType == typeof(System.Collections.IDictionary)) return this.
|
|
164
|
+
if (objType == typeof(byte)) return this.getByte(k);
|
|
165
|
+
else if (objType == typeof(sbyte)) return this.getSByte(k);
|
|
166
|
+
else if (objType == typeof(short)) return this.getShort(k);
|
|
167
|
+
else if (objType == typeof(int)) return this.getInt(k);
|
|
168
|
+
else if (objType == typeof(float)) return this.getFloat(k);
|
|
169
|
+
else if (objType == typeof(long)) return this.getLong(k);
|
|
170
|
+
else if (objType == typeof(double)) return this.getDouble(k);
|
|
171
|
+
else if (objType == typeof(bool)) return this.getBool(k);
|
|
172
|
+
else if (objType == typeof(string)) return this.getString(k);
|
|
173
|
+
else if (objType == typeof(GNArray) || objType == typeof(System.Collections.IList)) return this.getGNArray(k);
|
|
174
|
+
else if (objType == typeof(GNHashtable) || objType == typeof(System.Collections.IDictionary)) return this.getGNHashtable(k);
|
|
139
175
|
|
|
140
176
|
return obj;
|
|
141
177
|
}
|
|
142
178
|
|
|
143
|
-
public byte
|
|
179
|
+
public byte getByte(int k, byte defaultValue = 0)
|
|
144
180
|
{
|
|
145
|
-
return Convert.ToByte(this.
|
|
181
|
+
return Convert.ToByte(this.get(k, defaultValue));
|
|
146
182
|
}
|
|
147
183
|
|
|
148
|
-
public sbyte
|
|
184
|
+
public sbyte getSByte(int k, sbyte defaultValue = 0)
|
|
149
185
|
{
|
|
150
|
-
return Convert.ToSByte(this.
|
|
186
|
+
return Convert.ToSByte(this.get(k, defaultValue));
|
|
151
187
|
}
|
|
152
188
|
|
|
153
|
-
public short
|
|
189
|
+
public short getShort(int k, short defaultValue = 0)
|
|
154
190
|
{
|
|
155
|
-
return Convert.ToInt16(this.
|
|
191
|
+
return Convert.ToInt16(this.get(k, defaultValue));
|
|
156
192
|
}
|
|
157
193
|
|
|
158
|
-
public int
|
|
194
|
+
public int getInt(int k, int defaultValue = 0)
|
|
159
195
|
{
|
|
160
|
-
return Convert.ToInt32(this.
|
|
196
|
+
return Convert.ToInt32(this.get(k, defaultValue));
|
|
161
197
|
}
|
|
162
198
|
|
|
163
|
-
public float
|
|
199
|
+
public float getFloat(int k, float defaultValue = 0)
|
|
164
200
|
{
|
|
165
|
-
return Convert.ToSingle(this.
|
|
201
|
+
return Convert.ToSingle(this.get(k, defaultValue));
|
|
166
202
|
}
|
|
167
203
|
|
|
168
|
-
public long
|
|
204
|
+
public long getLong(int k, long defaultValue = 0)
|
|
169
205
|
{
|
|
170
|
-
return Convert.ToInt64(this.
|
|
206
|
+
return Convert.ToInt64(this.get(k, defaultValue));
|
|
171
207
|
}
|
|
172
208
|
|
|
173
|
-
public double
|
|
209
|
+
public double getDouble(int k, double defaultValue = 0)
|
|
174
210
|
{
|
|
175
|
-
return Convert.ToDouble(this.
|
|
211
|
+
return Convert.ToDouble(this.get(k, defaultValue));
|
|
176
212
|
}
|
|
177
213
|
|
|
178
|
-
public bool
|
|
214
|
+
public bool getBool(int k, bool defaultValue = false)
|
|
179
215
|
{
|
|
180
|
-
return Convert.ToBoolean(this.
|
|
216
|
+
return Convert.ToBoolean(this.get(k, defaultValue));
|
|
181
217
|
}
|
|
182
218
|
|
|
183
|
-
public string
|
|
219
|
+
public string getString(int k, string defaultValue = null)
|
|
184
220
|
{
|
|
185
|
-
return Convert.ToString(this.
|
|
221
|
+
return Convert.ToString(this.get(k, defaultValue));
|
|
186
222
|
}
|
|
187
223
|
|
|
188
|
-
public object
|
|
224
|
+
public object getObject(int k, object defaultValue = null)
|
|
189
225
|
{
|
|
190
|
-
return this.
|
|
226
|
+
return this.get(k, defaultValue);
|
|
191
227
|
}
|
|
192
228
|
|
|
193
|
-
public T[]
|
|
229
|
+
public T[] getArray<T>(int k, T[] defaultValue = null)
|
|
194
230
|
{
|
|
195
|
-
var value0 = this.
|
|
231
|
+
var value0 = this.getGNArray(k);
|
|
196
232
|
if (value0 != null)
|
|
197
233
|
{
|
|
198
|
-
return value0.
|
|
234
|
+
return value0.toArray<T>();
|
|
199
235
|
}
|
|
200
236
|
|
|
201
237
|
return defaultValue;
|
|
202
238
|
}
|
|
203
239
|
|
|
204
|
-
public IList<T>
|
|
240
|
+
public IList<T> getList<T>(int k, IList<T> defaultValue = null)
|
|
205
241
|
{
|
|
206
|
-
var value0 = this.
|
|
242
|
+
var value0 = this.getGNArray(k);
|
|
207
243
|
if (value0 != null)
|
|
208
244
|
{
|
|
209
|
-
return value0.
|
|
245
|
+
return value0.toList<T>();
|
|
210
246
|
}
|
|
211
247
|
|
|
212
248
|
return defaultValue;
|
|
213
249
|
}
|
|
214
250
|
|
|
215
|
-
public GNArray
|
|
251
|
+
public GNArray getGNArray(int k, GNArray defaultValue = null)
|
|
216
252
|
{
|
|
217
|
-
return (GNArray)this.
|
|
253
|
+
return (GNArray)this.get(k, defaultValue);
|
|
218
254
|
}
|
|
219
255
|
|
|
220
|
-
public GNHashtable
|
|
256
|
+
public GNHashtable getGNHashtable(int k, GNHashtable defaultValue = null)
|
|
221
257
|
{
|
|
222
|
-
return (GNHashtable)this.
|
|
258
|
+
return (GNHashtable)this.get(k, defaultValue);
|
|
223
259
|
}
|
|
224
260
|
|
|
225
|
-
public override object
|
|
261
|
+
public override object toData()
|
|
226
262
|
{
|
|
227
263
|
var answer = new List<object>();
|
|
228
264
|
|
|
229
|
-
foreach (var c in
|
|
265
|
+
foreach (var c in this.array)
|
|
230
266
|
{
|
|
231
|
-
answer.Add(
|
|
267
|
+
answer.Add(GNData.createDataFromUseData(c));
|
|
232
268
|
}
|
|
233
269
|
|
|
234
270
|
return answer;
|
|
235
271
|
}
|
|
236
272
|
|
|
237
|
-
public override string
|
|
273
|
+
public override string toString()
|
|
238
274
|
{
|
|
239
275
|
var stringBuilder = new StringBuilder();
|
|
240
276
|
stringBuilder.Append("[");
|
|
241
277
|
|
|
242
|
-
for (var i = 0; i <
|
|
278
|
+
for (var i = 0; i < this.array.Count; i++)
|
|
243
279
|
{
|
|
244
280
|
if (i != 0) stringBuilder.Append(",");
|
|
245
281
|
|
|
246
|
-
var value =
|
|
282
|
+
var value = this.array[i];
|
|
247
283
|
|
|
248
284
|
if (value == null) stringBuilder.Append("null");
|
|
249
285
|
else if (value is GNData gnData) stringBuilder.Append(gnData.ToString());
|
|
@@ -256,6 +292,11 @@
|
|
|
256
292
|
return stringBuilder.ToString();
|
|
257
293
|
}
|
|
258
294
|
|
|
295
|
+
public override string ToString()
|
|
296
|
+
{
|
|
297
|
+
return this.toString();
|
|
298
|
+
}
|
|
299
|
+
|
|
259
300
|
}
|
|
260
301
|
|
|
261
302
|
}
|
package/Runtime/Common/GNData.cs
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
namespace XmobiTea.GN.Common
|
|
2
2
|
{
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// The base class for GNData
|
|
6
|
+
/// </summary>
|
|
7
|
+
public abstract class GNData : IGNData
|
|
4
8
|
{
|
|
5
|
-
protected static object
|
|
9
|
+
protected static object createUseDataFromOriginData(object value)
|
|
6
10
|
{
|
|
7
11
|
if (value == null) return null;
|
|
8
12
|
|
|
9
13
|
if (value is System.Collections.IList list)
|
|
10
14
|
{
|
|
11
|
-
var answer = new GNArray.Builder().
|
|
15
|
+
var answer = new GNArray.Builder().addAll(list).build();
|
|
12
16
|
|
|
13
17
|
return answer;
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
if (value is System.Collections.IDictionary dict)
|
|
17
21
|
{
|
|
18
|
-
var answer = new GNHashtable.Builder().
|
|
22
|
+
var answer = new GNHashtable.Builder().addAll(dict).build();
|
|
19
23
|
|
|
20
24
|
return answer;
|
|
21
25
|
}
|
|
@@ -23,19 +27,21 @@
|
|
|
23
27
|
return value;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
protected static object
|
|
30
|
+
protected static object createDataFromUseData(object value)
|
|
27
31
|
{
|
|
28
32
|
if (value == null) return null;
|
|
29
33
|
|
|
30
34
|
if (value is IGNData gnData)
|
|
31
35
|
{
|
|
32
|
-
return gnData.
|
|
36
|
+
return gnData.toData();
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
return value;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
public
|
|
42
|
+
public abstract object toData();
|
|
43
|
+
|
|
44
|
+
public abstract string toString();
|
|
39
45
|
|
|
40
46
|
}
|
|
41
47
|
|