com.xd.sdk.account 6.29.1 → 7.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.
Files changed (205) hide show
  1. package/Plugins/Android/libs/XDGAccount_7.0.0.aar +0 -0
  2. package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java.meta → Plugins/Android/libs/XDGAccount_7.0.0.aar.meta} +2 -2
  3. package/Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar +0 -0
  4. package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java.meta → Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar.meta} +2 -2
  5. package/Plugins/Android/libs/XDGSupport_7.0.0.aar +0 -0
  6. package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java.meta → Plugins/Android/libs/XDGSupport_7.0.0.aar.meta} +2 -2
  7. package/Plugins/Android/libs.meta +1 -1
  8. package/Plugins/Android.meta +1 -1
  9. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h +2 -8
  10. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h.meta +1 -1
  11. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK-Swift.h +329 -0
  12. package/Plugins/iOS/XDAccountSDK.framework/Headers/{TDSGlobalThirdPartyLoginManager.h.meta → XDAccountSDK-Swift.h.meta} +1 -1
  13. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h +1 -2
  14. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h.meta +1 -1
  15. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h +29 -43
  16. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h.meta +1 -1
  17. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountDefines.h +43 -0
  18. package/Plugins/iOS/XDAccountSDK.framework/Headers/{XDGPhoneAuthManager.h.meta → XDGAccountDefines.h.meta} +1 -1
  19. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h +3 -3
  20. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h.meta +1 -1
  21. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h +3 -0
  22. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h.meta +1 -1
  23. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginEntriesConfig.h.meta +1 -1
  24. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginService.h.meta +1 -1
  25. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGTapLoginPermissionDialog.h.meta +1 -1
  26. package/Plugins/iOS/XDAccountSDK.framework/Headers.meta +1 -1
  27. package/Plugins/iOS/XDAccountSDK.framework/Info.plist +0 -0
  28. package/Plugins/iOS/XDAccountSDK.framework/Info.plist.meta +1 -1
  29. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  30. package/Plugins/iOS/XDAccountSDK.framework/{Headers/XDGRoleInfo.h.meta → Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo.meta} +1 -1
  31. package/{Mobile/Http.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project.meta} +1 -1
  32. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json +9 -0
  33. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json.meta +7 -0
  34. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  35. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc.meta +7 -0
  36. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  37. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule.meta +7 -0
  38. package/{Mobile/Editor.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule.meta} +1 -1
  39. package/Plugins/iOS/XDAccountSDK.framework/Modules/module.modulemap.meta +1 -1
  40. package/Plugins/iOS/XDAccountSDK.framework/Modules.meta +1 -1
  41. package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK +0 -0
  42. package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK.meta +1 -1
  43. package/Plugins/iOS/XDAccountSDK.framework.meta +4 -4
  44. package/Plugins/iOS.meta +1 -1
  45. package/Plugins.meta +1 -1
  46. package/Runtime/Internal/IXDGAccount.Extended.cs +11 -0
  47. package/{Mobile/Http/XDGAccountHttpConfigMobile.cs.meta → Runtime/Internal/IXDGAccount.Extended.cs.meta} +1 -1
  48. package/Runtime/Internal/Mobile/AccountFeaturesImpl.cs +348 -0
  49. package/{Mobile/User/UserManagerMobile.cs.meta → Runtime/Internal/Mobile/AccountFeaturesImpl.cs.meta} +1 -1
  50. package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs +14 -0
  51. package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs.meta +3 -0
  52. package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs +37 -0
  53. package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs.meta +3 -0
  54. package/Runtime/Internal/Mobile/Http.meta +3 -0
  55. package/{Mobile.meta → Runtime/Internal/Mobile.meta} +1 -1
  56. package/Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs +168 -0
  57. package/{Mobile/Editor/XDAccountMobileProcessBuild.cs.meta → Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs.meta} +1 -1
  58. package/Runtime/Internal/Standalone/AccessToken.meta +8 -0
  59. package/Runtime/Internal/Standalone/AccountCell.cs +143 -0
  60. package/{Mobile/XDGAccountMobile.cs.meta → Runtime/Internal/Standalone/AccountCell.cs.meta} +1 -1
  61. package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs +461 -0
  62. package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs.meta +11 -0
  63. package/Runtime/Internal/Standalone/Auth/AppleAuth.cs +27 -0
  64. package/Runtime/Internal/Standalone/Auth/AppleAuth.cs.meta +11 -0
  65. package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs +27 -0
  66. package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs.meta +11 -0
  67. package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs +27 -0
  68. package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs.meta +11 -0
  69. package/Runtime/Internal/Standalone/Auth/GuestAuth.cs +22 -0
  70. package/Runtime/Internal/Standalone/Auth/GuestAuth.cs.meta +11 -0
  71. package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs +43 -0
  72. package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs.meta +11 -0
  73. package/Runtime/Internal/Standalone/Auth/SteamAuth.cs +90 -0
  74. package/Runtime/Internal/Standalone/Auth/SteamAuth.cs.meta +11 -0
  75. package/Runtime/Internal/Standalone/Auth/TapAuth.cs +72 -0
  76. package/Runtime/Internal/Standalone/Auth/TapAuth.cs.meta +11 -0
  77. package/Runtime/Internal/Standalone/Auth/WebAuth.cs +144 -0
  78. package/Runtime/Internal/Standalone/Auth/WebAuth.cs.meta +11 -0
  79. package/Runtime/Internal/Standalone/Auth.meta +8 -0
  80. package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs +15 -0
  81. package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs.meta +11 -0
  82. package/Runtime/Internal/Standalone/Compliance.meta +8 -0
  83. package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs +374 -0
  84. package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs.meta +11 -0
  85. package/Runtime/Internal/Standalone/LoginModule/Email.meta +8 -0
  86. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs +245 -0
  87. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs.meta +11 -0
  88. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs +392 -0
  89. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs.meta +11 -0
  90. package/Runtime/Internal/Standalone/LoginModule/Phone.meta +8 -0
  91. package/Runtime/Internal/Standalone/LoginModule.meta +8 -0
  92. package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs +228 -0
  93. package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs.meta +3 -0
  94. package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs +27 -0
  95. package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs.meta +3 -0
  96. package/Runtime/Internal/Standalone/SupportModule.meta +3 -0
  97. package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs +479 -0
  98. package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs.meta +11 -0
  99. package/Runtime/Internal/Standalone/Track.meta +8 -0
  100. package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs +156 -0
  101. package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs.meta +11 -0
  102. package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs +295 -0
  103. package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs.meta +11 -0
  104. package/Runtime/Internal/Standalone/UI/Email.meta +8 -0
  105. package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs +46 -0
  106. package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs.meta +11 -0
  107. package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs +522 -0
  108. package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs.meta +11 -0
  109. package/Runtime/Internal/Standalone/UI/PhoneIO.meta +8 -0
  110. package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs +84 -0
  111. package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs.meta +11 -0
  112. package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs +190 -0
  113. package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs.meta +11 -0
  114. package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs +164 -0
  115. package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs.meta +11 -0
  116. package/Runtime/Internal/Standalone/UI/PhoneVerification.meta +8 -0
  117. package/Runtime/Internal/Standalone/UI.meta +8 -0
  118. package/Runtime/Internal/Standalone/UserCenterAlert.cs +405 -0
  119. package/Runtime/Internal/Standalone/UserCenterAlert.cs.meta +11 -0
  120. package/Runtime/Internal/Standalone/UserModule.cs +604 -0
  121. package/Runtime/Internal/Standalone/UserModule.cs.meta +11 -0
  122. package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs +47 -0
  123. package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs.meta +3 -0
  124. package/Runtime/Internal/Standalone/WebFunction.meta +3 -0
  125. package/{Mobile/Plugins.meta → Runtime/Internal/Standalone.meta} +1 -1
  126. package/Runtime/Internal/XDGAccountEventHandler.cs +23 -0
  127. package/Runtime/Internal/XDGAccountEventHandler.cs.meta +3 -0
  128. package/Runtime/Internal/XDGAccountInternal.cs +86 -0
  129. package/Runtime/Internal/XDGAccountInternal.cs.meta +11 -0
  130. package/Runtime/Internal.meta +1 -1
  131. package/Runtime/Public/XDGAccount.Deprecated.cs +37 -0
  132. package/Runtime/Public/XDGAccount.Deprecated.cs.meta +11 -0
  133. package/Runtime/Public/XDGAccount.cs +107 -0
  134. package/Runtime/{XDGAccount.cs.meta → Public/XDGAccount.cs.meta} +1 -1
  135. package/Runtime/Public.meta +8 -0
  136. package/Runtime/XD.SDK.Account.asmdef +7 -2
  137. package/Runtime/XD.SDK.Account.asmdef.meta +1 -1
  138. package/Runtime.meta +1 -1
  139. package/package.json +5 -5
  140. package/package.json.meta +2 -2
  141. package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef +0 -20
  142. package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef.meta +0 -7
  143. package/Mobile/Editor/XDAccountMobileProcessBuild.cs +0 -20
  144. package/Mobile/Http/XDGAccountHttpConfigMobile.cs +0 -36
  145. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java +0 -36
  146. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java +0 -16
  147. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java +0 -20
  148. package/Mobile/Plugins/Android/com/xd/account/bridge.meta +0 -8
  149. package/Mobile/Plugins/Android/com/xd/account.meta +0 -8
  150. package/Mobile/Plugins/Android/com/xd.meta +0 -8
  151. package/Mobile/Plugins/Android/com.meta +0 -8
  152. package/Mobile/Plugins/Android.meta +0 -8
  153. package/Mobile/Plugins/iOS/XDAccountBridge.m +0 -29
  154. package/Mobile/Plugins/iOS/XDAccountBridge.m.meta +0 -37
  155. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h +0 -17
  156. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h.meta +0 -27
  157. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m +0 -23
  158. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m.meta +0 -37
  159. package/Mobile/Plugins/iOS.meta +0 -8
  160. package/Mobile/User/UserManagerMobile.cs +0 -45
  161. package/Mobile/User.meta +0 -8
  162. package/Mobile/XD.SDK.Account.Mobile.asmdef +0 -23
  163. package/Mobile/XD.SDK.Account.Mobile.asmdef.meta +0 -7
  164. package/Mobile/XDGAccountMobile.cs +0 -138
  165. package/Mobile/XDGAccountMobileImpl.cs +0 -444
  166. package/Mobile/XDGAccountMobileImpl.cs.meta +0 -11
  167. package/Mobile/XDGTokenManager.cs +0 -116
  168. package/Mobile/XDGTokenManager.cs.meta +0 -11
  169. package/Mobile/XDGUserWrapper.cs +0 -167
  170. package/Mobile/XDGUserWrapper.cs.meta +0 -11
  171. package/Plugins/Android/libs/XDGAccount_6.29.1.aar +0 -0
  172. package/Plugins/Android/libs/XDGAccount_6.29.1.aar.meta +0 -32
  173. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginManager.h +0 -47
  174. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGPhoneAuthManager.h +0 -33
  175. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGRoleInfo.h +0 -22
  176. package/README.md +0 -0
  177. package/README.md.meta +0 -7
  178. package/Runtime/Editor/XD.SDK.Account.Editor.asmdef +0 -19
  179. package/Runtime/Editor/XD.SDK.Account.Editor.asmdef.meta +0 -7
  180. package/Runtime/Editor/XDAccountProcessBuild.cs +0 -18
  181. package/Runtime/Editor/XDAccountProcessBuild.cs.meta +0 -11
  182. package/Runtime/Editor.meta +0 -8
  183. package/Runtime/IXDGAccount.cs +0 -44
  184. package/Runtime/IXDGAccount.cs.meta +0 -11
  185. package/Runtime/Internal/Http/IXDAccountHttpConfig.cs +0 -9
  186. package/Runtime/Internal/Http/IXDAccountHttpConfig.cs.meta +0 -11
  187. package/Runtime/Internal/Http/XDAccountHttpConfig.cs +0 -32
  188. package/Runtime/Internal/Http/XDAccountHttpConfig.cs.meta +0 -11
  189. package/Runtime/Internal/Http.meta +0 -8
  190. package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs +0 -7
  191. package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs.meta +0 -11
  192. package/Runtime/Internal/User.meta +0 -8
  193. package/Runtime/UserManager.cs +0 -35
  194. package/Runtime/UserManager.cs.meta +0 -11
  195. package/Runtime/XDGAccessToken.cs +0 -18
  196. package/Runtime/XDGAccessToken.cs.meta +0 -11
  197. package/Runtime/XDGAccount.cs +0 -130
  198. package/Runtime/XDGLoginType.cs +0 -17
  199. package/Runtime/XDGLoginType.cs.meta +0 -11
  200. package/Runtime/XDGRoleInfo.cs +0 -24
  201. package/Runtime/XDGRoleInfo.cs.meta +0 -11
  202. package/Runtime/XDGUser.cs +0 -30
  203. package/Runtime/XDGUser.cs.meta +0 -11
  204. package/Runtime/XDGUserStatusCode.cs +0 -16
  205. package/Runtime/XDGUserStatusCode.cs.meta +0 -11
