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