summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/CutSceneUI.cs
blob: 887ab86ed050d31d5d8163a3a76863c32daea14d (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient.UI
{
	public class CutSceneUI : DlgBase<CutSceneUI, CutSceneUIBehaviour>
	{
		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<XCutScene>.singleton.IsPlaying;
			if (isPlaying)
			{
				XSingleton<XCutScene>.singleton.Stop(false);
			}
		}

		protected void OnOverlayClick(IXUISprite go)
		{
			bool syncMode = XSingleton<XGame>.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);
				}
			}
		}
	}
}