//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Saturday, October 14, 2017
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
|
public class RealmCollectWin : Window
|
{
|
[SerializeField]
|
Text progressTip;
|
[SerializeField]
|
SmoothSlider progress;
|
[SerializeField]
|
Text progressText;
|
[SerializeField] Text m_FairyFeastTip;
|
|
private DateTime endTime;
|
private int miscPoint = 0;
|
private List<string> miscStrList = new List<string>(3);
|
|
DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
|
private float m_Time = 0;
|
#region Built-in
|
protected override void BindController()
|
{
|
miscStrList.Add(".");
|
miscStrList.Add("..");
|
miscStrList.Add("...");
|
}
|
|
protected override void AddListeners()
|
{
|
|
}
|
|
protected override void OnPreOpen()
|
{
|
PlayerRealmData.OnPlayerCollectEnd += OnPlayerCollectEnd;
|
|
progressTip.text = Language.Get("RealmWin_Bewrite_45");
|
progress.ResetValue(0);
|
progressText.text = (float)Math.Round(progress.value * 100, 0) + "%";
|
|
endTime = TimeUtility.ServerNow.AddMilliseconds(PlayerDatas.Instance.realm.CollectTime);
|
|
var mapId = dungeonModel.GetDataMapIdByMapId(PlayerDatas.Instance.baseData.MapID);
|
m_FairyFeastTip.gameObject.SetActive(mapId == 31230);
|
}
|
|
private void OnPlayerCollectEnd(int palyerID, byte type)
|
{
|
if (palyerID == PlayerDatas.Instance.baseData.PlayerID)
|
{
|
CloseImmediately();
|
}
|
}
|
|
protected override void OnAfterOpen()
|
{
|
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
PlayerRealmData.OnPlayerCollectEnd -= OnPlayerCollectEnd;
|
}
|
|
protected override void OnActived()
|
{
|
if (!PrepareHandler.Instance.isPreparing)
|
{
|
CloseClick();
|
}
|
}
|
|
protected override void LateUpdate()
|
{
|
m_Time += Time.deltaTime;
|
if (m_Time > 0.5f)
|
{
|
m_Time = 0;
|
progressTip.text = Language.Get("RealmWin_Bewrite_45") + miscStrList[miscPoint];
|
miscPoint++;
|
if (miscPoint >= 3) miscPoint = 0;
|
}
|
progress.value = 1 - (float)(endTime - TimeUtility.ServerNow).TotalMilliseconds / PlayerDatas.Instance.realm.CollectTime;
|
progressText.text = (float)Math.Round(progress.value * 100, 0) + "%";
|
if (progress.value >= 1)
|
{
|
CloseImmediately();
|
}
|
}
|
#endregion
|
|
|
}
|
|
}
|
|
|
|
|