//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Wednesday, May 09, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
public class GotoChargeWin : UIBase
|
{
|
[SerializeField] Text m_CTGStageDisplay;
|
public long startTime = DateTime.Now.Ticks;
|
|
|
private void Update() {
|
#if !UNITY_EDITOR
|
if (SDKUtils.Instance.FreePlatformInfo == null || string.IsNullOrEmpty(SDKUtils.Instance.FreePlatformInfo.account)){
|
return;
|
}
|
if (DateTime.Now.Ticks - startTime > 50000000)
|
{
|
CloseWindow();
|
}
|
#endif
|
|
if (DateTime.Now.Ticks - startTime > 10000000)
|
{
|
CloseWindow();
|
}
|
|
}
|
protected override void OnPreOpen()
|
{
|
SDKUtils.Instance.onFreePlatformPayCancel += OnChargeComplete;
|
SDKUtils.Instance.onFreePlatformPayFail += OnChargeComplete;
|
SDKUtils.Instance.onFreePlatformPayOk += OnChargeComplete;
|
|
m_CTGStageDisplay.text = Language.Get("GotoCharging");
|
RechargeManager.Instance.OnCTGStageChange += OnCTGStageChange;
|
|
startTime = DateTime.Now.Ticks;
|
}
|
|
|
protected override void OnPreClose()
|
{
|
SDKUtils.Instance.onFreePlatformPayCancel -= OnChargeComplete;
|
SDKUtils.Instance.onFreePlatformPayFail -= OnChargeComplete;
|
SDKUtils.Instance.onFreePlatformPayOk -= OnChargeComplete;
|
RechargeManager.Instance.OnCTGStageChange -= OnCTGStageChange;
|
}
|
|
|
|
private void OnCTGStageChange(string _display)
|
{
|
m_CTGStageDisplay.text = _display;
|
}
|
private void OnChargeComplete()
|
{
|
CloseWindow();
|
}
|
}
|