summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/UI/Panel/PanelItemBar/UIItemWidget.cs
blob: 0019c5c4c43c6dd93727c09c34062ae65eab11a6 (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
//#define TEST
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public struct UIItemWidgetParam
{
	public ItemBase item;
}

public class UIItemWidget : UIGridPropBase
{
	public Image Image_Icon;

	public Text Text_Count;

	public ItemBase item { get { return m_Item; } }
	private ItemBase m_Item;

	public override void Set(object param)
	{
		UIItemWidgetParam info = (UIItemWidgetParam)param;
		m_Item = info.item;

		Image_Icon.sprite = ResourceManager.Instance.Load<Sprite>(info.item.iconPath);

#if TEST
int n = Random.Range(1, 20);
Text_Count.gameObject.SetActive(n > 1);
Text_Count.text = n.ToString();
#else
		Text_Count.gameObject.SetActive(false);
#endif

	}

}