Ejemplo n.º 1
0
    public override bool OnTouchEnded()
    {
        bool handled = base.OnTouchEnded();

        if (clickTimes == ClickTimes.ONE)
        {
            if (handled)
            {
                if (onClick != null)
                {
                    onClick(this.gameObject);
                }
            }
        }
        else
        {
            string actColStr   = ColorUtil.BeginColorTag(activeTextColor);
            string deactColStr = ColorUtil.BeginColorTag(deactiveTextColor);
            string endColTag   = ColorUtil.EndColorTag();
            switch (m_State)
            {
            case State.NONE:
                if (TouchScreen.selectedGameObject == this.gameObject)
                {
                    selectText.text = actColStr + shownText + endColTag;
                    m_State         = State.SELECTED;
                }
                else
                {
                    selectText.text = deactColStr + shownText + endColTag;
                }
                break;

            case State.SELECTED:
                if (TouchScreen.selectedGameObject == this.gameObject)
                {
                    if (onClick != null)
                    {
                        onClick(this.gameObject);
                    }
                }
                else
                {
                    selectText.text = deactColStr + shownText + endColTag;
                    m_State         = State.NONE;
                }
                break;
            }
        }
        return(true);
    }