42 lines
924 B
C#
42 lines
924 B
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using TMPro;
|
|||
|
using System;
|
|||
|
|
|||
|
namespace SimpleInventorySystem {
|
|||
|
public class ChangeSlotTitle : MonoBehaviour
|
|||
|
{
|
|||
|
public SlotTitlePair[] SlotTitlePairs;
|
|||
|
public TextMeshProUGUI text;
|
|||
|
private string oldText;
|
|||
|
|
|||
|
public void Start()
|
|||
|
{
|
|||
|
oldText = text.text;
|
|||
|
}
|
|||
|
|
|||
|
public void ChangeTitle(ItemTags itemTag)
|
|||
|
{
|
|||
|
for(int i = 0; i < SlotTitlePairs.Length; i++)
|
|||
|
{
|
|||
|
if(SlotTitlePairs[i].itemTag == itemTag)
|
|||
|
{
|
|||
|
text.text = SlotTitlePairs[i].title;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void ResetTitle()
|
|||
|
{
|
|||
|
text.text = oldText;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class SlotTitlePair
|
|||
|
{
|
|||
|
public ItemTags itemTag;
|
|||
|
public string title;
|
|||
|
}
|
|||
|
}
|