CultivateImmortal/Assets/Scripts/GameObject/BtnMaterial.cs

31 lines
660 B
C#

using System.Collections;
using System.Collections.Generic;
using System.Xml.Linq;
using UnityEngine;
using UnityEngine.UI;
public class BtnMaterial : MonoBehaviour
{
public Button btnSelf;
public Text txtName;
public Text txtNum;
private GoodsData nowGoods;
void Start()
{
//点击按钮更新背包面板上的文字描述
btnSelf.onClick.AddListener(() =>
{
UIManager.Instance.GetPanel<BagPanel>().UpdateTxtInfo(nowGoods);
});
}
public void UpdatePanel(GoodsData goods)
{
nowGoods = goods;
txtName.text = goods.name;
txtNum.text = goods.num.ToString();
}
}