53 lines
1.0 KiB
C#
53 lines
1.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.UI;
|
|
using UnityEngine;
|
|
using WI;
|
|
using System;
|
|
using TMPro;
|
|
|
|
public class UI_FloorButton : UIBase
|
|
{
|
|
private Button button;
|
|
private Image SelectImage;
|
|
|
|
public Action<UI_FloorButton> onClickButton;
|
|
public int value;
|
|
|
|
public Color selectColor;
|
|
public Color originColor;
|
|
|
|
public void SettingButton(int value)
|
|
{
|
|
this.value = value;
|
|
|
|
button = GetComponent<Button>();
|
|
var buttonText = GetComponentInChildren<TMP_Text>();
|
|
|
|
if (value + 1 >= 6)
|
|
{
|
|
buttonText.SetText("RF");
|
|
}
|
|
else
|
|
{
|
|
buttonText.SetText($"{value + 1}F");
|
|
}
|
|
|
|
button.onClick.AddListener(OnClickButton);
|
|
originColor = button.image.color;
|
|
}
|
|
private void OnClickButton()
|
|
{
|
|
onClickButton?.Invoke(this);
|
|
}
|
|
public void Select()
|
|
{
|
|
SelectImage.gameObject.SetActive(true);
|
|
}
|
|
public void Deselect()
|
|
{
|
|
SelectImage.gameObject.SetActive(false);
|
|
}
|
|
|
|
}
|