summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/XBossRewardDlg.cs
blob: bef8cf76deb7e13bbc1b55e143a2738986488f6e (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
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient.UI
{
	public class XBossRewardDlg : XSingleton<XBossRewardDlg>
	{
		private XGuildDragonDocument _Doc = null;

		private GameObject PanelObject;

		private IXUIButton m_lblClose;

		public IXUIScrollView m_ScrollView;

		private IXUIWrapContent m_WrapContent;

		public void Init(GameObject _go)
		{
			bool flag = this.PanelObject == null || this.PanelObject != _go;
			if (flag)
			{
				this.PanelObject = _go;
				this._Doc = XDocuments.GetSpecificDocument<XGuildDragonDocument>(XGuildDragonDocument.uuID);
				this.m_lblClose = (_go.transform.Find("Bg/Close").GetComponent("XUIButton") as IXUIButton);
				this.m_lblClose.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClick));
				this.m_ScrollView = (_go.transform.Find("Bg/ScrollView").GetComponent("XUIScrollView") as IXUIScrollView);
				this.m_WrapContent = (_go.transform.Find("Bg/ScrollView/WrapContent").GetComponent("XUIWrapContent") as IXUIWrapContent);
				this.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.GuildRankWrapContentItemUpdated));
			}
			this.RefreshGuildRoleRank();
		}

		private void GuildRankWrapContentItemUpdated(Transform t, int index)
		{
			List<Seq2<uint>> currentRewardList = this._Doc.currentRewardList;
			bool flag = index < 0 || index >= currentRewardList.Count;
			if (!flag)
			{
				Seq2<uint> seq = currentRewardList[index];
				XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(t.Find("ItemTpl").gameObject, (int)seq.value0, (int)seq.value1, false);
				IXUISprite ixuisprite = t.Find("ItemTpl/Icon").GetComponent("XUISprite") as IXUISprite;
				ixuisprite.ID = (ulong)seq.value0;
				ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
				IXUILabel ixuilabel = t.Find("Name").GetComponent("XUILabel") as IXUILabel;
				ixuilabel.SetText(this.GetName(index));
				IXUILabel ixuilabel2 = t.Find("Des").GetComponent("XUILabel") as IXUILabel;
				ixuilabel2.SetText(this.GetDes(index));
				IXUILabel ixuilabel3 = t.Find("ItemTpl/ssssss").GetComponent("XUILabel") as IXUILabel;
				ixuilabel3.SetText(this.GetLabel(index));
			}
		}

		private string GetName(int index)
		{
			string str = this._Doc.dicRewardName[index];
			return XStringDefineProxy.GetString(str + "_TITLE");
		}

		private string GetLabel(int index)
		{
			string key = this._Doc.dicRewardName[index];
			return XStringDefineProxy.GetString(key);
		}

		private string GetDes(int index)
		{
			string key = this._Doc.dicRewardDes[index];
			return XStringDefineProxy.GetString(key);
		}

		public void RefreshGuildRoleRank()
		{
			this.m_WrapContent.SetContentCount(this._Doc.currentRewardList.Count, false);
			this.m_ScrollView.ResetPosition();
		}

		private bool OnCloseClick(IXUIButton button)
		{
			this.PanelObject.SetActive(false);
			return true;
		}
	}
}