public override void Apply() { GearXYValue gv; if (!this._storage.TryGetValue(this._controller.selectedPageId, out gv)) { gv = this._default; } if (this.tween && UIPackage.constructing == 0 && !disableAllTweenEffect) { if (this._tweener != null) { if (this._tweenTarget.position != gv.position) { this._tweener.Kill(true); this._tweener = null; } else { return; } } if (this._owner.position != gv.position) { this._tweenTarget = gv; this._tweener = DOTween.To(() => this._owner.position, v => { this._owner.SetGearState(GObject.GearState.Position, true); this._owner.position = v; this._owner.SetGearState(GObject.GearState.Position, false); }, gv.position, this.tweenTime) .SetEase(this.easeType) .SetUpdate(true) .OnComplete(() => { this._tweener = null; }); if (this.delay > 0) { this._tweener.SetDelay(this.delay); } } } else { this._owner.SetGearState(GObject.GearState.Position, true); this._owner.position = gv.position; this._owner.SetGearState(GObject.GearState.Position, false); } }
protected override void Init() { this._default = new GearXYValue(this._owner.position); this._storage = new Dictionary <string, GearXYValue>(); }