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

namespace XMainClient.UI
{
	internal class ActivityRiftItemsHandler : DlgHandlerBase
	{
		protected override string FileName
		{
			get
			{
				return "GameSystem/TeamMysteriousItemList";
			}
		}

		public GameObject m_goTpl;

		public IXUIButton m_btnClose;

		public IXUIScrollView m_scroll;

		public XUIPool m_ItemsPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);

		private List<uint> m_data;

		private Vector3 m_pos;

		protected override void Init()
		{
			base.Init();
			this.m_btnClose = (base.transform.Find("Bg/Close").GetComponent("XUIButton") as IXUIButton);
			this.m_goTpl = base.transform.Find("Bg/ScrollView/ItemTpl").gameObject;
			this.m_pos = this.m_goTpl.transform.localPosition;
			GameObject gameObject = base.transform.Find("Bg/ScrollView").gameObject;
			this.m_scroll = (gameObject.GetComponent("XUIScrollView") as IXUIScrollView);
			this.m_ItemsPool.SetupPool(gameObject, this.m_goTpl, 8u, false);
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
			this.m_btnClose.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClose));
		}

		public void ShowItemList(List<uint> list)
		{
			this.m_data = list;
			base.SetVisible(true);
		}

		protected override void OnShow()
		{
			base.OnShow();
			this.m_ItemsPool.FakeReturnAll();
			for (int i = 0; i < this.m_data.Count; i++)
			{
				GameObject gameObject = this.m_ItemsPool.FetchGameObject(false);
				this.SetitemInfo(gameObject, this.m_data[i]);
				IXUILabel ixuilabel = gameObject.transform.Find("Intro").GetComponent("XUILabel") as IXUILabel;
				ItemList.RowData itemConf = XBagDocument.GetItemConf((int)this.m_data[i]);
				ixuilabel.SetText(itemConf.ItemDescription);
				gameObject.transform.localPosition = new Vector3(this.m_pos.x, this.m_pos.y - (float)(110 * i), this.m_pos.z);
			}
			this.m_ItemsPool.ActualReturnAll(false);
		}

		private void SetitemInfo(GameObject obj, uint itemID)
		{
			IXUISprite ixuisprite = obj.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
			ixuisprite.ID = (ulong)itemID;
			XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(obj, (int)itemID, 0, false);
		}

		private bool OnClose(IXUIButton btn)
		{
			base.SetVisible(false);
			return true;
		}
	}
}