/// <summary> /// Interactive calls this method on state change /// </summary> /// <param name="state"> /// Enum containing the following states: /// DefaultState: normal state of the button /// FocusState: gameObject has gaze /// PressState: currently being pressed /// SelectedState: selected and has no other interaction /// FocusSelected: selected with gaze /// PressSelected: selected and pressed /// Disabled: button is disabled /// DisabledSelected: the button is not interactive, but in it's alternate state (toggle button) /// </param> public virtual void SetState(Interactive.ButtonStateEnum state) { switch (state) { case Interactive.ButtonStateEnum.Default: break; case Interactive.ButtonStateEnum.Focus: break; case Interactive.ButtonStateEnum.Press: break; case Interactive.ButtonStateEnum.Selected: break; case Interactive.ButtonStateEnum.FocusSelected: break; case Interactive.ButtonStateEnum.PressSelected: break; case Interactive.ButtonStateEnum.Disabled: break; case Interactive.ButtonStateEnum.DisabledSelected: break; default: break; } State = state; }
/// <summary> /// swap the texture based on the theme /// </summary> /// <param Name="state"></param> private void SetTexture(Interactive.ButtonStateEnum state) { if (mTextureTheme != null) { mMaterial.SetTexture("_MainTex", mTextureTheme.GetThemeValue(state)); } }
/// <summary> /// Set active state /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); bool show = (state == Interactive.ButtonStateEnum.FocusSelected || state == Interactive.ButtonStateEnum.Focus || state == Interactive.ButtonStateEnum.Press || state == Interactive.ButtonStateEnum.PressSelected); for (int i = 0; i < Targets.Length; ++i) { Targets[i].SetActive(show); } }
/// <summary> /// Interactive calls this method on state change /// </summary> /// <param name="state"> /// Enum containing the following states: /// DefaultState: normal state of the button /// FocusState: gameObject has gaze /// PressState: currently being pressed /// SelectedState: selected and has no other interaction /// FocusSelected: selected with gaze /// PressSelected: selected and pressed /// Disabled: button is disabled /// DisabledSelected: the button is not interactive, but in it's alternate state (toggle button) /// </param> public override void SetState(Interactive.ButtonStateEnum state) { int colorIndex = -1; switch (state) { case Interactive.ButtonStateEnum.Default: this.gameObject.transform.localScale = EffectScale[0]; this.gameObject.transform.localPosition = EffectPosition[0]; colorIndex = 0; break; case Interactive.ButtonStateEnum.Focus: this.gameObject.transform.localScale = EffectScale[1]; this.gameObject.transform.localPosition = EffectPosition[0]; colorIndex = 0; break; case Interactive.ButtonStateEnum.Press: this.gameObject.transform.localPosition = EffectPosition[1]; colorIndex = 0; break; case Interactive.ButtonStateEnum.Selected: this.gameObject.transform.localScale = EffectScale[0]; this.gameObject.transform.localPosition = EffectPosition[0]; colorIndex = 1; break; case Interactive.ButtonStateEnum.FocusSelected: this.gameObject.transform.localScale = EffectScale[1]; this.gameObject.transform.localPosition = EffectPosition[0]; colorIndex = 1; break; case Interactive.ButtonStateEnum.PressSelected: this.gameObject.transform.localPosition = EffectPosition[1]; colorIndex = 1; break; case Interactive.ButtonStateEnum.Disabled: this.gameObject.transform.localScale = EffectScale[0]; this.gameObject.transform.localPosition = EffectPosition[0]; colorIndex = 0; break; case Interactive.ButtonStateEnum.DisabledSelected: this.gameObject.transform.localScale = EffectScale[0]; this.gameObject.transform.localPosition = EffectPosition[0]; colorIndex = 1; break; default: break; } if (mRenderer != null && colorIndex > -1) { mRenderer.material.color = EffectColors[colorIndex]; } }
/// <summary> /// Fade in or out based on focus /// </summary> /// <param Name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); if (state == Interactive.ButtonStateEnum.FocusSelected || state == Interactive.ButtonStateEnum.Focus || state == Interactive.ButtonStateEnum.Press || state == Interactive.ButtonStateEnum.PressSelected) { mFadeController.FadeIn(); } else { mFadeController.FadeOut(); } }
public override void SetState(Interactive.ButtonStateEnum state) { /* * string stateString = ""; * switch (state) * { * case Interactive.ButtonStateEnum.Selected: * stateString = TextPop; * break; * } * TextField.text = stateString; */ }
/// <summary> /// set the colors /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); if (mInnerColorTheme != null) { ColorBlender.StartTransition(mInnerColorTheme.GetThemeValue(state), InnerMaterial.name); } if (mOuterColorTheme != null) { ColorBlender.StartTransition(mOuterColorTheme.GetThemeValue(state), OuterMaterial.name); } }
/// <summary> /// Set or fade the colors /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); if (mColorTheme != null) { if (ColorBlender != null) { ColorBlender.StartTransition(mColorTheme.GetThemeValue(state)); } else if (mMaterial != null) { mMaterial.color = mColorTheme.GetThemeValue(state); } } }
/// <summary> /// Set the text value /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); string label = ""; if (state == Interactive.ButtonStateEnum.FocusSelected || state == Interactive.ButtonStateEnum.Selected || state == Interactive.ButtonStateEnum.PressSelected || state == Interactive.ButtonStateEnum.DisabledSelected) { label = SelectedLabel; } else { label = DefaultLabel; } Label.text = label; }
/// <summary> /// Set the Scale /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); if (mScaleTheme != null) { if (ScaleTweener != null) { ScaleTweener.TargetValue = mScaleTheme.GetThemeValue(state); ScaleTweener.StartRunning(); } else { transform.localScale = mScaleTheme.GetThemeValue(state); } } }
/// <summary> /// Set the position /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); if (mPositionTheme != null) { if (MovePositionTweener != null) { MovePositionTweener.TargetValue = mPositionTheme.GetThemeValue(state); MovePositionTweener.StartRunning(); } else { transform.localPosition = mPositionTheme.GetThemeValue(state); } } }
/// <summary> /// Animate the position /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); if (mMoveToPosition != null) { if (state == Interactive.ButtonStateEnum.FocusSelected || state == Interactive.ButtonStateEnum.Selected || state == Interactive.ButtonStateEnum.PressSelected || state == Interactive.ButtonStateEnum.DisabledSelected) { mMoveToPosition.TargetValue = SelectPosition; mMoveToPosition.StartRunning(); } else { mMoveToPosition.TargetValue = DefaultPosition; mMoveToPosition.StartRunning(); } } }
/// <summary> /// Interactive calls this method on state change /// </summary> /// <param Name="state"> /// Enum containing the following states: /// DefaultState: normal state of the button /// FocusState: gameObject has gaze /// PressState: currently being pressed /// SelectedState: selected and has no other interaction /// FocusSelected: selected with gaze /// PressSelected: selected and pressed /// Disabled: button is disabled /// DisabledSelected: the button is not interactive, but in it's alternate state (toggle button) /// </param> public override void SetState(Interactive.ButtonStateEnum state) { string stateString = "Default"; switch (state) { case Interactive.ButtonStateEnum.Default: stateString = "Default"; break; case Interactive.ButtonStateEnum.Focus: stateString = "Focus"; break; case Interactive.ButtonStateEnum.Press: stateString = "Press"; break; case Interactive.ButtonStateEnum.Selected: stateString = "Selected"; break; case Interactive.ButtonStateEnum.FocusSelected: stateString = "FocusSelected"; break; case Interactive.ButtonStateEnum.PressSelected: stateString = "PressSelected"; break; case Interactive.ButtonStateEnum.Disabled: stateString = "Disabled"; break; case Interactive.ButtonStateEnum.DisabledSelected: stateString = "DisabledSelected"; break; default: break; } TextField.text = stateString; }
/// <summary> /// Set colors, position and label text /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); if (mText != null) { if (mColorTheme != null) { mText.color = mColorTheme.GetThemeValue(state); } if (ButtonLabels != null && this.name == "LabelDictation") { if (InteractiveHost.IsSelected) { if (ButtonLabels.Selected != "") { mText.text = ButtonLabels.Selected; } else { mText.text = ButtonLabels.Default; } } else { mText.text = ButtonLabels.Default; } } } if (mPositionTheme != null) { if (MovePosition != null) { MovePosition.TargetValue = mPositionTheme.GetThemeValue(state); MovePosition.StartRunning(); } else { transform.localPosition = mPositionTheme.GetThemeValue(state); } } }
public Type GetThemeValue(Interactive.ButtonStateEnum state) { switch (state) { case Interactive.ButtonStateEnum.Default: CurrentValue = Default; break; case Interactive.ButtonStateEnum.Focus: CurrentValue = Focus; break; case Interactive.ButtonStateEnum.Press: CurrentValue = Press; break; case Interactive.ButtonStateEnum.Selected: CurrentValue = Selected; break; case Interactive.ButtonStateEnum.FocusSelected: CurrentValue = FocusSelected; break; case Interactive.ButtonStateEnum.PressSelected: CurrentValue = PressSelected; break; case Interactive.ButtonStateEnum.Disabled: CurrentValue = Disabled; break; case Interactive.ButtonStateEnum.DisabledSelected: CurrentValue = DisabledSelected; break; default: CurrentValue = Default; break; } return(CurrentValue); }
/// <summary> /// set states or start animaitons /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); if (mColorTheme != null) { if (ColorBlender != null) { ColorBlender.StartTransition(mColorTheme.GetThemeValue(state)); } else if (mMaterial != null) { mMaterial.color = mColorTheme.GetThemeValue(state); } } if (mPositionTheme != null) { if (MovePosition != null) { MovePosition.TargetValue = mPositionTheme.GetThemeValue(state); MovePosition.StartRunning(); } else { transform.localPosition = mPositionTheme.GetThemeValue(state); } } if (mScaleTheme != null) { if (ScaleSize != null) { ScaleSize.TargetValue = mScaleTheme.GetThemeValue(state); ScaleSize.StartRunning(); } else { transform.localScale = mScaleTheme.GetThemeValue(state); } } }
/// <summary> /// Interactive calls this method on state change /// </summary> /// <param name="state"> /// Enum containing the following states: /// DefaultState: normal state of the button /// FocusState: gameObject has gaze /// PressState: currently being pressed /// SelectedState: selected and has no other interaction /// FocusSelected: selected with gaze /// PressSelected: selected and pressed /// Disabled: button is disabled /// DisabledSelected: the button is not interactive, but in it's alternate state (toggle button) /// </param> public override void SetState(Interactive.ButtonStateEnum state) { switch (state) { case Interactive.ButtonStateEnum.Default: mIsEnabled = true; break; case Interactive.ButtonStateEnum.Focus: mIsEnabled = true; break; case Interactive.ButtonStateEnum.Press: mIsEnabled = true; break; case Interactive.ButtonStateEnum.Selected: mIsEnabled = true; break; case Interactive.ButtonStateEnum.FocusSelected: mIsEnabled = true; break; case Interactive.ButtonStateEnum.PressSelected: mIsEnabled = true; break; case Interactive.ButtonStateEnum.Disabled: mIsEnabled = false; break; case Interactive.ButtonStateEnum.DisabledSelected: mIsEnabled = false; break; default: break; } TextField.text = mIsEnabled ? "(Enabled)" : "(Disabled)"; }
/// <summary> /// On the selected state, activate this game object /// </summary> /// <param Name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); TargetObject.SetActive(InteractiveHost.IsSelected); }
/// <summary> /// Sets the state of the widget /// </summary> /// <param name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); mThemeUpdated = false; }
/// <summary> /// From InteractiveWidget /// </summary> /// <param Name="state"></param> public override void SetState(Interactive.ButtonStateEnum state) { base.SetState(state); SetTexture(state); }