42 lines
1.3 KiB
Plaintext
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);
|
|
}
|
|
}
|
|
}
|