//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, March 14, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using LitJson; namespace Snxxz.UI { public class IDAuthenticationWin : Window { [SerializeField] InputField m_UserName; [SerializeField] InputField m_IdentityNumber; [SerializeField] Button m_Authentication; #region Built-in protected override void BindController() { } protected override void AddListeners() { m_Authentication.AddListener(Authentication); } protected override void OnPreOpen() { } protected override void OnAfterOpen() { SDKUtility.Instance.onFreePlatfromDoIDAuthenticationOk += OnAuthenticationOk; } protected override void OnPreClose() { SDKUtility.Instance.onFreePlatfromDoIDAuthenticationOk -= OnAuthenticationOk; } protected override void OnAfterClose() { } #endregion private void Authentication() { if (string.IsNullOrEmpty(m_UserName.text)) { ServerTipDetails.DisplayNormalTip(Language.Get("UserName_Z")); return; } var userName = m_UserName.text; if (string.IsNullOrEmpty(m_IdentityNumber.text)) { ServerTipDetails.DisplayNormalTip(Language.Get("IdentityNumber_Z")); return; } var identityNumber = m_IdentityNumber.text; if (identityNumber.Length != 15 && identityNumber.Length != 18) { ServerTipDetails.DisplayNormalTip(Language.Get("IdentityNumber_Z1")); return; } var account = ModelCenter.Instance.GetModel().sdkLoginResult.account; SDKUtility.Instance.FreePlatformDoIDAuthentication(account, userName, identityNumber); } private void OnAuthenticationOk(SDKUtility.FP_DoIDAuthentication _result) { ServerTipDetails.DisplayNormalTip(_result.errordesc); if (_result.errorcode == "1") { var send = new CA103_tagCMAdult(); send.Adult = MathUtility.CheckAdult(_result.card_id) ? (byte)1 : (byte)0; GameNetSystem.Instance.SendInfo(send); var account = ModelCenter.Instance.GetModel().sdkLoginResult.account; SDKUtility.Instance.FreePlatformCheckIDAuthentication(account); CloseClick(); } } } }