WXMC/.svn/pristine/2f/2f393015a9eba0d939bee1c4b5324a2e46c67a75.svn-base
2024-12-04 16:18:46 +08:00

42 lines
1.3 KiB
Plaintext

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PHomeInventoryItemDisplayer : MonoBehaviour
{
[SerializeField]
private Image m_icon;
[SerializeField]
private Button m_PutBtn;
[SerializeField]
private Button m_selectBallBtn;
[SerializeField]
private Text m_inventoryDesc;
[SerializeField]
private Image m_imgMask;
public void Init(PHomeInventoryItem inventoryItem,Action<PHomeInventoryItem> selectCallback,bool showPutBtn = true,bool showSelectBtn = false)
{
m_icon.sprite = inventoryItem.Icon;
m_inventoryDesc.text = inventoryItem.Desc;
PHomeWorldBall currWorldBall = inventoryItem as PHomeWorldBall;
m_PutBtn.gameObject.SetActive(showPutBtn);
m_selectBallBtn.gameObject.SetActive(showSelectBtn);
m_selectBallBtn.onClick.AddListener(()=>
{
selectCallback(inventoryItem);
}
);
m_PutBtn.onClick.AddListener(()=>
{
selectCallback(inventoryItem);
}
);
if(PHomeMainWorldGameMode.main==null)
{
m_imgMask.gameObject.SetActive(currWorldBall!=null && currWorldBall == PHomeInventory.instance.UseWorldBall);
}
}
}