75 lines
1.5 KiB
C#
75 lines
1.5 KiB
C#
![]() |
// ***********************************************************************
|
|||
|
// Assembly : Game
|
|||
|
// Author : Kimch
|
|||
|
// Created : 2020-09-12
|
|||
|
// Description :
|
|||
|
// Last Modified By :
|
|||
|
// Last Modified On :
|
|||
|
// ***********************************************************************
|
|||
|
// <copyright file= "MoneyWidget" company="KUNPO"></copyright>
|
|||
|
// <summary></summary>
|
|||
|
// ***********************************************************************
|
|||
|
|
|||
|
using TMPro;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
namespace G.UI
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public class MoneyWidget : KUIWidget
|
|||
|
{
|
|||
|
#region Auto Generate
|
|||
|
|
|||
|
#pragma warning disable CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|||
|
[KUIFlag]
|
|||
|
Image _imgIcon;
|
|||
|
[KUIFlag]
|
|||
|
TextMeshProUGUI _tmpCount;
|
|||
|
#pragma warning restore CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Method
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
/// <param name="id"></param>
|
|||
|
/// <param name="count"></param>
|
|||
|
public void SetMoney(int id, int count)
|
|||
|
{
|
|||
|
var prop = ItemProxy.Instance.GetStaticItem<ItemProp>(id);
|
|||
|
if (prop != null)
|
|||
|
{
|
|||
|
IconProxy.Instance.SetSprite(_imgIcon, prop.icon);
|
|||
|
}
|
|||
|
_tmpCount.text = count.ToString();
|
|||
|
}
|
|||
|
|
|||
|
public override void Refresh()
|
|||
|
{
|
|||
|
if (this.data is Item.ItemInfo itemInfo)
|
|||
|
{
|
|||
|
SetMoney(itemInfo.id, itemInfo.count);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Unity
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
SetViewData();
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|