@@ -0,0 +1,405 @@
1
+ #if UNITY_EDITOR || UNITY_STANDALONE
2
+ using System;
3
+ using System.Collections.Generic;
4
+ using System.Linq;
5
+ using System.Threading.Tasks;
6
+ using UnityEngine;
7
+ using UnityEngine.UI;
8
+ using XD.SDK.Account.Internal.Standalone;
9
+ using XD.SDK.Common;
10
+ using XD.SDK.Common.Internal.Standalone;
11
+
12
+ namespace XD.SDK.Account.Standalone
13
+ {
14
+ public class UserCenterAlert : UIElement
15
+ {
16
+ private static readonly int MIN_BIND_COUNT = 1;
17
+ private static readonly float TIMEOUT = 0.25f;
18
+
19
+ private GameObject content;
20
+ private Text bindTitleTxt;
21
+ private Text titleTxt;
22
+ private Text infoTitleTxt;
23
+ private Text idTxt;
24
+ private GameObject errorView;
25
+
26
+ private LocalizableString localizableString;
27
+ private XDGUser user;
28
+
29
+ public GameObject bindsContent;
30
+ private static readonly float cellHeight = 36.0f;
31
+
32
+ private List<AccountCell> cellList;
33
+ private float _currentTime = 0;
34
+
35
+ //绑定解绑回调
36
+ public static Action<LoginType> bindCallback;
37
+ public static Action<XDGError> bindErrorCallback;
38
+ public static Action<LoginType> unBindCallback;
39
+ public static Action<XDGError> unBindErrorCallback;
40
+
41
+ private void Awake()
42
+ {
43
+ titleTxt = transform.Find("Header/TitleTxt").GetComponent<Text>();
44
+
45
+ content = transform.Find("Content/Viewport/Content").gameObject;
46
+ infoTitleTxt = transform.Find("Content/Viewport/Content/UserPanel/AccountContainer/InfotTitleTxt")
47
+ .GetComponent<Text>();
48
+ idTxt = transform.Find("Content/Viewport/Content/UserPanel/IdContainer/IdText").GetComponent<Text>();
49
+ errorView = transform.Find("LoadFailedView").gameObject;
50
+ bindTitleTxt = transform.Find("Content/Viewport/Content/BindTitleContainer/BindTitleText")
51
+ .GetComponent<Text>();
52
+ bindsContent = transform.Find("Content/Viewport/Content/BindsContent").gameObject;
53
+
54
+ Button errorRetryButton = errorView.transform.Find("RetryButton").GetComponent<Button>();
55
+ errorRetryButton.onClick.AddListener(ErrorViewTap);
56
+
57
+ errorView.SetActive(false);
58
+
59
+ Button copyBtn = transform.Find("Content/Viewport/Content/UserPanel/IdContainer/CopyBt")
60
+ .GetComponent<Button>();
61
+ copyBtn.onClick.AddListener(CopyTaped);
62
+ Button closeBtn = transform.Find("Header/CloseBt").GetComponent<Button>();
63
+ closeBtn.onClick.AddListener(CloseTaped);
64
+
65
+ Button logoutBtn = transform.Find("Content/Viewport/Content/LogoutButton").GetComponent<Button>();
66
+ logoutBtn.onClick.AddListener(OnLogoutClicked);
67
+
68
+ localizableString = XDLocalization.GetCurrentLocalizableString();
69
+
70
+ Text logoutBtnText = logoutBtn.transform.Find("Text").GetComponent<Text>();
71
+ logoutBtnText.text = localizableString.Logout2;
72
+ }
73
+
74
+ async void Start()
75
+ {
76
+ user = await UserModule.GetLocalUser() as XDGUser;
77
+ localizableString = XDLocalization.GetCurrentLocalizableString();
78
+ titleTxt.text = GetTitle();
79
+ bindTitleTxt.text = localizableString.BoundAccounts;
80
+
81
+ infoTitleTxt.text = GetAccountInfo();
82
+ idTxt.text = $"ID: {user.UserId}";
83
+ errorView.GetComponentInChildren<Text>().text = localizableString.NetworkErrorRetry;
84
+
85
+ // TODO 延迟布局
86
+ await Task.Delay(100);
87
+
88
+ List<LoginTypeModel> supportTypes = GetSupportTypes();
89
+
90
+ cellList = new List<AccountCell>(supportTypes.Count);
91
+
92
+ for (int i = 0; i < supportTypes.Count; i++)
93
+ {
94
+ LoginTypeModel st = supportTypes[i];
95
+
96
+ AccountCell.AccountCellModel model = new AccountCell.AccountCellModel
97
+ {
98
+ LoginName = st.TypeName,
99
+ LoginType = st.Type,
100
+ BindType = BindType.None
101
+ };
102
+
103
+ GameObject gameObj = Instantiate(Resources.Load("Prefabs/AccountCell")) as GameObject;
104
+ gameObj.name = "AccountCell" + i;
105
+ gameObj.transform.SetParent(bindsContent.transform);
106
+ gameObj.transform.localPosition = new Vector3(350, -cellHeight / 2 - (cellHeight * i), 0);
107
+ gameObj.transform.localScale = Vector3.one;
108
+
109
+ AccountCell cell = gameObj.AddComponent<AccountCell>();
110
+ cell.cellIndex = i;
111
+ cell.SetModel(model);
112
+ cell.OnBind = cellIndex =>
113
+ {
114
+ if (model.BindType == BindType.Bind)
115
+ {
116
+ // 限制最后一个不允许解绑
117
+ int bindCount = cellList.Where(c => c.model.BindType == BindType.Bind)
118
+ .Count();
119
+ if (bindCount <= MIN_BIND_COUNT)
120
+ {
121
+ UIManager.ShowToast(localizableString.UnbindLastAccountTips);
122
+ return;
123
+ }
124
+
125
+ //开始解绑
126
+ var dic = new Dictionary<string, object>()
127
+ {
128
+ { "loginType", model.LoginType },
129
+ { "alertType", (int)DeleteAlertType.Unbindthird },
130
+ };
131
+ UIManager.ShowUI<DeleteAccountAlert>(dic,
132
+ (code, data) =>
133
+ {
134
+ UIManager.ShowLoading(true);
135
+ _currentTime = TIMEOUT;
136
+ Unbind(model.LoginType, cellIndex);
137
+ });
138
+ }
139
+ else
140
+ {
141
+ //开始绑定
142
+ UIManager.ShowLoading(true);
143
+ _currentTime = TIMEOUT;
144
+ Bind(model.LoginType, cellIndex);
145
+ }
146
+ };
147
+
148
+ cellList.Add(cell);
149
+ }
150
+
151
+ _ = RequestBinds();
152
+ }
153
+
154
+ private void OnDisable()
155
+ {
156
+ if (_currentTime > 0)
157
+ {
158
+ UIManager.DismissLoading();
159
+ _currentTime = 0;
160
+ }
161
+ }
162
+
163
+ private void Update()
164
+ {
165
+ titleTxt.text = content.transform.localPosition.y < 100 ? GetTitle() : GetAccountInfo();
166
+ if (_currentTime > 0)
167
+ {
168
+ _currentTime -= Time.deltaTime;
169
+ if (_currentTime <= 0)
170
+ {
171
+ UIManager.DismissLoading();
172
+ _currentTime = 0;
173
+ }
174
+ }
175
+ }
176
+
177
+ private string GetTitle()
178
+ {
179
+ return $"<b>{localizableString.AccountSafeInfo}</b>";
180
+ }
181
+
182
+ private string GetAccountInfo()
183
+ {
184
+ string account;
185
+ LoginType type = user.GetLoginType();
186
+ account = LoginTypeModel.GetReadableName(type);
187
+ account = localizableString.AccountFormat.Replace("%s", account);
188
+
189
+ return $"<b>{account}</b><size=12><color=#BFBFBF>({localizableString.CurrentAccountPrefix})</color></size>";
190
+ }
191
+
192
+ public void CloseTaped()
193
+ {
194
+ UIManager.DismissAll();
195
+ }
196
+
197
+ public void CopyTaped()
198
+ {
199
+ GUIUtility.systemCopyBuffer = user.UserId;
200
+ UIManager.ShowToast(localizableString.CopySuccess);
201
+ }
202
+
203
+ private async Task RequestBinds()
204
+ {
205
+ UIManager.ShowLoading();
206
+ try
207
+ {
208
+ Dictionary<LoginType, Bind> binds = (await UserModule.GetBindList())
209
+ .ToDictionary(bind => (LoginType)bind.LoginType, bind => bind);
210
+
211
+ for (int i = 0; i < cellList.Count; i++)
212
+ {
213
+ AccountCell cell = cellList[i];
214
+ cell.model.BindType = binds.ContainsKey(cell.model.LoginType) ? BindType.Bind : BindType.UnBind;
215
+ Dictionary<string, object> extras = new Dictionary<string, object>();
216
+ if (binds.TryGetValue(cell.model.LoginType, out Bind bind))
217
+ {
218
+ if (!string.IsNullOrEmpty(bind.OpenId))
219
+ {
220
+ extras["openId"] = bind.OpenId;
221
+ }
222
+ }
223
+
224
+ cell.model.Extras = extras;
225
+ cell.RefreshState(cell.model);
226
+ }
227
+ }
228
+ catch (Exception e)
229
+ {
230
+ XDGLogger.Warn($"列表请求失败: {e}");
231
+ errorView.SetActive(true);
232
+ }
233
+ finally
234
+ {
235
+ UIManager.DismissLoading();
236
+ }
237
+ }
238
+
239
+ private async void Bind(LoginType loginType, int cellIndex)
240
+ {
241
+ XDGLogger.Debug("绑定: " + loginType);
242
+ try
243
+ {
244
+ await UserModule.Bind(loginType);
245
+ await RequestBinds();
246
+
247
+ UIManager.ShowToast(localizableString.BindSuccess);
248
+
249
+ AccountFeaturesImpl.UserStatusChangeCallback.Invoke(XDGUserStatusCodeType.BIND, LoginTypeModel.GetName(loginType));
250
+ }
251
+ catch (XDGError e)
252
+ {
253
+ ShowBindError(e);
254
+ }
255
+ catch (TaskCanceledException)
256
+ {
257
+ XDGLogger.Debug("关闭绑定");
258
+ }
259
+ catch (Exception e)
260
+ {
261
+ XDGLogger.Warn($"绑定失败: {e}");
262
+ UIManager.ShowToast(localizableString.BindError);
263
+ }
264
+ }
265
+
266
+ private void ShowBindError(XDGError error)
267
+ {
268
+ if (error.Code == ResponseCode.Common.Cancelled)
269
+ {
270
+ UIManager.ShowToast(localizableString.LoginCancel);
271
+ }
272
+ else
273
+ {
274
+ if (string.IsNullOrEmpty(error.Message))
275
+ {
276
+ UIManager.ShowToast(localizableString.BindError);
277
+ }
278
+ else
279
+ {
280
+ UIManager.ShowToast(error.Message);
281
+ }
282
+ }
283
+
284
+ if (bindErrorCallback != null)
285
+ {
286
+ bindErrorCallback(error);
287
+ }
288
+ }
289
+
290
+ private async void Unbind(LoginType loginType, int cellIndex)
291
+ {
292
+ XDGLogger.Debug("解绑: " + loginType);
293
+ UIManager.ShowLoading();
294
+ try
295
+ {
296
+ AccountCell cell = cellList[cellIndex];
297
+ await UserModule.Unbind(loginType, cell.model.Extras);
298
+ AccountFeaturesImpl.UserStatusChangeCallback.Invoke(XDGUserStatusCodeType.UNBIND, LoginTypeModel.GetName(loginType));
299
+
300
+ await AccessTokenModule.GetLocalAccessToken();
301
+ if (loginType == user.GetLoginType())
302
+ {
303
+ UIManager.ShowToast(localizableString.UnbindDeleteSuccessReturnSign);
304
+ UIManager.DismissAll();
305
+
306
+ AccountFeaturesImpl.Instance.InternalLogout();
307
+ }
308
+ else
309
+ {
310
+ UIManager.ShowToast(localizableString.UnbindSuccess);
311
+ await RequestBinds();
312
+ }
313
+ }
314
+ catch (XDGError e)
315
+ {
316
+ XDGLogger.Warn(e.ToString());
317
+ if (string.IsNullOrEmpty(e.Message))
318
+ {
319
+ UIManager.ShowToast(localizableString.UnbindError);
320
+ }
321
+ else
322
+ {
323
+ UIManager.ShowToast(e.Message);
324
+ }
325
+ }
326
+ catch (TaskCanceledException)
327
+ {
328
+ XDGLogger.Debug("关闭解绑");
329
+ }
330
+ catch (Exception e)
331
+ {
332
+ XDGLogger.Warn($"解绑失败: {e}");
333
+ UIManager.ShowToast(localizableString.UnbindError);
334
+ }
335
+ finally
336
+ {
337
+ UIManager.DismissLoading();
338
+ }
339
+ }
340
+
341
+ private List<LoginTypeModel> GetSupportTypes()
342
+ {
343
+ List<LoginTypeModel> list = new List<LoginTypeModel>();
344
+ if (ConfigModule.BindEntries != null)
345
+ {
346
+ Dictionary<string, LoginTypeModel> sdkSupportedLoginTypes = SDKSupportedLoginTypes
347
+ .ToDictionary(item => item.TypeName.ToLower(), item => item);
348
+ foreach (string bindType in ConfigModule.BindEntries)
349
+ {
350
+ if (sdkSupportedLoginTypes.TryGetValue(bindType.ToLower(), out LoginTypeModel loginTypeModel))
351
+ {
352
+ list.Add(loginTypeModel);
353
+ }
354
+ }
355
+ }
356
+
357
+ return list;
358
+ }
359
+
360
+ private static List<LoginTypeModel> SDKSupportedLoginTypes => new List<LoginTypeModel>
361
+ {
362
+ new LoginTypeModel(LoginType.Phone),
363
+ new LoginTypeModel(LoginType.TapTap),
364
+ new LoginTypeModel(LoginType.Google),
365
+ new LoginTypeModel(LoginType.Apple),
366
+ new LoginTypeModel(LoginType.Steam),
367
+ new LoginTypeModel(LoginType.Facebook),
368
+ new LoginTypeModel(LoginType.Email)
369
+ };
370
+
371
+ public void ErrorViewTap()
372
+ {
373
+ XDGLogger.Debug("点击了 errorViewTap");
374
+ errorView.SetActive(false);
375
+ _ = RequestBinds();
376
+ }
377
+
378
+ private void OnLogoutClicked()
379
+ {
380
+ LocalizableString localizable = XDLocalization.GetCurrentLocalizableString();
381
+ Dictionary<string, object> config = new Dictionary<string, object>
382
+ {
383
+ { Dialog.TITLE_KEY, localizable.ConfirmLogout },
384
+ { Dialog.CONTENT_KEY, localizable.ConfirmLogoutCurrentAccount },
385
+ { Dialog.SECONDARY_TEXT_KEY, localizable.Confirm2 },
386
+ { Dialog.PRIMARY_TEXT_KEY, localizable.Cancel2 }
387
+ };
388
+ UIManager.ShowUI<Dialog>("Dialog", config, (code, data) =>
389
+ {
390
+ UIManager.ShowLoading(true);
391
+ _currentTime = TIMEOUT;
392
+ if (code == 1)
393
+ {
394
+ UIManager.DismissAll();
395
+ AccountFeaturesImpl.Instance.InternalLogout();
396
+ }
397
+ else
398
+ {
399
+ UIManager.Dismiss();
400
+ }
401
+ });
402
+ }
403
+ }
404
+ }
405
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 831c72662e5d43a593655769bf604133
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: