From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/UI/CutSceneUI.cs | 121 +++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/CutSceneUI.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/CutSceneUI.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/CutSceneUI.cs b/Client/Assets/Scripts/XMainClient/UI/CutSceneUI.cs new file mode 100644 index 00000000..887ab86e --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CutSceneUI.cs @@ -0,0 +1,121 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + public class CutSceneUI : DlgBase + { + public override string fileName + { + get + { + return "Common/CutSceneUI"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override bool exclusive + { + get + { + return true; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + protected override void Init() + { + base.uiBehaviour.m_BG.SetVisible(true); + base.uiBehaviour.m_Text.SetText(""); + } + + public override void RegisterEvent() + { + base.uiBehaviour.m_Skip.RegisterLabelClickEventHandler(new LabelClickEventHandler(this.OnSkipClick)); + base.uiBehaviour.m_Overlay.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnOverlayClick)); + } + + protected override void OnShow() + { + base.OnShow(); + base.uiBehaviour.m_Overlay.gameObject.SetActive(true); + base.uiBehaviour.m_Skip.gameObject.SetActive(false); + base.uiBehaviour.m_IntroTween.gameObject.SetActive(false); + } + + protected override void OnHide() + { + base.OnHide(); + base.uiBehaviour.m_Text.SetText(""); + } + + protected void OnSkipClick(IXUILabel uiSprite) + { + bool isPlaying = XSingleton.singleton.IsPlaying; + if (isPlaying) + { + XSingleton.singleton.Stop(false); + } + } + + protected void OnOverlayClick(IXUISprite go) + { + bool syncMode = XSingleton.singleton.SyncMode; + if (!syncMode) + { + base.uiBehaviour.m_Overlay.gameObject.SetActive(false); + base.uiBehaviour.m_Skip.gameObject.SetActive(true); + } + } + + public void SetText(string text) + { + bool flag = !base.IsVisible(); + if (flag) + { + this.SetVisible(true, true); + } + base.uiBehaviour.m_Text.SetText(text); + } + + public void SetIntroText(bool enabled, string name, string text, float x, float y) + { + bool flag = !base.IsVisible(); + if (!flag) + { + if (enabled) + { + base.uiBehaviour.m_Name.SetText(name); + base.uiBehaviour.m_IntroTween.gameObject.transform.localPosition = new Vector2(x, y); + base.uiBehaviour.m_IntroText.SetText(text); + base.uiBehaviour.m_IntroTween.SetTweenGroup(0); + base.uiBehaviour.m_IntroTween.ResetTweenByGroup(true, 0); + base.uiBehaviour.m_IntroTween.PlayTween(true, -1f); + } + else + { + base.uiBehaviour.m_IntroTween.SetTweenGroup(1); + base.uiBehaviour.m_IntroTween.ResetTweenByGroup(true, 1); + base.uiBehaviour.m_IntroTween.PlayTween(true, -1f); + } + } + } + } +} -- cgit v1.1-26-g67d0