56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
using System;
|
|
using TH1_Logic.Config;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
namespace TH1_UI.View.Outside
|
|
{
|
|
public class UIOutsideMenuAnnouncementPanelVersionLabelMono : MonoBehaviour
|
|
{
|
|
|
|
|
|
public TextMeshProUGUI Text;
|
|
public Image BG;
|
|
public Sprite NormalBG;
|
|
public Sprite SelectBG;
|
|
public Button Button;
|
|
private Action _onClick;
|
|
private bool _select;
|
|
public bool Selected => _select;
|
|
|
|
|
|
|
|
public void Clear()
|
|
{
|
|
Button.onClick.RemoveAllListeners();
|
|
}
|
|
|
|
public void Unselect()
|
|
{
|
|
_select = false;
|
|
BG.sprite = NormalBG;
|
|
Text.color = ConfigManager.ColorConfig.Text.NormalDark ;
|
|
}
|
|
public void SetContent(string content,bool select,Action onClick)
|
|
{
|
|
_select = select;
|
|
Text.text = content;
|
|
BG.sprite = select ? SelectBG : NormalBG;
|
|
Text.color = select ? ConfigManager.ColorConfig.Text.NormalLight : ConfigManager.ColorConfig.Text.NormalDark ;
|
|
_onClick = onClick;
|
|
Button.onClick.AddListener(OnClick);
|
|
}
|
|
|
|
private void OnClick()
|
|
{
|
|
_onClick?.Invoke();
|
|
_select = true;
|
|
BG.sprite = SelectBG;
|
|
Text.color = ConfigManager.ColorConfig.Text.NormalLight;
|
|
}
|
|
|
|
}
|
|
}
|