/// <summary> /// C'tor for TextLine /// </summary> /// <param name="parent">The UIGridElement owner.</param> /// <param name="text">The text to display.</param> /// <param name="Font">The function to get the current font.</param> /// <param name="checkbox">Should this line have a checkbox at the beginning?</param> public TextLine(UIGridElement parent, string text, UI2D.Shared.GetFont Font, bool checkbox) { this.parent = parent; this.text = TextHelper.FilterInvalidCharacters(text); this.Font = Font; this.checkbox = checkbox; } // end of TextLine c'tor
} // end of Refresh() public override void Update(ref Matrix parentMatrix) { int focus = SelectionIndex.X; bool wasDirty = dirty; GamePadInput pad = GamePadInput.GetGamePad0(); base.Update(ref parentMatrix); // Did something change? If so, update the transforms for the tiles. if (wasDirty || focus != SelectionIndex.X) { float twitchTime = Time.FrameRate > 20.0f ? 0.2f : 0.0f; Vector3 negativeX = new Vector3(-1.0f, 1.0f, 1.0f); Vector3 rotation = new Vector3(kTipBackAngle, 0.0f, 0.0f); for (int i = 0; i < ActualDimensions.X; i++) { UIGridElement e = grid[i, 0]; e.Rotation = rotation; int index = focusIndex.X - i; if (index >= 0) { //e.Position = positions[index]; e.TwitchPosition(positions[index], twitchTime, TwitchCurve.Shape.OvershootOut); } else { Vector3 position = positions[-index]; position.X = -position.X; //e.Position = position; e.TwitchPosition(position, twitchTime, TwitchCurve.Shape.OvershootOut); } } } var brushElement = (UIGrid2DBrushElement)SelectionElement; var overlay = (string)(brushElement.Tag); HelpOverlay.ReplaceTop(overlay); } // end of Update();
} // end of Refresh() public override void Update(ref Matrix parentMatrix) { int focus = SelectionIndex.X; bool wasDirty = dirty; // Normally the B button will allow a user to back out of any grid. // For the tool menu though we don't want this to happen so we // clear any input on that button before calling the base Update(). GamePadInput pad = GamePadInput.GetGamePad0(); pad.ButtonB.ClearAllWasPressedState(); base.Update(ref parentMatrix); // Did something change? If so, update the transforms for the tiles. if (wasDirty || focus != SelectionIndex.X) { float twitchTime = Time.FrameRate > 20.0f ? 0.2f : 0.0f; Vector3 negativeX = new Vector3(-1.0f, 1.0f, 1.0f); Vector3 rotation = new Vector3(kTipBackAngle, 0.0f, 0.0f); for (int i = 0; i < ActualDimensions.X; i++) { UIGridElement e = grid[i, 0]; e.Rotation = rotation; int index = focusIndex.X - i; if (index >= 0) { //e.Position = positions[index]; e.TwitchPosition(positions[index], twitchTime, TwitchCurve.Shape.OvershootOut); } else { Vector3 position = positions[-index]; position.X = -position.X; //e.Position = position; e.TwitchPosition(position, twitchTime, TwitchCurve.Shape.OvershootOut); } } } // Update Help Overlay. UIGrid2DTextureElement selection = SelectionElement as UIGrid2DTextureElement; if (active && selection != null) { HelpOverlay.ToolIcon = selection.DiffuseTexture; } HelpOverlay.Pop(); switch ((InGame.UpdateMode)SelectionElement.Tag) { case InGame.UpdateMode.RunSim: HelpOverlay.Push(@"ToolMenuRunSim"); break; case InGame.UpdateMode.MiniHub: HelpOverlay.Push(@"ToolMenuHomeMenu"); break; case InGame.UpdateMode.EditObject: HelpOverlay.Push(@"ToolMenuObjectEdit"); break; case InGame.UpdateMode.TweakObject: HelpOverlay.Push(@"ToolMenuObjectTweak"); break; case InGame.UpdateMode.TerrainFlatten: HelpOverlay.Push(@"ToolMenuTerrainSmoothLevel"); break; case InGame.UpdateMode.TerrainMaterial: HelpOverlay.Push(@"ToolMenuTerrainMaterial"); break; case InGame.UpdateMode.TerrainRoughHill: HelpOverlay.Push(@"ToolMenuTerrainSpikeyHilly"); break; case InGame.UpdateMode.TerrainUpDown: HelpOverlay.Push(@"ToolMenuTerrainUpDown"); break; case InGame.UpdateMode.TerrainWater: HelpOverlay.Push(@"ToolMenuTerrainWater"); break; case InGame.UpdateMode.DeleteObjects: HelpOverlay.Push(@"ToolMenuDeleteObjects"); break; case InGame.UpdateMode.EditWorldParameters: HelpOverlay.Push(@"ToolMenuWorldSettings"); break; default: Debug.Assert(false); break; } } // end of Update();