Description:
Tweak style.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r481:cbdafdb3816f -

@@ -31,12 +31,10
31 SetComponent(entity, new GameStateComponent { isPlaying = message.isPlaying });
31 SetComponent(entity, new GameStateComponent { isPlaying = message.isPlaying });
32 }
32 }
33 }
33 }
34
35 }
34 }
36
35
37 public void startGame()
36 public void startGame()
38 {
37 {
39
40 }
38 }
41 }
39 }
42 }
40 }
@@ -143,7 +143,6
143 foreach (var message in this.selectedMessages)
143 foreach (var message in this.selectedMessages)
144 {
144 {
145 SendMessage(message);
145 SendMessage(message);
146 // SetComponent<SelectedComponent>(message.Entity, new SelectedComponent { selected = true});
147 }
146 }
148 foreach (var message in this.jumpCameraMessages)
147 foreach (var message in this.jumpCameraMessages)
149 {
148 {
@@ -11,8 +11,6
11
11
12 namespace isometricparkfna.Engines {
12 namespace isometricparkfna.Engines {
13
13
14
15
16 [Sends( typeof(ZoomCameraMessage),
14 [Sends( typeof(ZoomCameraMessage),
17 typeof(MoveCameraMessage),
15 typeof(MoveCameraMessage),
18 typeof(JumpCameraMessage),
16 typeof(JumpCameraMessage),
@@ -187,7 +185,6
187
185
188 if (keyboardCur.IsKeyDown(Keys.Escape) && keyboardPrev.IsKeyUp(Keys.Escape))
186 if (keyboardCur.IsKeyDown(Keys.Escape) && keyboardPrev.IsKeyUp(Keys.Escape))
189 {
187 {
190 // SendMessage(new TogglePauseMessage());
191 SendMessage(new ToggleWindowTypeMessage {Window = Window.InGameMenu});
188 SendMessage(new ToggleWindowTypeMessage {Window = Window.InGameMenu});
192 SendMessage(new GameRateMessage { paused = true, rate = null });
189 SendMessage(new GameRateMessage { paused = true, rate = null });
193 }
190 }
@@ -238,7 +235,6
238
235
239 if (mouseCur.RightButton == ButtonState.Pressed && mousePrev.RightButton == ButtonState.Released)
236 if (mouseCur.RightButton == ButtonState.Pressed && mousePrev.RightButton == ButtonState.Released)
240 {
237 {
241 // this.camera.Jump(this.original_point);
242 SendMessage(new JumpCameraMessage {Movement = original_point});
238 SendMessage(new JumpCameraMessage {Movement = original_point});
243 }
239 }
244
240
@@ -42,7 +42,6
42 }
42 }
43 }
43 }
44 this.all_squares = squares.ToArray();
44 this.all_squares = squares.ToArray();
45
46 }
45 }
47
46
48 public int addTick()
47 public int addTick()
@@ -65,7 +64,6
65 });
64 });
66 }
65 }
67
66
68
69 decimal new_contract_amount = 0M;
67 decimal new_contract_amount = 0M;
70 decimal new_enforcement_amount = 0M;
68 decimal new_enforcement_amount = 0M;
71 decimal new_misc_amount = 0M;
69 decimal new_misc_amount = 0M;
@@ -180,7 +178,6
180 Logging.Info(String.Format("Planted {0} trees, expected {1}, P(destroy)= {2}", added, (expected / 12.0), probability));
178 Logging.Info(String.Format("Planted {0} trees, expected {1}, P(destroy)= {2}", added, (expected / 12.0), probability));
181 }
179 }
182 }
180 }
183
184 }
181 }
185 this.ticksToSend = 0;
182 this.ticksToSend = 0;
186
183
@@ -188,11 +185,8
188 simulation.enforcement = new_enforcement_amount;
185 simulation.enforcement = new_enforcement_amount;
189 simulation.misc = new_misc_amount;
186 simulation.misc = new_misc_amount;
190
187
191
192 //Move this here?
188 //Move this here?
193 // this.simulation.update(dt);
189 // this.simulation.update(dt);
194
195 }
190 }
196
197 }
191 }
198 }
192 }
@@ -4,7 +4,6
4 using Microsoft.Xna.Framework.Graphics;
4 using Microsoft.Xna.Framework.Graphics;
5 using Microsoft.Xna.Framework.Media;
5 using Microsoft.Xna.Framework.Media;
6
6
7
8 using System;
7 using System;
9 using System.IO;
8 using System.IO;
10 using System.Reflection;
9 using System.Reflection;
@@ -166,7 +165,6
166 this.Window.Title = "Isometric Park";
165 this.Window.Title = "Isometric Park";
167
166
168 Content.RootDirectory = "Content";
167 Content.RootDirectory = "Content";
169
170 }
168 }
171
169
172 protected override void Initialize()
170 protected override void Initialize()
@@ -342,7 +340,6
342
340
343 World = WorldBuilder.Build();
341 World = WorldBuilder.Build();
344
342
345
346 this.output = grammar.Flatten("#greeting#");
343 this.output = grammar.Flatten("#greeting#");
347 var result = grammar.Flatten("#[assistantName:#assistantNames#][friendOfThePark:#assistantNames#][whatever:whatever]vars#");
344 var result = grammar.Flatten("#[assistantName:#assistantNames#][friendOfThePark:#assistantNames#][whatever:whatever]vars#");
348
345
@@ -418,66 +415,19
418
415
419 Vector2 calculateMousegrid(Vector2 normalizedMousePos)
416 Vector2 calculateMousegrid(Vector2 normalizedMousePos)
420 {
417 {
421 //int gridx = (int)(normalizedMousePos.X / Tile.TileSpriteWidth);
422 //int gridy = (int)(normalizedMousePos.Y / Tile.TileSpriteHeight);
423 Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight);
418 Vector2 adjust = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight);
424 Vector2 adjustedMousePos = normalizedMousePos - adjust;
419 Vector2 adjustedMousePos = normalizedMousePos - adjust;
425
420
426 float boardx = ((adjustedMousePos.X / Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight));
421 float boardx = ((adjustedMousePos.X / Tile.TileSpriteWidth) + (adjustedMousePos.Y / Tile.TileSpriteHeight));
427 float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth));
422 float boardy = ((adjustedMousePos.Y / Tile.TileSpriteHeight) - (adjustedMousePos.X / Tile.TileSpriteWidth));
428
423
429
430 return new Vector2((int)boardx, (int)boardy);
424 return new Vector2((int)boardx, (int)boardy);
431 /*
432 int gridx = (int)((normalizedMousePos.X + (this.baseOffsetX + 4)) / Tile.TileWidth) ;
433 int gridy = (int)((normalizedMousePos.Y + (this.baseOffsetX + 4) + (2*baseOffsetY)) / (Tile.TileStepY));
434
435
436
437
438 int within_gridx = (int)((normalizedMousePos.X) % Tile.TileWidth) - (Tile.TileWidth/2);
439 int within_gridy = (int)((normalizedMousePos.Y) % Tile.TileHeight) - (Tile.TileHeight / 2);
440
441 int middle_distance = Math.Abs(within_gridx) + Math.Abs(within_gridx);
442 Vector2 adjustment_vector;
443
444 return new Vector2(gridx, gridy);
445 if (middle_distance < (Tile.TileWidth / 2))
446 {
447 return new Vector2(gridx, gridy);
448 }
449
450 else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == 1))
451 {
452 adjustment_vector = new Vector2(-1, -1);
453 return new Vector2(gridx, gridy) + adjustment_vector;
454 }
455 else if ((Math.Sign(within_gridx) == -1) && (Math.Sign(within_gridy) == -1))
456 {
457 adjustment_vector = new Vector2(-1, 1);
458 return new Vector2(gridx, gridy) + adjustment_vector;
459 }
460 else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == 1))
461 {
462 adjustment_vector = new Vector2(0, -1);
463 return new Vector2(gridx, gridy) + adjustment_vector;
464 }
465 else if ((Math.Sign(within_gridx) == 1) && (Math.Sign(within_gridy) == -1))
466 {
467 adjustment_vector = new Vector2(0, 1);
468 return new Vector2(gridx, gridy) + adjustment_vector;
469 }
470 else {
471 return new Vector2(gridx, gridy);
472 }
473 */
474 }
425 }
475
426
476
427
477
428
478 protected override void Update(GameTime gameTime)
429 protected override void Update(GameTime gameTime)
479 {
430 {
480
481 Stopwatch stopWatch = new Stopwatch();
431 Stopwatch stopWatch = new Stopwatch();
482 stopWatch.Start();
432 stopWatch.Start();
483
433
@@ -491,7 +441,7
491 MouseState mouseCur = Mouse.GetState();
441 MouseState mouseCur = Mouse.GetState();
492
442
493 #region input
443 #region input
494 //
444
495 #region misc_keys
445 #region misc_keys
496 #if DEBUG
446 #if DEBUG
497 if (keyboardCur.IsKeyDown(Keys.OemBackslash)
447 if (keyboardCur.IsKeyDown(Keys.OemBackslash)
@@ -501,10 +451,6
501 sound.Play(volume, pitch, pan);
451 sound.Play(volume, pitch, pan);
502 }
452 }
503 #endif
453 #endif
504 // if (keyboardCur.IsKeyDown(Keys.V) && keyboardPrev.IsKeyUp(Keys.V))
505 // {
506 // debugWindow.setMonoFont(debugWindow.addFont("Roboto", 25, false));
507 // }
508 #endregion misc_keys
454 #endregion misc_keys
509 #endregion input
455 #endregion input
510
456
@@ -519,12 +465,6
519
465
520 this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice)));
466 this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice)));
521
467
522 //int gridx = (int)((this.original_point.X-baseOffsetX) / Tile.TileStepX);
523 /* int gridx = (int)(this.original_point.Y / Tile.TileHeight + this.original_point.X / Tile.TileWidth); */
524 //int gridy = (int)((this.original_point.Y-baseOffsetY) / (Tile.TileStepY*2));
525 /* int gridy = (int)(this.original_point.Y / Tile.TileHeight - this.original_point.X / Tile.TileWidth); */
526
527 //this.mouseGrid = new Vector2(gridx, gridy);
528 this.mouseGrid = this.calculateMousegrid(this.original_point);
468 this.mouseGrid = this.calculateMousegrid(this.original_point);
529
469
530 elapsedTime += gameTime.ElapsedGameTime;
470 elapsedTime += gameTime.ElapsedGameTime;
@@ -728,9 +668,6
728 Tile.OutlineSquare(batch, 5, 1, Color.Green, 2);
668 Tile.OutlineSquare(batch, 5, 1, Color.Green, 2);
729 Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2);
669 Tile.OutlineSquare(batch, 7, 1, Color.Orange, 2);
730 Tile.OutlineSquare(batch, 9, 1, Color.Orange, 3);
670 Tile.OutlineSquare(batch, 9, 1, Color.Orange, 3);
731 // Tile.OutlineSquare2(batch, 12, 1, Color.Orange, 2);
732
733 //Tile.drawEdge(batch, new Edge {Start=new Vector2(14, 1), End= new Vector2(15, 1)}, Color.Orange);
734
671
735 //donut
672 //donut
736 Tile.DrawOutlinedSquares(batch, new Vector2[] {new Vector2(19, 1), new Vector2(19, 2), new Vector2(20, 1), new Vector2(21, 1),
673 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
747 Quad.FillSquare2(batch, 8, 7, Color.Teal, .125f, 0.79f);
684 Quad.FillSquare2(batch, 8, 7, Color.Teal, .125f, 0.79f);
748 #endif
685 #endif
749
686
750
751
752 #endregion draw_cursor
687 #endregion draw_cursor
753
688
754
755 #region draw_trees
689 #region draw_trees
756 if (this.showTrees) {
690 if (this.showTrees) {
757 for (int i = 0; i < this.simulation.map.MapHeight; i++)
691 for (int i = 0; i < this.simulation.map.MapHeight; i++)
@@ -797,13 +731,15
797 null,
731 null,
798 null);
732 null);
799
733
800 if (MathUtils.BetweenExclusive(this.mouseGrid.X, 0, this.squaresAcross) && MathUtils.BetweenExclusive(this.mouseGrid.Y, 0, this.squaresAcross))
734 if (MathUtils.BetweenExclusive(this.mouseGrid.X, 0, this.squaresAcross)
735 && MathUtils.BetweenExclusive(this.mouseGrid.Y, 0, this.squaresAcross))
801 {
736 {
802 has_tree = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].hasTree;
737 has_tree = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].hasTree;
803 }
738 }
804
739
805 String status_left = "";
740 String status_left = "";
806 if (MathUtils.BetweenExclusive(this.mouseGrid.X, -1, this.simulation.map.MapWidth) && MathUtils.BetweenExclusive(this.mouseGrid.Y, -1, this.simulation.map.MapHeight))
741 if (MathUtils.BetweenExclusive(this.mouseGrid.X, -1, this.simulation.map.MapWidth)
742 && MathUtils.BetweenExclusive(this.mouseGrid.Y, -1, this.simulation.map.MapHeight))
807 {
743 {
808 status_left = String.Format("{0:},{1:} {2} ({3})", this.mouseGrid.X, this.mouseGrid.Y,
744 status_left = String.Format("{0:},{1:} {2} ({3})", this.mouseGrid.X, this.mouseGrid.Y,
809 this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].status,
745 this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].status,
@@ -830,10 +766,8
830 batch.DrawString(monoFont, status_left, new Vector2(1, top), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
766 batch.DrawString(monoFont, status_left, new Vector2(1, top), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
831 batch.DrawString(monoFont, header_left, new Vector2(1, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
767 batch.DrawString(monoFont, header_left, new Vector2(1, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
832 batch.DrawString(monoFont, header_middle, new Vector2(middle_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
768 batch.DrawString(monoFont, header_middle, new Vector2(middle_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
833 // batch.DrawString(monoFont, header_right, new Vector2(right_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
834 #endregion draw_header
769 #endregion draw_header
835
770
836
837 #region budget
771 #region budget
838
772
839 if (this.showBudget)
773 if (this.showBudget)
@@ -846,8 +780,6
846 batch.End();
780 batch.End();
847
781
848 #region window
782 #region window
849
850 // bool quit = false;
851 Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left);
783 Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left);
852
784
853 if (quit) {
785 if (quit) {
@@ -902,14 +834,15
902 past_fps.Enqueue(this.frameRate);
834 past_fps.Enqueue(this.frameRate);
903
835
904 /*
836 /*
905 if (this.frameRate > 60.0)
837 if (this.frameRate > 60.0)
906 {
838 {
907 Logging.Warning(String.Format("Framerate is higher than limit: {0}", this.frameRate));
839 Logging.Warning(String.Format("Framerate is higher than limit: {0}", this.frameRate));
908 }
840 }
909 if (this.frameRate < 30.0)
841 if (this.frameRate < 30.0)
910 {
842 {
911 Logging.Warning(String.Format("Framerate is lower than desired: {0}", this.frameRate));
843 Logging.Warning(String.Format("Framerate is lower than desired: {0}", this.frameRate));
912 }*/
844 }
845 */
913 }
846 }
914 /*
847 /*
915 if (this.frameRate > 120.0)
848 if (this.frameRate > 120.0)
@@ -977,7 +910,6
977 base.Draw(gameTime);
910 base.Draw(gameTime);
978 }
911 }
979
912
980
981 public void setResolution(Vector2 newResolution, bool fullscreen)
913 public void setResolution(Vector2 newResolution, bool fullscreen)
982 {
914 {
983 FNAGame.width = (int)newResolution.X;
915 FNAGame.width = (int)newResolution.X;
@@ -988,5 +920,4
988 this.gdm.IsFullScreen = fullscreen;
920 this.gdm.IsFullScreen = fullscreen;
989 this.gdm.ApplyChanges();
921 this.gdm.ApplyChanges();
990 }
922 }
991
992 }
923 }
@@ -63,6 +63,8
63 public const int MAX_TREES_TO_PLANT = 25;
63 public const int MAX_TREES_TO_PLANT = 25;
64 public const int MAX_TREES_TO_CLEAR = 25;
64 public const int MAX_TREES_TO_CLEAR = 25;
65
65
66 public SimulationBridgeEngine BridgeEngine { get; private set; }
67
66 public decimal Subsidy {
68 public decimal Subsidy {
67 get; set;
69 get; set;
68 /* {
70 /* {
@@ -97,8 +99,6
97
99
98 private List<Budget> budgets;
100 private List<Budget> budgets;
99
101
100 public SimulationBridgeEngine BridgeEngine { get; private set; }
101 // public SimulationBridgeEngine bridgeEngine {get;}
102 public decimal contracts;
102 public decimal contracts;
103 public decimal enforcement;
103 public decimal enforcement;
104 public decimal misc;
104 public decimal misc;
@@ -133,7 +133,6
133 }
133 }
134 }
134 }
135
135
136
137 private Grammar grammar;
136 private Grammar grammar;
138 private List<NewsItem> sourceNewsItems;
137 private List<NewsItem> sourceNewsItems;
139 public List<NewsItem> latestNewsItems;
138 public List<NewsItem> latestNewsItems;
@@ -242,8 +241,6
242
241
243 private void advanceSimulation()
242 private void advanceSimulation()
244 {
243 {
245
246
247 var oldSeason = this.Season;
244 var oldSeason = this.Season;
248 this.DateTime = this.DateTime.AddMonths(1);
245 this.DateTime = this.DateTime.AddMonths(1);
249 this.Subsidy = Math.Max(0, this.Subsidy + this.SubsidyDelta);
246 this.Subsidy = Math.Max(0, this.Subsidy + this.SubsidyDelta);
@@ -252,9 +249,6
252
249
253 this.BridgeEngine.addTick();
250 this.BridgeEngine.addTick();
254
251
255
256
257
258 foreach (Cell cell in this.map.iterate_cells())
252 foreach (Cell cell in this.map.iterate_cells())
259 {
253 {
260 if (random.NextDouble() > SPONTANEOUS_NEW_TREE_CHANCE)
254 if (random.NextDouble() > SPONTANEOUS_NEW_TREE_CHANCE)
@@ -296,7 +290,6
296 }
290 }
297 }
291 }
298
292
299
300 int trees_to_clear = this.tree_clearing;
293 int trees_to_clear = this.tree_clearing;
301 foreach (Cell cell in this.map.iterate_cells_with_neighbors(7).Where(c => c.hasTree))
294 foreach (Cell cell in this.map.iterate_cells_with_neighbors(7).Where(c => c.hasTree))
302 {
295 {
@@ -320,7 +313,6
320 misc = this.misc
313 misc = this.misc
321 };
314 };
322
315
323
324 newBudget = this.applyBudget(newBudget); ;
316 newBudget = this.applyBudget(newBudget); ;
325 this.budgets.Add(newBudget);
317 this.budgets.Add(newBudget);
326
318
@@ -358,8 +350,6
358 this.grammar = grammar;
350 this.grammar = grammar;
359
351
360 this.updateNews();
352 this.updateNews();
361
362
363 }
353 }
364
354
365 public void update(TimeSpan deltaTime)
355 public void update(TimeSpan deltaTime)
@@ -122,7 +122,7
122 ImGui.DragFloat("##Scale", ref io.FontGlobalScale, 0.005f, 0.2f, 5.0f, "%.2f");
122 ImGui.DragFloat("##Scale", ref io.FontGlobalScale, 0.005f, 0.2f, 5.0f, "%.2f");
123
123
124 ImGui.SameLine();
124 ImGui.SameLine();
125 Widgets.LabelTooltip("(?)", "Adjust this if increasing font size isn't enough.");
125 Widgets.LabelTooltip("(?)", "Adjust this if increasing font size isn't enough.");
126
126
127 ImGui.Checkbox("Fullscreen", ref newFullscreen);
127 ImGui.Checkbox("Fullscreen", ref newFullscreen);
128
128
@@ -149,7 +149,7
149 ImGui.EndCombo();
149 ImGui.EndCombo();
150 }
150 }
151 ImGui.SameLine();
151 ImGui.SameLine();
152 Widgets.LabelTooltip("(?)", "Removes profanity from the game, if you must.");
152 Widgets.LabelTooltip("(?)", "Removes profanity from the game, if you must.");
153
153
154 ImGui.Separator();
154 ImGui.Separator();
155
155
You need to be logged in to leave comments. Login now