[U] add PlayFab SDK and SNS login improvements
- Add PlayFabSDK as local package dependency - Add PlayFabTool.cs for PlayFab API integration - Implement LoginBySns method in TYSdkFacade - Add Android SNS login support in SDKManager and UnityBridgeFunc - Add Build Android With Debug menu option - Improve exception handling and timeout management 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -153,24 +153,24 @@ namespace tysdk
|
||||
|
||||
public async Task<LoginInfo> Login(EAccoutType accoutType)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
await Task.Yield();
|
||||
var deviceId = UnityEngine.Device.SystemInfo.deviceUniqueIdentifier.Split('-')[0].Substring(0, 8);
|
||||
|
||||
var userId = (int)ulong.Parse(deviceId, System.Globalization.NumberStyles.HexNumber);
|
||||
|
||||
_accountInfo = new AccountInfo()
|
||||
{
|
||||
userId = userId,
|
||||
};
|
||||
|
||||
return new LoginInfo()
|
||||
{
|
||||
isSuccess = true,
|
||||
userId = userId
|
||||
};
|
||||
|
||||
#elif UNITY_ANDROID || UNITY_IOS
|
||||
// #if UNITY_EDITOR
|
||||
// await Task.Yield();
|
||||
// var deviceId = UnityEngine.Device.SystemInfo.deviceUniqueIdentifier.Split('-')[0].Substring(0, 8);
|
||||
//
|
||||
// var userId = (int)ulong.Parse(deviceId, System.Globalization.NumberStyles.HexNumber);
|
||||
//
|
||||
// _accountInfo = new AccountInfo()
|
||||
// {
|
||||
// userId = userId,
|
||||
// };
|
||||
//
|
||||
// return new LoginInfo()
|
||||
// {
|
||||
// isSuccess = true,
|
||||
// userId = userId
|
||||
// };
|
||||
//
|
||||
// #elif UNITY_ANDROID || UNITY_IOS
|
||||
|
||||
|
||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(30));
|
||||
@@ -193,7 +193,7 @@ namespace tysdk
|
||||
Debug.LogWarning($"[TYSdkFacade] Login failed: {e}");
|
||||
return new LoginInfo(){isSuccess = false};
|
||||
}
|
||||
#endif
|
||||
// #endif
|
||||
}
|
||||
|
||||
public async Task<LoginInfo> LoginByToken()
|
||||
@@ -220,6 +220,31 @@ namespace tysdk
|
||||
return new LoginInfo() { isSuccess = false };
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<LoginInfo> LoginBySns()
|
||||
{
|
||||
var accoutInfo = AccountInfo.GetSavedAccoutInfo();
|
||||
if (accoutInfo == null) return new LoginInfo();
|
||||
|
||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LoginInfo>(TimeSpan.FromSeconds(30));
|
||||
|
||||
UnityBridgeFunc.UnityLoginByTokenFun(accoutInfo.token);
|
||||
|
||||
try
|
||||
{
|
||||
var loginInfo = await task;
|
||||
if (loginInfo.isSuccess)
|
||||
{
|
||||
_accountInfo.Save();
|
||||
}
|
||||
return loginInfo;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogWarning($"[TYSdkFacade] Login by token failed: {e}");
|
||||
return new LoginInfo() { isSuccess = false };
|
||||
}
|
||||
}
|
||||
|
||||
public void LoginResult(string json)
|
||||
{
|
||||
@@ -285,7 +310,7 @@ namespace tysdk
|
||||
if (_accountInfo == null) return new LinkResult(){ code = 1};
|
||||
if (_accountInfo.linkedAccout.Contains(accoutType)) return new LinkResult(){ code = 0};
|
||||
|
||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LinkResult>();
|
||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<LinkResult>(TimeSpan.FromMinutes(1));
|
||||
UnityBridgeFunc.LinkAccount(accoutType);
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user