FairyGUI.GButton.SetState C# (CSharp) Method

SetState() protected method

protected SetState ( string val ) : void
val string
return void
        protected void SetState(string val)
        {
            if (_buttonController != null)
                _buttonController.selectedPage = val;

            if (_downEffect == 1)
            {
                int cnt = this.numChildren;
                if (val == DOWN || val == SELECTED_OVER || val == SELECTED_DISABLED)
                {
                    Color color = new Color(_downEffectValue, _downEffectValue, _downEffectValue);
                    for (int i = 0; i < cnt; i++)
                    {
                        GObject obj = this.GetChildAt(i);
                        if ((obj is IColorGear) && !(obj is GTextField))
                            ((IColorGear)obj).color = color;
                    }
                }
                else
                {
                    for (int i = 0; i < cnt; i++)
                    {
                        GObject obj = this.GetChildAt(i);
                        if ((obj is IColorGear) && !(obj is GTextField))
                            ((IColorGear)obj).color = Color.white;
                    }
                }
            }
            else if (_downEffect == 2)
            {
                if (val == DOWN || val == SELECTED_OVER || val == SELECTED_DISABLED)
                    SetScale(_downEffectValue, _downEffectValue);
                else
                    SetScale(1, 1);
            }
        }