# HG changeset patch # User Alys Brooks # Date 2021-12-13 05:17:20 # Node ID cbdafdb3816fa41e5ddba76fcb80a615ba36d041 # Parent 0a9dcd0f113ff048f03006541ec98823e0193566 Tweak style. diff --git a/isometric-park-fna/Engines/GameStateEngine.cs b/isometric-park-fna/Engines/GameStateEngine.cs --- a/isometric-park-fna/Engines/GameStateEngine.cs +++ b/isometric-park-fna/Engines/GameStateEngine.cs @@ -31,12 +31,10 @@ SetComponent(entity, new GameStateComponent { isPlaying = message.isPlaying }); } } - } public void startGame() { - } } } diff --git a/isometric-park-fna/Engines/ImGuiWindowBridgeEngine.cs b/isometric-park-fna/Engines/ImGuiWindowBridgeEngine.cs --- a/isometric-park-fna/Engines/ImGuiWindowBridgeEngine.cs +++ b/isometric-park-fna/Engines/ImGuiWindowBridgeEngine.cs @@ -143,7 +143,6 @@ foreach (var message in this.selectedMessages) { SendMessage(message); - // SetComponent(message.Entity, new SelectedComponent { selected = true}); } foreach (var message in this.jumpCameraMessages) { diff --git a/isometric-park-fna/Engines/InputEngine.cs b/isometric-park-fna/Engines/InputEngine.cs --- a/isometric-park-fna/Engines/InputEngine.cs +++ b/isometric-park-fna/Engines/InputEngine.cs @@ -11,8 +11,6 @@ namespace isometricparkfna.Engines { - - [Sends( typeof(ZoomCameraMessage), typeof(MoveCameraMessage), typeof(JumpCameraMessage), @@ -187,7 +185,6 @@ if (keyboardCur.IsKeyDown(Keys.Escape) && keyboardPrev.IsKeyUp(Keys.Escape)) { - // SendMessage(new TogglePauseMessage()); SendMessage(new ToggleWindowTypeMessage {Window = Window.InGameMenu}); SendMessage(new GameRateMessage { paused = true, rate = null }); } @@ -238,7 +235,6 @@ if (mouseCur.RightButton == ButtonState.Pressed && mousePrev.RightButton == ButtonState.Released) { - // this.camera.Jump(this.original_point); SendMessage(new JumpCameraMessage {Movement = original_point}); } diff --git a/isometric-park-fna/Engines/SimulationBridgeEngine.cs b/isometric-park-fna/Engines/SimulationBridgeEngine.cs --- a/isometric-park-fna/Engines/SimulationBridgeEngine.cs +++ b/isometric-park-fna/Engines/SimulationBridgeEngine.cs @@ -42,7 +42,6 @@ } } this.all_squares = squares.ToArray(); - } public int addTick() @@ -65,7 +64,6 @@ }); } - decimal new_contract_amount = 0M; decimal new_enforcement_amount = 0M; decimal new_misc_amount = 0M; @@ -180,7 +178,6 @@ Logging.Info(String.Format("Planted {0} trees, expected {1}, P(destroy)= {2}", added, (expected / 12.0), probability)); } } - } this.ticksToSend = 0; @@ -188,11 +185,8 @@ simulation.enforcement = new_enforcement_amount; simulation.misc = new_misc_amount; - //Move this here? // this.simulation.update(dt); - } - } } diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -4,7 +4,6 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Media; - using System; using System.IO; using System.Reflection; @@ -166,7 +165,6 @@ this.Window.Title = "Isometric Park"; Content.RootDirectory = "Content"; - } protected override void Initialize() @@ -342,7 +340,6 @@ World = WorldBuilder.Build(); - this.output = grammar.Flatten("#greeting#"); var result = grammar.Flatten("#[assistantName:#assistantNames#][friendOfThePark:#assistantNames#][whatever:whatever]vars#"); @@ -418,66 +415,19 @@ Vector2 calculateMousegrid(Vector2 normalizedMousePos) { - //int gridx = (int)(normalizedMousePos.X / Tile.TileSpriteWidth); - //int gridy = (int)(normalizedMousePos.Y / Tile.TileSpriteHeight); Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); Vector2 adjustedMousePos = normalizedMousePos - adjust; float boardx = ((adjustedMousePos.X / Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight)); float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth)); - return new Vector2((int)boardx, (int)boardy); - /* - int gridx = (int)((normalizedMousePos.X + (this.baseOffsetX + 4)) / Tile.TileWidth) ; - int gridy = (int)((normalizedMousePos.Y + (this.baseOffsetX + 4) + (2*baseOffsetY)) / (Tile.TileStepY)); - - - - - int within_gridx = (int)((normalizedMousePos.X) % Tile.TileWidth) - (Tile.TileWidth/2); - int within_gridy = (int)((normalizedMousePos.Y) % Tile.TileHeight) - (Tile.TileHeight / 2); - - int middle_distance = Math.Abs(within_gridx) + Math.Abs(within_gridx); - Vector2 adjustment_vector; - - return new Vector2(gridx, gridy); - if (middle_distance < (Tile.TileWidth / 2)) - { - return new Vector2(gridx, gridy); - } - - else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == 1)) - { - adjustment_vector = new Vector2(-1, -1); - return new Vector2(gridx, gridy) + adjustment_vector; - } - else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == -1)) - { - adjustment_vector = new Vector2(-1, 1); - return new Vector2(gridx, gridy) + adjustment_vector; - } - else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == 1)) - { - adjustment_vector = new Vector2(0, -1); - return new Vector2(gridx, gridy) + adjustment_vector; - } - else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == -1)) - { - adjustment_vector = new Vector2(0, 1); - return new Vector2(gridx, gridy) + adjustment_vector; - } - else { - return new Vector2(gridx, gridy); - } - */ } protected override void Update(GameTime gameTime) { - Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); @@ -491,7 +441,7 @@ MouseState mouseCur = Mouse.GetState(); #region input - // + #region misc_keys #if DEBUG if (keyboardCur.IsKeyDown(Keys.OemBackslash) @@ -501,10 +451,6 @@ sound.Play(volume, pitch, pan); } #endif - // if (keyboardCur.IsKeyDown(Keys.V) && keyboardPrev.IsKeyUp(Keys.V)) - // { - // debugWindow.setMonoFont(debugWindow.addFont("Roboto", 25, false)); - // } #endregion misc_keys #endregion input @@ -519,12 +465,6 @@ this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice))); - //int gridx = (int)((this.original_point.X-baseOffsetX) / Tile.TileStepX); - /* int gridx = (int)(this.original_point.Y / Tile.TileHeight + this.original_point.X / Tile.TileWidth); */ - //int gridy = (int)((this.original_point.Y-baseOffsetY) / (Tile.TileStepY*2)); - /* int gridy = (int)(this.original_point.Y / Tile.TileHeight - this.original_point.X / Tile.TileWidth); */ - - //this.mouseGrid = new Vector2(gridx, gridy); this.mouseGrid = this.calculateMousegrid(this.original_point); elapsedTime += gameTime.ElapsedGameTime; @@ -728,9 +668,6 @@ Tile.OutlineSquare(batch, 5, 1, Color.Green, 2); Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2); Tile.OutlineSquare(batch, 9, 1, Color.Orange, 3); - // Tile.OutlineSquare2(batch, 12, 1, Color.Orange, 2); - - //Tile.drawEdge(batch, new Edge {Start=new Vector2(14, 1), End= new Vector2(15, 1)}, Color.Orange); //donut Tile.DrawOutlinedSquares(batch, new Vector2[] {new Vector2(19, 1), new Vector2(19, 2), new Vector2(20, 1), new Vector2(21, 1), @@ -747,11 +684,8 @@ Quad.FillSquare2(batch, 8, 7, Color.Teal, .125f, 0.79f); #endif - - #endregion draw_cursor - #region draw_trees if (this.showTrees) { for (int i = 0; i < this.simulation.map.MapHeight; i++) @@ -797,13 +731,15 @@ null, null); - if (MathUtils.BetweenExclusive(this.mouseGrid.X, 0, this.squaresAcross) && MathUtils.BetweenExclusive(this.mouseGrid.Y, 0, this.squaresAcross)) + if (MathUtils.BetweenExclusive(this.mouseGrid.X, 0, this.squaresAcross) + && MathUtils.BetweenExclusive(this.mouseGrid.Y, 0, this.squaresAcross)) { has_tree = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].hasTree; } String status_left = ""; - if (MathUtils.BetweenExclusive(this.mouseGrid.X, -1, this.simulation.map.MapWidth) && MathUtils.BetweenExclusive(this.mouseGrid.Y, -1, this.simulation.map.MapHeight)) + if (MathUtils.BetweenExclusive(this.mouseGrid.X, -1, this.simulation.map.MapWidth) + && MathUtils.BetweenExclusive(this.mouseGrid.Y, -1, this.simulation.map.MapHeight)) { status_left = String.Format("{0:},{1:} {2} ({3})", this.mouseGrid.X, this.mouseGrid.Y, this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].status, @@ -830,10 +766,8 @@ batch.DrawString(monoFont, status_left, new Vector2(1, top), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); batch.DrawString(monoFont, header_left, new Vector2(1, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); batch.DrawString(monoFont, header_middle, new Vector2(middle_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); - // batch.DrawString(monoFont, header_right, new Vector2(right_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); #endregion draw_header - #region budget if (this.showBudget) @@ -846,8 +780,6 @@ batch.End(); #region window - - // bool quit = false; Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left); if (quit) { @@ -902,14 +834,15 @@ past_fps.Enqueue(this.frameRate); /* - if (this.frameRate > 60.0) - { - Logging.Warning(String.Format("Framerate is higher than limit: {0}", this.frameRate)); - } - if (this.frameRate < 30.0) - { - Logging.Warning(String.Format("Framerate is lower than desired: {0}", this.frameRate)); - }*/ + if (this.frameRate > 60.0) + { + Logging.Warning(String.Format("Framerate is higher than limit: {0}", this.frameRate)); + } + if (this.frameRate < 30.0) + { + Logging.Warning(String.Format("Framerate is lower than desired: {0}", this.frameRate)); + } + */ } /* if (this.frameRate > 120.0) @@ -977,7 +910,6 @@ base.Draw(gameTime); } - public void setResolution(Vector2 newResolution, bool fullscreen) { FNAGame.width = (int)newResolution.X; @@ -988,5 +920,4 @@ this.gdm.IsFullScreen = fullscreen; this.gdm.ApplyChanges(); } - } diff --git a/isometric-park-fna/Simulation.cs b/isometric-park-fna/Simulation.cs --- a/isometric-park-fna/Simulation.cs +++ b/isometric-park-fna/Simulation.cs @@ -63,6 +63,8 @@ public const int MAX_TREES_TO_PLANT = 25; public const int MAX_TREES_TO_CLEAR = 25; + public SimulationBridgeEngine BridgeEngine { get; private set; } + public decimal Subsidy { get; set; /* { @@ -97,8 +99,6 @@ private List budgets; - public SimulationBridgeEngine BridgeEngine { get; private set; } - // public SimulationBridgeEngine bridgeEngine {get;} public decimal contracts; public decimal enforcement; public decimal misc; @@ -133,7 +133,6 @@ } } - private Grammar grammar; private List sourceNewsItems; public List latestNewsItems; @@ -242,8 +241,6 @@ private void advanceSimulation() { - - var oldSeason = this.Season; this.DateTime = this.DateTime.AddMonths(1); this.Subsidy = Math.Max(0, this.Subsidy + this.SubsidyDelta); @@ -252,9 +249,6 @@ this.BridgeEngine.addTick(); - - - foreach (Cell cell in this.map.iterate_cells()) { if (random.NextDouble() > SPONTANEOUS_NEW_TREE_CHANCE) @@ -296,7 +290,6 @@ } } - int trees_to_clear = this.tree_clearing; foreach (Cell cell in this.map.iterate_cells_with_neighbors(7).Where(c => c.hasTree)) { @@ -320,7 +313,6 @@ misc = this.misc }; - newBudget = this.applyBudget(newBudget); ; this.budgets.Add(newBudget); @@ -358,8 +350,6 @@ this.grammar = grammar; this.updateNews(); - - } public void update(TimeSpan deltaTime) diff --git a/isometric-park-fna/UI/OptionsWindow.cs b/isometric-park-fna/UI/OptionsWindow.cs --- a/isometric-park-fna/UI/OptionsWindow.cs +++ b/isometric-park-fna/UI/OptionsWindow.cs @@ -122,7 +122,7 @@ ImGui.DragFloat("##Scale", ref io.FontGlobalScale, 0.005f, 0.2f, 5.0f, "%.2f"); ImGui.SameLine(); - Widgets.LabelTooltip("(?)", "Adjust this if increasing font size isn't enough."); + Widgets.LabelTooltip("(?)", "Adjust this if increasing font size isn't enough."); ImGui.Checkbox("Fullscreen", ref newFullscreen); @@ -149,7 +149,7 @@ ImGui.EndCombo(); } ImGui.SameLine(); - Widgets.LabelTooltip("(?)", "Removes profanity from the game, if you must."); + Widgets.LabelTooltip("(?)", "Removes profanity from the game, if you must."); ImGui.Separator();