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

namespace XMainClient
{
	internal class EquipSetCreateConfirmHandler : DlgHandlerBase
	{
		private IXUIButton mBtnCancel;

		private IXUIButton mBtnOK;

		private IXUILabel mLbLevel;

		private EquipSetItemBaseView mItemView;

		private XEquipCreateDocument mDoc;

		protected override void Init()
		{
			base.Init();
			this.mDoc = XEquipCreateDocument.Doc;
			Transform transform = base.PanelObject.transform.Find("OK");
			this.mBtnOK = (transform.GetComponent("XUIButton") as IXUIButton);
			transform = base.PanelObject.transform.Find("Cancel");
			this.mBtnCancel = (transform.GetComponent("XUIButton") as IXUIButton);
			transform = base.PanelObject.transform.Find("Level");
			this.mLbLevel = (transform.GetComponent("XUILabel") as IXUILabel);
			this.mItemView = new EquipSetItemBaseView();
			this.mItemView.FindFrom(base.PanelObject.transform);
		}

		public override void RegisterEvent()
		{
			base.Init();
			this.mBtnOK.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickButtonOK));
			this.mBtnCancel.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickButtonCancel));
		}

		public void SetEquipInfo(int _dataID)
		{
			ItemComposeTable.RowData itemConposeDataByID = XEquipCreateDocument.GetItemConposeDataByID(_dataID);
			bool flag = itemConposeDataByID == null;
			if (!flag)
			{
				ItemList.RowData itemConf = XBagDocument.GetItemConf(itemConposeDataByID.ItemID);
				bool flag2 = itemConf == null;
				if (!flag2)
				{
					this.mLbLevel.SetText(itemConf.ReqLevel.ToString());
					bool isBind = this.mDoc.IsBind;
					bool flag3 = itemConf.ItemType == 1 || itemConf.ItemType == 31;
					if (flag3)
					{
						isBind = itemConposeDataByID.IsBind;
					}
					bool flag4 = !itemConf.CanTrade;
					if (flag4)
					{
						isBind = true;
					}
					bool flag5 = base.IsVisible() && this.mItemView != null;
					if (flag5)
					{
						EquipSetItemBaseView.stEquipInfoParam param;
						param.isShowTooltip = false;
						param.playerProf = 0;
						this.mItemView.SetItemInfo(itemConf, param, isBind);
					}
					this.mBtnOK.ID = (ulong)((long)_dataID);
				}
			}
		}

		private bool OnClickButtonOK(IXUIButton btn)
		{
			base.SetVisible(false);
			this.mDoc.StartCreateEquip((int)btn.ID);
			return true;
		}

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

		public override void OnUnload()
		{
			this.mDoc = null;
			base.OnUnload();
		}
	}
}