33 lines
821 B
C#
33 lines
821 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class LevelBtnAttach : MonoBehaviour
|
|
{
|
|
public Sprite[] states;
|
|
public Image selfImage;
|
|
public Button selfBtns;
|
|
public TMP_Text selfText;
|
|
public string currrentCityName;
|
|
public int index = 0;
|
|
void Start()
|
|
{
|
|
selfImage = GetComponent<Image>();
|
|
selfBtns = GetComponent<Button>();
|
|
selfText = transform.GetComponentInChildren<TMP_Text>();
|
|
}
|
|
|
|
public void SetStates(bool isOn = true, bool isClick = true, int index = 0, string cityName = "")
|
|
{
|
|
gameObject.SetActive(isOn);
|
|
selfImage.sprite = states[index];
|
|
selfBtns.interactable = isClick;
|
|
if (cityName != "")
|
|
selfText.text = cityName;
|
|
}
|
|
|
|
|
|
}
|