Esempio n. 1
0
        public override void Apply()
        {
            GearColorValue cv;

            if (!this._storage.TryGetValue(this._controller.selectedPageId, out cv))
            {
                cv = this._default;
            }

            ITextColorGear textColorGear = this._owner as ITextColorGear;

            if (this.tween &&
                UIPackage.constructing == 0 &&
                !disableAllTweenEffect)
            {
                if (this._tweener != null)
                {
                    if (this._tweenTarget.color == cv.color)
                    {
                        return;
                    }
                    this._tweener.Kill(true);
                    this._tweener = null;
                }
                if (this._owner.color != cv.color)
                {
                    this._tweenTarget = cv;
                    this._tweener     = DOTween.To(() => this._owner.color, delegate(Color v)
                    {
                        this._owner.SetGearState(GObject.GearState.Color, true);
                        this._owner.color = v;
                        this._owner.SetGearState(GObject.GearState.Color, false);
                    }, cv.color, this.tweenTime).SetEase(this.easeType).SetUpdate(true).OnComplete(delegate
                    {
                        this._tweener = null;
                    });
                    if (this.delay > 0f)
                    {
                        this._tweener.SetDelay(this.delay);
                    }
                    return;
                }
            }
            this._owner.SetGearState(GObject.GearState.Color, true);
            if (textColorGear != null)
            {
                textColorGear.textColor   = cv.color;
                textColorGear.strokeColor = cv.strokeColor;
            }
            else
            {
                this._owner.color = cv.color;
            }
            this._owner.SetGearState(GObject.GearState.Color, false);
        }
Esempio n. 2
0
        protected override void Init()
        {
            this._default       = new GearColorValue();
            this._default.color = this._owner.color;
            ITextColorGear textColorGear = this._owner as ITextColorGear;

            if (textColorGear != null)
            {
                this._default.strokeColor = textColorGear.strokeColor;
            }
            this._storage = new Dictionary <string, GearColorValue>();
        }