43 lines
862 B
C#
43 lines
862 B
C#
|
|
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);
|
|||
|
|
}
|
|||
|
|
}
|