Description:
Many small tweaks.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -155,7 +155,7 | |||||
|
155 | var odds_to_try = new[] {0.5f, 0.75f, 1.0f, 0.5f, 0.75f, 1.0f}; |
|
155 | var odds_to_try = new[] {0.5f, 0.75f, 1.0f, 0.5f, 0.75f, 1.0f}; |
|
156 | var retry_location = new[] {false, false, false, true, false, false}; |
|
156 | var retry_location = new[] {false, false, false, true, false, false}; |
|
157 | Debug.Assert(odds_to_try.Count() == retry_location.Count()); |
|
157 | Debug.Assert(odds_to_try.Count() == retry_location.Count()); |
|
158 | // foreach( double odds in odds_to_try ) |
|
158 | |
|
159 | for(int i = 0; i < odds_to_try.Count(); i++) |
|
159 | for(int i = 0; i < odds_to_try.Count(); i++) |
|
160 | { |
|
160 | { |
|
161 |
|
161 | ||
@@ -204,7 +204,6 | |||||
|
204 | _ => random_generator.Next(CONTRACT_MINIMUM, CONTRACT_MAXIMUM) |
|
204 | _ => random_generator.Next(CONTRACT_MINIMUM, CONTRACT_MAXIMUM) |
|
205 | }; |
|
205 | }; |
|
206 |
|
206 | ||
|
207 | // AddComponent |
|
||
|
208 | AddComponent(contract, new AreaComponent { squares = squares }); |
|
207 | AddComponent(contract, new AreaComponent { squares = squares }); |
|
209 | AddComponent(contract, new NameAndDescriptionComponent { DisplayName = this.grammar.Flatten(message.name) }); |
|
208 | AddComponent(contract, new NameAndDescriptionComponent { DisplayName = this.grammar.Flatten(message.name) }); |
|
210 | AddComponent(contract, new SelectedComponent { selected = false }); |
|
209 | AddComponent(contract, new SelectedComponent { selected = false }); |
@@ -21,11 +21,9 | |||||
|
21 | Family, |
|
21 | Family, |
|
22 | LargeCorporation, |
|
22 | LargeCorporation, |
|
23 | Cooperative |
|
23 | Cooperative |
|
24 |
|
|||
|
25 | } |
|
24 | } |
|
26 |
|
25 | ||
|
27 | [Receives(typeof(SpawnOrganizationtMessage))] |
|
26 | [Receives(typeof(SpawnOrganizationtMessage))] |
|
28 | //[Reads(typeof(AreaComponent), typeof(ContractStatusComponent))] |
|
||
|
29 | class OrganizationSpawner : Spawner<SpawnOrganizationtMessage> |
|
27 | class OrganizationSpawner : Spawner<SpawnOrganizationtMessage> |
|
30 | { |
|
28 | { |
|
31 |
|
29 | ||
@@ -45,7 +43,6 | |||||
|
45 | { |
|
43 | { |
|
46 |
|
44 | ||
|
47 | var organization = CreateEntity(); |
|
45 | var organization = CreateEntity(); |
|
48 | // var image_index = random_generator.Next(1, 7); |
|
||
|
49 | var image_index = message.type switch { |
|
46 | var image_index = message.type switch { |
|
50 | OrganizationType.Cooperative => MathUtils.NextSample(random_generator, new[] {1, 2, 3, 11, 12, 13, 15}), |
|
47 | OrganizationType.Cooperative => MathUtils.NextSample(random_generator, new[] {1, 2, 3, 11, 12, 13, 15}), |
|
51 | OrganizationType.LargeCorporation => MathUtils.NextSample(random_generator, new[] {0, 6, 7, 9, 10}), |
|
48 | OrganizationType.LargeCorporation => MathUtils.NextSample(random_generator, new[] {0, 6, 7, 9, 10}), |
@@ -54,9 +51,7 | |||||
|
54 |
|
51 | ||
|
55 | }; |
|
52 | }; |
|
56 | Logging.Success("Generated image index."); |
|
53 | Logging.Success("Generated image index."); |
|
57 |
|
|||
|
58 |
|
54 | ||
|
59 |
|
|||
|
60 | var name = message.name != null ? message.name : "#logging_company.capitalizeAll#"; |
|
55 | var name = message.name != null ? message.name : "#logging_company.capitalizeAll#"; |
|
61 | var description = message.description != null ? message.description : ""; |
|
56 | var description = message.description != null ? message.description : ""; |
|
62 |
|
57 | ||
@@ -66,8 +61,6 | |||||
|
66 | AddComponent(organization, new OffersContractsComponent { }); |
|
61 | AddComponent(organization, new OffersContractsComponent { }); |
|
67 | AddComponent(organization, new OrganizationTypeComponent { type = message.type }); |
|
62 | AddComponent(organization, new OrganizationTypeComponent { type = message.type }); |
|
68 |
|
63 | ||
|
69 |
|
|||
|
70 | } |
|
64 | } |
|
71 |
|
|||
|
72 | } |
|
65 | } |
|
73 | } |
|
66 | } |
@@ -113,7 +113,6 | |||||
|
113 |
|
113 | ||
|
114 | private FNAGame() |
|
114 | private FNAGame() |
|
115 | { |
|
115 | { |
|
116 | //this.device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.) |
|
||
|
117 |
|
116 | ||
|
118 | #if DEBUG |
|
117 | #if DEBUG |
|
119 | foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) |
|
118 | foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) |
@@ -204,10 +203,6 | |||||
|
204 |
|
203 | ||
|
205 | this.grammar = new TraceryNet.Grammar(json2); |
|
204 | this.grammar = new TraceryNet.Grammar(json2); |
|
206 |
|
205 | ||
|
207 | //let's see if this works: |
|
||
|
208 | // WorldBuilder = new WorldBuilder(); |
|
||
|
209 | var dummy_entity = WorldBuilder.CreateEntity(); |
|
||
|
210 |
|
|||
|
211 |
|
206 | ||
|
212 | WorldBuilder.AddEngine(new InputEngine(Menu.MENU_BAR_HEIGHT, FNAGame.width, FNAGame.height)); |
|
207 | WorldBuilder.AddEngine(new InputEngine(Menu.MENU_BAR_HEIGHT, FNAGame.width, FNAGame.height)); |
|
213 | WorldBuilder.AddEngine(new UIEngine()); |
|
208 | WorldBuilder.AddEngine(new UIEngine()); |
@@ -282,12 +277,10 | |||||
|
282 | WorldBuilder.SendMessage(new SpawnContractMessage |
|
277 | WorldBuilder.SendMessage(new SpawnContractMessage |
|
283 | { |
|
278 | { |
|
284 | squares = squares, |
|
279 | squares = squares, |
|
285 | //new[] {new Vector2(4,4), new Vector2(5,4)}, |
|
||
|
286 | name = "Northshore Logging" |
|
280 | name = "Northshore Logging" |
|
287 | }); |
|
281 | }); |
|
288 | WorldBuilder.SendMessage(new SpawnContractMessage |
|
282 | WorldBuilder.SendMessage(new SpawnContractMessage |
|
289 | { |
|
283 | { |
|
290 | // squares = squares2, //new[] { new Vector2(6, 6), new Vector2(6, 7), new Vector2(6, 8) }, |
|
||
|
291 | name = "Aeres Maximalis Ltd." |
|
284 | name = "Aeres Maximalis Ltd." |
|
292 | }); |
|
285 | }); |
|
293 | World = WorldBuilder.Build(); |
|
286 | World = WorldBuilder.Build(); |
@@ -308,8 +301,6 | |||||
|
308 | ); |
|
301 | ); |
|
309 |
|
302 | ||
|
310 |
|
303 | ||
|
311 |
|
|||
|
312 |
|
|||
|
313 | this.output = grammar.Flatten("#greeting#"); |
|
304 | this.output = grammar.Flatten("#greeting#"); |
|
314 | var result = grammar.Flatten("#[assistantName:#assistantNames#][whatever:whatever]vars#"); |
|
305 | var result = grammar.Flatten("#[assistantName:#assistantNames#][whatever:whatever]vars#"); |
|
315 |
|
306 | ||
@@ -565,43 +556,6 | |||||
|
565 | null, |
|
556 | null, |
|
566 | camera.get_transformation(GraphicsDevice)); |
|
557 | camera.get_transformation(GraphicsDevice)); |
|
567 |
|
558 | ||
|
568 | //New tile stuff |
|
||
|
569 | /* |
|
||
|
570 | Vector2 firstSquare = Vector2.Zero; |
|
||
|
571 | int firstX = (int)firstSquare.X; |
|
||
|
572 | int firstY = (int)firstSquare.Y; |
|
||
|
573 |
|
|||
|
574 | Vector2 squareOffset = Vector2.Zero; |
|
||
|
575 |
|
|||
|
576 | int offsetX = (int)squareOffset.X; |
|
||
|
577 | int offsetY = (int)squareOffset.Y; |
|
||
|
578 |
|
|||
|
579 |
|
|||
|
580 | for (int y = 0; y < this.squaresDown; y++) |
|
||
|
581 | { |
|
||
|
582 | int rowOffset = 0; |
|
||
|
583 | if ((firstY + y) % 2 == 1) |
|
||
|
584 | rowOffset = Tile.OddRowXOffset; |
|
||
|
585 |
|
|||
|
586 | for (int x = 0; x < this.squaresAcross; x++) { |
|
||
|
587 |
|
|||
|
588 |
|
|||
|
589 | batch.Draw( |
|
||
|
590 | Tile.TileSetTexture, |
|
||
|
591 | new Rectangle( |
|
||
|
592 | ((x * Tile.TileStepX) - offsetX + rowOffset + baseOffsetX), |
|
||
|
593 | ((y * Tile.TileStepY) - offsetY + baseOffsetY), |
|
||
|
594 | Tile.TileWidth, Tile.TileHeight), |
|
||
|
595 | Tile.GetSourceRectangle(1), |
|
||
|
596 | Color.White, |
|
||
|
597 | 0.0f, |
|
||
|
598 | Vector2.Zero, |
|
||
|
599 | SpriteEffects.None, |
|
||
|
600 | 0.9f); |
|
||
|
601 |
|
|||
|
602 |
|
|||
|
603 | } |
|
||
|
604 | }*/ |
|
||
|
605 |
|
559 | ||
|
606 | #region draw_tiles |
|
560 | #region draw_tiles |
|
607 | //reset |
|
561 | //reset |
@@ -757,26 +711,7 | |||||
|
757 |
|
711 | ||
|
758 |
|
712 | ||
|
759 | #endregion draw_cursor |
|
713 | #endregion draw_cursor |
|
760 | /* |
|
||
|
761 |
|
714 | ||
|
762 | for (int i = 0; i< 80; i++) |
|
||
|
763 | { |
|
||
|
764 | for (int j = 0; j < 50; j += 1) |
|
||
|
765 | { |
|
||
|
766 | //Warning: creates a flashing effect because tree positions update every 1/60th of a second |
|
||
|
767 |
|
|||
|
768 | if (this.random_generator.NextDouble() > 0.75) |
|
||
|
769 | { |
|
||
|
770 | drawTileAt(i, j, 142, 2); |
|
||
|
771 | } |
|
||
|
772 |
|
|||
|
773 | if ((i + j) % 3 == 0) |
|
||
|
774 | { |
|
||
|
775 | drawTileAt(i, j, 142, 2); |
|
||
|
776 | } |
|
||
|
777 |
|
|||
|
778 | } |
|
||
|
779 | }//*/ |
|
||
|
780 |
|
715 | ||
|
781 | #region draw_trees |
|
716 | #region draw_trees |
|
782 | if (this.showTrees) { |
|
717 | if (this.showTrees) { |
@@ -38,29 +38,16 | |||||
|
38 |
|
38 | ||
|
39 | static public void FillSquare(GraphicsDevice device, int x, int y, Color color, float alpha) |
|
39 | static public void FillSquare(GraphicsDevice device, int x, int y, Color color, float alpha) |
|
40 | { |
|
40 | { |
|
41 |
|
|||
|
42 | // Vector2 adjust2 = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved |
|
||
|
43 | // |
|
||
|
44 | var startX = ((x - y) * Tile.TileSpriteWidth / 2) + (Tile.TileSpriteWidth / 2); |
|
41 | var startX = ((x - y) * Tile.TileSpriteWidth / 2) + (Tile.TileSpriteWidth / 2); |
|
45 | var startY = (x + y) * Tile.TileSpriteHeight / 2 + (Tile.TileSpriteHeight); |
|
42 | var startY = (x + y) * Tile.TileSpriteHeight / 2 + (Tile.TileSpriteHeight); |
|
46 | startX = 0; |
|
43 | startX = 0; |
|
47 | startY = 10; |
|
44 | startY = 10; |
|
48 | // |
|
||
|
49 | // Rectangle rect = new Rectangle(startX, startY, Tile.TileSpriteWidth / 2, (int)(Tile.TileSpriteHeight * 0.75)); |
|
||
|
50 | // batch.Draw(Line.PixelTexture, rect, null, color, 0.785f, new Vector2(0,0), SpriteEffects.None, 0.79f); |
|
||
|
51 | // |
|
||
|
52 |
|
45 | ||
|
53 | // vert[0].Position = new Vector3(startX, startY, 0); |
|
||
|
54 | // vert[1].Position = new Vector3(startX+Tile.TileSpriteWidth, startY, 0); |
|
||
|
55 | // vert[2].Position = new Vector3(startX, startY+Tile.TileSpriteHeight, 0); |
|
||
|
56 | // vert[3].Position = new Vector3(startX+Tile.TileSpriteWidth, startY+Tile.TileSpriteHeight, 0); |
|
||
|
57 | vert[0].Position = new Vector3(startX, startY, 0); |
|
46 | vert[0].Position = new Vector3(startX, startY, 0); |
|
58 | vert[1].Position = new Vector3(startX + 100, startY, 0); |
|
47 | vert[1].Position = new Vector3(startX + 100, startY, 0); |
|
59 | vert[2].Position = new Vector3(startX, startY + 100, 0); |
|
48 | vert[2].Position = new Vector3(startX, startY + 100, 0); |
|
60 | vert[3].Position = new Vector3(startX + 100, startY + 100, 0); |
|
49 | vert[3].Position = new Vector3(startX + 100, startY + 100, 0); |
|
61 |
|
50 | ||
|
62 |
|
|||
|
63 |
|
|||
|
64 | vert[0].TextureCoordinate = new Vector2(0, 0); |
|
51 | vert[0].TextureCoordinate = new Vector2(0, 0); |
|
65 | vert[1].TextureCoordinate = new Vector2(1, 0); |
|
52 | vert[1].TextureCoordinate = new Vector2(1, 0); |
|
66 | vert[2].TextureCoordinate = new Vector2(0, 1); |
|
53 | vert[2].TextureCoordinate = new Vector2(0, 1); |
@@ -110,10 +97,6 | |||||
|
110 | { |
|
97 | { |
|
111 | FillSquare2(batch, (int)square.X, (int)square.Y, color, alpha, depth); |
|
98 | FillSquare2(batch, (int)square.X, (int)square.Y, color, alpha, depth); |
|
112 | } |
|
99 | } |
|
113 |
|
|||
|
114 | } |
|
100 | } |
|
115 |
|
|||
|
116 | } |
|
101 | } |
|
117 |
|
102 | } | |
|
118 |
|
|||
|
119 | } No newline at end of file |
|
@@ -367,16 +367,7 | |||||
|
367 | this.lastAdvance += advancesToSimulate * millisecondsPerAdvance; |
|
367 | this.lastAdvance += advancesToSimulate * millisecondsPerAdvance; |
|
368 | } |
|
368 | } |
|
369 |
|
369 | ||
|
370 | /* |
|
||
|
371 | if ((this.Tick % this.millisecondsPerAdvance) == 0) |
|
||
|
372 | { |
|
||
|
373 | this.DateTime = this.DateTime.AddMonths(1); |
|
||
|
374 | }*/ |
|
||
|
375 |
|
|||
|
376 | } |
|
370 | } |
|
377 |
|
|||
|
378 |
|
|||
|
379 |
|
|||
|
380 | } |
|
371 | } |
|
381 | } |
|
372 | } |
|
382 | } |
|
373 | } |
@@ -25,22 +25,17 | |||||
|
25 |
|
25 | ||
|
26 | public static void LoadContent(ImGuiRenderer _imGuiRenderer, ImageMap map) |
|
26 | public static void LoadContent(ImGuiRenderer _imGuiRenderer, ImageMap map) |
|
27 | { |
|
27 | { |
|
28 |
|
|||
|
29 | ContractWindow.map = map; |
|
28 | ContractWindow.map = map; |
|
30 |
|
29 | ||
|
31 | var _xnaTexture = ImageMap.ImageMapTexture; |
|
30 | var _xnaTexture = ImageMap.ImageMapTexture; |
|
32 | ContractWindow._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture); |
|
31 | ContractWindow._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture); |
|
33 | } |
|
32 | } |
|
34 |
|
33 | ||
|
35 |
|
|||
|
36 | public static void Render(ImFontPtr font, ImFontPtr italicFont, ImGuiWindowBridgeEngine engine, Entity entity, string name, string description, ContractStatus status, decimal amount, string delta_trees, int area_size, int imageIndex) |
|
34 | public static void Render(ImFontPtr font, ImFontPtr italicFont, ImGuiWindowBridgeEngine engine, Entity entity, string name, string description, ContractStatus status, decimal amount, string delta_trees, int area_size, int imageIndex) |
|
37 |
|
35 | ||
|
38 | { |
|
36 | { |
|
39 | bool newShow = true; |
|
37 | bool newShow = true; |
|
40 |
|
38 | ||
|
41 | // Entity newSelected; |
|
||
|
42 | ; |
|
||
|
43 |
|
|||
|
44 | if (newShow) |
|
39 | if (newShow) |
|
45 | { |
|
40 | { |
|
46 | ImGui.PushFont(font); |
|
41 | ImGui.PushFont(font); |
@@ -49,7 +44,8 | |||||
|
49 | StyleSet.pushStyleVarSet(StyleSet.defaultWindowVars); |
|
44 | StyleSet.pushStyleVarSet(StyleSet.defaultWindowVars); |
|
50 | StyleSet.pushColorSet(StyleSet.defaultWindowColors); |
|
45 | StyleSet.pushColorSet(StyleSet.defaultWindowColors); |
|
51 | ImGui.SetNextWindowSize(new Num.Vector2(320, 360)); |
|
46 | ImGui.SetNextWindowSize(new Num.Vector2(320, 360)); |
|
52 |
ImGui.Begin(string.Format("Contract {0} ## {1}", name, entity.ID), ref newShow, |
|
47 | ImGui.Begin(string.Format("Contract {0} ## {1}", name, entity.ID), ref newShow, |
|
|
48 | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings); | ||
|
53 |
|
49 | ||
|
54 | ImGui.Image(_imGuiTexture, new Num.Vector2(250, 200), map.GetSourceUVStart(imageIndex), map.GetSourceUVEnd(imageIndex), Num.Vector4.One, Num.Vector4.Zero); // Here, the previously loaded texture is used |
|
50 | ImGui.Image(_imGuiTexture, new Num.Vector2(250, 200), map.GetSourceUVStart(imageIndex), map.GetSourceUVEnd(imageIndex), Num.Vector4.One, Num.Vector4.Zero); // Here, the previously loaded texture is used |
|
55 |
|
51 | ||
@@ -84,7 +80,7 | |||||
|
84 | break; |
|
80 | break; |
|
85 | } |
|
81 | } |
|
86 | ImGui.Text(string.Format("Amount: ${0}/mo.", amount)); |
|
82 | ImGui.Text(string.Format("Amount: ${0}/mo.", amount)); |
|
87 |
ImGui.Text(string.Format("Size |
|
83 | ImGui.Text(string.Format("Size: {0} acres", area_size)); |
|
88 |
|
84 | ||
|
89 | if (delta_trees != null) |
|
85 | if (delta_trees != null) |
|
90 | { |
|
86 | { |
@@ -174,7 +170,6 | |||||
|
174 |
|
170 | ||
|
175 | engine.contractStatusMessages.Add(new ChangeContractStatusMessage { Entity = entity, newStatus = ContractStatus.Broken }); |
|
171 | engine.contractStatusMessages.Add(new ChangeContractStatusMessage { Entity = entity, newStatus = ContractStatus.Broken }); |
|
176 | } |
|
172 | } |
|
177 |
|
|||
|
178 | } |
|
173 | } |
|
179 | } |
|
174 | } |
|
180 | } |
|
175 | } |
@@ -38,8 +38,12 | |||||
|
38 | ImGui.SetNextWindowSize(new Num.Vector2(320, 340)); |
|
38 | ImGui.SetNextWindowSize(new Num.Vector2(320, 340)); |
|
39 | ImGui.Begin("Contracts", ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings); |
|
39 | ImGui.Begin("Contracts", ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings); |
|
40 | ImGui.ListBoxHeader("##Contracts:", new Num.Vector2(320, 150)); |
|
40 | ImGui.ListBoxHeader("##Contracts:", new Num.Vector2(320, 150)); |
|
41 | foreach (var contract in contracts.Where((contract) => ((!(new[] {ContractStatus.Expired, ContractStatus.Broken, ContractStatus.Rejected}.Contains(contract.status)) |
|
41 | |
|
42 | || ContractsWindow.show_all )))) |
|
42 | var filter_statuses = new[] {ContractStatus.Expired, ContractStatus.Broken, ContractStatus.Rejected}; |
|
|
43 | |||
|
|
44 | foreach (var contract in contracts.Where((contract) => | ||
|
|
45 | ((!(filter_statuses.Contains(contract.status)) | ||
|
|
46 | || ContractsWindow.show_all )))) | ||
|
43 | { |
|
47 | { |
|
44 | if (ImGui.Selectable(String.Format("{0}##{1}",contract.name, contract.entity.ID), |
|
48 | if (ImGui.Selectable(String.Format("{0}##{1}",contract.name, contract.entity.ID), |
|
45 | ContractsWindow.selected.entity == contract.entity)) |
|
49 | ContractsWindow.selected.entity == contract.entity)) |
@@ -118,8 +118,6 | |||||
|
118 | return (variation * z2) + mean; |
|
118 | return (variation * z2) + mean; |
|
119 | } |
|
119 | } |
|
120 |
|
120 | ||
|
121 |
|
|||
|
122 |
|
|||
|
123 | } |
|
121 | } |
|
124 |
|
122 | ||
|
125 | public static int NextSample(Random random, int[] integers) |
|
123 | public static int NextSample(Random random, int[] integers) |
@@ -128,7 +126,5 | |||||
|
128 |
|
126 | ||
|
129 | return integers[index]; |
|
127 | return integers[index]; |
|
130 | } |
|
128 | } |
|
131 |
|
|||
|
132 | } |
|
129 | } |
|
133 |
|
|||
|
134 | } |
|
130 | } |
You need to be logged in to leave comments.
Login now