public void UpdateState(UISelectField.VisualState state, bool instant) { if (this.textComponent == null || !this.enabled || !this.gameObject.activeInHierarchy || this.transitionType == TransitionType.None) { return; } Color color = this.colors.normalColor; // Prepare the state values switch (state) { case UISelectField.VisualState.Normal: color = this.colors.normalColor; break; case UISelectField.VisualState.Highlighted: color = this.colors.highlightedColor; break; case UISelectField.VisualState.Pressed: color = this.colors.pressedColor; break; case UISelectField.VisualState.Active: color = this.colors.activeColor; break; case UISelectField.VisualState.ActiveHighlighted: color = this.colors.activeHighlightedColor; break; case UISelectField.VisualState.ActivePressed: color = this.colors.activePressedColor; break; case UISelectField.VisualState.Disabled: color = this.colors.disabledColor; break; } // Do the transition if (this.transitionType == TransitionType.CrossFade) { this.StartColorTween(color * this.colors.colorMultiplier, (instant ? true : (this.colors.fadeDuration == 0f))); } }
public void OnTransition(UISelectField.VisualState state, bool instant) { if ((this.targetGraphic == null && this.targetGameObject == null) || !this.gameObject.activeInHierarchy || this.m_Transition == Selectable.Transition.None) { return; } Color color = this.colors.normalColor; Sprite newSprite = null; string triggername = this.animationTriggers.normalTrigger; // Prepare the state values switch (state) { case UISelectField.VisualState.Normal: color = this.colors.normalColor; newSprite = null; triggername = this.animationTriggers.normalTrigger; break; case UISelectField.VisualState.Highlighted: color = this.colors.highlightedColor; newSprite = this.spriteState.highlightedSprite; triggername = this.animationTriggers.highlightedTrigger; break; case UISelectField.VisualState.Pressed: color = this.colors.pressedColor; newSprite = this.spriteState.pressedSprite; triggername = this.animationTriggers.pressedTrigger; break; case UISelectField.VisualState.Active: color = this.colors.activeColor; newSprite = this.spriteState.activeSprite; triggername = this.animationTriggers.activeTrigger; break; case UISelectField.VisualState.ActiveHighlighted: color = this.colors.activeHighlightedColor; newSprite = this.spriteState.activeHighlightedSprite; triggername = this.animationTriggers.activeHighlightedTrigger; break; case UISelectField.VisualState.ActivePressed: color = this.colors.activePressedColor; newSprite = this.spriteState.activePressedSprite; triggername = this.animationTriggers.activePressedTrigger; break; case UISelectField.VisualState.Disabled: color = this.colors.disabledColor; newSprite = this.spriteState.disabledSprite; triggername = this.animationTriggers.disabledTrigger; break; } // Do the transition switch (this.m_Transition) { case Selectable.Transition.ColorTint: this.StartColorTween(color * this.colors.colorMultiplier, (instant ? true : (this.colors.fadeDuration == 0f))); break; case Selectable.Transition.SpriteSwap: this.DoSpriteSwap(newSprite); break; case Selectable.Transition.Animation: this.TriggerAnimation(triggername); break; } }
public void UpdateState(UISelectField.VisualState state) { this.UpdateState(state, false); }