blob: 3644bd8da0a96d32d01645bb5a5ffa4367786db1 (
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
|
using System;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XUtliPoolLib;
namespace XMainClient
{
internal class NeedItemView
{
public GameObject goItem;
public IXUISprite sprIcon;
public IXUILabel lbNum;
public bool bShowTotal;
public int itemid;
public int itemcount;
public bool bIsEnough;
public NeedItemView(bool showTotal = true)
{
this.bShowTotal = showTotal;
}
public void FindFrom(Transform t)
{
bool flag = t != null;
if (flag)
{
this.goItem = t.gameObject;
this.lbNum = (t.Find("Num").GetComponent("XUILabel") as IXUILabel);
this.sprIcon = (t.Find("Icon").GetComponent("XUISprite") as IXUISprite);
}
}
public void ResetItem()
{
XSingleton<XItemDrawerMgr>.singleton.DrawItem(this.goItem, null);
this.itemid = 0;
}
public bool SetItem(int itemID, int needCount)
{
this.itemid = itemID;
this.itemcount = needCount;
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(this.goItem, itemID, needCount, true);
this.sprIcon.ID = (ulong)((long)itemID);
ulong itemCount = XBagDocument.BagDoc.GetItemCount(itemID);
ulong num = (ulong)((long)needCount);
bool flag = itemCount >= num;
if (flag)
{
bool flag2 = this.bShowTotal;
if (flag2)
{
this.lbNum.SetText(string.Format(XStringDefineProxy.GetString("COMMON_COUNT_TOTAL_FMT"), XSingleton<UiUtility>.singleton.NumberFormat(itemCount), XSingleton<UiUtility>.singleton.NumberFormat(num)));
}
else
{
this.lbNum.SetText(string.Format("{0}", XSingleton<UiUtility>.singleton.NumberFormat(num)));
}
this.bIsEnough = true;
}
else
{
bool flag3 = this.bShowTotal;
if (flag3)
{
this.lbNum.SetText(string.Format(XStringDefineProxy.GetString("COMMON_COUNT_TOTAL_NOTENOUGH_FMT"), XSingleton<UiUtility>.singleton.NumberFormat(itemCount), XSingleton<UiUtility>.singleton.NumberFormat(num)));
}
else
{
this.lbNum.SetText(string.Format("[FF0000]{0}[-]", XSingleton<UiUtility>.singleton.NumberFormat(num)));
}
this.bIsEnough = false;
}
return this.bIsEnough;
}
}
}
|