//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Saturday, January 06, 2018 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class StoryHintWin : Window { public Image headIcon; public Text talkerName; public Text content; private UnityEngine.Events.UnityAction m_OnClose; private float m_Duration; #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { StoryHintModel _model = ModelCenter.Instance.GetModel(); if (string.IsNullOrEmpty(_model.icon) == false) { headIcon.SetSprite(_model.icon); } m_Duration = _model.duration; talkerName.text = _model.name; content.text = _model.content; if (_model.onClosed != null) { m_OnClose = _model.onClosed; } } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { if (m_OnClose != null) { m_OnClose(); m_OnClose = null; } } #endregion protected override void LateUpdate() { base.LateUpdate(); m_Duration -= Time.deltaTime; if (m_Duration <= 0) { WindowCenter.Instance.Close(); } } } }