[U] Sync n3
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: a2476ed86dea148a3b7327293f8372cd
|
guid: 56f87573a715b418e8502b3402d41a44
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@@ -55,6 +55,14 @@ namespace tysdk.editor
|
|||||||
File.WriteAllText(mainAppPath, newContent);
|
File.WriteAllText(mainAppPath, newContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ProceeFirebasePlist(string target, PBXProject proj, string root)
|
||||||
|
{
|
||||||
|
var plistPath = Path.Combine("Packages/tysdk/Files", "GoogleService-Info.plist");
|
||||||
|
File.Copy(plistPath, $"{root}/GoogleService-Info.plist", true);
|
||||||
|
var plistGuid = proj.AddFile("GoogleService-Info.plist", "GoogleService-Info.plist", PBXSourceTree.Source);
|
||||||
|
proj.AddFileToBuild(target, plistGuid);
|
||||||
|
}
|
||||||
|
|
||||||
private static void XCodeSetSigingAndCapbilities(string target, PBXProject proj, string root)
|
private static void XCodeSetSigingAndCapbilities(string target, PBXProject proj, string root)
|
||||||
{
|
{
|
||||||
var entitlementsContent = File.ReadAllText("Packages/tysdk/Files/Unity-iPhone.entitlements");
|
var entitlementsContent = File.ReadAllText("Packages/tysdk/Files/Unity-iPhone.entitlements");
|
||||||
@@ -66,14 +74,6 @@ namespace tysdk.editor
|
|||||||
//proj.AddCapability(target, PBXCapabilityType.AssociatedDomains, "Unity-iPhone/Unity-iPhone.entitlements");
|
//proj.AddCapability(target, PBXCapabilityType.AssociatedDomains, "Unity-iPhone/Unity-iPhone.entitlements");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProceeFirebasePlist(string target, PBXProject proj, string root)
|
|
||||||
{
|
|
||||||
var plistPath = Path.Combine("Packages/tysdk/Files", "GoogleService-Info.plist");
|
|
||||||
File.Copy(plistPath, $"{root}/GoogleService-Info.plist", true);
|
|
||||||
var plistGuid = proj.AddFile("GoogleService-Info.plist", "GoogleService-Info.plist", PBXSourceTree.Source);
|
|
||||||
proj.AddFileToBuild(target, plistGuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ProcessBuildSettings(PBXProject proj)
|
private static void ProcessBuildSettings(PBXProject proj)
|
||||||
{
|
{
|
||||||
string target = proj.TargetGuidByName("GameAssembly");
|
string target = proj.TargetGuidByName("GameAssembly");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: de52d9ff9949f4d54b71776fb23da414
|
guid: fe43ff94ee6dd4dc980ffa685191687c
|
||||||
TextScriptImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
|||||||
@@ -72,13 +72,8 @@ public class SDKManager {
|
|||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
JSONObject serverResponse = new JSONObject(s);
|
JSONObject serverResponse = new JSONObject(s);
|
||||||
JSONObject userInfo = serverResponse.getJSONObject("result");
|
JSONObject userInfo = serverResponse.getJSONObject("result");
|
||||||
JSONObject userInfoReorganization = new JSONObject();
|
|
||||||
userInfoReorganization.put("userId", userInfo.optString("userId"));
|
|
||||||
userInfoReorganization.put("token", userInfo.optString("token"));
|
|
||||||
userInfoReorganization.put("jwttoken", userInfo.optString("jwttoken"));
|
|
||||||
userInfoReorganization.put("loginChannelTypeC", userInfo.optString("loginChannelTypeC"));
|
|
||||||
JSONObject userInfoResult = new JSONObject();
|
JSONObject userInfoResult = new JSONObject();
|
||||||
userInfoResult.put("result", userInfoReorganization);
|
userInfoResult.put("result", userInfo);
|
||||||
result.put("respObj", userInfoResult);
|
result.put("respObj", userInfoResult);
|
||||||
} else {
|
} else {
|
||||||
result.put("errStr", s);
|
result.put("errStr", s);
|
||||||
|
|||||||
Binary file not shown.
@@ -1,87 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f09db8f4c73f97540a96ebe183df5fd1
|
|
||||||
PluginImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
iconMap: {}
|
|
||||||
executionOrder: {}
|
|
||||||
defineConstraints: []
|
|
||||||
isPreloaded: 0
|
|
||||||
isOverridable: 0
|
|
||||||
isExplicitlyReferenced: 0
|
|
||||||
validateReferences: 1
|
|
||||||
platformData:
|
|
||||||
- first:
|
|
||||||
: Any
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
Exclude Android: 1
|
|
||||||
Exclude Editor: 1
|
|
||||||
Exclude Linux64: 1
|
|
||||||
Exclude OSXUniversal: 1
|
|
||||||
Exclude Win: 1
|
|
||||||
Exclude Win64: 1
|
|
||||||
Exclude iOS: 1
|
|
||||||
- first:
|
|
||||||
Android: Android
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
AndroidSharedLibraryType: Executable
|
|
||||||
CPU: ARMv7
|
|
||||||
- first:
|
|
||||||
Any:
|
|
||||||
second:
|
|
||||||
enabled: 1
|
|
||||||
settings: {}
|
|
||||||
- first:
|
|
||||||
Editor: Editor
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: AnyCPU
|
|
||||||
DefaultValueInitialized: true
|
|
||||||
OS: AnyOS
|
|
||||||
- first:
|
|
||||||
Standalone: Linux64
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Standalone: OSXUniversal
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Standalone: Win
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Standalone: Win64
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Windows Store Apps: WindowsStoreApps
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: AnyCPU
|
|
||||||
- first:
|
|
||||||
iPhone: iOS
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
AddToEmbeddedBinaries: false
|
|
||||||
CPU: AnyCPU
|
|
||||||
CompileFlags:
|
|
||||||
FrameworkDependencies:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: bacddd479751940f38f3f6cbe40aed5c
|
guid: 07220c05f1f0b4944b33ce5b6d053876
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@@ -14,35 +14,14 @@ namespace tysdk
|
|||||||
{
|
{
|
||||||
public class AccountInfo
|
public class AccountInfo
|
||||||
{
|
{
|
||||||
#if UNITY_ANDROID
|
|
||||||
|
|
||||||
private static Dictionary<string, EAccoutType> accoutTypeMap = new Dictionary<string, EAccoutType>(){
|
|
||||||
{EAccoutType.hwGoogle.ToString(), EAccoutType.hwGoogle},
|
|
||||||
{EAccoutType.hwFacebook.ToString(), EAccoutType.hwFacebook},
|
|
||||||
{"tyGuest", EAccoutType.hwGuest}
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
|
|
||||||
private static Dictionary<string, EAccoutType> accoutTypeMap = new Dictionary<string, EAccoutType>(){
|
|
||||||
{"google", EAccoutType.hwGoogle},
|
|
||||||
{"fb", EAccoutType.hwFacebook},
|
|
||||||
{"tyGuest", EAccoutType.hwGuest},
|
|
||||||
{"ios13", EAccoutType.Apple}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public int userId;
|
public int userId;
|
||||||
public string token;
|
public string token;
|
||||||
public string jwtToken;
|
public string jwtToken;
|
||||||
public string strUserId => userId.ToString();
|
public string strUserId => userId.ToString();
|
||||||
public string channelstr {
|
|
||||||
set{
|
|
||||||
channel = accoutTypeMap[value];
|
|
||||||
linkedAccout.Add(channel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public HashSet<EAccoutType> linkedAccout = new HashSet<EAccoutType>();
|
public HashSet<EAccoutType> linkedAccout = new HashSet<EAccoutType>();
|
||||||
public EAccoutType channel {get; private set;}
|
public EAccoutType channel {get; set;}
|
||||||
|
public string userName;
|
||||||
|
public string avatar;
|
||||||
|
|
||||||
private const string KEY_ACCOUNT_INFO = "KEY_ACCOUNT_INFO";
|
private const string KEY_ACCOUNT_INFO = "KEY_ACCOUNT_INFO";
|
||||||
|
|
||||||
@@ -54,23 +33,30 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddLinkedAccount(string channel)
|
private static Dictionary<string, EAccoutType> accoutTypeMap = new Dictionary<string, EAccoutType>(){
|
||||||
|
{"google", EAccoutType.hwGoogle},
|
||||||
|
{"fb", EAccoutType.hwFacebook},
|
||||||
|
{"tyGuest", EAccoutType.hwGuest},
|
||||||
|
{"ios13", EAccoutType.Apple}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static EAccoutType ConvertAccoutType(string accountType)
|
||||||
{
|
{
|
||||||
if(accoutTypeMap.TryGetValue(channel, out var accoutType))
|
if (accoutTypeMap.ContainsKey(accountType))
|
||||||
{
|
{
|
||||||
if (!linkedAccout.Contains(accoutType))
|
return accoutTypeMap[accountType];
|
||||||
{
|
|
||||||
linkedAccout.Add(accoutType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return (EAccoutType)Enum.Parse(typeof(EAccoutType), accountType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
JObject jInfo = new JObject();
|
JObject jInfo = new JObject();
|
||||||
jInfo["channel"] = accoutTypeMap.First(x => x.Value == channel).Key;
|
jInfo["channel"] = channel.ToString();
|
||||||
jInfo["token"] = token;
|
jInfo["token"] = token;
|
||||||
jInfo["userId"] = userId;
|
jInfo["userId"] = userId;
|
||||||
|
jInfo["userName"] = userName;
|
||||||
|
jInfo["avatar"] = avatar;
|
||||||
jInfo["jwtToken"] = jwtToken;
|
jInfo["jwtToken"] = jwtToken;
|
||||||
jInfo["linkedAccout"] = string.Join(",", linkedAccout.Select(x => x.ToString()));
|
jInfo["linkedAccout"] = string.Join(",", linkedAccout.Select(x => x.ToString()));
|
||||||
PlayerPrefs.SetString(KEY_ACCOUNT_INFO, jInfo.ToString());
|
PlayerPrefs.SetString(KEY_ACCOUNT_INFO, jInfo.ToString());
|
||||||
@@ -86,14 +72,26 @@ namespace tysdk
|
|||||||
if (PlayerPrefs.HasKey(KEY_ACCOUNT_INFO))
|
if (PlayerPrefs.HasKey(KEY_ACCOUNT_INFO))
|
||||||
{
|
{
|
||||||
var jInfo = JObject.Parse(PlayerPrefs.GetString(KEY_ACCOUNT_INFO));
|
var jInfo = JObject.Parse(PlayerPrefs.GetString(KEY_ACCOUNT_INFO));
|
||||||
return new AccountInfo()
|
var accountInfo = new AccountInfo()
|
||||||
{
|
{
|
||||||
userId = (int)jInfo["userId"],
|
userId = (int)jInfo["userId"],
|
||||||
token = (string)jInfo["token"],
|
token = (string)jInfo["token"],
|
||||||
channelstr = (string)jInfo["channel"],
|
channel = ConvertAccoutType((string)jInfo["channel"]),
|
||||||
jwtToken = (string)jInfo["jwtToken"],
|
jwtToken = (string)jInfo["jwtToken"],
|
||||||
linkedAccout = jInfo["linkedAccout"].ToString().Split(',').Select(x => (EAccoutType)Enum.Parse(typeof(EAccoutType), x)).ToHashSet()
|
linkedAccout = jInfo["linkedAccout"].ToString().Split(',').Select(x => ConvertAccoutType(x)).ToHashSet()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(jInfo.TryGetValue("userName", out var userName))
|
||||||
|
{
|
||||||
|
accountInfo.userName = (string) userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(jInfo.TryGetValue("avatar", out var avatar))
|
||||||
|
{
|
||||||
|
accountInfo.avatar = (string)avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
return accountInfo;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -184,10 +182,15 @@ namespace tysdk
|
|||||||
|
|
||||||
UnityBridgeFunc.UnityLogin(accoutType);
|
UnityBridgeFunc.UnityLogin(accoutType);
|
||||||
|
|
||||||
return await taskSource.Task;
|
var loginInfo = await taskSource.Task;
|
||||||
|
if(loginInfo.isSuccess)
|
||||||
|
{
|
||||||
|
_accountInfo.channel = accoutType;
|
||||||
|
_accountInfo.AddLinkedAccount(accoutType);
|
||||||
|
_accountInfo.Save();
|
||||||
|
}
|
||||||
|
return loginInfo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<LoginInfo> LoginByToken()
|
public async Task<LoginInfo> LoginByToken()
|
||||||
@@ -203,7 +206,12 @@ namespace tysdk
|
|||||||
|
|
||||||
UnityBridgeFunc.UnityLoginByTokenFun(accoutInfo.token);
|
UnityBridgeFunc.UnityLoginByTokenFun(accoutInfo.token);
|
||||||
|
|
||||||
return await taskSource.Task;
|
var loginInfo = await taskSource.Task;
|
||||||
|
if(loginInfo.isSuccess)
|
||||||
|
{
|
||||||
|
_accountInfo.Save();
|
||||||
|
}
|
||||||
|
return loginInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoginResult(string json)
|
public void LoginResult(string json)
|
||||||
@@ -221,7 +229,6 @@ namespace tysdk
|
|||||||
var userId = (int)loginData["userId"];
|
var userId = (int)loginData["userId"];
|
||||||
var token = (string)loginData["token"];
|
var token = (string)loginData["token"];
|
||||||
var jwtToken = (string)loginData["jwttoken"];
|
var jwtToken = (string)loginData["jwttoken"];
|
||||||
var channelstr = (string)loginData["loginChannelTypeC"];
|
|
||||||
|
|
||||||
var savedInfo = AccountInfo.GetSavedAccoutInfo();
|
var savedInfo = AccountInfo.GetSavedAccoutInfo();
|
||||||
if(savedInfo == null || savedInfo.userId != userId)
|
if(savedInfo == null || savedInfo.userId != userId)
|
||||||
@@ -229,19 +236,16 @@ namespace tysdk
|
|||||||
_accountInfo = new AccountInfo()
|
_accountInfo = new AccountInfo()
|
||||||
{
|
{
|
||||||
userId = (int)loginData["userId"],
|
userId = (int)loginData["userId"],
|
||||||
|
userName = (string)loginData["userName"],
|
||||||
|
avatar = (string)loginData["purl"],
|
||||||
token = (string)loginData["token"],
|
token = (string)loginData["token"],
|
||||||
jwtToken = (string)loginData["jwttoken"],
|
jwtToken = (string)loginData["jwttoken"],
|
||||||
channelstr = (string)loginData["loginChannelTypeC"]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_accountInfo.Save();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
savedInfo.token = token;
|
savedInfo.token = token;
|
||||||
savedInfo.jwtToken = jwtToken;
|
savedInfo.jwtToken = jwtToken;
|
||||||
savedInfo.AddLinkedAccount(channelstr);
|
|
||||||
savedInfo.Save();
|
|
||||||
_accountInfo = savedInfo;
|
_accountInfo = savedInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,12 +294,13 @@ namespace tysdk
|
|||||||
var result = await taskSource.Task;
|
var result = await taskSource.Task;
|
||||||
if (result.isSuccess)
|
if (result.isSuccess)
|
||||||
{
|
{
|
||||||
var savedInfo = AccountInfo.GetSavedAccoutInfo();
|
if(_accountInfo == null)
|
||||||
if(savedInfo != null)
|
_accountInfo = AccountInfo.GetSavedAccoutInfo();
|
||||||
|
|
||||||
|
if(_accountInfo != null)
|
||||||
{
|
{
|
||||||
savedInfo.AddLinkedAccount(accoutType);
|
_accountInfo.AddLinkedAccount(accoutType);
|
||||||
savedInfo.Save();
|
_accountInfo.Save();
|
||||||
_accountInfo = savedInfo;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,6 +337,17 @@ namespace tysdk
|
|||||||
UnityBridgeFunc.LinkAccount(accoutType);
|
UnityBridgeFunc.LinkAccount(accoutType);
|
||||||
|
|
||||||
var result = await taskSource.Task;
|
var result = await taskSource.Task;
|
||||||
|
if (result.isSuccess)
|
||||||
|
{
|
||||||
|
if(_accountInfo == null)
|
||||||
|
_accountInfo = AccountInfo.GetSavedAccoutInfo();
|
||||||
|
|
||||||
|
if(_accountInfo != null)
|
||||||
|
{
|
||||||
|
_accountInfo.AddLinkedAccount(accoutType);
|
||||||
|
_accountInfo.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result.isSuccess;
|
return result.isSuccess;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "tysdk",
|
"name": "tysdk",
|
||||||
"rootNamespace": "tysdk",
|
"rootNamespace": "tysdk",
|
||||||
"references": [
|
"references": [],
|
||||||
"GUID:0a958a7eb80a248e1b8bc4553787c209"
|
|
||||||
],
|
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
"allowUnsafeCode": false,
|
"allowUnsafeCode": false,
|
||||||
|
|||||||
Reference in New Issue
Block a user