blob: 2724279f4c8051fb1bf349d084e64403ebcb0b29 (
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
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class ItemUseListDlg : DlgBase<ItemUseListDlg, ItemUseListDlgBehaviour>
{
public override string fileName
{
get
{
return "Hall/ShapeshiftDlg";
}
}
public override int layer
{
get
{
return 100;
}
}
public override bool autoload
{
get
{
return true;
}
}
private List<XItem> m_ItemList = null;
private ButtonClickEventHandler m_ClickHandler = null;
protected override void Init()
{
}
public override void RegisterEvent()
{
base.uiBehaviour.m_Close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnCloseClicked));
base.uiBehaviour.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.OnWrapContentUpdated));
}
public void SetTitle(string text)
{
base.uiBehaviour.m_Title.SetText(text);
}
public void Set(ButtonClickEventHandler clickHandler, List<XItem> itemList)
{
bool flag = itemList == null;
if (!flag)
{
this.m_ItemList = itemList;
this.m_ClickHandler = clickHandler;
this.SetVisible(true, true);
}
}
protected override void OnShow()
{
base.OnShow();
bool flag = this.m_ItemList != null;
if (flag)
{
base.uiBehaviour.m_WrapContent.SetContentCount(this.m_ItemList.Count, false);
}
base.uiBehaviour.m_ScrollView.ResetPosition();
}
private void OnWrapContentUpdated(Transform t, int index)
{
bool flag = index < 0 || this.m_ItemList == null || index >= this.m_ItemList.Count;
if (!flag)
{
XItem item = this.m_ItemList[index];
Transform transform = t.Find("Item");
IXUIButton ixuibutton = t.Find("BtnUse").GetComponent("XUIButton") as IXUIButton;
XSingleton<XItemDrawerMgr>.singleton.DrawItem(transform.gameObject, item);
ixuibutton.ID = (ulong)((long)index);
ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnUseClicked));
}
}
private bool OnUseClicked(IXUIButton btn)
{
bool flag = this.m_ClickHandler != null;
if (flag)
{
this.m_ClickHandler(btn);
}
this.SetVisible(false, true);
return true;
}
private void OnCloseClicked(IXUISprite iSp)
{
this.SetVisible(false, true);
}
}
}
|