From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/NpcPopSpeekView.cs | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/NpcPopSpeekView.cs (limited to 'Client/Assets/Scripts/XMainClient/NpcPopSpeekView.cs') diff --git a/Client/Assets/Scripts/XMainClient/NpcPopSpeekView.cs b/Client/Assets/Scripts/XMainClient/NpcPopSpeekView.cs new file mode 100644 index 00000000..4432684e --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/NpcPopSpeekView.cs @@ -0,0 +1,89 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class NpcPopSpeekView : DlgBase + { + public override string fileName + { + get + { + return "Battle/NpcPopSpeek"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + private IXUISprite m_avatar; + + private IXUILabel m_text; + + private IXUITweenTool m_tween; + + private GameObject m_Warning; + + protected override void Init() + { + this.m_avatar = (base.uiBehaviour.transform.Find("Duihua/Avatar").GetComponent("XUISprite") as IXUISprite); + this.m_text = (base.uiBehaviour.transform.Find("Duihua/Text").GetComponent("XUILabel") as IXUILabel); + this.m_tween = (base.uiBehaviour.transform.Find("Duihua").GetComponent("XUIPlayTween") as IXUITweenTool); + this.m_Warning = base.uiBehaviour.transform.Find("Duihua/Warning").gameObject; + } + + public void ShowNpcPopSpeek(int type, int npcid, string text, float time, string fmod) + { + this.SetVisible(true, true); + bool flag = type == 1; + if (flag) + { + this.m_Warning.SetActive(false); + } + else + { + bool flag2 = type == 2; + if (flag2) + { + this.m_Warning.SetActive(true); + } + } + XEntityStatistics.RowData byID = XSingleton.singleton.EntityStatistics.GetByID((uint)npcid); + XEntityPresentation.RowData byPresentID = XSingleton.singleton.EntityInfo.GetByPresentID(byID.PresentID); + DlgBase.singleton.ShowCurrTempMsg(text, byID.Name); + bool flag3 = byID != null; + if (flag3) + { + this.m_avatar.SetSprite(byPresentID.Avatar, byPresentID.Atlas, false); + } + this.m_text.SetText(text); + this.m_tween.PlayTween(true, -1f); + bool flag4 = !string.IsNullOrEmpty(fmod); + if (flag4) + { + XSingleton.singleton.PlayUISound(fmod, true, AudioChannel.Action); + } + } + + protected void ClosePopSpeek(object o) + { + this.m_tween.PlayTween(false, -1f); + } + } +} -- cgit v1.1-26-g67d0