//On up public override void OnPointerUp(PointerEventData eventData) { if (m_enabled) { base.OnPointerUp(eventData); CUIFunctions.PlayAction(m_onUp, this.gameObject); } }
public void SetValue(float value) { if(m_value > value) CUIFunctions.PlayAction(m_decreaseValue, this.gameObject); else if (m_value < value) CUIFunctions.PlayAction(m_increaseValue, this.gameObject); m_value = value; m_text.text = m_value.ToString(m_format); }
//Change by amount public void ChangeValue(float amount) { m_value += amount; if(amount > 0) CUIFunctions.PlayAction(m_increaseValue, this.gameObject); else if (amount < 0) CUIFunctions.PlayAction(m_decreaseValue, this.gameObject); m_text.text = m_value.ToString(m_format); }
//Enable public float Enable() { if (m_enabled == false) { m_enabled = true; gameObject.SetActive(true); return(CUIFunctions.PlayAction(m_onEnabled, this.gameObject)); } return(0); }
//My disable function public float Disable() { if (m_enabled) { m_enabled = false; //Use return value from play actions being called to start coroutine float time = CUIFunctions.PlayAction(m_onDisabled, this.gameObject); StartCoroutine(CUIFunctions.DisableAfter(time, this.gameObject)); return(time); } return(0); }
public void ChangeBy(float amount) { if (amount != 0) { m_lerpTimer = 0; if (amount > 0) { CUIFunctions.PlayAction(m_onIncrease, this.gameObject); } else { CUIFunctions.PlayAction(m_onDecrease, this.gameObject); } m_targetValue += amount; } }
public void SetValue(float value) { if (value != m_targetValue) { m_lerpTimer = 0; if (value > m_targetValue) { CUIFunctions.PlayAction(m_onIncrease, this.gameObject); } else { CUIFunctions.PlayAction(m_onDecrease, this.gameObject); } m_targetValue = value; } //StartCoroutine(LerpToOver(value, m_lerpTime)); }
public float Disable() { if (m_enabled) { m_enabled = false; //ICUIElement[] childrenElements = GetComponentsInChildren<ICUIElement>(); float time = 0; foreach (ICUIElement element in childrenElements) { float duration = element.Disable(); if (time < duration) { time = duration; } } StartCoroutine(CUIFunctions.DisableAfter(time, this.gameObject)); return(time); } return(0); }