private void DrawPanel_Paint(object sender, PaintEventArgs e) { // Text string bcad = (_game.GameYear < 0) ? "B.C." : "A.D."; using var font1 = new Font("Times New Roman", 14); Draw.Text(e.Graphics, "ATTITUDE ADVISOR", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 3), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"Kingdom of the {_game.ActiveCiv.TribeName}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 24), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"King {_game.ActiveCiv.LeaderName} : {Math.Abs(_game.GameYear)} {bcad}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 45), Color.FromArgb(67, 67, 67), 2, 1); // Cities int count = 0; foreach (City city in _game.GetCities.Where(n => n.Owner == _game.ActiveCiv)) { // City image //e.Graphics.DrawImage(Draw.City(city, true, 0), new Point(4 + 64 * ((count + 1) % 2), 69 + 32 * count)); // City name using var font2 = new Font("Times New Roman", 11, FontStyle.Bold); Draw.Text(e.Graphics, city.Name, font2, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(142, 82 + 32 * count), Color.FromArgb(67, 67, 67), 1, 1); // Faces //e.Graphics.DrawImage(Draw.DrawFaces(city, 1), new Point(220, 69 + 32 * count)); count++; } }
private void DrawPanel_Paint(object sender, PaintEventArgs e) { using var _font = new Font("Times New Roman", 18); // Draw icons and text int itemNo = _city.ItemInProduction; // It's a unit if (itemNo < 62) { _completeitButton.Location = new Point(140, 69); _nevermindButton.Location = new Point(140, 98); using var _unitPic = Images.Units[itemNo].Resize(4); e.Graphics.DrawImage(_unitPic, 4, 4); // 2-times larger int _costToComplete = 10 * Game.Rules.UnitCost[itemNo] - _city.ShieldsProgress; string _itemName = Game.Rules.UnitName[itemNo]; Draw.Text(e.Graphics, $"Cost to complete {_itemName} : {_costToComplete} gold.", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(51, 51, 51), new Point(120, 8)); Draw.Text(e.Graphics, $"Treasury: {Game.ActiveCiv.Money} gold.", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(51, 51, 51), new Point(120, 35)); } // It's an improvement else { _completeitButton.Location = new Point(85, 69); _nevermindButton.Location = new Point(85, 98); string _itemName = Game.Rules.ImprovementName[itemNo - 62 + 1]; using var _improvPic = Images.Improvements[itemNo - 62 + 1].Resize(1); e.Graphics.DrawImage(_improvPic, 4, 4); int _costToComplete = 10 * Game.Rules.ImprovementCost[itemNo - 62 + 1] - _city.ShieldsProgress; Draw.Text(e.Graphics, $"Cost to complete {_itemName} : {_costToComplete} gold.", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(51, 51, 51), new Point(80, 8)); Draw.Text(e.Graphics, $"Treasury: {Game.ActiveCiv.Money} gold.", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(51, 51, 51), new Point(80, 35)); } }
private void CityPanel_Paint(object sender, PaintEventArgs e) { string bcad = (Game.GameYear < 0) ? "B.C." : "A.D."; string text = String.Format($"City of {_thisCity.Name}, {Math.Abs(Game.GameYear)} {bcad}, Population {_thisCity.Population:n0} (Treasury: {_thisCity.Owner.Money} Gold)"); using var font = new Font("Times New Roman", 14); Draw.Text(e.Graphics, text, font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(135, 135, 135), new Point(Width / 2, 15), Color.Black, 1, 0); }
private void CityBuyPanel_Paint(object sender, PaintEventArgs e) { // Title string text = _city.ItemInProduction < 62 ? Game.Rules.UnitName[_city.ItemInProduction] : Game.Rules.ImprovementName[_city.ItemInProduction - 62 + 1]; using var _font = new Font("Times New Roman", 17); Draw.Text(e.Graphics, "Buy " + text, _font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(135, 135, 135), new Point(this.Width / 2, 20), Color.Black, 1, 1); }
private void DrawPanel_Paint(object sender, PaintEventArgs e) { // Texts using var font = new Font("Arial", 9, FontStyle.Bold); Draw.Text(e.Graphics, "Citizens", font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(223, 187, 63), new Point(101, 53), Color.FromArgb(67, 67, 67), 1, 1); Draw.Text(e.Graphics, "City Resources", font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(223, 187, 63), new Point(317, 52), Color.FromArgb(67, 67, 67), 1, 1); Draw.Text(e.Graphics, "Food Storage", font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(75, 155, 35), new Point(535, 7), Color.Black, 1, 1); Draw.Text(e.Graphics, "City Improvements", font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(223, 187, 63), new Point(96, 296), Color.FromArgb(67, 67, 67), 1, 1); }
private void StatsPanel_Paint(object sender, PaintEventArgs e) { using var _font = new Font("Times New Roman", 12, FontStyle.Bold); string showYear = (Game.GameYear < 0) ? $"{Math.Abs(Game.GameYear)} B.C." : $"A.D. {Math.Abs(Game.GameYear)}"; Draw.Text(e.Graphics, Game.PlayerCiv.Population.ToString("###,###", new NumberFormatInfo() { NumberDecimalSeparator = "," }) + " People", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(51, 51, 51), new Point(5, 2), Color.FromArgb(191, 191, 191), 1, 1); Draw.Text(e.Graphics, showYear, _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(51, 51, 51), new Point(5, 20), Color.FromArgb(191, 191, 191), 1, 1); Draw.Text(e.Graphics, $"{Game.PlayerCiv.Money} Gold 5.0.5", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(51, 51, 51), new Point(5, 38), Color.FromArgb(191, 191, 191), 1, 1); }
private void StatusPanel_Paint(object sender, PaintEventArgs e) { // Title using var _font = new Font("Times New Roman", 17, FontStyle.Bold); Draw.Text(e.Graphics, "Status", _font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(135, 135, 135), new Point(this.Width / 2, 20), Color.Black, 1, 1); // Outer border using var _pen1 = new Pen(Color.FromArgb(227, 227, 227)); using var _pen2 = new Pen(Color.FromArgb(105, 105, 105)); using var _pen3 = new Pen(Color.FromArgb(255, 255, 255)); using var _pen4 = new Pen(Color.FromArgb(160, 160, 160)); using var _pen5 = new Pen(Color.FromArgb(240, 240, 240)); using var _pen6 = new Pen(Color.FromArgb(223, 223, 223)); using var _pen7 = new Pen(Color.FromArgb(67, 67, 67)); e.Graphics.DrawLine(_pen1, 0, 0, this.Width - 2, 0); // 1st layer of border e.Graphics.DrawLine(_pen1, 0, 0, 0, this.Height - 2); e.Graphics.DrawLine(_pen2, this.Width - 1, 0, this.Width - 1, this.Height - 1); e.Graphics.DrawLine(_pen2, 0, this.Height - 1, this.Width - 1, this.Height - 1); e.Graphics.DrawLine(_pen3, 1, 1, this.Width - 3, 1); // 2nd layer of border e.Graphics.DrawLine(_pen3, 1, 1, 1, this.Height - 3); e.Graphics.DrawLine(_pen4, this.Width - 2, 1, this.Width - 2, this.Height - 2); e.Graphics.DrawLine(_pen4, 1, this.Height - 2, this.Width - 2, this.Height - 2); e.Graphics.DrawLine(_pen5, 2, 2, this.Width - 4, 2); // 3rd layer of border e.Graphics.DrawLine(_pen5, 2, 2, 2, this.Height - 4); e.Graphics.DrawLine(_pen5, this.Width - 3, 2, this.Width - 3, this.Height - 3); e.Graphics.DrawLine(_pen5, 2, this.Height - 3, this.Width - 3, this.Height - 3); e.Graphics.DrawLine(_pen6, 3, 3, this.Width - 5, 3); // 4th layer of border e.Graphics.DrawLine(_pen6, 3, 3, 3, this.Height - 5); e.Graphics.DrawLine(_pen7, this.Width - 4, 3, this.Width - 4, this.Height - 4); e.Graphics.DrawLine(_pen7, 3, this.Height - 4, this.Width - 4, this.Height - 4); e.Graphics.DrawLine(_pen6, 4, 4, this.Width - 6, 4); // 5th layer of border e.Graphics.DrawLine(_pen6, 4, 4, 4, this.Height - 6); e.Graphics.DrawLine(_pen7, this.Width - 5, 4, this.Width - 5, this.Height - 5); e.Graphics.DrawLine(_pen7, 4, this.Height - 5, this.Width - 5, this.Height - 5); // Draw line borders of stats panel e.Graphics.DrawLine(_pen7, 9, 36, 252, 36); // 1st layer of border e.Graphics.DrawLine(_pen7, 9, 36, 9, 98); e.Graphics.DrawLine(_pen6, 9, 99, 252, 99); e.Graphics.DrawLine(_pen6, 252, 36, 252, 99); e.Graphics.DrawLine(_pen7, 10, 37, 250, 37); // 2nd layer of border e.Graphics.DrawLine(_pen7, 10, 38, 10, 97); e.Graphics.DrawLine(_pen6, 10, 98, 251, 98); e.Graphics.DrawLine(_pen6, 251, 37, 251, 98); // Draw line borders of unit panel e.Graphics.DrawLine(_pen7, 9, 104, 252, 104); // 1st layer of border e.Graphics.DrawLine(_pen7, 9, 104, 9, 106 + UnitPanel.Height); e.Graphics.DrawLine(_pen6, 9, 107 + UnitPanel.Height, 252, 107 + UnitPanel.Height); e.Graphics.DrawLine(_pen6, 252, 104, 252, 105 + UnitPanel.Height); e.Graphics.DrawLine(_pen7, 9, 105, 250, 105); // 2nd layer of border e.Graphics.DrawLine(_pen7, 10, 104, 10, 105 + UnitPanel.Height); e.Graphics.DrawLine(_pen6, 10, 106 + UnitPanel.Height, 252, 106 + UnitPanel.Height); e.Graphics.DrawLine(_pen6, 251, 105, 251, 105 + UnitPanel.Height); }
private void DrawPanel_Paint(object sender, PaintEventArgs e) { // Draw text string statText = _showStatistics ? "Statistics" : "Casualties"; string bcad = (_game.GameYear < 0) ? "B.C." : "A.D."; using var font1 = new Font("Times New Roman", 14); Draw.Text(e.Graphics, "DEFENSE MINISTER: " + statText, font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 3), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"Kingdom of the {_game.ActiveCiv.TribeName}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 24), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"King {_game.ActiveCiv.LeaderName} : {Math.Abs(_game.GameYear)} {bcad}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 45), Color.FromArgb(67, 67, 67), 2, 1); // Units if (_showStatistics) { int count = 0; for (int i = 0; i < 62; i++) { if (_activeUnitCount[i] > 0) { // Image of unit using var unitPic = Draw.UnitType(i, _game.ActiveCiv.Id); e.Graphics.DrawImage(unitPic, new Point(4 + 64 * ((count + 1) % 2), 69 + 24 * count)); // Unit name using var font2 = new Font("Times New Roman", 11, FontStyle.Bold); Draw.Text(e.Graphics, _game.Rules.UnitName[i], font2, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(142, 85 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); // Unit attack/defense/movement Draw.Text(e.Graphics, $"{_game.Rules.UnitAttack[i]} / {_game.Rules.UnitDefense[i]} / {_game.Rules.UnitMove[i]}", font2, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(255, 85 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); // Hitpoints/firepower Draw.Text(e.Graphics, $"{_game.Rules.UnitHitp[i]} / {_game.Rules.UnitFirepwr[i]}", font2, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(300, 85 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); // No of active units Draw.Text(e.Graphics, $"{_activeUnitCount[i]} active", font2, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(255, 223, 79), new Point(325, 85 + 24 * count), Color.Black, 1, 1); // No of units in production if (_unitInProductionCount[i] > 0) { Draw.Text(e.Graphics, $"{_unitInProductionCount[i]} in prod", font2, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(63, 187, 199), new Point(390, 85 + 24 * count), Color.Black, 1, 1); } count++; } } } else { // TO-DO: show casualties } }
private void DrawPanel_Paint(object sender, PaintEventArgs e) { // Text string bcad = (_game.GameYear < 0) ? "B.C." : "A.D."; using var font1 = new Font("Times New Roman", 14); Draw.Text(e.Graphics, "CITY STATUS", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 3), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"Kingdom of the {_game.ActiveCiv.TribeName}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 24), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"King {_game.ActiveCiv.LeaderName} : {Math.Abs(_game.GameYear)} {bcad}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 45), Color.FromArgb(67, 67, 67), 2, 1); // Cities int count = 0; foreach (City city in _game.GetCities.Where(n => n.Owner == _game.ActiveCiv)) { // City image Draw.City(e.Graphics, city, true, 0, new Point(4 + 64 * ((count + 1) % 2), 69 + 24 * count)); //e.Graphics.DrawImage(city.Graphic(true, 0), new Point(4 + 64 * ((count + 1) % 2), 69 + 24 * count)); // OLD // City name using var font2 = new Font("Times New Roman", 11, FontStyle.Bold); Draw.Text(e.Graphics, city.Name, font2, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(142, 82 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); // Food production Draw.Text(e.Graphics, city.Food.ToString(), font2, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(255, 82 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); e.Graphics.DrawImage(Images.CityFoodBig, new Point(265, 85 + 24 * count)); // Shields Draw.Text(e.Graphics, city.ShieldProduction.ToString(), font2, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(292, 82 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); e.Graphics.DrawImage(Images.CitySupportBig, new Point(297, 85 + 24 * count)); // Trade Draw.Text(e.Graphics, city.Trade.ToString(), font2, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(329, 82 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); e.Graphics.DrawImage(Images.CityTradeBig, new Point(335, 85 + 24 * count)); // Item in production int item = city.ItemInProduction; if (city.ItemInProduction < 62) // Unit is in production { Draw.Text(e.Graphics, $"{_game.Rules.UnitName[item]} ( + {city.ShieldsProgress} / {10 * _game.Rules.UnitCost[item]} )", font2, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(255, 223, 79), new Point(367, 82 + 24 * count), Color.Black, 1, 1); } // Improvement else { Draw.Text(e.Graphics, $"{_game.Rules.ImprovementName[item - 62 + 1]} ( {city.ShieldsProgress} / {10 * _game.Rules.ImprovementCost[item - 62 + 1]} )", font2, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(367, 82 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); } count++; } }
// Draw border around panel public virtual void Civ2panel_Paint(object sender, PaintEventArgs e) { // Title (if exists) if (_title != null) { using var font = new Font("Times New Roman", 17, FontStyle.Bold); Draw.Text(e.Graphics, _title, font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(135, 135, 135), new Point(this.Width / 2, 20), Color.Black, 1, 1); } // Outer border using var _pen1 = new Pen(Color.FromArgb(227, 227, 227)); using var _pen2 = new Pen(Color.FromArgb(105, 105, 105)); using var _pen3 = new Pen(Color.FromArgb(255, 255, 255)); using var _pen4 = new Pen(Color.FromArgb(160, 160, 160)); using var _pen5 = new Pen(Color.FromArgb(240, 240, 240)); using var _pen6 = new Pen(Color.FromArgb(223, 223, 223)); using var _pen7 = new Pen(Color.FromArgb(67, 67, 67)); e.Graphics.DrawLine(_pen1, 0, 0, this.Width - 2, 0); // 1st layer of border e.Graphics.DrawLine(_pen1, 0, 0, 0, this.Height - 2); e.Graphics.DrawLine(_pen2, this.Width - 1, 0, this.Width - 1, this.Height - 1); e.Graphics.DrawLine(_pen2, 0, this.Height - 1, this.Width - 1, this.Height - 1); e.Graphics.DrawLine(_pen3, 1, 1, this.Width - 3, 1); // 2nd layer of border e.Graphics.DrawLine(_pen3, 1, 1, 1, this.Height - 3); e.Graphics.DrawLine(_pen4, this.Width - 2, 1, this.Width - 2, this.Height - 2); e.Graphics.DrawLine(_pen4, 1, this.Height - 2, this.Width - 2, this.Height - 2); e.Graphics.DrawLine(_pen5, 2, 2, this.Width - 4, 2); // 3rd layer of border e.Graphics.DrawLine(_pen5, 2, 2, 2, this.Height - 4); e.Graphics.DrawLine(_pen5, this.Width - 3, 2, this.Width - 3, this.Height - 3); e.Graphics.DrawLine(_pen5, 2, this.Height - 3, this.Width - 3, this.Height - 3); e.Graphics.DrawLine(_pen6, 3, 3, this.Width - 5, 3); // 4th layer of border e.Graphics.DrawLine(_pen6, 3, 3, 3, this.Height - 5); e.Graphics.DrawLine(_pen7, this.Width - 4, 3, this.Width - 4, this.Height - 4); e.Graphics.DrawLine(_pen7, 3, this.Height - 4, this.Width - 4, this.Height - 4); e.Graphics.DrawLine(_pen6, 4, 4, this.Width - 6, 4); // 5th layer of border e.Graphics.DrawLine(_pen6, 4, 4, 4, this.Height - 6); e.Graphics.DrawLine(_pen7, this.Width - 5, 4, this.Width - 5, this.Height - 5); e.Graphics.DrawLine(_pen7, 4, this.Height - 5, this.Width - 5, this.Height - 5); // Border for draw panel e.Graphics.DrawLine(_pen7, 9, _paddingTop - 1, 9 + (Width - 18 - 1), _paddingTop - 1); // 1st layer of border e.Graphics.DrawLine(_pen7, 10, _paddingTop - 1, 10, Height - _paddingBtm - 1); e.Graphics.DrawLine(_pen6, Width - 11, _paddingTop - 1, Width - 11, Height - _paddingBtm - 1); e.Graphics.DrawLine(_pen6, 9, Height - _paddingBtm, Width - 9 - 1, Height - _paddingBtm); e.Graphics.DrawLine(_pen7, 10, _paddingTop - 2, 9 + (Width - 18 - 2), _paddingTop - 2); // 2nd layer of border e.Graphics.DrawLine(_pen7, 9, _paddingTop - 2, 9, Height - _paddingBtm); e.Graphics.DrawLine(_pen6, Width - 10, _paddingTop - 2, Width - 10, Height - _paddingBtm); e.Graphics.DrawLine(_pen6, 9, Height - _paddingBtm + 1, Width - 9 - 1, Height - _paddingBtm + 1); }
private void DrawPanel_Paint(object sender, PaintEventArgs e) { // Draw text string bcad = (_game.GameYear < 0) ? "B.C." : "A.D."; using var font1 = new Font("Times New Roman", 14); Draw.Text(e.Graphics, "SCIENCE ADVISOR", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 3), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"Kingdom of the {_game.ActiveCiv.TribeName}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 24), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"King {_game.ActiveCiv.LeaderName} : {Math.Abs(_game.GameYear)} {bcad}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 45), Color.FromArgb(67, 67, 67), 2, 1); // If civ discovered all techs if (_game.ActiveCiv.ReseachingTech == 255) { Draw.Text(e.Graphics, "Discoveries Every 80 Turns", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 71), Color.FromArgb(67, 67, 67), 2, 1); } // If civ is still researching else { using var _pen = new Pen(Color.White); e.Graphics.DrawRectangle(_pen, new Rectangle(2, 73, 595, 53)); // White rectangle Draw.Text(e.Graphics, $"Researching: {_game.Rules.AdvanceName[_game.ActiveCiv.ReseachingTech]}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 74), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, "Discoveries Every 80 Turns", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 130), Color.FromArgb(67, 67, 67), 2, 1); } // Write discovered advances using var font2 = new Font("Times New Roman", 11, FontStyle.Bold); int count = 0; int startingOffset = (_game.ActiveCiv.ReseachingTech == 255) ? 100 : 160; for (int i = _barValue * _techsPerColumn; i < _discoveredAdvances.Count; i++) { int x = 198 * (count / _techsPerColumn); int y = 22 * (count % _techsPerColumn); e.Graphics.DrawImage(Images.ResearchIcons[_game.Rules.AdvanceCategory[_discoveredAdvances[i]], _game.Rules.AdvanceEpoch[_discoveredAdvances[i]]], new Point(4 + x, startingOffset - 1 + y)); Draw.Text(e.Graphics, _game.Rules.AdvanceName[_discoveredAdvances[i]], font1, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(63, 187, 199), new Point(x + 42, y + startingOffset), Color.FromArgb(67, 67, 67), 2, 1); count++; if (count == 3 * _techsPerColumn) { break; // Only 3 columns can be shown } } }
private void UnitsInCity_Paint(object sender, PaintEventArgs e) { int count = 0; int row = 0; int col = 0; int zoom = -2; // zoom=-2(norm), 1(big) using var font = new Font("Arial", 9, FontStyle.Bold); foreach (IUnit unit in _thisCity.UnitsInCity) { col = count % 5; row = count / 5; //e.Graphics.DrawImage(Draw.Unit(unit, false, zoom), new Point(8 * (8 + zoom) * col, 6 * (8 + zoom) * row + 5 * row)); Draw.Text(e.Graphics, unit.HomeCity.Name.Substring(0, 3), font, StringAlignment.Center, StringAlignment.Center, Color.Black, new Point(8 * (8 + zoom) * col + 8 * (8 + zoom) / 2, 6 * (8 + zoom) * row + 5 * row + 6 * (8 + zoom)), Color.FromArgb(135, 135, 135), 1, 1); // TODO: doesn't work for <3 characters in city name count++; } // Trade text Draw.Text(e.Graphics, $"Supplies: {_thisCity.CommoditySupplied[0]}, {_thisCity.CommoditySupplied[2]}, {_thisCity.CommoditySupplied[2]}", font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(227, 83, 15), new Point(6, 135), Color.FromArgb(67, 67, 67), 1, 1); Draw.Text(e.Graphics, $"Demands: {_thisCity.CommodityDemanded[0]}, {_thisCity.CommodityDemanded[2]}, {_thisCity.CommodityDemanded[2]}", font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(227, 83, 15), new Point(6, 148), Color.FromArgb(67, 67, 67), 1, 1); Draw.Text(e.Graphics, $"{Game.GetCities[_thisCity.TradeRoutePartnerCity[0]].Name} {_thisCity.CommodityInRoute[0]}: +1", font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(227, 83, 15), new Point(6, 163), Color.FromArgb(67, 67, 67), 1, 1); }
private void UnitPanel_Paint(object sender, PaintEventArgs e) { using var _font = new Font("Times new roman", 12, FontStyle.Bold); var _frontColor = Color.FromArgb(51, 51, 51); var _backColor = Color.FromArgb(191, 191, 191); List <IUnit> _unitsOnThisTile = Game.UnitsHere(Game.ActiveXY[0], Game.ActiveXY[1]); string _cityName, _wholeText, _roadText, _irrigText, _airbaseText; int _column; // View piece mode if (_main.ViewPieceMode) { Draw.Text(e.Graphics, "Viewing Pieces", _font, StringAlignment.Center, StringAlignment.Center, Color.White, new Point(119, 10), Color.Black, 1, 0); // Draw location & tile type on active square Draw.Text(e.Graphics, $"Loc: ({Game.ActiveXY[0]}, {Game.ActiveXY[1]}) {Map.Tile[(Game.ActiveXY[0] - Game.ActiveXY[1] % 2) / 2, Game.ActiveXY[1]].Island}", _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(5, 27), _backColor, 1, 1); Draw.Text(e.Graphics, $"({Map.Tile[(Game.ActiveXY[0] - Game.ActiveXY[1] % 2) / 2, Game.ActiveXY[1]].Type})", _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(5, 45), _backColor, 1, 1); int count; //for (count = 0; count < Math.Min(_unitsOnThisTile.Count, maxUnitsToDraw); count++) //{ // //e.Graphics.DrawImage(ModifyImage.Resize(Draw.Unit(UnitsOnThisTile[count], false, 0), (int)Math.Round(64 * 1.15), (int)Math.Round(48 * 1.15)), 6, 70 + count * 56); // //e.Graphics.DrawImage(ModifyImage.Resize(Draw.Unit(UnitsOnThisTile[count], false, 0), 0), 6, 70 + count * 56); // TODO: do this again!!! // Draw.Text(e.Graphics, _unitsOnThisTile[count].HomeCity.Name, _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(79, 70 + count * 56), _backColor, 1, 1); // Draw.Text(e.Graphics, _unitsOnThisTile[count].Order.ToString(), _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(79, 88 + count * 56), _backColor, 1, 1); // TODO: give proper conversion of orders to string // Draw.Text(e.Graphics, _unitsOnThisTile[count].Name, _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(79, 106 + count * 56), _backColor, 1, 1); //} //if (count < _unitsOnThisTile.Count) //{ // string _moreUnits = (_unitsOnThisTile.Count - count == 1) ? "More Unit" : "More Units"; // Draw.Text(e.Graphics, $"({_unitsOnThisTile.Count() - count} {_moreUnits})", _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(5, UnitPanel.Height - 27), _backColor, 1, 1); //} } // Moving units mode else { Draw.Text(e.Graphics, "Moving Units", _font, StringAlignment.Center, StringAlignment.Center, Color.White, new Point(119, 10), Color.Black, 1, 0); // Show active unit info Draw.Unit(e.Graphics, Game.ActiveUnit, false, 1, new Point(7, 27)); // Show move points correctly int _fullMovPts = Game.ActiveUnit.MovePoints / 3; int _remMovPts = Game.ActiveUnit.MovePoints % 3; string _text = $"Moves: {_fullMovPts} {_remMovPts}/3"; if (_remMovPts == 0) { _text = $"Moves: {_fullMovPts}"; } Draw.Text(e.Graphics, _text, _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(79, 25), _backColor, 1, 1); // Show other unit info _cityName = (Game.ActiveUnit.HomeCity == null) ? "NONE" : Game.ActiveUnit.HomeCity.Name; Draw.Text(e.Graphics, _cityName, _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(79, 43), _backColor, 1, 1); Draw.Text(e.Graphics, Game.ActiveCiv.Adjective, _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(79, 61), _backColor, 1, 1); _column = 83; Draw.Text(e.Graphics, Game.ActiveUnit.Name, _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(5, _column), _backColor, 1, 1); _column += 18; Draw.Text(e.Graphics, $"({Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Type})", _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(5, _column), _backColor, 1, 1); // If road/railroad/irrigation/farmland/mine present _wholeText = null; _roadText = null; _irrigText = null; if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Road || Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Railroad || Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Irrigation || Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Farmland || Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Mining) { _column += 18; if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Road) { _roadText = "Road"; } if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Railroad) { _roadText = "Railroad"; } if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Irrigation) { _irrigText = "Irrigation"; } if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Farmland) { _irrigText = "Farmland"; } if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Mining) { _irrigText = "Mining"; } if (_roadText != null && _irrigText == null) { _wholeText = $"({_roadText})"; } else if (_roadText == null && _irrigText != null) { _wholeText = $"({_irrigText})"; } else if (_roadText != null && _irrigText != null) { _wholeText = $"({_roadText}, {_irrigText})"; } Draw.Text(e.Graphics, _wholeText, _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(5, _column), _backColor, 1, 1); } // If airbase/fortress present _airbaseText = null; if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Airbase || Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Fortress) { _column += 18; if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Fortress) { _airbaseText = "Fortress"; } if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Airbase) { _airbaseText = "Airbase"; } Draw.Text(e.Graphics, $"({_airbaseText})", _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(5, _column), _backColor, 1, 1); } // If pollution present if (Map.TileC2(Game.ActiveXY[0], Game.ActiveXY[1]).Pollution) { _column += 18; Draw.Text(e.Graphics, "(Pollution)", _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(5, _column), _backColor, 1, 1); } _column += 5; // Show info for other units on the tile int drawCount = 0; foreach (IUnit unit in _unitsOnThisTile.Where(u => u != Game.ActiveUnit)) { // First check if there is vertical space still left for drawing in panel if (_column + 69 > UnitPanel.Height) { break; } // Draw unit Draw.Unit(e.Graphics, unit, false, 1, new Point(7, _column + 27)); // Show other unit info _column += 20; _cityName = (unit.HomeCity == null) ? "NONE" : Game.ActiveUnit.HomeCity.Name; Draw.Text(e.Graphics, _cityName, _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(80, _column), _backColor, 1, 1); _column += 18; Draw.Text(e.Graphics, Order2string(unit.Order), _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(80, _column), _backColor, 1, 1); _column += 18; Draw.Text(e.Graphics, unit.Name, _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(80, _column), _backColor, 1, 1); System.Diagnostics.Debug.WriteLine($"{unit.Name} drawn"); drawCount++; } // If not all units were drawn print a message if (_unitsOnThisTile.Count - 1 != drawCount) // -1 because you must not count in active unit { _column += 22; _text = _unitsOnThisTile.Count - 1 - drawCount == 1 ? "Unit" : "Units"; Draw.Text(e.Graphics, $"({_unitsOnThisTile.Count - 1 - drawCount} More {_text})", _font, StringAlignment.Near, StringAlignment.Near, _frontColor, new Point(9, _column), _backColor, 1, 1); } } // Blinking "end of turn" message if (WaitingAtEndOfTurn) { using var _font2 = new Font("Times New Roman", 12, FontStyle.Bold); Color _EoTcolor = BoolSwitcher ? Color.White : Color.FromArgb(135, 135, 135); Draw.Text(e.Graphics, "End of Turn", _font2, StringAlignment.Near, StringAlignment.Near, _EoTcolor, new Point(5, UnitPanel.Height - 51), Color.Black, 1, 0); Draw.Text(e.Graphics, "(Press ENTER)", _font2, StringAlignment.Near, StringAlignment.Near, _EoTcolor, new Point(10, UnitPanel.Height - 33), Color.Black, 1, 0); } }
private void ChoicePanel_Paint(object sender, PaintEventArgs e) { using var _brush1 = new SolidBrush(Color.FromArgb(107, 107, 107)); using var _pen1 = new Pen(Color.FromArgb(223, 223, 223)); using var _pen2 = new Pen(Color.FromArgb(67, 67, 67)); using var _fontSelected = new Font("Times New Roman", 16, FontStyle.Bold); using var _fontNotSelected = new Font("Times New Roman", 16, FontStyle.Regular); // Entries for (int row = 0; row < 16; row++) { // Draw selection rectangle & set font of text in it if (_barValue + row == _city.ItemInProduction) { e.Graphics.FillRectangle(_brush1, new Rectangle(85, 2 + row * 23, 556, 21)); e.Graphics.DrawLine(_pen1, 84, 1 + row * 23, 84 + 556 + 1, 1 + row * 23); // Border line e.Graphics.DrawLine(_pen1, 84, 1 + row * 23, 84, 1 + row * 23 + 21); // Border line e.Graphics.DrawLine(_pen2, 84, 1 + row * 23 + 22, 84 + 556 + 1, 1 + row * 23 + 22); // Border line e.Graphics.DrawLine(_pen2, 641, 1 + row * 23, 641, 1 + row * 23 + 21); // Border line } // Draw units if (_barValue + row < _totalNoUnits) { int _unitNo = _barValue + row; // Unit Pic Draw.UnitSprite(e.Graphics, (UnitType)(_barValue + row), false, false, -2, new Point(1 + ((_barValue + row) % 2) * 38, 3 + row * 23 - 8)); // Text if (_barValue + row == _city.ItemInProduction) // Chosen line, draw text with shadow { Draw.Text(e.Graphics, Game.Rules.UnitName[_unitNo], _fontSelected, StringAlignment.Near, StringAlignment.Near, Color.White, new Point(85, row * 23), Color.Black, 1, 1); Draw.Text(e.Graphics, $"(20 Turns, ADM: {Game.Rules.UnitAttack[_unitNo]} / {Game.Rules.UnitDefense[_unitNo]} / {Game.Rules.UnitMove[_unitNo]} HP: { Game.Rules.UnitHitp[_unitNo]} / {Game.Rules.UnitFirepwr[_unitNo]} )", _fontSelected, StringAlignment.Far, StringAlignment.Near, Color.White, new Point(_choicePanel.Width - _verticalBar.Width, row * 23), Color.Black, 1, 1); } else // No shadow { Draw.Text(e.Graphics, Game.Rules.UnitName[_unitNo], _fontNotSelected, StringAlignment.Near, StringAlignment.Near, Color.Black, new Point(85, row * 23)); Draw.Text(e.Graphics, $"(20 Turns, ADM: {Game.Rules.UnitAttack[_unitNo]} / {Game.Rules.UnitDefense[_unitNo]} / {Game.Rules.UnitMove[_unitNo]} HP: { Game.Rules.UnitHitp[_unitNo]} / {Game.Rules.UnitFirepwr[_unitNo]} )", _fontNotSelected, StringAlignment.Far, StringAlignment.Near, Color.Black, new Point(_choicePanel.Width - _verticalBar.Width, row * 23)); } } // Draw improvements else { int _improvNo = _barValue + row - _totalNoUnits + 1; // Improvement pic e.Graphics.DrawImage(Images.Improvements[_improvNo], new Point(1 + ((_barValue + row) % 2) * 38, 3 + row * 23)); // Text if (_barValue + row == _city.ItemInProduction) // Chosen line, draw text with shadow { Draw.Text(e.Graphics, Game.Rules.ImprovementName[_improvNo], _fontSelected, StringAlignment.Near, StringAlignment.Near, Color.White, new Point(85, row * 23), Color.Black, 1, 1); Draw.Text(e.Graphics, "(20 Turns)", _fontSelected, StringAlignment.Far, StringAlignment.Near, Color.White, new Point(_choicePanel.Width - _verticalBar.Width, row * 23 + 1), Color.Black, 1, 1); } else // No shadow { Draw.Text(e.Graphics, Game.Rules.ImprovementName[_improvNo], _fontNotSelected, StringAlignment.Near, StringAlignment.Near, Color.Black, new Point(85, row * 23)); Draw.Text(e.Graphics, "(20 Turns)", _fontNotSelected, StringAlignment.Far, StringAlignment.Near, Color.Black, new Point(_choicePanel.Width - _verticalBar.Width - 1, row * 23)); } } } }
private void MapPanel_Paint(object sender, PaintEventArgs e) { // Title using var _font = new Font("Times New Roman", 17, FontStyle.Bold); Draw.Text(e.Graphics, $"{Game.PlayerCiv.Adjective} Map", _font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(135, 135, 135), new Point(Width / 2, 20), Color.Black, 1, 1); }
private void DrawPanel_Paint(object sender, PaintEventArgs e) { // Text string bcad = (_game.GameYear < 0) ? "B.C." : "A.D."; using var font1 = new Font("Times New Roman", 14); using var font2 = new Font("Times New Roman", 11, FontStyle.Bold); using var font3 = new Font("Times New Roman", 13); Draw.Text(e.Graphics, "TRADE ADVISOR", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 3), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"Kingdom of the {_game.ActiveCiv.TribeName}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 24), Color.FromArgb(67, 67, 67), 2, 1); Draw.Text(e.Graphics, $"King {_game.ActiveCiv.LeaderName} : {Math.Abs(_game.GameYear)} {bcad}", font1, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(302, 45), Color.FromArgb(67, 67, 67), 2, 1); // Trade & maintenance text Draw.Text(e.Graphics, "City Trade", font3, StringAlignment.Near, StringAlignment.Near, Color.White, new Point(140, 80), Color.Black, 1, 1); Draw.Text(e.Graphics, "Maintenance Costs", font3, StringAlignment.Center, StringAlignment.Near, Color.White, new Point(355, 80), Color.Black, 1, 1); // Cities int count = 0; foreach (City city in _game.GetCities.Where(n => n.Owner == _game.ActiveCiv)) { // City image Draw.City(e.Graphics, city, true, 0, new Point(4 + 64 * ((count + 1) % 2), 95 + 24 * count)); // City name Draw.Text(e.Graphics, city.Name, font2, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(142, 105 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); // CITY TRADE // Trade Draw.Text(e.Graphics, city.Trade.ToString(), font2, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(255, 108 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); e.Graphics.DrawImage(Images.CityTaxBig, new Point(260, 111 + 24 * count)); // Science Draw.Text(e.Graphics, city.Science.ToString(), font2, StringAlignment.Center, StringAlignment.Near, Color.FromArgb(223, 223, 223), new Point(290, 108 + 24 * count), Color.FromArgb(67, 67, 67), 1, 1); e.Graphics.DrawImage(Images.CitySciBig, new Point(295, 111 + 24 * count)); count++; } // MAINTENTANCE COSTS // Individual costs count = 0; for (int i = 0; i < 67; i++) { if ((_noOfImprovements[i] > 0) && (_game.Rules.ImprovementUpkeep[i] > 0)) // Only show improvements with upkeep > 0 { Draw.Text(e.Graphics, $"{_noOfImprovements[i]} {_game.Rules.ImprovementName[i]} (Cost: {_upkeepOfImprovements[i]})", font2, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(255, 223, 79), new Point(355, 105 + 24 * count), Color.Black, 1, 1); count++; } } Draw.Text(e.Graphics, $"Total Cost : {_totalCost}", font2, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(255, 223, 79), new Point(355, 300), Color.Black, 1, 1); // TOTALS // Total cost Draw.Text(e.Graphics, $"Total Cost: {_totalCost}", font2, StringAlignment.Near, StringAlignment.Near, Color.White, new Point(142, 270), Color.Black, 1, 1); e.Graphics.DrawImage(Images.CityTaxBig, new Point(245, 270)); // Total income Draw.Text(e.Graphics, $"Total Income: {_totalIncome}", font3, StringAlignment.Near, StringAlignment.Near, Color.White, new Point(142, 295), Color.Black, 1, 1); e.Graphics.DrawImage(Images.CityTaxBig, new Point(245, 295)); // Total science Draw.Text(e.Graphics, $"Total Science: {_totalScience}", font3, StringAlignment.Near, StringAlignment.Near, Color.White, new Point(142, 320), Color.Black, 1, 1); e.Graphics.DrawImage(Images.CitySciBig, new Point(245, 320)); // Discoveries Draw.Text(e.Graphics, $"Discoveries: {_discoveries} Turns", font3, StringAlignment.Near, StringAlignment.Near, Color.White, new Point(142, 345), Color.Black, 1, 1); }
// Draw icons in city resources (surplus < 0 is hunger) public static Bitmap CityResources(City city)//, int foodIcons, int surplusIcons, int tradeIcons, int corruptionIcons, int taxIcons, int luxIcons, int sciIcons, int supportIcons, int productionIcons) { int x_size = 226; int y_size = 151; var icons = new Bitmap(x_size, y_size); using (var g = Graphics.FromImage(icons)) { using var _font = new Font("Arial", 9, FontStyle.Bold); // FOOD // Text Draw.Text(g, $"Food: {city.Food}", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(87, 171, 39), new Point(0, 0), Color.Black, 1, 1); Draw.Text(g, $"Surplus: {city.SurplusHunger}", _font, StringAlignment.Far, StringAlignment.Near, Color.FromArgb(63, 139, 31), new Point(225, 0), Color.Black, 1, 1); // Number of food+surplus/hunger icons determines spacing between icons int spacing; switch (city.Food + Math.Abs(city.SurplusHunger)) { case int n when(n >= 1 && n <= 15): spacing = 15; break; // norm=15, big=23, gap=1px case int n when(n == 16 || n == 17): spacing = 13; break; // norm=13, big=20, overlap=1px case int n when(n == 18 || n == 19): spacing = 11; break; // norm=11, big=17, overlap=3px case int n when(n == 20 || n == 21): spacing = 10; break; // norm=10, big=15, overlap=4px case int n when(n == 22 || n == 23): spacing = 9; break; // norm=9, big=14, overlap=5px case int n when(n == 24 || n == 25): spacing = 8; break; // norm=8, big=12, overlap=6px case int n when(n >= 26 && n <= 29): spacing = 7; break; // norm=7, big=11, overlap=7px case int n when(n >= 30 && n <= 33): spacing = 6; break; // norm=6, big=9, overlap=8px case int n when(n >= 34 && n <= 37): spacing = 5; break; // norm=5, big=8, overlap=9px case int n when(n >= 38 && n <= 49): spacing = 4; break; // norm=4, big=6, overlap=10px case int n when(n >= 50 && n <= 65): spacing = 3; break; // norm=3, big=5, overlap=11px case int n when(n >= 66): spacing = 2; break; // norm=2, big=3, overlap=12px default: spacing = 2; break; } // TODO: Draw background rectangle //g.FillRectangle(new SolidBrush(Color.FromArgb(71, 147, 31)), 0, 0, spacing * city.Food + 21 - spacing + 6, 23); // Background square for food //g.FillRectangle(new SolidBrush(Color.FromArgb(55, 123, 23)), x_size - (spacing * Math.Abs(city.SurplusHunger) + 21 - spacing + 3), // 0, spacing * Math.Abs(city.SurplusHunger) + 21 - spacing + 6, 23); // Background square for surplus/hunger // Icons for (int i = 0; i < city.Food; i++) { g.DrawImage(Images.CityFoodBig, i * spacing + 3, 15); } for (int i = 0; i < Math.Abs(city.SurplusHunger); i++) { if (city.SurplusHunger < 0) { g.DrawImage(Images.CityHungerBig, x_size - (spacing * Math.Abs(city.SurplusHunger) + 14 - spacing) + i * spacing, 15); // Hunger } else { g.DrawImage(Images.CityFoodBig, x_size - (spacing * Math.Abs(city.SurplusHunger) + 14 - spacing) + i * spacing, 15); // Surplus } } // TRADE // Text Draw.Text(g, $"Trade: {city.Trade}", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(239, 159, 7), new Point(0, 41), Color.Black, 1, 1); Draw.Text(g, $"Corruption: {city.Corruption}", _font, StringAlignment.Far, StringAlignment.Near, Color.FromArgb(227, 83, 15), new Point(225, 41), Color.Black, 1, 1); // Spacing between icons switch (city.Trade + city.Corruption) { case int n when(n >= 1 && n <= 15): spacing = 15; break; // norm=15, big=23, gap=1px case int n when(n == 16 || n == 17): spacing = 13; break; // norm=13, big=20, overlap=1px case int n when(n == 18 || n == 19): spacing = 11; break; // norm=11, big=17, overlap=3px case int n when(n == 20 || n == 21): spacing = 10; break; // norm=10, big=15, overlap=4px case int n when(n == 22 || n == 23): spacing = 9; break; // norm=9, big=14, overlap=5px case int n when(n == 24 || n == 25): spacing = 8; break; // norm=8, big=12, overlap=6px case int n when(n >= 26 && n <= 29): spacing = 7; break; // norm=7, big=11, overlap=7px case int n when(n >= 30 && n <= 33): spacing = 6; break; // norm=6, big=9, overlap=8px case int n when(n >= 34 && n <= 37): spacing = 5; break; // norm=5, big=8, overlap=9px case int n when(n >= 38 && n <= 49): spacing = 4; break; // norm=4, big=6, overlap=10px case int n when(n >= 50 && n <= 65): spacing = 3; break; // norm=3, big=5, overlap=11px case int n when(n >= 66): spacing = 2; break; // norm=2, big=3, overlap=12px default: spacing = 2; break; } // TODO: Draw background rectangle //g.FillRectangle(new SolidBrush(Color.FromArgb(71, 147, 31)), 0, 0, spacing * foodIcons + 21 - spacing + 6, 23); //background square for food //g.FillRectangle(new SolidBrush(Color.FromArgb(55, 123, 23)), x_size - (spacing * Math.Abs(surplusIcons) + 21 - spacing + 3), 0, spacing * Math.Abs(surplusIcons) + 21 - spacing + 6, 23); //background square for surplus/hunger // Icons for (int i = 0; i < city.Trade; i++) { g.DrawImage(Images.CityTradeBig, i * spacing + 3, 56); } for (int i = 0; i < city.Corruption; i++) { g.DrawImage(Images.CityCorruptBig, x_size - (spacing * city.Corruption + 14 - spacing) + i * spacing, 56); } // TAX+LUX+SCI // Text Draw.Text(g, $"50% Tax: {city.Tax}", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(239, 159, 7), new Point(0, 95), Color.Black, 1, 1); Draw.Text(g, $"0% Lux: {city.Lux}", _font, StringAlignment.Center, StringAlignment.Near, Color.White, new Point(111, 95), Color.Black, 1, 1); Draw.Text(g, $"50% Sci: {city.Science}", _font, StringAlignment.Far, StringAlignment.Near, Color.FromArgb(63, 187, 199), new Point(225, 95), Color.Black, 1, 1); // Spacing between icons switch (city.Tax + city.Lux + city.Science) { case int n when(n >= 1 && n <= 15): spacing = 15; break; // norm=15, big=23, gap=1px case int n when(n == 16 || n == 17): spacing = 13; break; // norm=13, big=20, overlap=1px case int n when(n == 18 || n == 19): spacing = 11; break; // norm=11, big=17, overlap=3px case int n when(n == 20 || n == 21): spacing = 10; break; // norm=10, big=15, overlap=4px case int n when(n == 22 || n == 23): spacing = 9; break; // norm=9, big=14, overlap=5px case int n when(n == 24 || n == 25): spacing = 8; break; // norm=8, big=12, overlap=6px case int n when(n >= 26 && n <= 29): spacing = 7; break; // norm=7, big=11, overlap=7px case int n when(n >= 30 && n <= 33): spacing = 6; break; // norm=6, big=9, overlap=8px case int n when(n >= 34 && n <= 37): spacing = 5; break; // norm=5, big=8, overlap=9px case int n when(n >= 38 && n <= 49): spacing = 4; break; // norm=4, big=6, overlap=10px case int n when(n >= 50 && n <= 65): spacing = 3; break; // norm=3, big=5, overlap=11px case int n when(n >= 66): spacing = 2; break; // norm=2, big=3, overlap=12px default: spacing = 2; break; } // TODO: Draw background rectangle //g.FillRectangle(new SolidBrush(Color.FromArgb(71, 147, 31)), 0, 0, spacing * foodIcons + 21 - spacing + 6, 23); //background square for food //g.FillRectangle(new SolidBrush(Color.FromArgb(55, 123, 23)), x_size - (spacing * Math.Abs(surplusIcons) + 21 - spacing + 3), 0, spacing * Math.Abs(surplusIcons) + 21 - spacing + 6, 23); //background square for surplus/hunger // Icons for (int i = 0; i < city.Tax; i++) { g.DrawImage(Images.CityTaxBig, i * spacing + 3, 80); } for (int i = 0; i < city.Science; i++) { g.DrawImage(Images.CitySciBig, x_size - (spacing * city.Science + 14 - spacing) + i * spacing, 80); } for (int i = 0; i < city.Lux; i++) { g.DrawImage(Images.CityLuxBig, x_size / 2 - (spacing * city.Lux + 14 - spacing) / 2, 80); } // SUPPORT+PRODUCTION // Text Draw.Text(g, $"Support: {city.Support}", _font, StringAlignment.Near, StringAlignment.Near, Color.FromArgb(63, 79, 167), new Point(0, 135), Color.Black, 1, 1); Draw.Text(g, $"Production: {city.Production}", _font, StringAlignment.Far, StringAlignment.Near, Color.FromArgb(7, 11, 103), new Point(225, 135), Color.Black, 1, 1); // Spacing between icons switch (city.Support + city.Production) { case int n when(n >= 1 && n <= 15): spacing = 15; break; // norm=15, big=23, gap=1px case int n when(n == 16 || n == 17): spacing = 13; break; // norm=13, big=20, overlap=1px case int n when(n == 18 || n == 19): spacing = 11; break; // norm=11, big=17, overlap=3px case int n when(n == 20 || n == 21): spacing = 10; break; // norm=10, big=15, overlap=4px case int n when(n == 22 || n == 23): spacing = 9; break; // norm=9, big=14, overlap=5px case int n when(n == 24 || n == 25): spacing = 8; break; // norm=8, big=12, overlap=6px case int n when(n >= 26 && n <= 29): spacing = 7; break; // norm=7, big=11, overlap=7px case int n when(n >= 30 && n <= 33): spacing = 6; break; // norm=6, big=9, overlap=8px case int n when(n >= 34 && n <= 37): spacing = 5; break; // norm=5, big=8, overlap=9px case int n when(n >= 38 && n <= 49): spacing = 4; break; // norm=4, big=6, overlap=10px case int n when(n >= 50 && n <= 65): spacing = 3; break; // norm=3, big=5, overlap=11px case int n when(n >= 66): spacing = 2; break; // norm=2, big=3, overlap=12px default: spacing = 2; break; } // TODO: Draw background rectangle //g.FillRectangle(new SolidBrush(Color.FromArgb(71, 147, 31)), 0, 0, spacing * foodIcons + 21 - spacing + 6, 23); //background square for food //g.FillRectangle(new SolidBrush(Color.FromArgb(55, 123, 23)), x_size - (spacing * Math.Abs(surplusIcons) + 21 - spacing + 3), 0, spacing * Math.Abs(surplusIcons) + 21 - spacing + 6, 23); //background square for surplus/hunger // Icons for (int i = 0; i < city.Support; i++) { g.DrawImage(Images.CitySupportBig, i * spacing + 3, 121); } for (int i = 0; i < city.Production; i++) { g.DrawImage(Images.CitySupportBig, x_size - (spacing * city.Production + 14 - spacing) + i * spacing, 121); } } return(icons); }