summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/GuildPassBoard.cs
blob: aa01a342e336ae1f546b7254cf45f79a42c9a79d (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
161
162
163
164
165
166
167
168
169
using System;
using KKSG;
using UILib;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient
{
	internal class GuildPassBoard : MonoBehaviour
	{
		private GameObject _billboard = null;

		private GameObject _transfer = null;

		private GameObject _donghua = null;

		public uint index = 0u;

		public uint sceneid = 0u;

		private IXUILabel m_lblName;

		private IXUISprite m_sprName;

		private IXUILabel m_lblPoint;

		private IXUISprite m_sprPoint;

		private IXUILabel m_lblMember;

		private IXUISprite m_sprMember;

		private bool mOpen = false;

		private GameObject mGoParent;

		public static string BUBBLE_TEMPLATE = "UI/Guild/GuildTerritory/GuildTerritoryBillboard";

		private void Awake()
		{
			this._billboard = XSingleton<XResourceLoaderMgr>.singleton.CreateFromPrefab(GuildPassBoard.BUBBLE_TEMPLATE, Vector3.zero, base.transform.rotation, true, false);
			this.m_lblName = (this._billboard.transform.Find("Name").GetComponent("XUILabel") as IXUILabel);
			this.m_sprName = (this._billboard.transform.Find("Name/p").GetComponent("XUISprite") as IXUISprite);
			this.m_lblPoint = (this._billboard.transform.Find("DoubleScore").GetComponent("XUILabel") as IXUILabel);
			this.m_sprPoint = (this._billboard.transform.Find("DoubleScore/p").GetComponent("XUISprite") as IXUISprite);
			this.m_lblMember = (this._billboard.transform.Find("PlayerNum").GetComponent("XUILabel") as IXUILabel);
			this.m_sprMember = (this._billboard.transform.Find("PlayerNum/p").GetComponent("XUISprite") as IXUISprite);
		}

		private void OnDestroy()
		{
			this.DestroyGameObjects();
		}

		private void LateUpdate()
		{
			bool flag = this._billboard != null && XSingleton<XScene>.singleton.GameCamera.CameraTrans != null;
			if (flag)
			{
				this._billboard.transform.localPosition = Vector3.zero;
				this._billboard.transform.localScale = 0.01f * Vector3.one;
				this._billboard.transform.rotation = XSingleton<XScene>.singleton.GameCamera.CameraTrans.rotation;
			}
			bool flag2 = Time.frameCount % 15 == 0 && XSingleton<XScene>.singleton.GameCamera.UnityCamera != null;
			if (flag2)
			{
			}
		}

		public void Init(uint ix, uint scid, GameObject parent)
		{
			this.index = ix;
			this.sceneid = scid;
			this.mOpen = true;
			this.mGoParent = parent;
			this._billboard.transform.parent = parent.transform;
			string name = XGuildTerritoryDocument.mGuildTransfer.GetByid(ix).name;
			this._transfer = GameObject.Find("cankao/Blockwall" + this.index + "/TransferGuildWall");
			this._donghua = GameObject.Find("cankao/Blockwall" + this.index + "/kqq_zd_donghua");
			this.UpdateOpenState(false);
			bool flag = this.m_lblName != null;
			if (flag)
			{
				this.m_lblName.SetText(name);
			}
			this.m_lblPoint.gameObject.SetActive(false);
			this.UpdateMember(0u, 8u);
		}

		public void DestroyGameObjects()
		{
			XResourceLoaderMgr.SafeDestroy(ref this._billboard, true);
		}

		public void UpdateBoard(GCFZhanChBriefInfo info)
		{
			this.UpdatePoint(info.multipoint);
			this.UpdateMember(info.curusercount, info.maxusercount);
			this.UpdateOpenState(info.isopen);
		}

		public void UpdateOpenState(bool open)
		{
			bool flag = this.mOpen != open;
			if (flag)
			{
				this._transfer.SetActive(open);
				this._donghua.SetActive(!open);
				this.mOpen = open;
			}
		}

		public void ResetOpenState()
		{
			bool flag = this._transfer != null;
			if (flag)
			{
				this._transfer.SetActive(true);
			}
			bool flag2 = this._donghua != null;
			if (flag2)
			{
				this._donghua.SetActive(true);
			}
		}

		private void UpdateMember(uint curr, uint cnt)
		{
			bool flag = this.m_lblMember != null;
			if (flag)
			{
				this.m_lblMember.SetText(XSingleton<XCommon>.singleton.StringCombine(curr.ToString(), "/", cnt.ToString()));
			}
		}

		private void UpdatePoint(uint state)
		{
			bool flag = this.m_lblPoint != null;
			if (flag)
			{
				this.m_lblPoint.gameObject.SetActive(state >= 2u);
				this.m_lblPoint.SetText(XStringDefineProxy.GetString("Territtory_Score" + state));
			}
		}

		private void SetBillBoardDepth(float dis = 0f)
		{
			int num = -(int)(dis * 100f);
			bool flag = this.m_lblName != null && this.m_sprName != null;
			if (flag)
			{
				this.m_lblName.spriteDepth = num + 1;
				this.m_sprName.spriteDepth = num;
			}
			bool flag2 = this.m_lblMember != null && this.m_sprMember != null;
			if (flag2)
			{
				this.m_lblMember.spriteDepth = num + 1;
				this.m_sprMember.spriteDepth = num;
			}
			bool flag3 = this.m_lblPoint != null && this.m_sprPoint != null;
			if (flag3)
			{
				this.m_lblPoint.spriteDepth = num + 1;
				this.m_sprPoint.spriteDepth = num;
			}
		}
	}
}