mergemilitary/Assets/Scripts/UIs/CustomControl/TabButton.cs

30 lines
594 B
C#
Raw Normal View History

2022-05-23 13:39:59 +00:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TabButton : MonoBehaviour
{
public Action<int> DelClick;
[SerializeField] int mIndex;
[SerializeField] GameObject mGobOn;
[SerializeField] GameObject mGobOff;
private void Awake()
{
UIUtils.BindBtn(GetComponent<Button>(), OnClick);
}
public void SetOn(bool pIsOn)
{
mGobOn.SetActive(pIsOn);
mGobOff.SetActive(!pIsOn);
}
private void OnClick()
{
DelClick?.Invoke(mIndex);
}
}