summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/GVGDuelWrapDisplay.cs
blob: 1bd74fca024aa513a9832504e2ca14a6cac32e8d (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
using System;
using UILib;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient.UI
{
	internal class GVGDuelWrapDisplay
	{
		private IXUILabel m_time;

		private IXUILabel m_guildNameCurrent;

		private IXUILabel m_guildNameUsed;

		private IXUILabel m_guildNameNext;

		private IXUISprite m_PortraitCurrent;

		private IXUISprite m_PortraitUsed;

		private IXUISprite m_PortraitNext;

		private IXUISprite m_enterBattle;

		private IXUILabel m_score;

		private Transform m_UsedPortraitEmpty;

		private Transform m_CurrentPortraitEmpty;

		private Transform m_NextPortraitEmpty;

		private Transform m_CurrentVS;

		private Transform m_CurrentMessage;

		private Transform m_win;

		private Transform m_lose;

		private Transform m_current;

		private Transform m_next;

		private Transform m_used;

		private int _index;

		public void Setup(Transform t, int index, SpriteClickEventHandler handler)
		{
			this._index = index;
			this.m_current = t.Find("Current");
			this.m_next = t.Find("Next");
			this.m_used = t.Find("Used");
			this.m_win = t.Find("Used/Result/Win");
			this.m_lose = t.Find("Used/Result/Lose");
			this.m_time = (t.Find("Day").GetComponent("XUILabel") as IXUILabel);
			this.m_guildNameCurrent = (t.Find("Current/GuildName").GetComponent("XUILabel") as IXUILabel);
			this.m_guildNameUsed = (t.Find("Used/GuildName").GetComponent("XUILabel") as IXUILabel);
			this.m_guildNameNext = (t.Find("Next/GuildName").GetComponent("XUILabel") as IXUILabel);
			this.m_PortraitCurrent = (t.Find("Current/Portrait").GetComponent("XUISprite") as IXUISprite);
			this.m_PortraitUsed = (t.Find("Used/Portrait").GetComponent("XUISprite") as IXUISprite);
			this.m_PortraitNext = (t.Find("Next/Portrait").GetComponent("XUISprite") as IXUISprite);
			this.m_CurrentPortraitEmpty = t.Find("Current/Portrait_empty");
			this.m_UsedPortraitEmpty = t.Find("Used/Portrait_empty");
			this.m_NextPortraitEmpty = t.Find("Next/Portrait_empty");
			this.m_CurrentVS = t.Find("Current/VS");
			this.m_CurrentMessage = t.Find("Current/VS_empty");
			this.m_score = (t.Find("Used/Score").GetComponent("XUILabel") as IXUILabel);
			this.m_enterBattle = (t.Find("Current/Btn").GetComponent("XUISprite") as IXUISprite);
			this.m_enterBattle.RegisterSpriteClickEventHandler(handler);
			this.m_enterBattle.ID = (ulong)((long)index);
		}

		public void Reset()
		{
			this.m_time.SetText(string.Empty);
			this.m_next.gameObject.SetActive(true);
			this.m_used.gameObject.SetActive(false);
			this.m_current.gameObject.SetActive(false);
		}

		public void Set(GVGDuelCombatInfo combatInfo)
		{
			bool flag = combatInfo == null;
			if (flag)
			{
				this.Reset();
			}
			else
			{
				this.m_time.SetText(combatInfo.ToTimeString());
				this.m_next.gameObject.SetActive(combatInfo.gs == GVGDuelStatu.IDLE);
				this.m_used.gameObject.SetActive(combatInfo.gs == GVGDuelStatu.FINISH);
				this.m_current.gameObject.SetActive(combatInfo.gs == GVGDuelStatu.FIGHTING);
				GVGDuelStatu gs = combatInfo.gs;
				if (gs != GVGDuelStatu.FINISH)
				{
					if (gs != GVGDuelStatu.FIGHTING)
					{
						this.m_guildNameNext.SetText(combatInfo.GetGuildName());
						this.m_PortraitNext.SetSprite(combatInfo.GetPortraitName());
						this.m_PortraitNext.SetVisible(combatInfo.Pass());
						this.m_PortraitNext.SetVisible(combatInfo.Pass());
						this.m_PortraitNext.ID = combatInfo.GuildID;
						this.m_NextPortraitEmpty.gameObject.SetActive(!combatInfo.Pass());
					}
					else
					{
						this.m_guildNameCurrent.SetText(combatInfo.GetGuildName());
						this.m_PortraitCurrent.SetSprite(combatInfo.GetPortraitName());
						this.m_PortraitCurrent.SetVisible(combatInfo.Pass());
						this.m_PortraitCurrent.SetVisible(combatInfo.Pass());
						this.m_PortraitCurrent.ID = combatInfo.GuildID;
						this.m_CurrentPortraitEmpty.gameObject.SetActive(!combatInfo.Pass());
						this.m_enterBattle.SetGrey(combatInfo.gs == GVGDuelStatu.FIGHTING);
						this.m_enterBattle.SetVisible(combatInfo.Pass());
						this.m_CurrentVS.gameObject.SetActive(combatInfo.Pass());
						this.m_CurrentMessage.gameObject.SetActive(!combatInfo.Pass());
					}
				}
				else
				{
					this.m_guildNameUsed.SetText(combatInfo.GetGuildName());
					this.m_PortraitUsed.SetSprite(combatInfo.GetPortraitName());
					this.m_UsedPortraitEmpty.gameObject.SetActive(!combatInfo.Pass());
					this.m_PortraitUsed.SetVisible(combatInfo.Pass());
					this.m_score.SetText(XSingleton<XCommon>.singleton.StringCombine("+", combatInfo.AddScore.ToString()));
					this.m_win.gameObject.SetActive(combatInfo.Winner);
					this.m_lose.gameObject.SetActive(!combatInfo.Winner);
					this.m_PortraitUsed.ID = combatInfo.GuildID;
				}
			}
		}

		public void Recycle()
		{
			this.m_time = null;
			this.m_guildNameCurrent = null;
			this.m_guildNameUsed = null;
			this.m_guildNameNext = null;
			this.m_PortraitCurrent = null;
			this.m_PortraitUsed = null;
			this.m_PortraitNext = null;
			this.m_enterBattle = null;
			this.m_score = null;
			this.m_UsedPortraitEmpty = null;
			this.m_CurrentPortraitEmpty = null;
			this.m_NextPortraitEmpty = null;
			this.m_CurrentVS = null;
			this.m_CurrentMessage = null;
			this.m_win = null;
			this.m_lose = null;
			this.m_current = null;
			this.m_next = null;
			this.m_used = null;
		}
	}
}