Skip to content

Commit

Permalink
feat:更新TDSSDK
Browse files Browse the repository at this point in the history
  • Loading branch information
EingShaw committed Mar 23, 2021
1 parent ac0f9ef commit 7db4a43
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 10 deletions.
Binary file modified Plugins/Android/libs/TDSSDK_v1.0.4.aar
Binary file not shown.
8 changes: 4 additions & 4 deletions Plugins/iOS/TDSSDK.framework/Headers/TDSSDKConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file modified Plugins/iOS/TDSSDK.framework/TDSSDK
Binary file not shown.
39 changes: 39 additions & 0 deletions Script/Runtime/ITDS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

}


}
16 changes: 14 additions & 2 deletions Script/Runtime/TDSError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,30 @@ namespace TapSDK
{
public class TDSSDKError
{
public int code;
public ErrorCode code;

public string errorDescription;

public TDSSDKError(string json)
{
Dictionary<string, object> dic = TDSCommon.Json.Deserialize(json) as Dictionary<string, object>;
this.code = TDSCommon.SafeDictionary.GetValue<int>(dic, "code");
int parseCode = TDSCommon.SafeDictionary.GetValue<int>(dic, "code");
this.code = ParseCode(parseCode);
this.errorDescription = TDSCommon.SafeDictionary.GetValue<string>(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;
Expand Down
6 changes: 3 additions & 3 deletions Script/Runtime/TDSSDKImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -149,7 +149,7 @@ public void GetUserInfo(Action<TDSUserInfo, TDSSDKError> 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;
}
Expand Down Expand Up @@ -178,7 +178,7 @@ public void GetUserDetailInfo(Action<TDSUserDetailInfo, TDSSDKError> 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);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit 7db4a43

Please sign in to comment.