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
using UnityEngine;
using UnityEngine.UI;
 
/// <summary>
/// 背包格子
/// </summary>
public class PackGirdCell : MonoBehaviour
{
    [SerializeField] ItemCell itemCell;
    [SerializeField] Image redPoint;    // 用图标代替简化ID管理
    public void Display(int index)
    {
        var guid = PackManager.Instance.GetSinglePack(PackType.Item).itemGuidList[index];
        if (string.IsNullOrEmpty(guid))
            return;
 
        var item = PackManager.Instance.GetItemByGuid(guid);
        ulong count = 0;
        if (GeneralDefine.itemMoneyCountDict.ContainsKey(item.itemId))
        {
            //展示货币数量的物品
            count = UIHelper.GetMoneyCnt(GeneralDefine.itemMoneyCountDict[item.itemId]);
        }
        else
        {
            count = (ulong)item.count;
        }
        itemCell.Init(new ItemCellModel(item.itemId, false, count));
        itemCell.button.AddListener(()=>
        {
            ItemTipUtility.Show(guid);
        });
 
        redPoint.SetActive(false);
    }
}