//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Thursday, December 28, 2017 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; namespace Snxxz.UI { public class StoryDialogueBubble : DialogueBubble { float m_Delay = 0f; bool delayOver = false; string content = string.Empty; new Transform target; new Camera camera; public static void StoryShow(string _content, Transform _target, Camera _camera, float _delay = 0f) { var bubble = DialogueBubblePool.Require(Pattern.Story); bubble.transform.SetParentEx(WindowCenter.Instance.uiRoot.bossShowCanvas.transform, Vector3.zero, Vector3.zero, Vector3.one); bubble.gameObject.SetActive(true); var storyBubble = bubble as StoryDialogueBubble; if (storyBubble) { storyBubble.DelayShow(_content, _target, _camera, _delay); } } public void DelayShow(string _content, Transform _target, Camera _camera, float _delay) { content = _content; target = _target; camera = _camera; delayOver = false; m_Delay = Time.time + _delay; if (m_Delay > 0f) { this.transform.localScale = Vector3.zero; } } protected override void LateUpdate() { base.LateUpdate(); if (!delayOver && Time.time > m_Delay) { delayOver = true; this.transform.localScale = Vector3.one; base.Show(content, target, camera); } } } }