private void DrawHappyRow(Picture output, int yy, int happy, int content, int unhappy, int ent, int sci, int tax) { int dex = 0; for (int x = 0; x < happy; x++) { output.AddLayer(Icons.Citizen((x % 2 == 0) ? Citizen.HappyMale : Citizen.HappyFemale), 7 + (8 * dex++), yy); } for (int x = 0; x < content; x++) { output.AddLayer(Icons.Citizen((x % 2 == 0) ? Citizen.ContentMale : Citizen.ContentFemale), 7 + (8 * dex++), yy); } for (int x = 0; x < unhappy; x++) { output.AddLayer(Icons.Citizen((x % 2 == 0) ? Citizen.UnhappyMale : Citizen.UnhappyFemale), 7 + (8 * dex++), yy); } for (int x = 0; x < ent; x++) { output.AddLayer(Icons.Citizen(Citizen.Entertainer), 7 + (8 * dex++), yy); } for (int x = 0; x < sci; x++) { output.AddLayer(Icons.Citizen(Citizen.Scientist), 7 + (8 * dex++), yy); } for (int x = 0; x < tax; x++) { output.AddLayer(Icons.Citizen(Citizen.Taxman), 7 + (8 * dex++), yy); } }
public override bool HasUpdate(uint gameTick) { if (_update) { string population = _city.Population.ToString("n0", new CultureInfo("en-US")); _canvas.FillLayerTile(_background); _canvas.AddBorder(1, 1, 0, 0, 207, 21); _canvas.FillRectangle(0, 207, 0, 1, 21); _canvas.DrawText($"{_city.Name} (Pop:{population})", 1, 17, 104, 1, TextAlign.Center); Citizen[] citizens = _city.Citizens.ToArray(); int xx = 0; for (int i = 0; i < _city.Size; i++) { xx += 8; if (i > 0) { if ((int)citizens[i] >= 6 && (int)citizens[i - 1] < 6) { xx += 6; } } AddLayer(Icons.Citizen(citizens[i]), xx, 7); } _update = false; } return(true); }
protected override bool HasUpdate(uint gameTick) { if (_update) { string population = Common.NumberSeperator(_city.Population); this.Tile(Pattern.PanelBlue) .DrawRectangle(colour: 1) .DrawText($"{_city.Name} (Pop:{population})", 1, 17, (int)Math.Ceiling((float)Width / 2), 1, TextAlign.Center); int xx = 0; int group = -1; Citizen[] citizens = _city.Citizens.ToArray(); for (int i = 0; i < _city.Size; i++) { xx += 8; if (group != (group = Common.CitizenGroup(citizens[i])) && group > 0 && i > 0) { xx += 2; if (group == 3) { xx += 4; } } this.AddLayer(Icons.Citizen(citizens[i]), xx, 7); } _update = false; } return(true); }
protected override bool HasUpdate(uint gameTick) { if (!_update) { return(false); } for (int i = 0; i < _cities.Length; i++) { City city = _cities[i]; if (city == null || city.Size == 0) { continue; } byte colour = Common.ColourLight[city.Owner]; int xx = 8; int yy = 32 + (32 * i); int ww = 304; int hh = 26; Player owner = Game.GetPlayer(city.Owner); this.FillRectangle(xx, yy, ww, hh, colour) .FillRectangle(xx + 1, yy + 1, ww - 2, hh - 2, 3); int dx = 42; int group = -1; Citizen[] citizens = city.Citizens.ToArray(); for (int j = 0; j < city.Size; j++) { dx += 8; if (group != (group = Common.CitizenGroup(citizens[j])) && group > 0 && i > 0) { dx += 2; if (group == 3) { dx += 4; } } this.AddLayer(Icons.Citizen(citizens[j]), dx, yy + 10); } dx += 16; foreach (IWonder wonder in city.Wonders) { this.AddLayer(wonder.SmallIcon, dx, yy + 11); dx += 19; } this.DrawText($"{i + 1}. {city.Name} ({owner.Civilization.Name})", 0, 15, 160, yy + 3, TextAlign.Center); } _update = false; return(true); }
// TODO max wide is 35 citizens private void DrawCityCitizens(City _city) { int group = -1; Citizen[] citizens = _city.Citizens.ToArray(); for (int i = 0; i < _city.Size; i++) { // TODO probably need to stick to a fixed width _xx += 8; if (group != (group = Common.CitizenGroup(citizens[i])) && group > 0 && i > 0) { _xx += (group == 3) ? 4 : 2; } this.AddLayer(Icons.Citizen(citizens[i]), _xx, _citizenY); } }
private void DrawCitizens(City city, int x, int y) { Citizen[] citizens = city.Citizens.ToArray(); for (int j = 0; j < city.Size; j++) { x += 8; if (j > 0) { if (citizens[j] == Citizen.Entertainer && citizens[j - 1] != Citizen.Entertainer) { x += 6; } } AddLayer(Icons.Citizen(citizens[j]), x, y - 4); } }
private void DrawCitizens(City city, int x, int y) { int group = -1; Citizen[] citizens = city.Citizens.ToArray(); for (int j = 0; j < city.Size; j++) { x += 8; if (group != (group = Common.CitizenGroup(citizens[j])) && group > 0 && j > 0) { x += 2; if (group == 3) { x += 4; } } this.AddLayer(Icons.Citizen(citizens[j]), x, y - 4); } }