private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(RadioButtonCategory state) { Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave(); switch (state) { case RadioButtonCategory.EnabledOn: break; case RadioButtonCategory.EnabledOff: break; case RadioButtonCategory.DisabledOn: break; case RadioButtonCategory.DisabledOff: break; case RadioButtonCategory.HighlightedOn: break; case RadioButtonCategory.HighlightedOff: break; case RadioButtonCategory.PushedOn: break; case RadioButtonCategory.PushedOff: break; } return(newState); }
public override void ApplyState(Gum.DataTypes.Variables.StateSave state) { bool matches = this.ElementSave.AllStates.Contains(state); if (matches) { var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state)); if (category == null) { if (state.Name == "Default") { this.mCurrentVariableState = VariableState.Default; } } else if (category.Name == "RadioButtonCategory") { if (state.Name == "EnabledOn") { this.mCurrentRadioButtonCategoryState = RadioButtonCategory.EnabledOn; } if (state.Name == "EnabledOff") { this.mCurrentRadioButtonCategoryState = RadioButtonCategory.EnabledOff; } if (state.Name == "DisabledOn") { this.mCurrentRadioButtonCategoryState = RadioButtonCategory.DisabledOn; } if (state.Name == "DisabledOff") { this.mCurrentRadioButtonCategoryState = RadioButtonCategory.DisabledOff; } if (state.Name == "HighlightedOn") { this.mCurrentRadioButtonCategoryState = RadioButtonCategory.HighlightedOn; } if (state.Name == "HighlightedOff") { this.mCurrentRadioButtonCategoryState = RadioButtonCategory.HighlightedOff; } if (state.Name == "PushedOn") { this.mCurrentRadioButtonCategoryState = RadioButtonCategory.PushedOn; } if (state.Name == "PushedOff") { this.mCurrentRadioButtonCategoryState = RadioButtonCategory.PushedOff; } } } base.ApplyState(state); }
public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateToRelative(RadioButtonCategory toState, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing, object owner = null) { Gum.DataTypes.Variables.StateSave current = GetCurrentValuesOnState(toState); Gum.DataTypes.Variables.StateSave toAsStateSave = AddToCurrentValuesWithState(toState); FlatRedBall.Glue.StateInterpolation.Tweener tweener = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing); if (owner == null) { tweener.Owner = this; } else { tweener.Owner = owner; } tweener.PositionChanged = newPosition => this.InterpolateBetween(current, toAsStateSave, newPosition); tweener.Ended += () => this.CurrentRadioButtonCategoryState = toState; tweener.Start(); StateInterpolationPlugin.TweenerManager.Self.Add(tweener); return(tweener); }
public void InterpolateBetween(RadioButtonCategory firstState, RadioButtonCategory secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif switch (firstState) { case RadioButtonCategory.EnabledOn: break; case RadioButtonCategory.EnabledOff: break; case RadioButtonCategory.DisabledOn: break; case RadioButtonCategory.DisabledOff: break; case RadioButtonCategory.HighlightedOn: break; case RadioButtonCategory.HighlightedOff: break; case RadioButtonCategory.PushedOn: break; case RadioButtonCategory.PushedOff: break; } switch (secondState) { case RadioButtonCategory.EnabledOn: break; case RadioButtonCategory.EnabledOff: break; case RadioButtonCategory.DisabledOn: break; case RadioButtonCategory.DisabledOff: break; case RadioButtonCategory.HighlightedOn: break; case RadioButtonCategory.HighlightedOff: break; case RadioButtonCategory.PushedOn: break; case RadioButtonCategory.PushedOff: break; } if (interpolationValue < 1) { mCurrentRadioButtonCategoryState = firstState; } else { mCurrentRadioButtonCategoryState = secondState; } }