This commit is contained in:
JA
2026-06-20 19:34:23 +08:00
parent e5031c0068
commit d442805c3f
4136 changed files with 514641 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIBagInfo : UIWindow
{
public Transform rectTransfrom;
public ItemTip tip;
private void Awake()
{
tip.gameObject.SetActive(false);
}
private void OnEnable()
{
PlayerInfo.Instance.OnUpdateBagInfo += UpdateUI;
UpdateUI();
}
private void OnDisable()
{
PlayerInfo.Instance.OnUpdateBagInfo -= UpdateUI;
tip.gameObject.SetActive(false);
}
public void UpdateUI()
{
foreach (Transform item in rectTransfrom)
{
Destroy(item.gameObject);
}
foreach (var item in PlayerInfo.Instance.info.BagInfo)
{
string path = "UI/Perfab/Item";
UnityEngine.Object go = Resloader.Load<GameObject>(path);
if (go != null)
{
GameObject m = (GameObject)Instantiate(go, rectTransfrom);
UIItemInfo ui = m.GetComponent<UIItemInfo>();
ui.gameObject.SetActive(true);
ui.SetInfo(item.Key, item.Value,this);
}
}
}
public void ShowItem(Item item)
{
tip.gameObject.SetActive(true);
tip.Init(item);
}
}