123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class NavTabButton : DGUI {
- public CallBackUtil.IntegerCallBack OnClick;
- public Text label;
- public Animator animator;
- private Button button;
- private bool m_Enabled;
- protected virtual void Awake ()
- {
- label = transform.FindChild ("Text").GetComponent<Text> ();
- animator = GetComponent<Animator> ();
- button = GetComponent<Button> ();
- button.onClick.AddListener (OnButtonClick);
- }
- void OnButtonClick()
- {
- OnClick (transform.GetSiblingIndex());
- }
- protected virtual void OnDestroy()
- {
- button.onClick.RemoveAllListeners ();
- }
- public bool enabled
- {
- set{
- m_Enabled = value;
- if (value)
- animator.Play ("TabBtnEnabled", 0, 0);
- else
- animator.Play ("TabBtnDisabled", 0, 0);
- }
- get{
- return m_Enabled;
- }
- }
- }
|