35 lines
		
	
	
		
			626 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			626 B
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| using UnityEngine.UI;
 | |
| 
 | |
| public class ButtonSound : MonoBehaviour
 | |
| {
 | |
|     public Action<int> DelClick;
 | |
| 
 | |
|     [SerializeField] Image mImgSound;
 | |
| 
 | |
|     private int mIndex;
 | |
| 
 | |
|     private void Awake()
 | |
|     {
 | |
|         Button tBtn = GetComponent<Button>();
 | |
|         UIUtils.BindBtn(tBtn, OnClick);
 | |
|     }
 | |
| 
 | |
|     public void Init(int pIndex)
 | |
|     {
 | |
|         mIndex = pIndex;
 | |
|     }
 | |
| 
 | |
|     public void SetSoundPic(Sprite pSoundPic)
 | |
|     {
 | |
|         mImgSound.sprite = pSoundPic;
 | |
|     }
 | |
| 
 | |
|     private void OnClick()
 | |
|     {
 | |
|         DelClick?.Invoke(mIndex);
 | |
|     }
 | |
| } |