# HG changeset patch # User alys # Date 2021-05-31 09:31:36 # Node ID 81028a34aa8824cc02f708f02336ad67daf3fa54 # Parent e7755bfd45e93287d5ab379d1432bde5bd4df9e7 Many small tweaks. diff --git a/isometric-park-fna/Engines/Spawners/ContractSpawner.cs b/isometric-park-fna/Engines/Spawners/ContractSpawner.cs --- a/isometric-park-fna/Engines/Spawners/ContractSpawner.cs +++ b/isometric-park-fna/Engines/Spawners/ContractSpawner.cs @@ -155,7 +155,7 @@ var odds_to_try = new[] {0.5f, 0.75f, 1.0f, 0.5f, 0.75f, 1.0f}; var retry_location = new[] {false, false, false, true, false, false}; Debug.Assert(odds_to_try.Count() == retry_location.Count()); - // foreach( double odds in odds_to_try ) + for(int i = 0; i < odds_to_try.Count(); i++) { @@ -204,7 +204,6 @@ _ => random_generator.Next(CONTRACT_MINIMUM, CONTRACT_MAXIMUM) }; - // AddComponent AddComponent(contract, new AreaComponent { squares = squares }); AddComponent(contract, new NameAndDescriptionComponent { DisplayName = this.grammar.Flatten(message.name) }); AddComponent(contract, new SelectedComponent { selected = false }); diff --git a/isometric-park-fna/Engines/Spawners/OrganizationSpawner.cs b/isometric-park-fna/Engines/Spawners/OrganizationSpawner.cs --- a/isometric-park-fna/Engines/Spawners/OrganizationSpawner.cs +++ b/isometric-park-fna/Engines/Spawners/OrganizationSpawner.cs @@ -21,11 +21,9 @@ Family, LargeCorporation, Cooperative - } [Receives(typeof(SpawnOrganizationtMessage))] - //[Reads(typeof(AreaComponent), typeof(ContractStatusComponent))] class OrganizationSpawner : Spawner { @@ -45,7 +43,6 @@ { var organization = CreateEntity(); - // var image_index = random_generator.Next(1, 7); var image_index = message.type switch { OrganizationType.Cooperative => MathUtils.NextSample(random_generator, new[] {1, 2, 3, 11, 12, 13, 15}), OrganizationType.LargeCorporation => MathUtils.NextSample(random_generator, new[] {0, 6, 7, 9, 10}), @@ -54,9 +51,7 @@ }; Logging.Success("Generated image index."); - - var name = message.name != null ? message.name : "#logging_company.capitalizeAll#"; var description = message.description != null ? message.description : ""; @@ -66,8 +61,6 @@ AddComponent(organization, new OffersContractsComponent { }); AddComponent(organization, new OrganizationTypeComponent { type = message.type }); - } - } } 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 @@ -113,7 +113,6 @@ private FNAGame() { - //this.device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.) #if DEBUG foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) @@ -204,10 +203,6 @@ this.grammar = new TraceryNet.Grammar(json2); - //let's see if this works: - // WorldBuilder = new WorldBuilder(); - var dummy_entity = WorldBuilder.CreateEntity(); - WorldBuilder.AddEngine(new InputEngine(Menu.MENU_BAR_HEIGHT, FNAGame.width, FNAGame.height)); WorldBuilder.AddEngine(new UIEngine()); @@ -282,12 +277,10 @@ WorldBuilder.SendMessage(new SpawnContractMessage { squares = squares, - //new[] {new Vector2(4,4), new Vector2(5,4)}, name = "Northshore Logging" }); WorldBuilder.SendMessage(new SpawnContractMessage { - // squares = squares2, //new[] { new Vector2(6, 6), new Vector2(6, 7), new Vector2(6, 8) }, name = "Aeres Maximalis Ltd." }); World = WorldBuilder.Build(); @@ -308,8 +301,6 @@ ); - - this.output = grammar.Flatten("#greeting#"); var result = grammar.Flatten("#[assistantName:#assistantNames#][whatever:whatever]vars#"); @@ -565,43 +556,6 @@ null, camera.get_transformation(GraphicsDevice)); - //New tile stuff - /* - Vector2 firstSquare = Vector2.Zero; - int firstX = (int)firstSquare.X; - int firstY = (int)firstSquare.Y; - - Vector2 squareOffset = Vector2.Zero; - - int offsetX = (int)squareOffset.X; - int offsetY = (int)squareOffset.Y; - - - for (int y = 0; y < this.squaresDown; y++) - { - int rowOffset = 0; - if ((firstY + y) % 2 == 1) - rowOffset = Tile.OddRowXOffset; - - for (int x = 0; x < this.squaresAcross; x++) { - - - batch.Draw( - Tile.TileSetTexture, - new Rectangle( - ((x * Tile.TileStepX) - offsetX + rowOffset + baseOffsetX), - ((y * Tile.TileStepY) - offsetY + baseOffsetY), - Tile.TileWidth, Tile.TileHeight), - Tile.GetSourceRectangle(1), - Color.White, - 0.0f, - Vector2.Zero, - SpriteEffects.None, - 0.9f); - - - } - }*/ #region draw_tiles //reset @@ -757,26 +711,7 @@ #endregion draw_cursor - /* - for (int i = 0; i< 80; i++) - { - for (int j = 0; j < 50; j += 1) - { - //Warning: creates a flashing effect because tree positions update every 1/60th of a second - - if (this.random_generator.NextDouble() > 0.75) - { - drawTileAt(i, j, 142, 2); - } - - if ((i + j) % 3 == 0) - { - drawTileAt(i, j, 142, 2); - } - - } - }//*/ #region draw_trees if (this.showTrees) { diff --git a/isometric-park-fna/Quad.cs b/isometric-park-fna/Quad.cs --- a/isometric-park-fna/Quad.cs +++ b/isometric-park-fna/Quad.cs @@ -38,29 +38,16 @@ static public void FillSquare(GraphicsDevice device, int x, int y, Color color, float alpha) { - - // Vector2 adjust2 = new Vector2(Tile.TileSpriteWidth / 2, Tile.TileSpriteHeight); //TODO figure out why this second value shouldn't be halved - // var startX = ((x - y) * Tile.TileSpriteWidth / 2) + (Tile.TileSpriteWidth / 2); var startY = (x + y) * Tile.TileSpriteHeight / 2 + (Tile.TileSpriteHeight); startX = 0; startY = 10; - // - // Rectangle rect = new Rectangle(startX, startY, Tile.TileSpriteWidth / 2, (int)(Tile.TileSpriteHeight * 0.75)); - // batch.Draw(Line.PixelTexture, rect, null, color, 0.785f, new Vector2(0,0), SpriteEffects.None, 0.79f); - // - // vert[0].Position = new Vector3(startX, startY, 0); - // vert[1].Position = new Vector3(startX+Tile.TileSpriteWidth, startY, 0); - // vert[2].Position = new Vector3(startX, startY+Tile.TileSpriteHeight, 0); - // vert[3].Position = new Vector3(startX+Tile.TileSpriteWidth, startY+Tile.TileSpriteHeight, 0); vert[0].Position = new Vector3(startX, startY, 0); vert[1].Position = new Vector3(startX + 100, startY, 0); vert[2].Position = new Vector3(startX, startY + 100, 0); vert[3].Position = new Vector3(startX + 100, startY + 100, 0); - - vert[0].TextureCoordinate = new Vector2(0, 0); vert[1].TextureCoordinate = new Vector2(1, 0); vert[2].TextureCoordinate = new Vector2(0, 1); @@ -110,10 +97,6 @@ { FillSquare2(batch, (int)square.X, (int)square.Y, color, alpha, depth); } - } - } - - -} \ No newline at end of file +} 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 @@ -367,16 +367,7 @@ this.lastAdvance += advancesToSimulate * millisecondsPerAdvance; } - /* - if ((this.Tick % this.millisecondsPerAdvance) == 0) - { - this.DateTime = this.DateTime.AddMonths(1); - }*/ - } - - - } } } diff --git a/isometric-park-fna/UI/ContractWindow.cs b/isometric-park-fna/UI/ContractWindow.cs --- a/isometric-park-fna/UI/ContractWindow.cs +++ b/isometric-park-fna/UI/ContractWindow.cs @@ -25,22 +25,17 @@ public static void LoadContent(ImGuiRenderer _imGuiRenderer, ImageMap map) { - ContractWindow.map = map; var _xnaTexture = ImageMap.ImageMapTexture; ContractWindow._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture); } - 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) { bool newShow = true; - // Entity newSelected; -; - if (newShow) { ImGui.PushFont(font); @@ -49,7 +44,8 @@ StyleSet.pushStyleVarSet(StyleSet.defaultWindowVars); StyleSet.pushColorSet(StyleSet.defaultWindowColors); ImGui.SetNextWindowSize(new Num.Vector2(320, 360)); - ImGui.Begin(string.Format("Contract {0} ## {1}", name, entity.ID), ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings); + ImGui.Begin(string.Format("Contract {0} ## {1}", name, entity.ID), ref newShow, + ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings); 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 @@ -84,7 +80,7 @@ break; } ImGui.Text(string.Format("Amount: ${0}/mo.", amount)); - ImGui.Text(string.Format("Size {0} m^2", area_size)); + ImGui.Text(string.Format("Size: {0} acres", area_size)); if (delta_trees != null) { @@ -174,7 +170,6 @@ engine.contractStatusMessages.Add(new ChangeContractStatusMessage { Entity = entity, newStatus = ContractStatus.Broken }); } - } } } diff --git a/isometric-park-fna/UI/ContractsWindow.cs b/isometric-park-fna/UI/ContractsWindow.cs --- a/isometric-park-fna/UI/ContractsWindow.cs +++ b/isometric-park-fna/UI/ContractsWindow.cs @@ -38,8 +38,12 @@ ImGui.SetNextWindowSize(new Num.Vector2(320, 340)); ImGui.Begin("Contracts", ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings); ImGui.ListBoxHeader("##Contracts:", new Num.Vector2(320, 150)); - foreach (var contract in contracts.Where((contract) => ((!(new[] {ContractStatus.Expired, ContractStatus.Broken, ContractStatus.Rejected}.Contains(contract.status)) - || ContractsWindow.show_all )))) + + var filter_statuses = new[] {ContractStatus.Expired, ContractStatus.Broken, ContractStatus.Rejected}; + + foreach (var contract in contracts.Where((contract) => + ((!(filter_statuses.Contains(contract.status)) + || ContractsWindow.show_all )))) { if (ImGui.Selectable(String.Format("{0}##{1}",contract.name, contract.entity.ID), ContractsWindow.selected.entity == contract.entity)) diff --git a/isometric-park-fna/Utils/MathUtils.cs b/isometric-park-fna/Utils/MathUtils.cs --- a/isometric-park-fna/Utils/MathUtils.cs +++ b/isometric-park-fna/Utils/MathUtils.cs @@ -118,8 +118,6 @@ return (variation * z2) + mean; } - - } public static int NextSample(Random random, int[] integers) @@ -128,7 +126,5 @@ return integers[index]; } - } - }