summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/NpcPopSpeekView.cs
blob: 4432684ed1d03b15513cf064e3ad31a93e5d3d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class NpcPopSpeekView : DlgBase<NpcPopSpeekView, DlgBehaviourBase>
	{
		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<XEntityMgr>.singleton.EntityStatistics.GetByID((uint)npcid);
			XEntityPresentation.RowData byPresentID = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(byID.PresentID);
			DlgBase<XChatSmallView, XChatSmallBehaviour>.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<XAudioMgr>.singleton.PlayUISound(fmod, true, AudioChannel.Action);
			}
		}

		protected void ClosePopSpeek(object o)
		{
			this.m_tween.PlayTween(false, -1f);
		}
	}
}