public WorldView(World World, Vector2f DrawSize) { _World = World; _RenderTarget = new RenderTexture((uint)_World.Settings.Width, (uint)_World.Settings.Height); _Vertices = new Vertex[World.Settings.Width * World.Settings.Height]; for (int i = 0; i < World.Settings.Width; ++i) { for (int j = 0; j < World.Settings.Height; ++j) { float h = World.HeightAt(i, j); float m = World.Moisture(i, j); float t = World.TemperatureAt(i, j); _Vertices[i * World.Settings.Height + j].Position = new Vector2f(i, j); _Vertices[i * World.Settings.Height + j].Color = Color.White; } } foreach (Region R in _World.Regions) { RegionView M = new RegionView(this, R); _Regions.Add(R, M); } _Corners = new Vertex[] { new Vertex(new Vector2f(0, 0), new Vector2f(0, 0)), new Vertex(new Vector2f(DrawSize.X, 0), new Vector2f(_World.Settings.Width - 1, 0)), new Vertex(new Vector2f(DrawSize.X, DrawSize.Y), new Vector2f(_World.Settings.Width - 1, _World.Settings.Height - 1)), new Vertex(new Vector2f(0, DrawSize.Y), new Vector2f(0, _World.Settings.Height - 1)) }; }
public void SetRegion(WorldView World, RegionView Region) { if (_Region != null) { _World.HighlightRegion(_Region, false); } _Region = Region; _World = World; World.HighlightRegion(Region, true); _Readout.DisplayedString = String.Format( "{0}\nPopulation: ~{1:N0}\nProsperity: {2:0.00}\nGovernment:~{3}", Region.Region.Name, RoundToFigures((int)Region.Region.Population, 2), Region.Region.FlowPerCapita(), Region.Region.Administration.GovernmentForm); if (_SummaryPage.Items.Count == 1) { _SummaryPage.Add(Region.Region.Administration.Flag); } else { _SummaryPage.Items[_SummaryPage.Items.Count - 1] = Region.Region.Administration.Flag; } Region.Region.Administration.Flag.Position = new Vector2f(2, 36); _EconomyTable.Clear(); foreach (Tangible Tangible in Region.Region.Economy.All.OrderBy(i => i.Name)) { _EconomyTable.Add( new TableRow("table-row") { new Button("table-cell") { DisplayedString = Tangible.Name }, new Button("table-cell") { DisplayedString = string.Format("{0:0.00}", Region.Region.Price(Tangible)) }, new Button("table-cell") { DisplayedString = string.Format("{0:0}", Region.Region[Tangible].Supply) } }); } }
public void HighlightRegion(RegionView Region, bool Highlighted) { Region.SetHighlight(Highlighted); _Redraw = true; }