summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Team/XTeamBonusHandler.cs
blob: 407555909c6439b209fee7b6522616530be58583 (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
using System;
using UILib;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XTeamBonusHandler : DlgHandlerBase
	{
		private XUIPool m_AttrPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);

		private XTeamDocument _TeamDoc;

		private IXUIButton m_Root;

		private GameObject m_TitleActive;

		private GameObject m_TitleDisactive;

		private GameObject m_AttrActive;

		private GameObject m_AttrDisactive;

		protected override void Init()
		{
			base.Init();
			this.m_Root = (base.PanelObject.GetComponent("XUIButton") as IXUIButton);
			this.m_TitleActive = base.PanelObject.transform.Find("TitleActive").gameObject;
			this.m_TitleDisactive = base.PanelObject.transform.Find("TitleDisactive").gameObject;
			Transform transform = base.PanelObject.transform.Find("AttrActive");
			Transform transform2 = base.PanelObject.transform.Find("AttrDisactive");
			this.m_AttrActive = transform.gameObject;
			this.m_AttrDisactive = transform2.gameObject;
			this._TeamDoc = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
			string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("TeamGuildBuff").Split(XGlobalConfig.SequenceSeparator);
			int num = int.Parse(array[0]);
			int num2 = int.Parse(array[1]);
			BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData(num, num2);
			bool flag = buffData == null;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog(string.Format("TeamGuildBuff: Buff data not found: [{0} {1}]", num, num2), null, null, null, null, null);
			}
			else
			{
				IXUILabel ixuilabel = transform.Find("Name").GetComponent("XUILabel") as IXUILabel;
				IXUILabel ixuilabel2 = transform.Find("Value").GetComponent("XUILabel") as IXUILabel;
				IXUILabel ixuilabel3 = transform2.Find("Name").GetComponent("XUILabel") as IXUILabel;
				IXUILabel ixuilabel4 = transform2.Find("Value").GetComponent("XUILabel") as IXUILabel;
				ixuilabel.SetText(buffData.BuffName);
				ixuilabel2.SetText(string.Empty);
				ixuilabel3.SetText(buffData.BuffName);
				ixuilabel4.SetText(string.Empty);
			}
		}

		public void Refresh()
		{
			bool flag = !this._TeamDoc.bInTeam;
			if (flag)
			{
				this._Enable(false);
			}
			else
			{
				XTeamMember myData = this._TeamDoc.MyTeam.myData;
				bool flag2 = myData == null || myData.guildID == 0UL;
				if (flag2)
				{
					this._Enable(false);
				}
				else
				{
					bool flag3 = false;
					for (int i = 0; i < this._TeamDoc.MyTeam.members.Count; i++)
					{
						XTeamMember xteamMember = this._TeamDoc.MyTeam.members[i];
						bool flag4 = xteamMember != myData && xteamMember.guildID == myData.guildID;
						if (flag4)
						{
							flag3 = true;
							break;
						}
					}
					bool flag5 = !flag3;
					if (flag5)
					{
						this._Enable(false);
					}
					else
					{
						this._Enable(true);
					}
				}
			}
		}

		private void _Enable(bool bEnable)
		{
			this.m_TitleActive.SetActive(bEnable);
			this.m_TitleDisactive.SetActive(!bEnable);
			this.m_AttrActive.SetActive(bEnable);
			this.m_AttrDisactive.SetActive(!bEnable);
		}
	}
}