protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { Color color; switch (state) { case Selectable.SelectionState.Normal: color = base.colors.normalColor; break; case Selectable.SelectionState.Highlighted: color = base.colors.highlightedColor; break; case Selectable.SelectionState.Pressed: color = base.colors.pressedColor; break; case Selectable.SelectionState.Disabled: color = base.colors.disabledColor; break; default: color = Color.black; break; } if (this.m_Text != null) { this.m_Text.color = color; } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); if (tops != null) { for (int i = 0; i < transform.childCount; i++) { float bottom = bottoms [i]; float top = tops [i]; if (state == Selectable.SelectionState.Pressed) { bottom -= 20; top -= 20; } Transform child = transform.GetChild(i); RectTransform rectTransform = child.GetComponent <RectTransform> (); rectTransform.offsetMin = new Vector2(rectTransform.offsetMin.x, bottom); rectTransform.offsetMax = new Vector2(rectTransform.offsetMax.x, top); } } }
// Token: 0x06002166 RID: 8550 RVA: 0x0009CB8C File Offset: 0x0009AD8C protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); switch (state) { case Selectable.SelectionState.Normal: this.newPosition.x = this.originalPosition.x; this.newButtonScale = 1f; this.hovering = false; break; case Selectable.SelectionState.Highlighted: this.newPosition.x = this.originalPosition.x + 4f; Util.PlaySound("Play_UI_menuHover", RoR2Application.instance.gameObject); this.newButtonScale = 1.05f; this.hovering = true; break; case Selectable.SelectionState.Pressed: this.newPosition.x = this.originalPosition.x + 6f; this.newButtonScale = 0.95f; this.hovering = true; break; case Selectable.SelectionState.Disabled: this.newPosition.x = this.originalPosition.x; this.newButtonScale = 1f; this.hovering = false; break; } this.originalColor = base.targetGraphic.color; }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); switch (state) { case Selectable.SelectionState.Normal: this.m_Title.color = base.colors.normalColor; this.m_Text.color = base.colors.normalColor; return; case Selectable.SelectionState.Highlighted: this.m_Title.color = base.colors.highlightedColor; this.m_Text.color = base.colors.highlightedColor; return; case Selectable.SelectionState.Pressed: this.m_Title.color = base.colors.pressedColor; this.m_Text.color = base.colors.pressedColor; return; case Selectable.SelectionState.Disabled: this.m_Title.color = base.colors.disabledColor; this.m_Text.color = base.colors.disabledColor; return; default: return; } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { if (this.m_Text == null) { return; } switch (state) { case Selectable.SelectionState.Normal: this.m_Text.color = base.colors.normalColor; return; case Selectable.SelectionState.Highlighted: this.m_Text.color = base.colors.highlightedColor; return; case Selectable.SelectionState.Pressed: this.m_Text.color = base.colors.pressedColor; return; case Selectable.SelectionState.Disabled: this.m_Text.color = base.colors.disabledColor; return; default: this.m_Text.color = Color.black; return; } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { float alpha; Color color; float alphaMultiplier; float colorMultiplier; this.GetParameters(state, out alpha, out color, out alphaMultiplier, out colorMultiplier); if (this.toggleTransitionExtended > ToggleTransitionExtended.Fade) { instant = (Application.isPlaying == false || TweenerGlobal.instance == null); if (this.graphic != null) { if ((this.toggleTransitionExtended & ToggleTransitionExtended.Color) != 0) { this.graphic.CrossFadeColor(color * colorMultiplier, this.isOn == true ? this.colorTransitionOn.fadeDuration : this.colorTransitionOff.fadeDuration, ignoreTimeScale: true, useAlpha: true); } if ((this.toggleTransitionExtended & ToggleTransitionExtended.Alpha) != 0) { this.StartAlphaTween(this.isOn, alpha * alphaMultiplier, true); } } } else { base.DoStateTransition(state, instant); } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { //obUI = this.GetComponentsInChildren<Renderer>().ToList(); //Debug.Log("inside state transition"); if (state == SelectionState.Pressed) { StopAllCoroutines(); StartCoroutine(TweenColorFromCurrent(this.colors.pressedColor, this.colors.fadeDuration)); } if (state == Selectable.SelectionState.Highlighted) { //Debug.Log("state was highlight"); StartCoroutine(TweenColorFromCurrent(this.colors.highlightedColor, this.colors.fadeDuration)); StartCoroutine(TweenScaleFromCurrent(HoverScale, this.colors.fadeDuration)); } if (state == Selectable.SelectionState.Normal) { // Debug.Log("state was normal"); StopAllCoroutines(); StartCoroutine(TweenColorFromCurrent(this.colors.normalColor, this.colors.fadeDuration)); StartCoroutine(TweenScaleFromCurrent(NormalScale, this.colors.fadeDuration)); } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { if (this.isHighlightDisabled) { Color disabledHighlightedColor = this._disabledHighlightedColor; Sprite disabledHighlightedSprite = this._disabledHighlightedSprite; string disabledHighlightedTrigger = this._disabledHighlightedTrigger; if (base.gameObject.activeInHierarchy) { switch (base.transition) { case Selectable.Transition.ColorTint: this.StartColorTween(disabledHighlightedColor * base.colors.colorMultiplier, instant); break; case Selectable.Transition.SpriteSwap: this.DoSpriteSwap(disabledHighlightedSprite); break; case Selectable.Transition.Animation: this.TriggerAnimation(disabledHighlightedTrigger); break; } } } else { base.DoStateTransition(state, instant); } }
// Token: 0x06000882 RID: 2178 RVA: 0x000252C8 File Offset: 0x000234C8 protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); if (base.gameObject.activeInHierarchy) { switch (state) { case Selectable.SelectionState.Normal: case Selectable.SelectionState.Highlighted: if (this.m_baseColorList == null) { this.SetButtonComponentColor(this.m_normalStateColorList); } else { this.ResetButtonCompontentToBaseColor(); } break; case Selectable.SelectionState.Pressed: this.SetButtonComponentColor(this.m_pressedStateColorList); break; case Selectable.SelectionState.Disabled: this.SetButtonComponentColor(this.m_disableStateColorList); break; } } }
protected virtual void DoStateTransition(Selectable.SelectionState state, bool instant) { if (state == null || state == 1 || state == 2) { state = !this.mIsOn ? (Selectable.SelectionState) 0 : (Selectable.SelectionState) 2; } ((Selectable)this).DoStateTransition(state, instant); }
// Token: 0x06002A0F RID: 10767 RVA: 0x004671BC File Offset: 0x004653BC protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); if (this.m_StateTransitionHandler != null) { this.m_StateTransitionHandler.OnStateTransition((byte)state, instant); } }
public virtual void UpdateButtonState() { Selectable.SelectionState selectionState = ((Selectable)this).get_currentSelectionState(); if (((UIBehaviour)this).IsActive() && !((Selectable)this).IsInteractable()) { selectionState = (Selectable.SelectionState) 3; } ((Selectable)this).DoStateTransition(selectionState, true); }
protected virtual void DoStateTransition(Selectable.SelectionState state, bool instant) { Color color; Sprite newSprite; string triggername; switch (state) { case Selectable.SelectionState.Normal: color = this.m_Colors.normalColor; newSprite = (Sprite)null; triggername = this.m_AnimationTriggers.normalTrigger; break; case Selectable.SelectionState.Highlighted: color = this.m_Colors.highlightedColor; newSprite = this.m_SpriteState.highlightedSprite; triggername = this.m_AnimationTriggers.highlightedTrigger; break; case Selectable.SelectionState.Pressed: color = this.m_Colors.pressedColor; newSprite = this.m_SpriteState.pressedSprite; triggername = this.m_AnimationTriggers.pressedTrigger; break; case Selectable.SelectionState.Disabled: color = this.m_Colors.disabledColor; newSprite = this.m_SpriteState.disabledSprite; triggername = this.m_AnimationTriggers.disabledTrigger; break; default: color = Color.black; newSprite = (Sprite)null; triggername = string.Empty; break; } if (!this.gameObject.activeInHierarchy) { return; } switch (this.m_Transition) { case Selectable.Transition.ColorTint: this.StartColorTween(color * this.m_Colors.colorMultiplier, instant); break; case Selectable.Transition.SpriteSwap: this.DoSpriteSwap(newSprite); break; case Selectable.Transition.Animation: this.TriggerAnimation(triggername); break; } }
private void InternalEvaluateAndTransitionToSelectionState(bool instant) { Selectable.SelectionState state = this.m_CurrentSelectionState; if (this.IsActive() && !this.IsInteractable()) { state = Selectable.SelectionState.Disabled; } this.DoStateTransition(state, instant); }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); // Invoke the state change event if (this.onStateChange != null) { this.onStateChange.Invoke((VisualState)state, instant); } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { if (this.currentSeletionState == 2 && state == 1 && (Input.get_touchCount() > 0 || Input.GetMouseButton(0)) && EventSystem.get_current() != null && EventSystem.get_current().get_currentSelectedGameObject() != null && EventSystem.get_current().get_currentSelectedGameObject() == base.get_gameObject()) { this.currentSeletionState = state; return; } this.currentSeletionState = state; base.DoStateTransition(state, instant); }
protected override void OnEnable() { base.OnEnable(); Selectable.s_List.Add(this); Selectable.SelectionState currentSelectionState = Selectable.SelectionState.Normal; if (this.hasSelection) { currentSelectionState = Selectable.SelectionState.Highlighted; } this.m_CurrentSelectionState = currentSelectionState; this.InternalEvaluateAndTransitionToSelectionState(true); }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); if (state == Selectable.SelectionState.Highlighted) { UIAudioPlayer.Play(UIAudioPlayer.UISoundType.Focus); return; } if (state == Selectable.SelectionState.Pressed) { UIAudioPlayer.Play(UIAudioPlayer.UISoundType.Click); this.Select(); } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); if (_previousState == state) { return; } if (state == Selectable.SelectionState.Highlighted) { Util.PlaySound("Play_UI_menuHover", RoR2Application.instance.gameObject); } _previousState = state; }
protected void UpdateSelectionState(BaseEventData eventData) { if (this.IsPressed()) { this.m_CurrentSelectionState = Selectable.SelectionState.Pressed; } else if (this.IsHighlighted(eventData)) { this.m_CurrentSelectionState = Selectable.SelectionState.Highlighted; } else { this.m_CurrentSelectionState = Selectable.SelectionState.Normal; } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); if (this.label != null) { if (this.interactable == false) { this.label.color = this.labelColor.disabledColor; } else { this.label.color = this.labelColor.normalColor; } } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { Selectable.SelectionState currentSeletionState = this.currentSeletionState; base.DoStateTransition(state, instant); if (this.keyIndex != 0) { if (currentSeletionState == 2 && state != 2) { XInputManager.Instance.OnSkillBtnUp(this.keyIndex); } else if (currentSeletionState != 2 && state == 2) { XInputManager.Instance.OnSkillBtnDown(this.keyIndex, true); } } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { base.DoStateTransition(state, instant); if (state == Selectable.SelectionState.Highlighted) { this.m_HL.color = this.m_HL_HighlightColor; UIAudioPlayer.Play(UIAudioPlayer.UISoundType.Focus); return; } if (state == Selectable.SelectionState.Pressed) { UIAudioPlayer.Play(UIAudioPlayer.UISoundType.Click); return; } this.m_HL.color = this.m_HL_DefaultColor; }
private void EvaluateHightlightDisabled(bool isSelected) { if (!isSelected) { if (this.isHighlightDisabled) { this.isHighlightDisabled = false; Selectable.SelectionState state = (!this.isDisabled) ? base.currentSelectionState : Selectable.SelectionState.Disabled; this.DoStateTransition(state, false); } } else { if (!this.isDisabled) { return; } this.isHighlightDisabled = true; this.DoStateTransition(Selectable.SelectionState.Disabled, false); } }
protected virtual void DoStateTransition(Selectable.SelectionState state, bool instant) { if (this.isHighlightDisabled) { Color highlightedColor = this._disabledHighlightedColor; Sprite highlightedSprite = this._disabledHighlightedSprite; string highlightedTrigger = this._disabledHighlightedTrigger; if (!((Component)this).get_gameObject().get_activeInHierarchy()) { return; } Selectable.Transition transition = ((Selectable)this).get_transition(); if (transition != 1) { if (transition != 2) { if (transition != 3) { return; } this.TriggerAnimation(highlightedTrigger); } else { this.DoSpriteSwap(highlightedSprite); } } else { Color color = highlightedColor; ColorBlock colors = ((Selectable)this).get_colors(); double colorMultiplier = (double)((ColorBlock) ref colors).get_colorMultiplier(); this.StartColorTween(Color.op_Multiply(color, (float)colorMultiplier), instant); } } else { ((Selectable)this).DoStateTransition(state, instant); } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { Color color; switch (state) { case Selectable.SelectionState.Normal: color = base.colors.normalColor; break; case Selectable.SelectionState.Highlighted: color = base.colors.highlightedColor; break; case Selectable.SelectionState.Pressed: color = base.colors.pressedColor; if (this.m_Dir == UISelectButtonArrowDir.Left) { this.m_SelectButton.OnLeftButtonPressed(); } else if (this.m_Dir == UISelectButtonArrowDir.Right) { this.m_SelectButton.OnRightButtonPressed(); } break; case Selectable.SelectionState.Disabled: color = base.colors.disabledColor; break; default: color = Color.black; break; } if (this.m_Text != null) { this.m_Text.color = color; } }
protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { Color normalColor; switch (state) { case Selectable.SelectionState.Normal: normalColor = base.colors.normalColor; break; case Selectable.SelectionState.Highlighted: normalColor = base.colors.highlightedColor; break; case Selectable.SelectionState.Pressed: normalColor = base.colors.pressedColor; break; case Selectable.SelectionState.Disabled: normalColor = base.colors.disabledColor; break; default: normalColor = Color.black; break; } if (base.gameObject.activeInHierarchy) { if (base.transition == Selectable.Transition.ColorTint) { this.colorTween((Color)(normalColor * base.colors.colorMultiplier), instant); } else { base.DoStateTransition(state, instant); } } }
private void GetParameters(Selectable.SelectionState state, out float alpha, out Color color, out float alphaMultiplier, out float colorMultiplier) { var alphaBlock = (this.isOn == true ? this.alphaOn : this.alphaOff); var colorBlock = (this.isOn == true ? this.colorTransitionOn : this.colorTransitionOff); alphaMultiplier = alphaBlock.alphaMultiplier; colorMultiplier = colorBlock.colorMultiplier; switch (state) { case Selectable.SelectionState.Normal: alpha = alphaBlock.normalAlpha; color = colorBlock.normalColor; break; case Selectable.SelectionState.Highlighted: alpha = alphaBlock.highlightedAlpha; color = colorBlock.highlightedColor; break; case Selectable.SelectionState.Pressed: alpha = alphaBlock.pressedAlpha; color = colorBlock.pressedColor; break; case Selectable.SelectionState.Disabled: alpha = alphaBlock.disabledAlpha; color = colorBlock.disabledColor; break; default: alpha = 0f; color = Color.black; break; } }
/*protected override void OnDidApplyAnimationProperties() { * * base.OnDidApplyAnimationProperties(); * * this.ApplyState(this.currentSelectionState, false); * * }*/ private void ApplyState(Selectable.SelectionState state, bool instant) { if (this.label != null) { switch (state) { case SelectionState.Disabled: this.label.CrossFadeColor(this.labelColor.disabledColor, instant == true ? 0f : this.labelColor.fadeDuration, false, true); break; case SelectionState.Normal: this.label.CrossFadeColor(this.labelColor.normalColor, instant == true ? 0f : this.labelColor.fadeDuration, false, true); break; case SelectionState.Highlighted: this.label.CrossFadeColor(this.labelColor.highlightedColor, instant == true ? 0f : this.labelColor.fadeDuration, false, true); break; case SelectionState.Pressed: this.label.CrossFadeColor(this.labelColor.pressedColor, instant == true ? 0f : this.labelColor.fadeDuration, false, true); break; } } }
/// <summary> /// Dos the state transition of the select field. /// </summary> /// <param name="state">State.</param> /// <param name="instant">If set to <c>true</c> instant.</param> protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { if (!this.gameObject.activeInHierarchy) { return; } Color color = this.colors.normalColor; Sprite newSprite = null; string triggername = this.animationTriggers.normalTrigger; // Check if this is the disabled state before any others if (state == Selectable.SelectionState.Disabled) { this.m_CurrentVisualState = VisualState.Disabled; color = this.colors.disabledColor; newSprite = this.spriteState.disabledSprite; triggername = this.animationTriggers.disabledTrigger; } else { // Prepare the state values switch (state) { case Selectable.SelectionState.Normal: this.m_CurrentVisualState = (this.isOn) ? VisualState.Active : VisualState.Normal; color = (this.isOn) ? this.colors.activeColor : this.colors.normalColor; newSprite = (this.isOn) ? this.spriteState.activeSprite : null; triggername = (this.isOn) ? this.animationTriggers.activeTrigger : this.animationTriggers.normalTrigger; break; case Selectable.SelectionState.Highlighted: this.m_CurrentVisualState = (this.isOn) ? VisualState.ActiveHighlighted : VisualState.Highlighted; color = (this.isOn) ? this.colors.activeHighlightedColor : this.colors.highlightedColor; newSprite = (this.isOn) ? this.spriteState.activeHighlightedSprite : this.spriteState.highlightedSprite; triggername = (this.isOn) ? this.animationTriggers.activeHighlightedTrigger : this.animationTriggers.highlightedTrigger; break; case Selectable.SelectionState.Pressed: this.m_CurrentVisualState = (this.isOn) ? VisualState.ActivePressed : VisualState.Pressed; color = (this.isOn) ? this.colors.activePressedColor : this.colors.pressedColor; newSprite = (this.isOn) ? this.spriteState.activePressedSprite : this.spriteState.pressedSprite; triggername = (this.isOn) ? this.animationTriggers.activePressedTrigger : this.animationTriggers.pressedTrigger; break; } } // Do the transition switch (this.transition) { case Selectable.Transition.ColorTint: this.StartColorTween(color * this.colors.colorMultiplier, (instant ? 0f : this.colors.fadeDuration)); break; case Selectable.Transition.SpriteSwap: this.DoSpriteSwap(newSprite); break; case Selectable.Transition.Animation: this.TriggerAnimation(triggername); break; } // Invoke the transition event if (this.onTransition != null) { this.onTransition.Invoke(this.m_CurrentVisualState, instant); } }
/// <summary> /// <para>Internally update the selection state of the Selectable.</para> /// </summary> /// <param name="eventData"></param> protected void UpdateSelectionState(BaseEventData eventData) { if (this.IsPressed()) this.m_CurrentSelectionState = Selectable.SelectionState.Pressed; else if (this.IsHighlighted(eventData)) this.m_CurrentSelectionState = Selectable.SelectionState.Highlighted; else this.m_CurrentSelectionState = Selectable.SelectionState.Normal; }
protected override void OnEnable() { base.OnEnable(); Selectable.s_List.Add(this); Selectable.SelectionState selectionState = Selectable.SelectionState.Normal; if (this.hasSelection) selectionState = Selectable.SelectionState.Highlighted; this.m_CurrentSelectionState = selectionState; this.InternalEvaluateAndTransitionToSelectionState(true); }
/// <summary> /// Does the state transitioning. /// </summary> /// <param name="state">State.</param> /// <param name="instant">If set to <c>true</c> instant.</param> protected override void DoStateTransition(Selectable.SelectionState state, bool instant) { if (!this.m_HasEnableRun) return; // Save the state as current state this.m_CurrentState = state; Color newImageColor = this.m_ImageColors.normalColor; Color newTextColor = this.m_TextColors.normalColor; Sprite newSprite = null; string imageTrigger = this.m_ImageAnimationTriggers.normalTrigger; // Prepare state values switch (state) { case Selectable.SelectionState.Normal: newImageColor = (!this.isOn) ? this.m_ImageColors.normalColor : this.m_ImageColors.activeColor; newTextColor = (!this.isOn) ? this.m_TextColors.normalColor : this.m_TextColors.activeColor; newSprite = (!this.isOn) ? null : this.m_ImageSpriteState.activeSprite; imageTrigger = (!this.isOn) ? this.m_ImageAnimationTriggers.normalTrigger : this.m_ImageAnimationTriggers.activeTrigger; break; case Selectable.SelectionState.Highlighted: newImageColor = (!this.isOn) ? this.m_ImageColors.highlightedColor : this.m_ImageColors.activeHighlightedColor; newTextColor = (!this.isOn) ? this.m_TextColors.highlightedColor : this.m_TextColors.activeHighlightedColor; newSprite = (!this.isOn) ? this.m_ImageSpriteState.highlightedSprite : this.m_ImageSpriteState.activeHighlightedSprite; imageTrigger = (!this.isOn) ? this.m_ImageAnimationTriggers.highlightedTrigger : this.m_ImageAnimationTriggers.activeHighlightedTrigger; break; case Selectable.SelectionState.Pressed: newImageColor = (!this.isOn) ? this.m_ImageColors.pressedColor : this.m_ImageColors.activePressedColor; newTextColor = (!this.isOn) ? this.m_TextColors.pressedColor : this.m_TextColors.activePressedColor; newSprite = (!this.isOn) ? this.m_ImageSpriteState.pressedSprite : this.m_ImageSpriteState.activePressedSprite; imageTrigger = (!this.isOn) ? this.m_ImageAnimationTriggers.pressedTrigger : this.m_ImageAnimationTriggers.activePressedTrigger; break; case Selectable.SelectionState.Disabled: newImageColor = this.m_ImageColors.disabledColor; newTextColor = this.m_TextColors.disabledColor; newSprite = this.m_ImageSpriteState.disabledSprite; imageTrigger = this.m_ImageAnimationTriggers.disabledTrigger; break; } // Check if the tab is active in the scene if (this.gameObject.activeInHierarchy) { // Do the image transition switch (this.m_ImageTransition) { case Selectable.Transition.ColorTint: this.StartColorTween((this.m_ImageTarget as Graphic), newImageColor * this.m_ImageColors.colorMultiplier, (instant ? 0f : this.m_ImageColors.fadeDuration)); break; case Selectable.Transition.SpriteSwap: this.DoSpriteSwap(this.m_ImageTarget, newSprite); break; case Selectable.Transition.Animation: this.TriggerAnimation(this.m_ImageTarget.gameObject, imageTrigger); break; } // Do the text transition switch (this.m_TextTransition) { case TextTransition.ColorTint: this.StartColorTween((this.m_TextTarget as Graphic), newTextColor * this.m_TextColors.colorMultiplier, (instant ? 0f : this.m_TextColors.fadeDuration)); break; } } }