public virtual void Apply(Selectable item) { Selectable.Transition transition = _transition; bool transitionChanged = item.transition != transition; item.transition = transition; ICustomSelectable customSel = item as ICustomSelectable; if (transition == Selectable.Transition.ColorTint) { // Two-step color change to get around delay bug due to fade duration CustomColorBlock cb = _colors; cb.fadeDuration = 0.0f; item.colors = cb; cb.fadeDuration = _colors.fadeDuration; item.colors = cb; if (customSel != null) { customSel.disabledHighlightedColor = cb.disabledHighlightedColor; } } else if (transition == Selectable.Transition.SpriteSwap) { item.spriteState = _spriteState; if (customSel != null) { customSel.disabledHighlightedSprite = _spriteState.disabledHighlightedSprite; } } else if (transition == Selectable.Transition.Animation) { item.animationTriggers.disabledTrigger = _animationTriggers.disabledTrigger; item.animationTriggers.highlightedTrigger = _animationTriggers.highlightedTrigger; item.animationTriggers.normalTrigger = _animationTriggers.normalTrigger; item.animationTriggers.pressedTrigger = _animationTriggers.pressedTrigger; if (customSel != null) { customSel.disabledHighlightedTrigger = _animationTriggers.disabledHighlightedTrigger; } } if (transitionChanged) { item.targetGraphic.CrossFadeColor(item.targetGraphic.color, 0.0f, true, true); // force color to revert to default or it will be left with color tint } }
public virtual void Apply(Selectable item) { Selectable.Transition transition = this._transition; bool flag = item.get_transition() != transition; item.set_transition(transition); ICustomSelectable customSelectable = item as ICustomSelectable; if (transition == 1) { ThemeSettings.CustomColorBlock colors = this._colors; colors.fadeDuration = 0.0f; item.set_colors((ColorBlock)colors); colors.fadeDuration = this._colors.fadeDuration; item.set_colors((ColorBlock)colors); if (customSelectable != null) { customSelectable.disabledHighlightedColor = colors.disabledHighlightedColor; } } else if (transition == 2) { item.set_spriteState((SpriteState)this._spriteState); if (customSelectable != null) { customSelectable.disabledHighlightedSprite = this._spriteState.disabledHighlightedSprite; } } else if (transition == 3) { item.get_animationTriggers().set_disabledTrigger(this._animationTriggers.disabledTrigger); item.get_animationTriggers().set_highlightedTrigger(this._animationTriggers.highlightedTrigger); item.get_animationTriggers().set_normalTrigger(this._animationTriggers.normalTrigger); item.get_animationTriggers().set_pressedTrigger(this._animationTriggers.pressedTrigger); if (customSelectable != null) { customSelectable.disabledHighlightedTrigger = this._animationTriggers.disabledHighlightedTrigger; } } if (!flag) { return; } item.get_targetGraphic().CrossFadeColor(item.get_targetGraphic().get_color(), 0.0f, true, true); }
public virtual void Apply(Selectable item) { Selectable.Transition transition = this._transition; bool flag = item.transition != transition; item.transition = transition; ICustomSelectable customSelectable = item as ICustomSelectable; if (transition == Selectable.Transition.ColorTint) { ThemeSettings.CustomColorBlock colors = this._colors; colors.fadeDuration = 0f; item.colors = colors; colors.fadeDuration = this._colors.fadeDuration; item.colors = colors; if (customSelectable != null) { customSelectable.disabledHighlightedColor = colors.disabledHighlightedColor; } } else if (transition == Selectable.Transition.SpriteSwap) { item.spriteState = this._spriteState; if (customSelectable != null) { customSelectable.disabledHighlightedSprite = this._spriteState.disabledHighlightedSprite; } } else if (transition == Selectable.Transition.Animation) { item.animationTriggers.disabledTrigger = this._animationTriggers.disabledTrigger; item.animationTriggers.highlightedTrigger = this._animationTriggers.highlightedTrigger; item.animationTriggers.normalTrigger = this._animationTriggers.normalTrigger; item.animationTriggers.pressedTrigger = this._animationTriggers.pressedTrigger; if (customSelectable != null) { customSelectable.disabledHighlightedTrigger = this._animationTriggers.disabledHighlightedTrigger; } } if (flag) { item.targetGraphic.CrossFadeColor(item.targetGraphic.color, 0f, true, true); } }