2022-01-17 17:49:27 +03:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
public class EquipmentInfo : MonoBehaviour
|
|
|
|
{
|
|
|
|
public static EquipmentInfo main;
|
|
|
|
[SerializeField] private Text localName;
|
|
|
|
[SerializeField] private Text desqription;
|
|
|
|
|
|
|
|
[SerializeField] private Image icon;
|
|
|
|
[SerializeField] private Button AddButton;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
if (main != null && main != this)
|
|
|
|
{
|
2022-01-20 11:44:38 +03:00
|
|
|
Debug.LogWarning("2 equipmentinfo on the scene");
|
2022-01-17 17:49:27 +03:00
|
|
|
Destroy(this);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
main = this;
|
|
|
|
}
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
CardAbout(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CardAbout(int _index)
|
|
|
|
{
|
|
|
|
localName.text = Inventory.main.allEquipment[_index].GetComponent<Equipment>().equipmentConfig.equipmentCharacteristics.name;
|
|
|
|
desqription.text = Inventory.main.allEquipment[_index].GetComponent<Equipment>().equipmentConfig.equipmentCharacteristics.description;
|
|
|
|
icon.sprite = Inventory.main.allEquipment[_index].GetComponent<Equipment>().equipmentConfig.equipmentCharacteristics.sprite;
|
|
|
|
if (Inventory.main.EquipedOrNot(Inventory.main.lastCardNum))
|
|
|
|
AddButton.GetComponentInChildren<Text>().text = "UnEquip";
|
|
|
|
else
|
|
|
|
AddButton.GetComponentInChildren<Text>().text = "Equip";
|
|
|
|
}
|
|
|
|
}
|