summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/PairsPetInviteView.cs
blob: 694ac5243b33b67ab291c2b9549b83063e99c378 (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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
using System;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient.UI
{
	internal class PairsPetInviteView : DlgBase<PairsPetInviteView, PairsPetInviteBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "GameSystem/DoublepetInvitation";
			}
		}

		public override bool autoload
		{
			get
			{
				return true;
			}
		}

		public override bool hideMainMenu
		{
			get
			{
				return true;
			}
		}

		public override bool pushstack
		{
			get
			{
				return true;
			}
		}

		public override bool fullscreenui
		{
			get
			{
				return true;
			}
		}

		private XPetDocument m_doc;

		protected override void OnLoad()
		{
			base.OnLoad();
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
			base.uiBehaviour.m_closeBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked));
			base.uiBehaviour.m_ignoreBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickIgnoreAllBtn));
			base.uiBehaviour.m_tempRejectBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickTempRejectBtn));
		}

		protected override void OnUnload()
		{
			base.OnUnload();
		}

		protected override void Init()
		{
			base.Init();
			this.m_doc = XDocuments.GetSpecificDocument<XPetDocument>(XPetDocument.uuID);
			base.uiBehaviour.m_wrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentItemUpdated));
		}

		protected override void OnHide()
		{
			base.OnHide();
		}

		protected override void OnShow()
		{
			base.OnShow();
			base.uiBehaviour.m_wrapContent.gameObject.SetActive(false);
			this.m_doc.OnReqInviteList();
		}

		public override void StackRefresh()
		{
			base.StackRefresh();
		}

		public void RefreshUi()
		{
			this.FillContent();
		}

		private void FillContent()
		{
			base.uiBehaviour.m_wrapContent.gameObject.SetActive(true);
			base.uiBehaviour.m_wrapContent.SetContentCount(this.m_doc.PetInviteInfolist.Count, false);
		}

		private void WrapContentItemUpdated(Transform t, int index)
		{
			bool flag = index >= this.m_doc.PetInviteInfolist.Count;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("index >= PetInviteInfolist.Count", null, null, null, null, null);
			}
			else
			{
				PetInviteInfo petInviteInfo = this.m_doc.PetInviteInfolist[index];
				IXUISprite ixuisprite = t.Find("head").GetComponent("XUISprite") as IXUISprite;
				ixuisprite.spriteName = XSingleton<XProfessionSkillMgr>.singleton.GetSuperRiskAvatar(petInviteInfo.profession % 10u);
				IXUILabelSymbol ixuilabelSymbol = t.Find("Name").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
				ixuilabelSymbol.InputText = petInviteInfo.rolename;
				IXUILabel ixuilabel = t.Find("PPT").GetComponent("XUILabel") as IXUILabel;
				ixuilabel.SetText(petInviteInfo.ppt.ToString());
				PetInfoTable.RowData petInfo = XPetDocument.GetPetInfo(petInviteInfo.petconfigid);
				ixuisprite = (t.Find("Item/Quality").GetComponent("XUISprite") as IXUISprite);
				bool flag2 = petInfo != null;
				if (flag2)
				{
					ixuisprite.SetSprite(XSingleton<UiUtility>.singleton.GetItemQualityFrame((int)petInfo.quality, 0));
				}
				else
				{
					ixuisprite.SetSprite("");
				}
				ixuisprite = (t.Find("Item/PetIcon").GetComponent("XUISprite") as IXUISprite);
				bool flag3 = petInfo != null;
				if (flag3)
				{
					ixuisprite.SetSprite(petInfo.icon, petInfo.Atlas, false);
				}
				else
				{
					ixuisprite.SetSprite("");
				}
				ixuilabel = (t.Find("PetName").GetComponent("XUILabel") as IXUILabel);
				bool flag4 = petInfo != null;
				if (flag4)
				{
					ixuilabel.SetText(petInfo.name);
				}
				else
				{
					ixuilabel.SetText("");
				}
				ixuilabel = (t.Find("PetPPT").GetComponent("XUILabel") as IXUILabel);
				ixuilabel.SetText(petInviteInfo.petppt.ToString());
				ixuilabel = (t.Find("SpeedUp").GetComponent("XUILabel") as IXUILabel);
				bool flag5 = petInfo != null;
				if (flag5)
				{
					BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData((int)petInfo.SpeedBuff, 1);
					bool flag6 = buffData != null;
					if (flag6)
					{
						ixuilabel.SetText(string.Format("{0}%", (buffData.BuffChangeAttribute[0, 1] + 100f).ToString()));
					}
				}
				else
				{
					ixuilabel.SetText("");
				}
				IXUIButton ixuibutton = t.Find("Mentorship").GetComponent("XUIButton") as IXUIButton;
				ixuibutton.ID = petInviteInfo.roleid;
				ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickDrive));
			}
		}

		private bool OnCloseClicked(IXUIButton btn)
		{
			this.SetVisible(false, true);
			return true;
		}

		private bool OnClickIgnoreAllBtn(IXUIButton btn)
		{
			this.SetVisible(false, true);
			this.m_doc.OnReqIgnoreAll();
			return true;
		}

		private bool OnClickTempRejectBtn(IXUIButton btn)
		{
			this.SetVisible(false, true);
			return true;
		}

		private bool OnClickDrive(IXUIButton btn)
		{
			ulong id = btn.ID;
			this.m_doc.ReqPetPetOperationOther(PetOtherOp.AgreePetPairRide, id);
			return true;
		}
	}
}