com.xd.sdk.account 6.29.0 → 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.0.aar +0 -0
  172. package/Plugins/Android/libs/XDGAccount_6.29.0.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,522 @@
1
+ #if UNITY_EDITOR || UNITY_STANDALONE
2
+ using System;
3
+ using System.Collections.Generic;
4
+ using System.Linq;
5
+ using UnityEngine;
6
+ using UnityEngine.EventSystems;
7
+ using UnityEngine.UI;
8
+ using XD.SDK.Common.Internal;
9
+ using XD.SDK.Common.Internal.Standalone;
10
+
11
+ namespace XD.SDK.Account.Internal.Standalone
12
+ {
13
+ public class PhoneAlertIO : UIElement
14
+ {
15
+ public class Data
16
+ {
17
+ public string areaCode { get; set; }
18
+ public string phoneNumber { get; set; }
19
+ public string code { get; set; }
20
+ }
21
+
22
+ class AreaBoxData
23
+ {
24
+ public GameObject gameObj;
25
+ public AreaCodeData AreaCodeData;
26
+ }
27
+
28
+ public const int SEND_CODE = 0;
29
+ public const int LOGIN_OR_BIND = 1;
30
+ public const int CLOSE_CODE = -1;
31
+
32
+ private Button closeButton;
33
+
34
+ private Image PhoneNumberBG;
35
+ private Button areaCodeButton;
36
+ private Text areaCodeText;
37
+ private InputField phoneNumberInput;
38
+ private Text phoneNumberErrorTips;
39
+
40
+ private Image verificationCodeBG;
41
+ private InputField verificationCodeInput;
42
+ private Button sendCodeButton;
43
+ private Text sendCodeText;
44
+ private Text verificationCodeErrorTips;
45
+
46
+ private Button loginButton;
47
+
48
+ private Button userAgreementButton;
49
+ private Button privacyPolicyButton;
50
+ private Text footerText;
51
+
52
+ private GameObject areaCodePanel;
53
+ private GameObject areaCodeBox;
54
+ private InputField searchInput;
55
+ private LayoutElement scrollBoxLayout;
56
+ private ScrollRect scrollRect;
57
+
58
+ private List<AreaBoxData> AreaCodeBoxData = new List<AreaBoxData>();
59
+ private List<AreaCodeData> TempAreaCodes = XDGAreaCode.AreaCodes;
60
+
61
+ private AreaCodeData CurrentAreaData = null;
62
+
63
+ private LocalizableString localizableString;
64
+
65
+ private void Awake()
66
+ {
67
+ localizableString = XDLocalization.GetCurrentLocalizableString();
68
+ // 标题和关闭按钮
69
+ closeButton = transform.Find("Alert/CloseButton").GetComponent<Button>();
70
+ closeButton.onClick.AddListener(OnCloseButtonClicked);
71
+
72
+ // 手机号码框
73
+ PhoneNumberBG = transform.Find("Alert/PhoneNumberBox").GetComponent<Image>();
74
+ areaCodeButton = transform.Find("Alert/PhoneNumberBox/CodeButton").GetComponent<Button>();
75
+ areaCodeText = transform.Find("Alert/PhoneNumberBox/CodeButton").GetComponent<Text>();
76
+ phoneNumberInput = transform.Find("Alert/PhoneNumberBox/PhoneNumberInput").GetComponent<InputField>();
77
+ transform.Find("Alert/PhoneNumberBox/PhoneNumberInput/Placeholder").GetComponent<Text>().text = localizableString.PhoneBoxHint;
78
+ EventTrigger phoneInputTrigger = transform.Find("Alert/PhoneNumberBox/PhoneNumberInput").GetComponent<EventTrigger>();
79
+ phoneNumberErrorTips = transform.Find("Alert/PhoneNumberBox/PhoneNumberErrorTips").GetComponent<Text>();
80
+ areaCodeButton.onClick.AddListener(OnCodeButtonClicked);
81
+ var phoneSelectEntry = new EventTrigger.Entry
82
+ {
83
+ eventID = EventTriggerType.Select
84
+ };
85
+ phoneSelectEntry.callback.AddListener(OnPhoneInputSelected);
86
+ var phoneDeselectEntry = new EventTrigger.Entry
87
+ {
88
+ eventID = EventTriggerType.Deselect
89
+ };
90
+ phoneDeselectEntry.callback.AddListener(OnPhoneInputDeselect);
91
+ phoneInputTrigger.triggers = new List<EventTrigger.Entry>();
92
+ phoneInputTrigger.triggers.AddRange(new[]
93
+ {
94
+ phoneSelectEntry, phoneDeselectEntry
95
+ });
96
+ phoneNumberInput.onValueChanged.AddListener(OnPhoneNumberInputChanged);
97
+ phoneNumberErrorTips.gameObject.SetActive(false);
98
+
99
+ // 验证码框
100
+ verificationCodeBG = transform.Find("Alert/VerificationCodeBox").GetComponent<Image>();
101
+ verificationCodeInput = transform.Find("Alert/VerificationCodeBox/CodeInput").GetComponent<InputField>();
102
+ transform.Find("Alert/VerificationCodeBox/CodeInput/Placeholder").GetComponent<Text>().text = localizableString.CodeBoxHint;
103
+ EventTrigger verificationCodeInputTrigger = transform.Find("Alert/VerificationCodeBox/CodeInput").GetComponent<EventTrigger>();
104
+ sendCodeButton = transform.Find("Alert/VerificationCodeBox/SendButton").GetComponent<Button>();
105
+ sendCodeText = transform.Find("Alert/VerificationCodeBox/SendButton").GetComponent<Text>();
106
+ verificationCodeErrorTips = transform.Find("Alert/VerificationCodeBox/CodeErrorTips").GetComponent<Text>();
107
+ verificationCodeErrorTips.gameObject.SetActive(false);
108
+ var codeSelectEntry = new EventTrigger.Entry
109
+ {
110
+ eventID = EventTriggerType.Select
111
+ };
112
+ codeSelectEntry.callback.AddListener(OnCodeInputSelected);
113
+ var codeDeselectEntry = new EventTrigger.Entry
114
+ {
115
+ eventID = EventTriggerType.Deselect
116
+ };
117
+ codeDeselectEntry.callback.AddListener(OnCodeInputDeselect);
118
+ verificationCodeInputTrigger.triggers = new List<EventTrigger.Entry>();
119
+ verificationCodeInputTrigger.triggers.AddRange(new[]
120
+ {
121
+ codeSelectEntry, codeDeselectEntry
122
+ });
123
+ verificationCodeInput.onValueChanged.AddListener(OnCodeInputValueChanged);
124
+ sendCodeButton.onClick.AddListener(OnSendCodeButtonClicked);
125
+
126
+ // 登录按钮
127
+ loginButton = transform.Find("Alert/LoginButton").GetComponent<Button>();
128
+ transform.Find("Alert/LoginButton/Text").GetComponent<Text>().text = localizableString.CodeLoginButton;
129
+ loginButton.onClick.AddListener(OnLoginButtonClicked);
130
+
131
+ // 协议
132
+ userAgreementButton = transform.Find("Alert/Footer/UserAgreement").GetComponent<Button>();
133
+ privacyPolicyButton = transform.Find("Alert/Footer/PrivacyPolicy").GetComponent<Button>();
134
+ footerText = transform.Find("Alert/FooterText").GetComponent<Text>();
135
+ transform.Find("Alert/Footer/UserAgreement").GetComponent<Text>().text = localizableString.UserAgreement;
136
+ transform.Find("Alert/Footer/PrivacyPolicy").GetComponent<Text>().text = localizableString.PrivacyPolicy;
137
+ userAgreementButton.onClick.AddListener(OnUserAgreementButtonClicked);
138
+ privacyPolicyButton.onClick.AddListener(OnPrivacyPolicyButtonClicked);
139
+ transform.Find("Alert/FooterText").GetComponent<Text>().text =
140
+ localizableString.CodeBindFooterFormat.Replace("{support}", "<b>" + localizableString.CodeBindFooterSupport + "</b>");
141
+
142
+ // 区号框
143
+ areaCodePanel = transform.Find("AreaCodePanel").gameObject;
144
+ areaCodeBox = transform.Find("AreaCodePanel/ScrollBox/Panel").gameObject;
145
+ searchInput = transform.Find("AreaCodePanel/SearchBox").gameObject.GetComponent<InputField>();
146
+ transform.Find("AreaCodePanel/SearchBox/Placeholder").gameObject.GetComponent<Text>().text = localizableString.PhoneBoxSearchHint;
147
+ EventTrigger searchTrigger = transform.Find("AreaCodePanel/SearchBox").gameObject.GetComponent<EventTrigger>();
148
+ scrollBoxLayout = transform.Find("AreaCodePanel/ScrollBox").gameObject.GetComponent<LayoutElement>();
149
+ scrollRect = transform.Find("AreaCodePanel/ScrollBox").gameObject.GetComponent<ScrollRect>();
150
+ searchInput.onValueChanged.AddListener(UpdateSearch);
151
+ areaCodePanel.gameObject.SetActive(false);
152
+ var searchSelectEntry = new EventTrigger.Entry
153
+ {
154
+ eventID = EventTriggerType.Select
155
+ };
156
+ searchSelectEntry.callback.AddListener(OnSearchInputSelected);
157
+ var searchDeselectEntry = new EventTrigger.Entry
158
+ {
159
+ eventID = EventTriggerType.Deselect
160
+ };
161
+ searchDeselectEntry.callback.AddListener(OnSearchInputDeselect);
162
+ searchTrigger.triggers = new List<EventTrigger.Entry>();
163
+ searchTrigger.triggers.AddRange(new[]
164
+ {
165
+ searchSelectEntry, searchDeselectEntry
166
+ });
167
+ }
168
+
169
+ protected virtual void Start()
170
+ {
171
+ AliyunTrack.LoginOpenMobilePanel();
172
+ bool login = (extra["login"] as bool?) ?? false;
173
+ userAgreementButton.gameObject.SetActive(login);
174
+ privacyPolicyButton.gameObject.SetActive(login);
175
+ footerText.gameObject.SetActive(!login);
176
+
177
+ transform.Find("Alert/TitleText").GetComponent<Text>().text = login ? localizableString.SmsLoginTitle : localizableString.SmsBindTitle;
178
+
179
+ SetupDefaultSelection();
180
+ }
181
+
182
+ public AreaCodeData DetermineDefaultSelection()
183
+ {
184
+ if (CurrentAreaData != null)
185
+ {
186
+ var data = AreaCodeBoxData.FirstOrDefault(x => x.AreaCodeData.AreaCode == CurrentAreaData.AreaCode);
187
+ if (data != null)
188
+ {
189
+ return data.AreaCodeData;
190
+ }
191
+ }
192
+
193
+ AreaCodeData Data = null;
194
+ var info = IPInfoModule.GetCachedIPInfo();
195
+ if (info != null)
196
+ {
197
+ Data = TempAreaCodes.FirstOrDefault(x => x.Region == info?.CountryCode);
198
+ if (Data != null)
199
+ {
200
+ return Data;
201
+ }
202
+ }
203
+
204
+ Data = TempAreaCodes.FirstOrDefault(x => x.Region == "TW");
205
+ if (Data != null)
206
+ {
207
+ return Data;
208
+ }
209
+
210
+ return TempAreaCodes?[0];
211
+ }
212
+
213
+ public void SelectArea(AreaCodeData SelectedData)
214
+ {
215
+ CurrentAreaData = SelectedData;
216
+ areaCodeText.text = CurrentAreaData?.AreaCodeName;
217
+
218
+ TempAreaCodes = XDGAreaCode.AreaCodes;
219
+ if (CurrentAreaData != null)
220
+ {
221
+ TempAreaCodes.Remove(CurrentAreaData);
222
+ TempAreaCodes.Insert(0, CurrentAreaData);
223
+ }
224
+
225
+ OpenAreaCodePanel(false);
226
+ }
227
+
228
+ public void UpdateSearch(string SearchString)
229
+ {
230
+ foreach (var data in AreaCodeBoxData)
231
+ {
232
+ bool Show = SearchString.Length == 0
233
+ || data.AreaCodeData.RegionName.Contains(SearchString)
234
+ || data.AreaCodeData.AreaCodeName.Contains(SearchString);
235
+ data.gameObj.SetActive(Show);
236
+ }
237
+
238
+ RefreshScrollBoxHeight();
239
+ }
240
+
241
+ public void UpdatePhoneNumberError(string errorString)
242
+ {
243
+ phoneNumberErrorTips.text = errorString;
244
+ phoneNumberErrorTips.gameObject.SetActive(errorString.Length > 0);
245
+ }
246
+
247
+ public void UpdateCodeError(string errorString)
248
+ {
249
+ verificationCodeErrorTips.text = errorString;
250
+ verificationCodeErrorTips.gameObject.SetActive(errorString.Length > 0);
251
+ }
252
+
253
+ public void SetSendButtonEnable(bool enable)
254
+ {
255
+ sendCodeButtonEnable = enable;
256
+ }
257
+
258
+ public void UpdateCanResendSeconds(float Seconds)
259
+ {
260
+ canSendTime = DateTime.Now + TimeSpan.FromSeconds(Seconds);
261
+ }
262
+
263
+ public void OpenAreaCodePanel(bool newOpen)
264
+ {
265
+ if (newOpen)
266
+ {
267
+ areaCodePanel.gameObject.SetActive(true);
268
+
269
+ RefreshAreaBox();
270
+
271
+ areaCodeText.color = PhoneModuleIO.PhoneUIColor;
272
+
273
+ if (searchInput.gameObject.activeSelf)
274
+ {
275
+ EventSystem.current.SetSelectedGameObject(searchInput.gameObject);
276
+ }
277
+ else
278
+ {
279
+ var currentData = AreaCodeBoxData.FirstOrDefault(x => x.AreaCodeData.AreaCode == CurrentAreaData?.AreaCode);
280
+ EventSystem.current.SetSelectedGameObject(currentData != null ? currentData.gameObj : AreaCodeBoxData[0].gameObj);
281
+ }
282
+
283
+ RefreshScrollBoxHeight();
284
+ scrollRect.verticalNormalizedPosition = 1.0f;
285
+ }
286
+ else
287
+ {
288
+ areaCodePanel.gameObject.SetActive(false);
289
+ areaCodeText.color = PhoneModuleIO.PhoneUIBlackColor;
290
+ }
291
+ }
292
+
293
+ #region Callback
294
+
295
+ private void OnCodeButtonClicked()
296
+ {
297
+ OpenAreaCodePanel(!areaCodePanel.gameObject.activeSelf);
298
+ }
299
+
300
+ private void OnCloseButtonClicked()
301
+ {
302
+ OnCallback(CLOSE_CODE, null);
303
+ }
304
+
305
+ private void OnSendCodeButtonClicked()
306
+ {
307
+ OnCallback(SEND_CODE, new Data { areaCode = CurrentAreaData.AreaCode, phoneNumber = phoneNumberInput.text });
308
+ }
309
+
310
+ private void OnLoginButtonClicked()
311
+ {
312
+ OnCallback(LOGIN_OR_BIND, new Data { areaCode = CurrentAreaData.AreaCode, phoneNumber = phoneNumberInput.text, code = verificationCodeInput.text });
313
+ }
314
+
315
+ private void OnUserAgreementButtonClicked()
316
+ {
317
+ Agreement agreement = AgreementModule.currentAgreement();
318
+ XDGAgreement subAgreement = agreement.Agreements?.FirstOrDefault(x => x.Type == "terms-of-service");
319
+ string url = subAgreement?.Url ?? "https://protocol.xd.com/sdk-agreement-1.0.0.html";
320
+ Application.OpenURL(url);
321
+ }
322
+
323
+ private void OnPrivacyPolicyButtonClicked()
324
+ {
325
+ Agreement agreement = AgreementModule.currentAgreement();
326
+ XDGAgreement subAgreement = agreement.Agreements?.FirstOrDefault(x => x.Type == "privacy-policy");
327
+ string url = subAgreement?.Url ?? "https://protocol.xd.com/sdk-privacy-1.0.0.html";
328
+ Application.OpenURL(url);
329
+ }
330
+
331
+ private void OnPhoneNumberInputChanged(string newValue)
332
+ {
333
+ UpdatePhoneNumberError("");
334
+ }
335
+
336
+ private void OnCodeInputValueChanged(string newValue)
337
+ {
338
+ UpdateCodeError("");
339
+ }
340
+
341
+ #endregion
342
+
343
+ #region Private
344
+
345
+ private void RefreshSendCodeButtonStatus()
346
+ {
347
+ double CanSendSeconds = (canSendTime - DateTime.Now).TotalSeconds;
348
+ bool hasSent = canSendTime != DateTime.MinValue;
349
+ if (CanSendSeconds <= 0)
350
+ {
351
+ sendCodeText.text = hasSent ? localizableString.CodeBoxRetry : localizableString.CodeBoxSendCode;
352
+ sendCodeButton.enabled = sendCodeButtonEnable;
353
+ }
354
+ else
355
+ {
356
+ sendCodeText.text = $"{(int)Math.Ceiling(CanSendSeconds)} s";
357
+ sendCodeButton.enabled = false;
358
+ }
359
+
360
+ sendCodeText.color = sendCodeButton.enabled ? PhoneModuleIO.PhoneUIColor : PhoneModuleIO.PhoneUIDisableColor;
361
+ }
362
+
363
+ private bool sendCodeButtonEnable = true;
364
+ private DateTime canSendTime = DateTime.MinValue;
365
+
366
+ private void OnPhoneInputSelected(BaseEventData eventData)
367
+ {
368
+ phoneInputSelected = true;
369
+ RefreshPhoneInputBorderColor();
370
+ }
371
+
372
+ private void OnPhoneInputDeselect(BaseEventData eventData)
373
+ {
374
+ phoneInputSelected = false;
375
+ RefreshPhoneInputBorderColor();
376
+ }
377
+
378
+ private void RefreshPhoneInputBorderColor()
379
+ {
380
+ if (phoneNumberErrorTips.text.Length > 0)
381
+ {
382
+ PhoneNumberBG.color = Color.red;
383
+ }
384
+ else if (phoneInputSelected)
385
+ {
386
+ PhoneNumberBG.color = PhoneModuleIO.PhoneUIColor;
387
+ }
388
+ else
389
+ {
390
+ PhoneNumberBG.color = PhoneModuleIO.PhoneUIDisableColor;
391
+ }
392
+ }
393
+
394
+ private bool phoneInputSelected;
395
+
396
+ private void OnCodeInputSelected(BaseEventData eventData)
397
+ {
398
+ codeInputSelected = true;
399
+ RefreshCodeInputBorderColor();
400
+ }
401
+
402
+ private void OnCodeInputDeselect(BaseEventData eventData)
403
+ {
404
+ codeInputSelected = false;
405
+ RefreshCodeInputBorderColor();
406
+ }
407
+
408
+ private void RefreshCodeInputBorderColor()
409
+ {
410
+ if (verificationCodeInput.text.Length > 0)
411
+ {
412
+ verificationCodeBG.color = Color.red;
413
+ }
414
+ else if (codeInputSelected)
415
+ {
416
+ verificationCodeBG.color = PhoneModuleIO.PhoneUIColor;
417
+ }
418
+ else
419
+ {
420
+ verificationCodeBG.color = PhoneModuleIO.PhoneUIDisableColor;
421
+ }
422
+ }
423
+
424
+ private bool codeInputSelected;
425
+
426
+ private void OnSearchInputSelected(BaseEventData eventData)
427
+ {
428
+ var image = searchInput.GetComponent<Image>();
429
+ if (image != null) image.color = PhoneModuleIO.PhoneUIColor;
430
+ }
431
+
432
+ private void OnSearchInputDeselect(BaseEventData eventData)
433
+ {
434
+ var image = searchInput.GetComponent<Image>();
435
+ if (image != null) image.color = PhoneModuleIO.PhoneUIDisableColor;
436
+ }
437
+
438
+ private void SetupDefaultSelection()
439
+ {
440
+ AreaCodeData Data = DetermineDefaultSelection();
441
+ SelectArea(Data);
442
+ }
443
+
444
+ private void RefreshAreaBox()
445
+ {
446
+ for (int i = areaCodeBox.transform.childCount - 1; i >= 0; --i)
447
+ {
448
+ Destroy(areaCodeBox.transform.GetChild(i).gameObject);
449
+ }
450
+
451
+ AreaCodeBoxData.Clear();
452
+ for (int i = 0; i < TempAreaCodes.Count; ++i)
453
+ {
454
+ GameObject gameObj = Instantiate(Resources.Load("Prefabs/AreaCodeCell")) as GameObject;
455
+ if (gameObj != null)
456
+ {
457
+ AreaCodeCell cell = gameObj.AddComponent<AreaCodeCell>();
458
+
459
+ gameObj.name = "AreaCodeCell" + i;
460
+ gameObj.transform.SetParent(areaCodeBox.transform);
461
+ gameObj.transform.localScale = Vector3.one;
462
+ AreaCodeBoxData.Add(new AreaBoxData { gameObj = gameObj, AreaCodeData = TempAreaCodes[i] });
463
+
464
+ cell.UpdateCell(TempAreaCodes[i]);
465
+ cell.UpdateSelection(CurrentAreaData);
466
+ cell.OnSelected = SelectArea;
467
+ }
468
+ }
469
+
470
+ searchInput.gameObject.SetActive(TempAreaCodes.Count > 10);
471
+ }
472
+
473
+ private void RefreshScrollBoxHeight()
474
+ {
475
+ int Counter = 0;
476
+ foreach (var data in AreaCodeBoxData)
477
+ {
478
+ if (data.gameObj.activeSelf)
479
+ {
480
+ ++Counter;
481
+ }
482
+ }
483
+
484
+ float height = (Counter > 4 ? 4 : Counter) * 45;
485
+ scrollBoxLayout.preferredHeight = height;
486
+ }
487
+
488
+ private void Update()
489
+ {
490
+ if (areaCodePanel.gameObject.activeSelf)
491
+ {
492
+ if (!EventSystem.current.currentSelectedGameObject
493
+ || (searchInput.gameObject != EventSystem.current.currentSelectedGameObject &&
494
+ areaCodeBox != EventSystem.current.currentSelectedGameObject.transform.parent.gameObject))
495
+ {
496
+ OpenAreaCodePanel(false);
497
+ }
498
+ }
499
+
500
+ RectTransform trans = areaCodePanel.GetComponent<RectTransform>();
501
+ float w = trans.rect.width;
502
+ foreach (var data in AreaCodeBoxData)
503
+ {
504
+ float w1 = data.gameObj.GetComponent<RectTransform>().rect.width;
505
+ for (int i = 0; i < data.gameObj.transform.childCount; ++i)
506
+ {
507
+ GameObject obj = data.gameObj.transform.GetChild(i).gameObject;
508
+ string _name = obj.name;
509
+ float w2 = obj.GetComponent<RectTransform>().rect.width;
510
+ float x = obj.GetComponent<RectTransform>().rect.x;
511
+ int asd = 10;
512
+ }
513
+ }
514
+
515
+ RefreshSendCodeButtonStatus();
516
+ }
517
+
518
+ #endregion
519
+ }
520
+ }
521
+
522
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 4b91af3638f342c9a1cec59a89e0478f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 1e5cc6bc692a4f6eae3f0cc51191d23e
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,84 @@
1
+ #if UNITY_EDITOR || UNITY_STANDALONE
2
+ using System.Text.RegularExpressions;
3
+ using UnityEngine;
4
+ using UnityEngine.UI;
5
+ using XD.SDK.Common.Internal.Standalone;
6
+
7
+ namespace XD.SDK.Account.Internal.Standalone {
8
+ public class PhoneNumberInputAlert : UIElement {
9
+ public class Data {
10
+ public string AreaCode { get; set; }
11
+ public string PhoneNumber { get; set; }
12
+ }
13
+
14
+ public const int NEXT_CODE = 0;
15
+ public const int CLOSE_CODE = -1;
16
+
17
+ private static readonly string PHONE_NUMBER_REGEX = @"^1[0-9]{10}$";
18
+
19
+ private Button closeButton;
20
+ private Text titleText;
21
+ private Image inputBGImage;
22
+ private InputField inputNumberInput;
23
+ private Text errorNumberTipsText;
24
+ private Button nextButton;
25
+
26
+ private void Awake() {
27
+ closeButton = transform.Find("Alert/CloseButton").GetComponent<Button>();
28
+ titleText = transform.Find("Alert/TitleText").GetComponent<Text>();
29
+ inputBGImage = transform.Find("Alert/Input").GetComponent<Image>();
30
+ inputNumberInput = inputBGImage.transform.Find("NumberInput").GetComponent<InputField>();
31
+ errorNumberTipsText = transform.Find("Alert/ErrorNumberTips").GetComponent<Text>();
32
+ nextButton = transform.Find("Alert/NextButton").GetComponent<Button>();
33
+
34
+ errorNumberTipsText.gameObject.SetActive(false);
35
+
36
+ closeButton.onClick.AddListener(OnCloseClicked);
37
+ nextButton.onClick.AddListener(OnNextClicked);
38
+ }
39
+
40
+ private void Start() {
41
+ inputNumberInput.Select();
42
+ AliyunTrack.LoginOpenMobilePanel();
43
+ }
44
+
45
+ public bool CheckPhoneNumberValid(string phoneNumber) {
46
+ // 正则检查
47
+ bool valid = Regex.IsMatch(phoneNumber, PHONE_NUMBER_REGEX);
48
+ if (valid) {
49
+ inputBGImage.color = new Color(217.0f / 255, 217.0f / 255, 217.0f / 255);
50
+ } else {
51
+ inputBGImage.color = new Color(246.0f / 255, 76.0f / 255, 76.0f / 255);
52
+ }
53
+ errorNumberTipsText.gameObject.SetActive(!valid);
54
+ return valid;
55
+ }
56
+
57
+ #region UI Events
58
+
59
+ private void OnCloseClicked()
60
+ {
61
+ AliyunTrack.LoginMobileInputBtnClick(3);
62
+ OnCallback(CLOSE_CODE, null);
63
+ }
64
+
65
+ private void OnNextClicked() {
66
+ string areaCode = "86";
67
+ string phoneNumber = inputNumberInput.text;
68
+
69
+ if (!CheckPhoneNumberValid(phoneNumber)) {
70
+ return;
71
+ }
72
+
73
+ AliyunTrack.LoginMobileInputBtnClick(1);
74
+
75
+ OnCallback(NEXT_CODE, new Data {
76
+ AreaCode = areaCode,
77
+ PhoneNumber = phoneNumber
78
+ });
79
+ }
80
+
81
+ #endregion
82
+ }
83
+ }
84
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 9d6139fc7b66495fbe466b0911ded075
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: