33 lines
611 B
C#
33 lines
611 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class EquipmentOnlyBoughtToggle : MonoBehaviour
|
|
{
|
|
public bool onlyBought = true;
|
|
|
|
[HideInInspector]
|
|
public Toggle toggle;
|
|
|
|
private EquipmentGUI equipmentGUI;
|
|
|
|
private void OnEnable()
|
|
{
|
|
if (toggle == null)
|
|
{
|
|
toggle = GetComponent<Toggle>();
|
|
}
|
|
if (!equipmentGUI)
|
|
{
|
|
equipmentGUI = Object.FindObjectOfType<EquipmentGUI>();
|
|
}
|
|
}
|
|
|
|
public void ValueChanged()
|
|
{
|
|
if ((bool)equipmentGUI && (bool)equipmentGUI.equipmentManager && toggle.isOn && onlyBought != equipmentGUI.showOnlyBought)
|
|
{
|
|
equipmentGUI.ShowOnlyBought(onlyBought);
|
|
}
|
|
}
|
|
}
|