public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif bool setChatFrameInstanceHeightFirstValue = false; bool setChatFrameInstanceHeightSecondValue = false; float ChatFrameInstanceHeightFirstValue = 0; float ChatFrameInstanceHeightSecondValue = 0; bool setChatFrameInstanceWidthFirstValue = false; bool setChatFrameInstanceWidthSecondValue = false; float ChatFrameInstanceWidthFirstValue = 0; float ChatFrameInstanceWidthSecondValue = 0; bool setHeightFirstValue = false; bool setHeightSecondValue = false; float HeightFirstValue = 0; float HeightSecondValue = 0; bool setWidthFirstValue = false; bool setWidthSecondValue = false; float WidthFirstValue = 0; float WidthSecondValue = 0; bool setYesButtonCurrentButtonTypeStateFirstValue = false; bool setYesButtonCurrentButtonTypeStateSecondValue = false; AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType YesButtonCurrentButtonTypeStateFirstValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType YesButtonCurrentButtonTypeStateSecondValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; bool setYesButtonXFirstValue = false; bool setYesButtonXSecondValue = false; float YesButtonXFirstValue = 0; float YesButtonXSecondValue = 0; bool setYesButtonYFirstValue = false; bool setYesButtonYSecondValue = false; float YesButtonYFirstValue = 0; float YesButtonYSecondValue = 0; bool setYesButton1CurrentButtonTypeStateFirstValue = false; bool setYesButton1CurrentButtonTypeStateSecondValue = false; AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType YesButton1CurrentButtonTypeStateFirstValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType YesButton1CurrentButtonTypeStateSecondValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; bool setYesButton1XFirstValue = false; bool setYesButton1XSecondValue = false; float YesButton1XFirstValue = 0; float YesButton1XSecondValue = 0; bool setYesButton1YFirstValue = false; bool setYesButton1YSecondValue = false; float YesButton1YFirstValue = 0; float YesButton1YSecondValue = 0; switch (firstState) { case VariableState.Default: setChatFrameInstanceHeightFirstValue = true; ChatFrameInstanceHeightFirstValue = 75f; setChatFrameInstanceWidthFirstValue = true; ChatFrameInstanceWidthFirstValue = 90f; if (interpolationValue < 1) { this.ChatFrameInstance.XOrigin = RenderingLibrary.Graphics.HorizontalAlignment.Center; } if (interpolationValue < 1) { this.ChatFrameInstance.XUnits = Gum.Converters.GeneralUnitType.PixelsFromMiddle; } if (interpolationValue < 1) { this.ChatFrameInstance.YOrigin = RenderingLibrary.Graphics.VerticalAlignment.Center; } if (interpolationValue < 1) { this.ChatFrameInstance.YUnits = Gum.Converters.GeneralUnitType.PixelsFromMiddle; } setHeightFirstValue = true; HeightFirstValue = 50f; if (interpolationValue < 1) { this.HeightUnits = Gum.DataTypes.DimensionUnitType.Percentage; } setWidthFirstValue = true; WidthFirstValue = 50f; if (interpolationValue < 1) { this.WidthUnits = Gum.DataTypes.DimensionUnitType.Percentage; } setYesButtonCurrentButtonTypeStateFirstValue = true; YesButtonCurrentButtonTypeStateFirstValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; if (interpolationValue < 1) { this.YesButton.Parent = this.ContainedElements.FirstOrDefault(item => item.Name == "ChatFrameInstance") ?? this; } setYesButtonXFirstValue = true; YesButtonXFirstValue = 894f; setYesButtonYFirstValue = true; YesButtonYFirstValue = 342f; setYesButton1CurrentButtonTypeStateFirstValue = true; YesButton1CurrentButtonTypeStateFirstValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.X; if (interpolationValue < 1) { this.YesButton1.Parent = this.ContainedElements.FirstOrDefault(item => item.Name == "ChatFrameInstance") ?? this; } setYesButton1XFirstValue = true; YesButton1XFirstValue = 101f; setYesButton1YFirstValue = true; YesButton1YFirstValue = 339f; break; } switch (secondState) { case VariableState.Default: setChatFrameInstanceHeightSecondValue = true; ChatFrameInstanceHeightSecondValue = 75f; setChatFrameInstanceWidthSecondValue = true; ChatFrameInstanceWidthSecondValue = 90f; if (interpolationValue >= 1) { this.ChatFrameInstance.XOrigin = RenderingLibrary.Graphics.HorizontalAlignment.Center; } if (interpolationValue >= 1) { this.ChatFrameInstance.XUnits = Gum.Converters.GeneralUnitType.PixelsFromMiddle; } if (interpolationValue >= 1) { this.ChatFrameInstance.YOrigin = RenderingLibrary.Graphics.VerticalAlignment.Center; } if (interpolationValue >= 1) { this.ChatFrameInstance.YUnits = Gum.Converters.GeneralUnitType.PixelsFromMiddle; } setHeightSecondValue = true; HeightSecondValue = 50f; if (interpolationValue >= 1) { this.HeightUnits = Gum.DataTypes.DimensionUnitType.Percentage; } setWidthSecondValue = true; WidthSecondValue = 50f; if (interpolationValue >= 1) { this.WidthUnits = Gum.DataTypes.DimensionUnitType.Percentage; } setYesButtonCurrentButtonTypeStateSecondValue = true; YesButtonCurrentButtonTypeStateSecondValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; if (interpolationValue >= 1) { this.YesButton.Parent = this.ContainedElements.FirstOrDefault(item => item.Name == "ChatFrameInstance") ?? this; } setYesButtonXSecondValue = true; YesButtonXSecondValue = 894f; setYesButtonYSecondValue = true; YesButtonYSecondValue = 342f; setYesButton1CurrentButtonTypeStateSecondValue = true; YesButton1CurrentButtonTypeStateSecondValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.X; if (interpolationValue >= 1) { this.YesButton1.Parent = this.ContainedElements.FirstOrDefault(item => item.Name == "ChatFrameInstance") ?? this; } setYesButton1XSecondValue = true; YesButton1XSecondValue = 101f; setYesButton1YSecondValue = true; YesButton1YSecondValue = 339f; break; } if (setChatFrameInstanceHeightFirstValue && setChatFrameInstanceHeightSecondValue) { ChatFrameInstance.Height = ChatFrameInstanceHeightFirstValue * (1 - interpolationValue) + ChatFrameInstanceHeightSecondValue * interpolationValue; } if (setChatFrameInstanceWidthFirstValue && setChatFrameInstanceWidthSecondValue) { ChatFrameInstance.Width = ChatFrameInstanceWidthFirstValue * (1 - interpolationValue) + ChatFrameInstanceWidthSecondValue * interpolationValue; } if (setHeightFirstValue && setHeightSecondValue) { Height = HeightFirstValue * (1 - interpolationValue) + HeightSecondValue * interpolationValue; } if (setWidthFirstValue && setWidthSecondValue) { Width = WidthFirstValue * (1 - interpolationValue) + WidthSecondValue * interpolationValue; } if (setYesButtonCurrentButtonTypeStateFirstValue && setYesButtonCurrentButtonTypeStateSecondValue) { YesButton.InterpolateBetween(YesButtonCurrentButtonTypeStateFirstValue, YesButtonCurrentButtonTypeStateSecondValue, interpolationValue); } if (setYesButtonXFirstValue && setYesButtonXSecondValue) { YesButton.X = YesButtonXFirstValue * (1 - interpolationValue) + YesButtonXSecondValue * interpolationValue; } if (setYesButtonYFirstValue && setYesButtonYSecondValue) { YesButton.Y = YesButtonYFirstValue * (1 - interpolationValue) + YesButtonYSecondValue * interpolationValue; } if (setYesButton1CurrentButtonTypeStateFirstValue && setYesButton1CurrentButtonTypeStateSecondValue) { YesButton1.InterpolateBetween(YesButton1CurrentButtonTypeStateFirstValue, YesButton1CurrentButtonTypeStateSecondValue, interpolationValue); } if (setYesButton1XFirstValue && setYesButton1XSecondValue) { YesButton1.X = YesButton1XFirstValue * (1 - interpolationValue) + YesButton1XSecondValue * interpolationValue; } if (setYesButton1YFirstValue && setYesButton1YSecondValue) { YesButton1.Y = YesButton1YFirstValue * (1 - interpolationValue) + YesButton1YSecondValue * interpolationValue; } if (interpolationValue < 1) { mCurrentVariableState = firstState; } else { mCurrentVariableState = secondState; } }
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif bool setHeightFirstValue = false; bool setHeightSecondValue = false; float HeightFirstValue = 0; float HeightSecondValue = 0; bool setLargeInfoFrameInstanceHeightFirstValue = false; bool setLargeInfoFrameInstanceHeightSecondValue = false; float LargeInfoFrameInstanceHeightFirstValue = 0; float LargeInfoFrameInstanceHeightSecondValue = 0; bool setLargeInfoFrameInstanceWidthFirstValue = false; bool setLargeInfoFrameInstanceWidthSecondValue = false; float LargeInfoFrameInstanceWidthFirstValue = 0; float LargeInfoFrameInstanceWidthSecondValue = 0; bool setOKButtonCurrentButtonTypeStateFirstValue = false; bool setOKButtonCurrentButtonTypeStateSecondValue = false; AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType OKButtonCurrentButtonTypeStateFirstValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType OKButtonCurrentButtonTypeStateSecondValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; bool setOKButtonHeightFirstValue = false; bool setOKButtonHeightSecondValue = false; float OKButtonHeightFirstValue = 0; float OKButtonHeightSecondValue = 0; bool setOKButtonWidthFirstValue = false; bool setOKButtonWidthSecondValue = false; float OKButtonWidthFirstValue = 0; float OKButtonWidthSecondValue = 0; bool setOKButtonXFirstValue = false; bool setOKButtonXSecondValue = false; float OKButtonXFirstValue = 0; float OKButtonXSecondValue = 0; bool setOKButtonYFirstValue = false; bool setOKButtonYSecondValue = false; float OKButtonYFirstValue = 0; float OKButtonYSecondValue = 0; bool setTextInstanceFontScaleFirstValue = false; bool setTextInstanceFontScaleSecondValue = false; float TextInstanceFontScaleFirstValue = 0; float TextInstanceFontScaleSecondValue = 0; bool setTextInstanceHeightFirstValue = false; bool setTextInstanceHeightSecondValue = false; float TextInstanceHeightFirstValue = 0; float TextInstanceHeightSecondValue = 0; bool setTextInstanceWidthFirstValue = false; bool setTextInstanceWidthSecondValue = false; float TextInstanceWidthFirstValue = 0; float TextInstanceWidthSecondValue = 0; bool setTextInstanceXFirstValue = false; bool setTextInstanceXSecondValue = false; float TextInstanceXFirstValue = 0; float TextInstanceXSecondValue = 0; bool setTextInstanceYFirstValue = false; bool setTextInstanceYSecondValue = false; float TextInstanceYFirstValue = 0; float TextInstanceYSecondValue = 0; bool setWidthFirstValue = false; bool setWidthSecondValue = false; float WidthFirstValue = 0; float WidthSecondValue = 0; switch (firstState) { case VariableState.Default: setHeightFirstValue = true; HeightFirstValue = 100f; if (interpolationValue < 1) { this.HeightUnits = Gum.DataTypes.DimensionUnitType.Percentage; } setLargeInfoFrameInstanceHeightFirstValue = true; LargeInfoFrameInstanceHeightFirstValue = 90f; setLargeInfoFrameInstanceWidthFirstValue = true; LargeInfoFrameInstanceWidthFirstValue = 80f; setOKButtonCurrentButtonTypeStateFirstValue = true; OKButtonCurrentButtonTypeStateFirstValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; setOKButtonHeightFirstValue = true; OKButtonHeightFirstValue = 100f; if (interpolationValue < 1) { this.OKButton.Parent = this.ContainedElements.FirstOrDefault(item => item.Name == "LargeInfoFrameInstance") ?? this; } setOKButtonWidthFirstValue = true; OKButtonWidthFirstValue = 10f; setOKButtonXFirstValue = true; OKButtonXFirstValue = 86.74876f; if (interpolationValue < 1) { this.OKButton.XUnits = Gum.Converters.GeneralUnitType.Percentage; } setOKButtonYFirstValue = true; OKButtonYFirstValue = 75.20087f; if (interpolationValue < 1) { this.OKButton.YUnits = Gum.Converters.GeneralUnitType.Percentage; } if (interpolationValue < 1) { SetProperty("TextInstance.CustomFontFile", "../globalcontent/Font50MoireExtraBold.fnt"); } setTextInstanceFontScaleFirstValue = true; TextInstanceFontScaleFirstValue = 0.8f; setTextInstanceHeightFirstValue = true; TextInstanceHeightFirstValue = 917f; if (interpolationValue < 1) { this.TextInstance.Parent = this.ContainedElements.FirstOrDefault(item => item.Name == "LargeInfoFrameInstance") ?? this; } if (interpolationValue < 1) { this.TextInstance.UseCustomFont = true; } setTextInstanceWidthFirstValue = true; TextInstanceWidthFirstValue = 1584f; setTextInstanceXFirstValue = true; TextInstanceXFirstValue = 11.73942f; if (interpolationValue < 1) { this.TextInstance.XUnits = Gum.Converters.GeneralUnitType.Percentage; } setTextInstanceYFirstValue = true; TextInstanceYFirstValue = 7.34862f; if (interpolationValue < 1) { this.TextInstance.YUnits = Gum.Converters.GeneralUnitType.Percentage; } setWidthFirstValue = true; WidthFirstValue = 100f; if (interpolationValue < 1) { this.WidthUnits = Gum.DataTypes.DimensionUnitType.Percentage; } if (interpolationValue < 1) { this.XOrigin = RenderingLibrary.Graphics.HorizontalAlignment.Center; } if (interpolationValue < 1) { this.XUnits = Gum.Converters.GeneralUnitType.PixelsFromMiddle; } if (interpolationValue < 1) { this.YOrigin = RenderingLibrary.Graphics.VerticalAlignment.Center; } if (interpolationValue < 1) { this.YUnits = Gum.Converters.GeneralUnitType.PixelsFromMiddle; } break; } switch (secondState) { case VariableState.Default: setHeightSecondValue = true; HeightSecondValue = 100f; if (interpolationValue >= 1) { this.HeightUnits = Gum.DataTypes.DimensionUnitType.Percentage; } setLargeInfoFrameInstanceHeightSecondValue = true; LargeInfoFrameInstanceHeightSecondValue = 90f; setLargeInfoFrameInstanceWidthSecondValue = true; LargeInfoFrameInstanceWidthSecondValue = 80f; setOKButtonCurrentButtonTypeStateSecondValue = true; OKButtonCurrentButtonTypeStateSecondValue = AbbatoirIntergrade.GumRuntimes.frames.ButtonFrameRuntime.ButtonType.Check; setOKButtonHeightSecondValue = true; OKButtonHeightSecondValue = 100f; if (interpolationValue >= 1) { this.OKButton.Parent = this.ContainedElements.FirstOrDefault(item => item.Name == "LargeInfoFrameInstance") ?? this; } setOKButtonWidthSecondValue = true; OKButtonWidthSecondValue = 10f; setOKButtonXSecondValue = true; OKButtonXSecondValue = 86.74876f; if (interpolationValue >= 1) { this.OKButton.XUnits = Gum.Converters.GeneralUnitType.Percentage; } setOKButtonYSecondValue = true; OKButtonYSecondValue = 75.20087f; if (interpolationValue >= 1) { this.OKButton.YUnits = Gum.Converters.GeneralUnitType.Percentage; } if (interpolationValue >= 1) { SetProperty("TextInstance.CustomFontFile", "../globalcontent/Font50MoireExtraBold.fnt"); } setTextInstanceFontScaleSecondValue = true; TextInstanceFontScaleSecondValue = 0.8f; setTextInstanceHeightSecondValue = true; TextInstanceHeightSecondValue = 917f; if (interpolationValue >= 1) { this.TextInstance.Parent = this.ContainedElements.FirstOrDefault(item => item.Name == "LargeInfoFrameInstance") ?? this; } if (interpolationValue >= 1) { this.TextInstance.UseCustomFont = true; } setTextInstanceWidthSecondValue = true; TextInstanceWidthSecondValue = 1584f; setTextInstanceXSecondValue = true; TextInstanceXSecondValue = 11.73942f; if (interpolationValue >= 1) { this.TextInstance.XUnits = Gum.Converters.GeneralUnitType.Percentage; } setTextInstanceYSecondValue = true; TextInstanceYSecondValue = 7.34862f; if (interpolationValue >= 1) { this.TextInstance.YUnits = Gum.Converters.GeneralUnitType.Percentage; } setWidthSecondValue = true; WidthSecondValue = 100f; if (interpolationValue >= 1) { this.WidthUnits = Gum.DataTypes.DimensionUnitType.Percentage; } if (interpolationValue >= 1) { this.XOrigin = RenderingLibrary.Graphics.HorizontalAlignment.Center; } if (interpolationValue >= 1) { this.XUnits = Gum.Converters.GeneralUnitType.PixelsFromMiddle; } if (interpolationValue >= 1) { this.YOrigin = RenderingLibrary.Graphics.VerticalAlignment.Center; } if (interpolationValue >= 1) { this.YUnits = Gum.Converters.GeneralUnitType.PixelsFromMiddle; } break; } if (setHeightFirstValue && setHeightSecondValue) { Height = HeightFirstValue * (1 - interpolationValue) + HeightSecondValue * interpolationValue; } if (setLargeInfoFrameInstanceHeightFirstValue && setLargeInfoFrameInstanceHeightSecondValue) { LargeInfoFrameInstance.Height = LargeInfoFrameInstanceHeightFirstValue * (1 - interpolationValue) + LargeInfoFrameInstanceHeightSecondValue * interpolationValue; } if (setLargeInfoFrameInstanceWidthFirstValue && setLargeInfoFrameInstanceWidthSecondValue) { LargeInfoFrameInstance.Width = LargeInfoFrameInstanceWidthFirstValue * (1 - interpolationValue) + LargeInfoFrameInstanceWidthSecondValue * interpolationValue; } if (setOKButtonCurrentButtonTypeStateFirstValue && setOKButtonCurrentButtonTypeStateSecondValue) { OKButton.InterpolateBetween(OKButtonCurrentButtonTypeStateFirstValue, OKButtonCurrentButtonTypeStateSecondValue, interpolationValue); } if (setOKButtonHeightFirstValue && setOKButtonHeightSecondValue) { OKButton.Height = OKButtonHeightFirstValue * (1 - interpolationValue) + OKButtonHeightSecondValue * interpolationValue; } if (setOKButtonWidthFirstValue && setOKButtonWidthSecondValue) { OKButton.Width = OKButtonWidthFirstValue * (1 - interpolationValue) + OKButtonWidthSecondValue * interpolationValue; } if (setOKButtonXFirstValue && setOKButtonXSecondValue) { OKButton.X = OKButtonXFirstValue * (1 - interpolationValue) + OKButtonXSecondValue * interpolationValue; } if (setOKButtonYFirstValue && setOKButtonYSecondValue) { OKButton.Y = OKButtonYFirstValue * (1 - interpolationValue) + OKButtonYSecondValue * interpolationValue; } if (setTextInstanceFontScaleFirstValue && setTextInstanceFontScaleSecondValue) { TextInstance.FontScale = TextInstanceFontScaleFirstValue * (1 - interpolationValue) + TextInstanceFontScaleSecondValue * interpolationValue; } if (setTextInstanceHeightFirstValue && setTextInstanceHeightSecondValue) { TextInstance.Height = TextInstanceHeightFirstValue * (1 - interpolationValue) + TextInstanceHeightSecondValue * interpolationValue; } if (setTextInstanceWidthFirstValue && setTextInstanceWidthSecondValue) { TextInstance.Width = TextInstanceWidthFirstValue * (1 - interpolationValue) + TextInstanceWidthSecondValue * interpolationValue; } if (setTextInstanceXFirstValue && setTextInstanceXSecondValue) { TextInstance.X = TextInstanceXFirstValue * (1 - interpolationValue) + TextInstanceXSecondValue * interpolationValue; } if (setTextInstanceYFirstValue && setTextInstanceYSecondValue) { TextInstance.Y = TextInstanceYFirstValue * (1 - interpolationValue) + TextInstanceYSecondValue * interpolationValue; } if (setWidthFirstValue && setWidthSecondValue) { Width = WidthFirstValue * (1 - interpolationValue) + WidthSecondValue * interpolationValue; } if (interpolationValue < 1) { mCurrentVariableState = firstState; } else { mCurrentVariableState = secondState; } }