30 lines
		
	
	
		
			594 B
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			30 lines
		
	
	
		
			594 B
		
	
	
	
		
			C#
		
	
	
	
|  | 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); | |||
|  |     } | |||
|  | } |