//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, April 15, 2019
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
|
public class HazyGrassDungeonWin : Window
|
{
|
[SerializeField] DungeonTargetBehaviour m_DungeonTarget;
|
[SerializeField] Text m_BasicGrassCount;
|
[SerializeField] Text m_FairyGrassCount;
|
[SerializeField] Text m_BasicGrassRefreshTime;
|
[SerializeField] Text m_FairyGrassRefreshTime;
|
|
[SerializeField] Transform m_ContainerCollectSucc;
|
[SerializeField] Text m_GainRemind;
|
|
DungeonModel model { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
HazyGrassModel hazyGrassModel { get { return ModelCenter.Instance.GetModel<HazyGrassModel>(); } }
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
}
|
|
protected override void OnPreOpen()
|
{
|
m_ContainerCollectSucc.gameObject.SetActive(false);
|
|
Display();
|
|
GlobalTimeEvent.Instance.secondEvent += PerSecond;
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
GlobalTimeEvent.Instance.secondEvent -= PerSecond;
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
#endregion
|
|
private void PerSecond()
|
{
|
DisplayGrassRefreshTime();
|
}
|
|
void Display()
|
{
|
if (ClientDungeonStageUtility.isClientDungeon)
|
{
|
var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
m_DungeonTarget.Init(config.dungeonId);
|
}
|
else
|
{
|
var mapId = PlayerDatas.Instance.baseData.MapID;
|
m_DungeonTarget.Init(mapId);
|
}
|
|
DisplayGrassRefreshTime();
|
}
|
|
void DisplayGrassCount()
|
{
|
|
}
|
|
void DisplayGrassRefreshTime()
|
{
|
var used = Mathf.Max(0, (int)(TimeUtility.ServerNow - hazyGrassModel.grassBornTime).TotalSeconds);
|
var refreshSeconds = hazyGrassModel.grassRefreshSeconds - used % hazyGrassModel.grassRefreshSeconds;
|
m_BasicGrassRefreshTime.text = Language.Get("HazyBasicGrassRefresh", TimeUtility.SecondsToMS(refreshSeconds));
|
m_FairyGrassRefreshTime.text = Language.Get("HazyFairyGrassRefresh", TimeUtility.SecondsToMS(refreshSeconds));
|
}
|
}
|
|
}
|
|
|
|
|