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.
- 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.1.aar +0 -0
- package/Plugins/Android/libs/XDGAccount_6.29.1.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,479 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using XD.SDK.Common;
|
|
5
|
+
using XD.SDK.Common.Internal.Events;
|
|
6
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
7
|
+
using CommonTrack = XD.SDK.Common.Internal.Standalone.AliyunTrack;
|
|
8
|
+
|
|
9
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// 登陆部分
|
|
13
|
+
/// </summary>
|
|
14
|
+
public partial class AliyunTrack
|
|
15
|
+
{
|
|
16
|
+
private static string loginTypeString = "";
|
|
17
|
+
public static string LoginEventSessionId;
|
|
18
|
+
private static string userLoginTypeString;
|
|
19
|
+
private static bool enableAuthorizeTrack;
|
|
20
|
+
private static bool enableSDKLoginTrack;
|
|
21
|
+
private static bool enableSlientAuthorize;
|
|
22
|
+
private static bool isPhoneLogin;
|
|
23
|
+
private static bool isEmailLogin;
|
|
24
|
+
private static bool enableTrackPhoneData;
|
|
25
|
+
|
|
26
|
+
private static bool enableTrackEmailData;
|
|
27
|
+
|
|
28
|
+
// 登陆验证码显示次数
|
|
29
|
+
public static int VerifyShowCount { get; set; }
|
|
30
|
+
|
|
31
|
+
// 登陆验证码发送次数
|
|
32
|
+
public static int VerifySendCount { get; set; }
|
|
33
|
+
|
|
34
|
+
// 登陆验证码校验次数
|
|
35
|
+
public static int VerifyResponseCount { get; set; }
|
|
36
|
+
|
|
37
|
+
// 邮件验证码发送次数
|
|
38
|
+
public static int EmailSendCodeCount { get; set; }
|
|
39
|
+
|
|
40
|
+
// 邮件验证码验证次数
|
|
41
|
+
public static int EmailCodeVerifyCount { get; set; }
|
|
42
|
+
|
|
43
|
+
// 人机验证次数
|
|
44
|
+
public static int CaptchaCount { get; set; }
|
|
45
|
+
|
|
46
|
+
// 人机验证开始时间
|
|
47
|
+
public static DateTime CaptchaStartTime { get; set; }
|
|
48
|
+
|
|
49
|
+
public static void ResetPhoneLoginData()
|
|
50
|
+
{
|
|
51
|
+
VerifyShowCount = VerifySendCount = VerifyResponseCount = 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public static void ResetEmailLoginData()
|
|
55
|
+
{
|
|
56
|
+
EmailSendCodeCount = EmailCodeVerifyCount = CaptchaCount = 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public static void LoginTrackPhoneData()
|
|
60
|
+
{
|
|
61
|
+
enableTrackPhoneData = true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public static void LoginTrackEmailData()
|
|
65
|
+
{
|
|
66
|
+
enableTrackEmailData = true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/// <summary>
|
|
70
|
+
/// 开始登录
|
|
71
|
+
/// </summary>
|
|
72
|
+
/// <param name="currentLoginTypeString">本次登陆类型</param>
|
|
73
|
+
/// <param name="userLoginTypeString">上次登陆类型</param>
|
|
74
|
+
public static void LoginStart(string currentLoginTypeString, string userLoginTypeString = null)
|
|
75
|
+
{
|
|
76
|
+
loginTypeString = currentLoginTypeString;
|
|
77
|
+
LoginEventSessionId = CommonTrack.GetNewEventSessionId();
|
|
78
|
+
AliyunTrack.userLoginTypeString = userLoginTypeString ?? currentLoginTypeString;
|
|
79
|
+
enableAuthorizeTrack = false;
|
|
80
|
+
isPhoneLogin = currentLoginTypeString == LoginType.Phone.ToString();
|
|
81
|
+
isEmailLogin = currentLoginTypeString == LoginType.Email.ToString();
|
|
82
|
+
CommonTrack.LogEventAsync("sdklogin_start", GetLoginModuleCommonProperties("sdklogin_start"));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/// <summary>
|
|
86
|
+
/// 登陆封控拦截成功
|
|
87
|
+
/// </summary>
|
|
88
|
+
public static void LoginRiskSuccess(string reason)
|
|
89
|
+
{
|
|
90
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_risk_success");
|
|
91
|
+
contents["event_reason"] = reason;
|
|
92
|
+
CommonTrack.LogEventAsync("sdklogin_risk_success", contents);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/// <summary>
|
|
96
|
+
/// 激活授权埋点
|
|
97
|
+
/// </summary>
|
|
98
|
+
public static void LoginEnableAuthorizeTrack()
|
|
99
|
+
{
|
|
100
|
+
enableAuthorizeTrack = true;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// <summary>
|
|
104
|
+
/// 激活 SDK 登陆成功/失败埋点
|
|
105
|
+
/// </summary>
|
|
106
|
+
public static void LoginEnableSDKLoginTrack()
|
|
107
|
+
{
|
|
108
|
+
enableSDKLoginTrack = true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// <summary>
|
|
112
|
+
/// 激活静默登陆
|
|
113
|
+
/// </summary>
|
|
114
|
+
public static void LoginEnableSlientAuthorize()
|
|
115
|
+
{
|
|
116
|
+
enableSlientAuthorize = true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/// <summary>
|
|
120
|
+
/// 打开手机登录页面
|
|
121
|
+
/// </summary>
|
|
122
|
+
public static void LoginOpenMobilePanel()
|
|
123
|
+
{
|
|
124
|
+
if (false == enableTrackPhoneData) return;
|
|
125
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_to_mobile_define");
|
|
126
|
+
// enter_from 代表进入该页面的上一级页面,PC 上只有正常打开这一种情况
|
|
127
|
+
contents["enter_from"] = "start";
|
|
128
|
+
CommonTrack.LogEventAsync("sdklogin_to_mobile_define", contents);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
public static void LoginOpenEmailPanel()
|
|
132
|
+
{
|
|
133
|
+
if (false == enableTrackEmailData) return;
|
|
134
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_to_mail_define");
|
|
135
|
+
CommonTrack.LogEventAsync("sdklogin_to_mail_define", contents);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
public static void TriggerCaptchaStart(string from)
|
|
139
|
+
{
|
|
140
|
+
if (!enableTrackEmailData && !enableTrackPhoneData) return;
|
|
141
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_machine_verify_begin");
|
|
142
|
+
contents["event_reason"] = from;
|
|
143
|
+
contents["event_times"] = $"{++CaptchaCount}";
|
|
144
|
+
CaptchaStartTime = DateTime.Now;
|
|
145
|
+
CommonTrack.LogEventAsync("sdklogin_machine_verify_begin", contents);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public static void TriggerCaptchaSuccess(string from)
|
|
149
|
+
{
|
|
150
|
+
if (!enableTrackEmailData && !enableTrackPhoneData) return;
|
|
151
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_machine_verify_success");
|
|
152
|
+
contents["event_reason"] = from;
|
|
153
|
+
contents["event_times"] = $"{CaptchaCount}";
|
|
154
|
+
contents["duration"] = $"{DateTime.Now.Subtract(CaptchaStartTime).TotalSeconds}";
|
|
155
|
+
CommonTrack.LogEventAsync("sdklogin_machine_verify_success", contents);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public static void SendEmailCode(bool success)
|
|
159
|
+
{
|
|
160
|
+
if (false == enableTrackEmailData) return;
|
|
161
|
+
string eventName = success ? "sdklogin_mail_code_send_success" : "sdklogin_mail_code_send_fail";
|
|
162
|
+
var contents = GetLoginModuleCommonProperties(eventName);
|
|
163
|
+
contents["event_times"] = $"{++EmailSendCodeCount}";
|
|
164
|
+
CommonTrack.LogEventAsync(eventName, contents);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public static void EmailCodeVerifyResult(bool success, string failedReason = null)
|
|
168
|
+
{
|
|
169
|
+
if (false == enableTrackEmailData) return;
|
|
170
|
+
string eventName = success ? "sdklogin_mail_code_success" : "sdklogin_mail_code_fail";
|
|
171
|
+
var contents = GetLoginModuleCommonProperties(eventName);
|
|
172
|
+
contents["event_times"] = $"{++EmailCodeVerifyCount}";
|
|
173
|
+
if (failedReason != null)
|
|
174
|
+
{
|
|
175
|
+
contents["event_reason"] = failedReason;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
CommonTrack.LogEventAsync(eventName, contents);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/// <summary>
|
|
182
|
+
/// 输入手机号页面点击按钮
|
|
183
|
+
/// 1-下一步;2-使用一键登录;3-关闭
|
|
184
|
+
/// </summary>
|
|
185
|
+
public static void LoginMobileInputBtnClick(int buttonType)
|
|
186
|
+
{
|
|
187
|
+
if (false == enableTrackPhoneData) return;
|
|
188
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_mobile_button_click");
|
|
189
|
+
// enter_from 代表进入该页面的上一级页面,PC 上只有正常打开这一种情况
|
|
190
|
+
contents["button_click"] = buttonType.ToString();
|
|
191
|
+
CommonTrack.LogEventAsync("sdklogin_mobile_button_click", contents);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/// <summary>
|
|
195
|
+
/// 滑动验证结果,因为滑动验证逻辑是在前端页面里,sdk 并不能直接拿到成功或者失败的逻辑,所以不埋点
|
|
196
|
+
/// </summary>
|
|
197
|
+
/// <param name="result">验证结果:0-失败;1-成功</param>
|
|
198
|
+
/// <param name="failReason">验证失败时记录失败错误码</param>
|
|
199
|
+
/// <param name="slideCount">本次登录seesionid内滑块验证次数</param>
|
|
200
|
+
public static void LoginMobileDivRes(int result, string failReason, int slideCount)
|
|
201
|
+
{
|
|
202
|
+
if (false == enableTrackPhoneData) return;
|
|
203
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_div_res");
|
|
204
|
+
contents["get_res"] = result.ToString();
|
|
205
|
+
contents["event_reason"] = failReason;
|
|
206
|
+
contents["event_times"] = slideCount.ToString();
|
|
207
|
+
CommonTrack.LogEventAsync("sdklogin_div_res", contents);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/// <summary>
|
|
211
|
+
/// 唤起输入验证码页面
|
|
212
|
+
/// </summary>
|
|
213
|
+
public static void LoginMobileVerifyCodeInput()
|
|
214
|
+
{
|
|
215
|
+
if (false == enableTrackPhoneData) return;
|
|
216
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_mobile_code_input");
|
|
217
|
+
contents["event_times"] = (++VerifyShowCount).ToString();
|
|
218
|
+
CommonTrack.LogEventAsync("sdklogin_mobile_code_input", contents);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/// <summary>
|
|
222
|
+
/// 手机登录发送验证码成功
|
|
223
|
+
/// </summary>
|
|
224
|
+
public static void LoginMobileVerifyCodeSendSuccess()
|
|
225
|
+
{
|
|
226
|
+
if (false == enableTrackPhoneData) return;
|
|
227
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_mobile_code_send_success");
|
|
228
|
+
contents["event_times"] = (++VerifySendCount).ToString();
|
|
229
|
+
CommonTrack.LogEventAsync("sdklogin_mobile_code_send_success", contents);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/// <summary>
|
|
233
|
+
/// 手机登录发送验证码失败
|
|
234
|
+
/// </summary>
|
|
235
|
+
public static void LoginMobileVerifyCodeSendFail()
|
|
236
|
+
{
|
|
237
|
+
if (false == enableTrackPhoneData) return;
|
|
238
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_mobile_code_send_fail");
|
|
239
|
+
contents["event_times"] = (++VerifySendCount).ToString();
|
|
240
|
+
CommonTrack.LogEventAsync("sdklogin_mobile_code_send_fail", contents);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/// <summary>
|
|
244
|
+
/// 手机登录验证码校验通过
|
|
245
|
+
/// </summary>
|
|
246
|
+
public static void LoginMobileVerifyCodePassSuccess()
|
|
247
|
+
{
|
|
248
|
+
if (false == enableTrackPhoneData) return;
|
|
249
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_mobile_code_success");
|
|
250
|
+
contents["event_times"] = (++VerifyResponseCount).ToString();
|
|
251
|
+
CommonTrack.LogEventAsync("sdklogin_mobile_code_success", contents);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/// <summary>
|
|
255
|
+
/// 手机登录验证码校验失败
|
|
256
|
+
/// </summary>
|
|
257
|
+
public static void LoginMobileVerifyCodePassFail(string reason)
|
|
258
|
+
{
|
|
259
|
+
if (false == enableTrackPhoneData) return;
|
|
260
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_mobile_code_fail");
|
|
261
|
+
contents["event_times"] = (++VerifyResponseCount).ToString();
|
|
262
|
+
contents["event_reason"] = reason;
|
|
263
|
+
CommonTrack.LogEventAsync("sdklogin_mobile_code_fail", contents);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/// <summary>
|
|
267
|
+
/// 登陆跳转授权
|
|
268
|
+
/// </summary>
|
|
269
|
+
public static void LoginAuthorize()
|
|
270
|
+
{
|
|
271
|
+
if (!enableAuthorizeTrack) return;
|
|
272
|
+
if (!enableSlientAuthorize)
|
|
273
|
+
CommonTrack.LogEventAsync("sdklogin_to_authorize", GetLoginModuleCommonProperties("sdklogin_to_authorize"));
|
|
274
|
+
else
|
|
275
|
+
CommonTrack.LogEventAsync("silent_sdklogin_to_authorize", GetLoginModuleCommonProperties("silent_sdklogin_to_authorize"));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/// <summary>
|
|
279
|
+
/// 登陆授权成功
|
|
280
|
+
/// </summary>
|
|
281
|
+
public static void LoginAuthorizeSuccess()
|
|
282
|
+
{
|
|
283
|
+
if (enableAuthorizeTrack)
|
|
284
|
+
{
|
|
285
|
+
if (!enableSlientAuthorize)
|
|
286
|
+
CommonTrack.LogEventAsync("sdklogin_authorize_success", GetLoginModuleCommonProperties("sdklogin_authorize_success"));
|
|
287
|
+
else
|
|
288
|
+
CommonTrack.LogEventAsync("silent_sdklogin_authorize_success", GetLoginModuleCommonProperties("silent_sdklogin_authorize_success"));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
enableAuthorizeTrack = false;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/// <summary>
|
|
295
|
+
/// 登陆授权失败
|
|
296
|
+
/// </summary>
|
|
297
|
+
public static void LoginAuthorizeFail(string reason)
|
|
298
|
+
{
|
|
299
|
+
if (enableAuthorizeTrack)
|
|
300
|
+
{
|
|
301
|
+
if (!enableSlientAuthorize)
|
|
302
|
+
{
|
|
303
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_authorize_fail");
|
|
304
|
+
contents["event_reason"] = reason;
|
|
305
|
+
CommonTrack.LogEventAsync("sdklogin_authorize_fail", contents);
|
|
306
|
+
}
|
|
307
|
+
else
|
|
308
|
+
{
|
|
309
|
+
var contents = GetLoginModuleCommonProperties("silent_sdklogin_authorize_fail");
|
|
310
|
+
contents["event_reason"] = reason;
|
|
311
|
+
CommonTrack.LogEventAsync("silent_sdklogin_authorize_fail", contents);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
enableSlientAuthorize = false;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/// <summary>
|
|
319
|
+
/// SDK 登录成功
|
|
320
|
+
/// </summary>
|
|
321
|
+
public static void LoginPreSuccess()
|
|
322
|
+
{
|
|
323
|
+
if (enableSDKLoginTrack)
|
|
324
|
+
{
|
|
325
|
+
if (!enableSlientAuthorize)
|
|
326
|
+
CommonTrack.LogEventAsync("sdklogin_pre_login_success", GetLoginModuleCommonProperties("sdklogin_pre_login_success"));
|
|
327
|
+
else
|
|
328
|
+
CommonTrack.LogEventAsync("silent_sdklogin_pre_login_success",
|
|
329
|
+
GetLoginModuleCommonProperties("silent_sdklogin_pre_login_success", userLoginTypeString));
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
enableSDKLoginTrack = false;
|
|
333
|
+
enableSlientAuthorize = false;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/// <summary>
|
|
337
|
+
/// SDK 登录失败
|
|
338
|
+
/// </summary>
|
|
339
|
+
public static void LoginPreFail(string reason)
|
|
340
|
+
{
|
|
341
|
+
if (enableSDKLoginTrack)
|
|
342
|
+
{
|
|
343
|
+
if (!enableSlientAuthorize)
|
|
344
|
+
{
|
|
345
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_pre_login_fail", userLoginTypeString);
|
|
346
|
+
contents["event_reason"] = reason;
|
|
347
|
+
CommonTrack.LogEventAsync("sdklogin_pre_login_fail", contents);
|
|
348
|
+
}
|
|
349
|
+
else
|
|
350
|
+
{
|
|
351
|
+
var contents = GetLoginModuleCommonProperties("silent_sdklogin_pre_login_fail", userLoginTypeString);
|
|
352
|
+
contents["event_reason"] = reason;
|
|
353
|
+
CommonTrack.LogEventAsync("silent_sdklogin_pre_login_fail", contents);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
enableSDKLoginTrack = false;
|
|
358
|
+
enableSlientAuthorize = false;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
#region 实名
|
|
362
|
+
|
|
363
|
+
public static void LoginAntiAddictionStartup()
|
|
364
|
+
{
|
|
365
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_personal_start", userLoginTypeString);
|
|
366
|
+
CommonTrack.LogEventAsync("sdklogin_personal_start", contents);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
public static void LoginAntiAddictionResult(int code, string reason, string extras)
|
|
370
|
+
{
|
|
371
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_personal_res", userLoginTypeString);
|
|
372
|
+
contents["get_res"] = code.ToString();
|
|
373
|
+
contents["event_reason"] = reason;
|
|
374
|
+
contents["extras"] = extras;
|
|
375
|
+
CommonTrack.LogEventAsync("sdklogin_personal_res", contents);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
public static void LoginExitAntiAddictionPopup(int buttonType)
|
|
379
|
+
{
|
|
380
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_personal_popup_click", userLoginTypeString);
|
|
381
|
+
contents["button_click"] = buttonType.ToString();
|
|
382
|
+
CommonTrack.LogEventAsync("sdklogin_personal_popup_click", contents);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
#endregion
|
|
386
|
+
|
|
387
|
+
/// <summary>
|
|
388
|
+
/// 登录成功
|
|
389
|
+
/// </summary>
|
|
390
|
+
public static void LoginSuccess()
|
|
391
|
+
{
|
|
392
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_success", userLoginTypeString);
|
|
393
|
+
CommonTrack.LogEventAsync("sdklogin_success", contents);
|
|
394
|
+
enableTrackPhoneData = false;
|
|
395
|
+
enableTrackEmailData = false;
|
|
396
|
+
ResetPhoneLoginData();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/// <summary>
|
|
400
|
+
/// 登录失败
|
|
401
|
+
/// </summary>
|
|
402
|
+
/// <param name="extraInfo">失败原因</param>
|
|
403
|
+
public static void LoginFail(string reason)
|
|
404
|
+
{
|
|
405
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_fail", userLoginTypeString);
|
|
406
|
+
contents["event_reason"] = reason;
|
|
407
|
+
CommonTrack.LogEventAsync("sdklogin_fail", contents);
|
|
408
|
+
enableTrackPhoneData = false;
|
|
409
|
+
enableTrackEmailData = false;
|
|
410
|
+
ResetPhoneLoginData();
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/// <summary>
|
|
414
|
+
/// 登出账号
|
|
415
|
+
/// </summary>
|
|
416
|
+
/// <param name="extraInfo">登出原因(1.LOGOUT_API:游戏调用 SDK 的 logout.;2.XD_TOKEN_EXPIRED:自动登录时 XD Token 过期调用的 logout.;3.THIRD_TOKEN_EXPIRED:自动登录时第三方登录 Token 过期调用的 logout</param>
|
|
417
|
+
public static void LoginLogout(string reason)
|
|
418
|
+
{
|
|
419
|
+
var contents = GetLoginModuleCommonProperties("sdklogin_logout", userLoginTypeString);
|
|
420
|
+
contents["event_reason"] = reason;
|
|
421
|
+
CommonTrack.LogEventAsync("sdklogin_logout", contents);
|
|
422
|
+
ResetLoginData();
|
|
423
|
+
ResetPhoneLoginData();
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
private static void ResetLoginData()
|
|
427
|
+
{
|
|
428
|
+
userLoginTypeString = "";
|
|
429
|
+
loginTypeString = "";
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
private static Dictionary<string, string> GetLoginModuleCommonProperties(string eventName, string userLoginTypeString = "")
|
|
433
|
+
{
|
|
434
|
+
var current = XDGEventBus.Publish<XDGUser>(XDGEvents.AccountGetCurrentUser)?.UserId;
|
|
435
|
+
var content = new Dictionary<string, string>();
|
|
436
|
+
content["tag"] = "sdklogin";
|
|
437
|
+
content["event_session_id"] = LoginEventSessionId;
|
|
438
|
+
content["login_type"] = loginTypeString;
|
|
439
|
+
content["user_login_type"] = string.IsNullOrEmpty(current) ? "" : userLoginTypeString;
|
|
440
|
+
content["logid"] = CommonTrack.GetLogId(LoginEventSessionId, eventName);
|
|
441
|
+
content["isLoginModule"] = "true";
|
|
442
|
+
#if XD_STEAM_SUPPORT
|
|
443
|
+
if (SteamUtils.IsSDKSupported)
|
|
444
|
+
{
|
|
445
|
+
content["console_type"] = "steam";
|
|
446
|
+
}
|
|
447
|
+
#endif
|
|
448
|
+
|
|
449
|
+
if (isPhoneLogin)
|
|
450
|
+
{
|
|
451
|
+
// text 代表验证码登录, sim 代表自动登录
|
|
452
|
+
// PC 上只有验证码登录
|
|
453
|
+
content["sub_login_type"] = "text";
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return content;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
public static string CreateMD5(string input)
|
|
460
|
+
{
|
|
461
|
+
// Use input string to calculate MD5 hash
|
|
462
|
+
using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create())
|
|
463
|
+
{
|
|
464
|
+
byte[] inputBytes = System.Text.Encoding.UTF8.GetBytes(input);
|
|
465
|
+
byte[] hashBytes = md5.ComputeHash(inputBytes);
|
|
466
|
+
|
|
467
|
+
// Convert the byte array to hexadecimal string prior to .NET 5
|
|
468
|
+
var sb = new System.Text.StringBuilder();
|
|
469
|
+
for (int i = 0; i < hashBytes.Length; i++)
|
|
470
|
+
{
|
|
471
|
+
sb.Append(hashBytes[i].ToString("X2"));
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return sb.ToString();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
#endif
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using TMPro;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
using UnityEngine.EventSystems;
|
|
7
|
+
using UnityEngine.UI;
|
|
8
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
9
|
+
|
|
10
|
+
namespace XD.SDK.Account.Internal.Standalone{
|
|
11
|
+
public class CodeUnbindAlert : UIElement{
|
|
12
|
+
public class Data {
|
|
13
|
+
public string code{ get; set; }
|
|
14
|
+
}
|
|
15
|
+
public const int SEND_CODE = 0;
|
|
16
|
+
public const int UNBIND = 1;
|
|
17
|
+
public const int CLOSE_CODE = -1;
|
|
18
|
+
private Button closeButton;
|
|
19
|
+
|
|
20
|
+
private TextMeshProUGUI openIdText;
|
|
21
|
+
|
|
22
|
+
private Image verificationCodeBG;
|
|
23
|
+
private InputField verificationCodeInput;
|
|
24
|
+
private Button sendCodeButton;
|
|
25
|
+
private Text sendCodeText;
|
|
26
|
+
private Text verificationCodeErrorTips;
|
|
27
|
+
|
|
28
|
+
private Button unbindButton;
|
|
29
|
+
|
|
30
|
+
private Text footerText;
|
|
31
|
+
|
|
32
|
+
private LocalizableString localizableString;
|
|
33
|
+
private void Awake(){
|
|
34
|
+
localizableString = XDLocalization.GetCurrentLocalizableString();
|
|
35
|
+
// 标题和关闭按钮
|
|
36
|
+
closeButton = transform.Find("Alert/CloseButton").GetComponent<Button>();
|
|
37
|
+
transform.Find("Alert/TitleText").GetComponent<Text>().text = localizableString.CodeUnbindTitle;
|
|
38
|
+
closeButton.onClick.AddListener(OnCloseButtonClicked);
|
|
39
|
+
|
|
40
|
+
// OpenID
|
|
41
|
+
transform.Find("Alert/SubtitleText").GetComponent<Text>().text = localizableString.CodeUnbindSubtitle;
|
|
42
|
+
openIdText = transform.Find("Alert/OpenIdText").GetComponent<TextMeshProUGUI>();
|
|
43
|
+
|
|
44
|
+
// 验证码框
|
|
45
|
+
verificationCodeBG = transform.Find("Alert/VerificationCodeBox").GetComponent<Image>();
|
|
46
|
+
verificationCodeInput = transform.Find("Alert/VerificationCodeBox/CodeInput").GetComponent<InputField>();
|
|
47
|
+
transform.Find("Alert/VerificationCodeBox/CodeInput/Placeholder").GetComponent<Text>().text = localizableString.CodeBoxHint;
|
|
48
|
+
EventTrigger verificationCodeInputTrigger = transform.Find("Alert/VerificationCodeBox/CodeInput").GetComponent<EventTrigger>();
|
|
49
|
+
sendCodeButton = transform.Find("Alert/VerificationCodeBox/SendButton").GetComponent<Button>();
|
|
50
|
+
sendCodeText = transform.Find("Alert/VerificationCodeBox/SendButton").GetComponent<Text>();
|
|
51
|
+
verificationCodeErrorTips = transform.Find("Alert/VerificationCodeBox/CodeErrorTips").GetComponent<Text>();
|
|
52
|
+
verificationCodeErrorTips.gameObject.SetActive(false);
|
|
53
|
+
var codeSelectEntry = new EventTrigger.Entry{
|
|
54
|
+
eventID = EventTriggerType.Select
|
|
55
|
+
};
|
|
56
|
+
codeSelectEntry.callback.AddListener(OnCodeInputSelected);
|
|
57
|
+
var codeDeselectEntry = new EventTrigger.Entry{
|
|
58
|
+
eventID = EventTriggerType.Deselect
|
|
59
|
+
};
|
|
60
|
+
codeDeselectEntry.callback.AddListener(OnCodeInputDeselect);
|
|
61
|
+
verificationCodeInputTrigger.triggers = new List<EventTrigger.Entry>();
|
|
62
|
+
verificationCodeInputTrigger.triggers.AddRange(new []{
|
|
63
|
+
codeSelectEntry, codeDeselectEntry
|
|
64
|
+
});
|
|
65
|
+
verificationCodeInput.onValueChanged.AddListener(OnCodeInputValueChanged);
|
|
66
|
+
|
|
67
|
+
sendCodeButton.onClick.AddListener(OnSendCodeButtonClicked);
|
|
68
|
+
|
|
69
|
+
// 解绑按钮
|
|
70
|
+
unbindButton = transform.Find("Alert/UnbindButton").GetComponent<Button>();
|
|
71
|
+
transform.Find("Alert/UnbindButton/Text").GetComponent<Text>().text = localizableString.CodeUnbindButtonText;
|
|
72
|
+
unbindButton.onClick.AddListener(OnUnbindButtonClicked);
|
|
73
|
+
|
|
74
|
+
// 页脚提示
|
|
75
|
+
transform.Find("Alert/Footer").GetComponent<Text>().text = localizableString.CodeUnbindFooter;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private void Start(){
|
|
79
|
+
openIdText.text = extra["openId"] as string;
|
|
80
|
+
OnSendCodeButtonClicked();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public void UpdateCodeError(string errorString){
|
|
84
|
+
verificationCodeErrorTips.text = errorString;
|
|
85
|
+
verificationCodeErrorTips.gameObject.SetActive(errorString.Length > 0);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public void SetSendButtonEnable(bool enable){
|
|
89
|
+
sendCodeButtonEnable = enable;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public void UpdateCanResendSeconds(float Seconds){
|
|
93
|
+
canSendTime = DateTime.Now + TimeSpan.FromSeconds(Seconds);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
#region Callback
|
|
97
|
+
private void OnCloseButtonClicked(){
|
|
98
|
+
OnCallback(CLOSE_CODE, null);
|
|
99
|
+
}
|
|
100
|
+
private void OnSendCodeButtonClicked(){
|
|
101
|
+
OnCallback(SEND_CODE, null);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private void OnUnbindButtonClicked(){
|
|
105
|
+
OnCallback(UNBIND, new Data(){code = verificationCodeInput.text});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private void OnCodeInputValueChanged(string newValue){
|
|
109
|
+
UpdateCodeError("");
|
|
110
|
+
}
|
|
111
|
+
#endregion
|
|
112
|
+
|
|
113
|
+
#region Private
|
|
114
|
+
private void Update(){
|
|
115
|
+
RefreshSendCodeButtonStatus();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private void RefreshSendCodeButtonStatus(){
|
|
119
|
+
double CanSendSeconds = (canSendTime - DateTime.Now).TotalSeconds;
|
|
120
|
+
bool hasSent = canSendTime != DateTime.MinValue;
|
|
121
|
+
if (CanSendSeconds <= 0){
|
|
122
|
+
sendCodeText.text = hasSent ? localizableString.CodeBoxRetry : localizableString.CodeBoxSendCode;
|
|
123
|
+
sendCodeButton.enabled = sendCodeButtonEnable;
|
|
124
|
+
} else{
|
|
125
|
+
sendCodeText.text = $"{(int)Math.Ceiling(CanSendSeconds)} s";
|
|
126
|
+
sendCodeButton.enabled = false;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
sendCodeText.color = sendCodeButton.enabled ? PhoneModuleIO.PhoneUIColor : PhoneModuleIO.PhoneUIDisableColor;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private bool sendCodeButtonEnable = true;
|
|
133
|
+
private DateTime canSendTime = DateTime.MinValue;
|
|
134
|
+
private void OnCodeInputSelected(BaseEventData eventData){
|
|
135
|
+
codeInputSelected = true;
|
|
136
|
+
RefreshCodeInputBorderColor();
|
|
137
|
+
}
|
|
138
|
+
private void OnCodeInputDeselect(BaseEventData eventData){
|
|
139
|
+
codeInputSelected = false;
|
|
140
|
+
RefreshCodeInputBorderColor();
|
|
141
|
+
}
|
|
142
|
+
private void RefreshCodeInputBorderColor(){
|
|
143
|
+
if (verificationCodeInput.text.Length > 0){
|
|
144
|
+
verificationCodeBG.color = Color.red;
|
|
145
|
+
}else if (codeInputSelected){
|
|
146
|
+
verificationCodeBG.color = PhoneModuleIO.PhoneUIColor;
|
|
147
|
+
}else{
|
|
148
|
+
verificationCodeBG.color = PhoneModuleIO.PhoneUIDisableColor;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
private bool codeInputSelected;
|
|
152
|
+
#endregion
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
#endif
|