diff --git a/Plugins/Android/libs/TDSSDK_v1.0.4.aar b/Plugins/Android/libs/TDSSDK_v1.0.4.aar index 2ac6427..78da4bb 100644 Binary files a/Plugins/Android/libs/TDSSDK_v1.0.4.aar and b/Plugins/Android/libs/TDSSDK_v1.0.4.aar differ diff --git a/Plugins/iOS/TDSSDK.framework/Headers/TDSSDKConstants.h b/Plugins/iOS/TDSSDK.framework/Headers/TDSSDKConstants.h index a3b37aa..b6c4c17 100644 --- a/Plugins/iOS/TDSSDK.framework/Headers/TDSSDKConstants.h +++ b/Plugins/iOS/TDSSDK.framework/Headers/TDSSDKConstants.h @@ -9,15 +9,15 @@ NS_ASSUME_NONNULL_BEGIN -FOUNDATION_EXTERN int const ERROR_CODE_NORMAL; -FOUNDATION_EXTERN int const ERROR_CODE_NOT_INIT; +FOUNDATION_EXTERN int const ERROR_CODE_UNDEFINED; +FOUNDATION_EXTERN int const ERROR_CODE_UNINITIALIZED; FOUNDATION_EXTERN int const ERROR_CODE_BIND_CANCEL; FOUNDATION_EXTERN int const ERROR_CODE_BIND_ERROR; -FOUNDATION_EXTERN int const ERROR_CODE_LOGOUT_LOGIN_STATE_INVALID; +FOUNDATION_EXTERN int const ERROR_CODE_LOGOUT_INVALID_LOGIN_STATE; FOUNDATION_EXTERN int const ERROR_CODE_LOGOUT_USER_CENER_LOGOUT; FOUNDATION_EXTERN int const ERROR_CODE_LOGOUT_GAME; -FOUNDATION_EXTERN int const ERROR_CODE_LOGOUT_ANOTHER_LOGIN; +FOUNDATION_EXTERN int const ERROR_CODE_LOGOUT_KICKED; NS_ASSUME_NONNULL_END diff --git a/Plugins/iOS/TDSSDK.framework/TDSSDK b/Plugins/iOS/TDSSDK.framework/TDSSDK index 151822e..1f870ef 100644 Binary files a/Plugins/iOS/TDSSDK.framework/TDSSDK and b/Plugins/iOS/TDSSDK.framework/TDSSDK differ diff --git a/Script/Runtime/ITDS.cs b/Script/Runtime/ITDS.cs index 4010868..68da460 100644 --- a/Script/Runtime/ITDS.cs +++ b/Script/Runtime/ITDS.cs @@ -69,4 +69,43 @@ public enum TDSLanguage LANG_EN = 2 } + public enum ErrorCode + { + /* + * 未知错误 + */ + ERROR_CODE_UNDEFINED = 80000, + + /** + * SDK 未初始化 + */ + ERROR_CODE_UNINITIALIZED = 80001, + + /** + * 绑定取消 + */ + ERROR_CODE_BIND_CANCEL = 80002, + /** + * 绑定错误 + */ + ERROR_CODE_BIND_ERROR = 80003, + + /** + * 登陆错误 + */ + ERROR_CODE_LOGOUT_INVALID_LOGIN_STATE = 80004, + + /** + * 登陆被踢出 + */ + ERROR_CODE_LOGOUT_KICKED = 80007, + + /** + * 桥接回调错误 + */ + ERROR_CODE_BRIDGE_EXECUTE = 80080 + + } + + } \ No newline at end of file diff --git a/Script/Runtime/TDSError.cs b/Script/Runtime/TDSError.cs index 52d97ad..4b17f4e 100644 --- a/Script/Runtime/TDSError.cs +++ b/Script/Runtime/TDSError.cs @@ -7,18 +7,30 @@ namespace TapSDK { public class TDSSDKError { - public int code; + public ErrorCode code; public string errorDescription; public TDSSDKError(string json) { Dictionary dic = TDSCommon.Json.Deserialize(json) as Dictionary; - this.code = TDSCommon.SafeDictionary.GetValue(dic, "code"); + int parseCode = TDSCommon.SafeDictionary.GetValue(dic, "code"); + this.code = ParseCode(parseCode); this.errorDescription = TDSCommon.SafeDictionary.GetValue(dic, "error_description"); } public TDSSDKError(int code,string errorDescription) + { + this.code = ParseCode(code); + this.errorDescription = errorDescription; + } + + public ErrorCode ParseCode(int parseCode) + { + return Enum.IsDefined(typeof(ErrorCode),parseCode) ? (ErrorCode) Enum.ToObject(typeof(ErrorCode),parseCode) : ErrorCode.ERROR_CODE_UNDEFINED; + } + + public TDSSDKError(ErrorCode code,string errorDescription) { this.code = code; this.errorDescription = errorDescription; diff --git a/Script/Runtime/TDSSDKImpl.cs b/Script/Runtime/TDSSDKImpl.cs index f0a741e..cad5ac4 100644 --- a/Script/Runtime/TDSSDKImpl.cs +++ b/Script/Runtime/TDSSDKImpl.cs @@ -54,7 +54,7 @@ public void RegisterTDSSDKLoginResultCallback(TDSLoginResultCallback callback) { if (!CheckBridgeResult(result)) { - callback.OnLoginError(new TDSSDKError(-1, "Bridge execute RegisterTDSSDKLoginResultCallback Error!")); + callback.OnLoginError(new TDSSDKError(ErrorCode.ERROR_CODE_BRIDGE_EXECUTE, "Bridge execute RegisterTDSSDKLoginResultCallback Error!")); return; } TDSLoginWrapper loginWrapper = new TDSLoginWrapper(result.content); @@ -149,7 +149,7 @@ public void GetUserInfo(Action callback) { if (!CheckBridgeResult(result)) { - callback(null, new TDSSDKError(-1, "Bridge execute GetUserInfo Error!")); + callback(null, new TDSSDKError(ErrorCode.ERROR_CODE_BRIDGE_EXECUTE, "Bridge execute GetUserInfo Error!")); return; } @@ -178,7 +178,7 @@ public void GetUserDetailInfo(Action callback) Debug.Log("result:" + result.toJSON()); if (!CheckBridgeResult(result)) { - callback(null, new TDSSDKError(-1, "Bridge execute GetDetailInfo Error!")); + callback(null, new TDSSDKError(ErrorCode.ERROR_CODE_BRIDGE_EXECUTE, "Bridge execute GetDetailInfo Error!")); return; } TDSUserDetailInfoWrapper detailInfoWrapper = new TDSUserDetailInfoWrapper(result.content); diff --git a/package.json b/package.json index a60b3e7..5d5a2fa 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,6 @@ "unity": "2018.3", "license": "MIT", "dependencies": { - "com.tds.sdk": "https://github.com/xindong/TAPSDK_UPM.git#1.0.7.3-alpha" + "com.tds.sdk": "https://github.com/xindong/TAPSDK_UPM.git#1.0.7.6-alpha" } } \ No newline at end of file