chicken_dy/Assets/Scripts/UI/CustomControl/ButtonSlot.cs

43 lines
862 B
C#
Raw Normal View History

2022-02-09 08:35:01 +00:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ButtonSlot : MonoBehaviour
{
public Action<int> DelClick;
[SerializeField] GameObject mGobCurrentSign;
[SerializeField] Image mImgSound;
private int mIndex;
private void Awake()
{
Button tBtn = GetComponent<Button>();
UIUtils.BindBtn(tBtn, OnClick);
}
public void Init(int pIndex)
{
mIndex = pIndex;
mImgSound.gameObject.SetActive(false);
}
public void ShowCurrent(bool pShow)
{
mGobCurrentSign.SetActive(pShow);
}
public void SetSoundPic(Sprite pSoundPic)
{
mImgSound.gameObject.SetActive(true);
mImgSound.sprite = pSoundPic;
}
private void OnClick()
{
DelClick?.Invoke(mIndex);
}
}