//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, October 09, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI {
|
|
public class FairyGrabBossNoticeWin : Window
|
{
|
[SerializeField] Button m_Goto;
|
[SerializeField] RawImage m_Horse;
|
[SerializeField] RawImage m_Pet;
|
[SerializeField] Text m_SurplusTime;
|
|
FairyGrabBossModel model { get { return ModelCenter.Instance.GetModel<FairyGrabBossModel>(); } }
|
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
m_Goto.onClick.AddListener(Goto);
|
}
|
|
protected override void OnPreOpen()
|
{
|
GlobalTimeEvent.Instance.secondEvent += SecondEvent;
|
Display();
|
DisplayTime();
|
model.SetViewFairyGrabBossNotice();
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
GlobalTimeEvent.Instance.secondEvent -= SecondEvent;
|
UI3DModelExhibition.Instance.StopShow();
|
UI3DModelExhibition.InstanceClone1.StopShow();
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
#endregion
|
private void Goto()
|
{
|
WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.FairyGrabBoss);
|
}
|
|
void Display()
|
{
|
m_Horse.gameObject.SetActive(true);
|
m_Pet.gameObject.SetActive(true);
|
var npcConfig = NPCConfig.Get(model.noticeShowPet);
|
UI3DModelExhibition.Instance.ShowNPC(model.noticeShowPet, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, m_Pet);
|
var horseConfig = HorseConfig.Get(model.noticeShowHorse);
|
UI3DModelExhibition.InstanceClone1.ShowHourse(horseConfig.Model, m_Horse);
|
UI3DModelExhibition.Instance.interactable = false;
|
UI3DModelExhibition.InstanceClone1.interactable = false;
|
}
|
|
private void SecondEvent()
|
{
|
DisplayTime();
|
}
|
|
void DisplayTime()
|
{
|
var seconds = model.GetNextSessionSeconds();
|
var isOpen = model.IsOpen;
|
if (seconds > 0)
|
{
|
if (!m_SurplusTime.gameObject.activeSelf)
|
{
|
m_SurplusTime.gameObject.SetActive(true);
|
}
|
m_SurplusTime.text = Language.Get("FairyGrabBossTime", TimeUtility.SecondsToDHMSCHS(seconds));
|
}
|
else if (isOpen)
|
{
|
if (!m_SurplusTime.gameObject.activeSelf)
|
{
|
m_SurplusTime.gameObject.SetActive(true);
|
}
|
m_SurplusTime.text = Language.Get("FairyGrabBossOpened");
|
}
|
else
|
{
|
m_SurplusTime.gameObject.SetActive(false);
|
}
|
}
|
}
|
|
}
|
|
|
|
|