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.
- package/Plugins/Android/libs/XDGAccount_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java.meta → Plugins/Android/libs/XDGAccount_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java.meta → Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGSupport_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java.meta → Plugins/Android/libs/XDGSupport_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs.meta +1 -1
- package/Plugins/Android.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h +2 -8
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK-Swift.h +329 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/{TDSGlobalThirdPartyLoginManager.h.meta → XDAccountSDK-Swift.h.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h +1 -2
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h +29 -43
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountDefines.h +43 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/{XDGPhoneAuthManager.h.meta → XDGAccountDefines.h.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h +3 -3
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h +3 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginEntriesConfig.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginService.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGTapLoginPermissionDialog.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Info.plist +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Info.plist.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/{Headers/XDGRoleInfo.h.meta → Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo.meta} +1 -1
- package/{Mobile/Http.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json +9 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json.meta +7 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc.meta +7 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule.meta +7 -0
- package/{Mobile/Editor.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/module.modulemap.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework.meta +4 -4
- package/Plugins/iOS.meta +1 -1
- package/Plugins.meta +1 -1
- package/Runtime/Internal/IXDGAccount.Extended.cs +11 -0
- package/{Mobile/Http/XDGAccountHttpConfigMobile.cs.meta → Runtime/Internal/IXDGAccount.Extended.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/AccountFeaturesImpl.cs +348 -0
- package/{Mobile/User/UserManagerMobile.cs.meta → Runtime/Internal/Mobile/AccountFeaturesImpl.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs +14 -0
- package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs.meta +3 -0
- package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs +37 -0
- package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs.meta +3 -0
- package/Runtime/Internal/Mobile/Http.meta +3 -0
- package/{Mobile.meta → Runtime/Internal/Mobile.meta} +1 -1
- package/Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs +168 -0
- package/{Mobile/Editor/XDAccountMobileProcessBuild.cs.meta → Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/AccessToken.meta +8 -0
- package/Runtime/Internal/Standalone/AccountCell.cs +143 -0
- package/{Mobile/XDGAccountMobile.cs.meta → Runtime/Internal/Standalone/AccountCell.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs +461 -0
- package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/AppleAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/AppleAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/GuestAuth.cs +22 -0
- package/Runtime/Internal/Standalone/Auth/GuestAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs +43 -0
- package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/SteamAuth.cs +90 -0
- package/Runtime/Internal/Standalone/Auth/SteamAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/TapAuth.cs +72 -0
- package/Runtime/Internal/Standalone/Auth/TapAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/WebAuth.cs +144 -0
- package/Runtime/Internal/Standalone/Auth/WebAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth.meta +8 -0
- package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs +15 -0
- package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Compliance.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs +374 -0
- package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Email.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs +245 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs +392 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule.meta +8 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs +228 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs.meta +3 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs +27 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs.meta +3 -0
- package/Runtime/Internal/Standalone/SupportModule.meta +3 -0
- package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs +479 -0
- package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Track.meta +8 -0
- package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs +156 -0
- package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs +295 -0
- package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/Email.meta +8 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs +46 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs +522 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO.meta +8 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs +84 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs +190 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs +164 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification.meta +8 -0
- package/Runtime/Internal/Standalone/UI.meta +8 -0
- package/Runtime/Internal/Standalone/UserCenterAlert.cs +405 -0
- package/Runtime/Internal/Standalone/UserCenterAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UserModule.cs +604 -0
- package/Runtime/Internal/Standalone/UserModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs +47 -0
- package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs.meta +3 -0
- package/Runtime/Internal/Standalone/WebFunction.meta +3 -0
- package/{Mobile/Plugins.meta → Runtime/Internal/Standalone.meta} +1 -1
- package/Runtime/Internal/XDGAccountEventHandler.cs +23 -0
- package/Runtime/Internal/XDGAccountEventHandler.cs.meta +3 -0
- package/Runtime/Internal/XDGAccountInternal.cs +86 -0
- package/Runtime/Internal/XDGAccountInternal.cs.meta +11 -0
- package/Runtime/Internal.meta +1 -1
- package/Runtime/Public/XDGAccount.Deprecated.cs +37 -0
- package/Runtime/Public/XDGAccount.Deprecated.cs.meta +11 -0
- package/Runtime/Public/XDGAccount.cs +107 -0
- package/Runtime/{XDGAccount.cs.meta → Public/XDGAccount.cs.meta} +1 -1
- package/Runtime/Public.meta +8 -0
- package/Runtime/XD.SDK.Account.asmdef +7 -2
- package/Runtime/XD.SDK.Account.asmdef.meta +1 -1
- package/Runtime.meta +1 -1
- package/package.json +5 -5
- package/package.json.meta +2 -2
- package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef +0 -20
- package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef.meta +0 -7
- package/Mobile/Editor/XDAccountMobileProcessBuild.cs +0 -20
- package/Mobile/Http/XDGAccountHttpConfigMobile.cs +0 -36
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java +0 -36
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java +0 -16
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java +0 -20
- package/Mobile/Plugins/Android/com/xd/account/bridge.meta +0 -8
- package/Mobile/Plugins/Android/com/xd/account.meta +0 -8
- package/Mobile/Plugins/Android/com/xd.meta +0 -8
- package/Mobile/Plugins/Android/com.meta +0 -8
- package/Mobile/Plugins/Android.meta +0 -8
- package/Mobile/Plugins/iOS/XDAccountBridge.m +0 -29
- package/Mobile/Plugins/iOS/XDAccountBridge.m.meta +0 -37
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h +0 -17
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h.meta +0 -27
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m +0 -23
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m.meta +0 -37
- package/Mobile/Plugins/iOS.meta +0 -8
- package/Mobile/User/UserManagerMobile.cs +0 -45
- package/Mobile/User.meta +0 -8
- package/Mobile/XD.SDK.Account.Mobile.asmdef +0 -23
- package/Mobile/XD.SDK.Account.Mobile.asmdef.meta +0 -7
- package/Mobile/XDGAccountMobile.cs +0 -138
- package/Mobile/XDGAccountMobileImpl.cs +0 -444
- package/Mobile/XDGAccountMobileImpl.cs.meta +0 -11
- package/Mobile/XDGTokenManager.cs +0 -116
- package/Mobile/XDGTokenManager.cs.meta +0 -11
- package/Mobile/XDGUserWrapper.cs +0 -167
- package/Mobile/XDGUserWrapper.cs.meta +0 -11
- package/Plugins/Android/libs/XDGAccount_6.29.0.aar +0 -0
- package/Plugins/Android/libs/XDGAccount_6.29.0.aar.meta +0 -32
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginManager.h +0 -47
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGPhoneAuthManager.h +0 -33
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGRoleInfo.h +0 -22
- package/README.md +0 -0
- package/README.md.meta +0 -7
- package/Runtime/Editor/XD.SDK.Account.Editor.asmdef +0 -19
- package/Runtime/Editor/XD.SDK.Account.Editor.asmdef.meta +0 -7
- package/Runtime/Editor/XDAccountProcessBuild.cs +0 -18
- package/Runtime/Editor/XDAccountProcessBuild.cs.meta +0 -11
- package/Runtime/Editor.meta +0 -8
- package/Runtime/IXDGAccount.cs +0 -44
- package/Runtime/IXDGAccount.cs.meta +0 -11
- package/Runtime/Internal/Http/IXDAccountHttpConfig.cs +0 -9
- package/Runtime/Internal/Http/IXDAccountHttpConfig.cs.meta +0 -11
- package/Runtime/Internal/Http/XDAccountHttpConfig.cs +0 -32
- package/Runtime/Internal/Http/XDAccountHttpConfig.cs.meta +0 -11
- package/Runtime/Internal/Http.meta +0 -8
- package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs +0 -7
- package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs.meta +0 -11
- package/Runtime/Internal/User.meta +0 -8
- package/Runtime/UserManager.cs +0 -35
- package/Runtime/UserManager.cs.meta +0 -11
- package/Runtime/XDGAccessToken.cs +0 -18
- package/Runtime/XDGAccessToken.cs.meta +0 -11
- package/Runtime/XDGAccount.cs +0 -130
- package/Runtime/XDGLoginType.cs +0 -17
- package/Runtime/XDGLoginType.cs.meta +0 -11
- package/Runtime/XDGRoleInfo.cs +0 -24
- package/Runtime/XDGRoleInfo.cs.meta +0 -11
- package/Runtime/XDGUser.cs +0 -30
- package/Runtime/XDGUser.cs.meta +0 -11
- package/Runtime/XDGUserStatusCode.cs +0 -16
- 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,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
|