public CheckboxPanel(int width, int height, string title, string[] _checkboxNames, string[] buttonTexts) : base(width, height, 38, 46, title)
        {
            checkboxNames = _checkboxNames;

            // Buttons
            Button = new Civ2button[buttonTexts.Length];
            int btnW = (this.Width - 2 * 9 - 3 * (buttonTexts.Length - 1)) / buttonTexts.Length;  // Determine width of one button

            for (int i = 0; i < buttonTexts.Length; i++)
            {
                Button[i] = new Civ2button(buttonTexts[i], btnW, 36, new Font("Times new roman", 11));
                MainPanelLayout.Add(Button[i], 9 + btnW * i + 3 * i, Height - 46);
            }

            var InnerPanelLayout = new PixelLayout();

            InnerPanelLayout.Size = new Size(width, height);

            // Make checkbox fields for each option
            CheckboxFields = new List <Panel>();
            for (int i = 0; i < checkboxNames.Length; i++)
            {
                var panel = new Panel
                {
                    BackgroundColor = Colors.Transparent
                };
                InnerPanelLayout.Add(panel, 10, 32 * i + 4);
                panel.MouseDown += CheckboxFields_Click;
                CheckboxFields.Add(panel);
            }

            InnerPanel.Paint  += InnerPanel_Paint;
            InnerPanel.Content = InnerPanelLayout;
        }
示例#2
0
        public CityStatusWindow() : base(622, 421, 11, 11)
        {
            if (Game.GetActiveCiv.Cities.Count > 12)
            {
                bar = new VScrollBar()
                {
                    Height = 305, Value = 0, Maximum = Game.GetActiveCiv.Cities.Count
                };
                bar.ValueChanged += (_, _) =>
                {
                    barVal0 = bar.Value;
                    Surface.Invalidate();
                };
                Layout.Add(bar, 592, 79);
            }

            barVal0 = bar is null ? 0 : bar.Value;

            KeyDown += (sender, args) =>
            {
                if (args.Key is Keys.Escape)
                {
                    Close();
                }
            };

            var btn = new Civ2button("Close", 596, 24, new Font("Times new roman", 11));

            btn.Click += (_, _) => Close();
            Layout.Add(btn, 13, 385);

            Surface.Paint += Surface_Paint;
            Content        = Layout;
        }
示例#3
0
        public RadioButtonPanel(int width, int height, string title, string[] choiceNames, string[] buttonTexts) : base(width, height, 38, 46, title)
        {
            // Buttons
            Button = new Civ2button[buttonTexts.Length];
            int btnW = (this.Width - 2 * 9 - 3 * (buttonTexts.Length - 1)) / buttonTexts.Length;  // Determine width of one button

            for (int i = 0; i < buttonTexts.Length; i++)
            {
                Button[i] = new Civ2button(buttonTexts[i], btnW, 36, new Font("Times new roman", 11));
                MainPanelLayout.Add(Button[i], 9 + btnW * i + 3 * i, Height - 46);
            }

            // Radio buttons
            var layout2    = new PixelLayout();
            var controller = new RadioButton();

            RadioBtn = new RadioButton[choiceNames.Length];
            for (int row = 0; row < choiceNames.Length; row++)
            {
                RadioBtn[row] = new RadioButton(controller)
                {
                    Text = choiceNames[row], Font = new Font("Times new roman", 18), Size = new Size(InnerPanel.Width, 33), TextColor = Color.FromArgb(51, 51, 51)
                };
                layout2.Add(RadioBtn[row], 10, row * 33);
            }
            layout2.Size       = new Size(InnerPanel.Width, InnerPanel.Height);
            InnerPanel.Content = layout2;

            MainPanel.Content = MainPanelLayout;
        }
示例#4
0
        public DefenseMinisterWindow() : base(622, 421, 11, 11)
        {
            showCasualties = false;

            // Unit definitions for stats view
            var sortedTypes = Game.Rules.UnitTypes.Select(c => c.Type).ToList();

            unitStatDefs = Game.GetActiveCiv.Units.Where(u => !u.Dead).Select(u => u.TypeDefinition).Distinct().ToList().
                           OrderBy(x => sortedTypes.IndexOf(x.Type)).ToList();

            // Unit definitions for casualties view
            unitCasDefs = Game.GetActiveCiv.Units.Where(u => u.Dead).Select(u => u.TypeDefinition).Distinct().ToList().
                          OrderBy(x => sortedTypes.IndexOf(x.Type)).ToList();
            var ok = Game.GetActiveCiv.Units.Where(u => u.Dead);

            if (unitStatDefs.Count > 12)
            {
                bar = new VScrollBar()
                {
                    Height = 305, Value = 0, Maximum = unitStatDefs.Count
                };
                bar.ValueChanged += (_, _) =>
                {
                    barVal0 = bar.Value;
                    Surface.Invalidate();
                };
                Layout.Add(bar, 592, 79);
            }

            barVal0 = bar is null ? 0 : bar.Value;

            KeyDown += (sender, args) =>
            {
                if (args.Key is Keys.Escape)
                {
                    Close();
                }
            };

            var btn1 = new Civ2button("Close", 297, 24, new Font("Times new roman", 11));

            btn1.Click += (_, _) => Close();
            Layout.Add(btn1, 312, 385);

            var btn2 = new Civ2button("Casualties", 297, 24, new Font("Times new roman", 11));

            btn2.Click += (_, _) =>
            {
                showCasualties = !showCasualties;
                if (showCasualties)
                {
                    btn2.Text = "Statistics";
                }
                else
                {
                    btn2.Text = "Casualties";
                }
                Surface.Invalidate();
            };
            Layout.Add(btn2, 13, 385);

            Surface.Paint += Surface_Paint;
            Content        = Layout;
        }
示例#5
0
        public RadiobuttonPanel(Main parent, int width, int height, string title, string[] checkboxNames, string[] buttonTexts) : base(parent, width, height, 38, 46, title)
        {
            RadioBtnList = new RadioButtonList()
            {
                DataStore   = checkboxNames,
                Orientation = Orientation.Vertical
            };
            RadioBtnList.SelectedIndexChanged += (sender, e) => innerPanel.Invalidate();
            RadioBtnList.GotFocus             += (sender, e) => innerPanel.Invalidate();
            Layout.Add(RadioBtnList, 11 + 10, 40);

            // Define formatted texts
            var _font1  = new Font("Times New Roman", 18);
            var _brush1 = new SolidBrush(Color.FromArgb(51, 51, 51));

            FormattedText[] formattedText = new FormattedText[checkboxNames.Length];
            for (int i = 0; i < checkboxNames.Length; i++)
            {
                formattedText[i] = new FormattedText()
                {
                    Font            = _font1,
                    ForegroundBrush = _brush1,
                    Text            = checkboxNames[i]
                };
            }

            innerPanel = new Drawable()
            {
                Size = new Size(width - 2 * 11, height - 38 - 46), BackgroundColor = Colors.Black
            };
            innerPanel.Paint += (_, e) =>
            {
                // Background
                var imgSize = MapImages.PanelInnerWallpaper.Size;
                for (int row = 0; row < this.Height / imgSize.Height + 1; row++)
                {
                    for (int col = 0; col < this.Width / imgSize.Width + 1; col++)
                    {
                        e.Graphics.DrawImage(MapImages.PanelInnerWallpaper, col * imgSize.Width, row * imgSize.Height);
                    }
                }

                // Draw radio btn, text, text outline
                for (int row = 0; row < checkboxNames.Length; row++)
                {
                    Draw.RadioBtn(e.Graphics, RadioBtnList.SelectedIndex == row, new Point(10, 9 + 32 * row));

                    e.Graphics.DrawText(formattedText[row], new Point(36, 32 * row + 4));

                    using var _pen = new Pen(Color.FromArgb(64, 64, 64));
                    if (RadioBtnList.SelectedIndex == row)
                    {
                        e.Graphics.DrawRectangle(_pen, new Rectangle(34, 5 + 32 * row, innerPanel.Width - 37, 26));
                    }
                }
            };
            innerPanel.MouseDown += (sender, e) =>
            {
                for (int row = 0; row < checkboxNames.Length; row++)
                {
                    // Update if row is clicked
                    if (e.Location.X > 7 && e.Location.X < innerPanel.Width - 2 && e.Location.Y > 5 + 32 * row && e.Location.Y < 33 + 32 * row)
                    {
                        RadioBtnList.SelectedIndex = row;
                        innerPanel.Invalidate();
                    }
                }
            };
            Layout.Add(innerPanel, 11, 38);

            // Buttons
            Button = new Civ2button[buttonTexts.Length];
            int btnW = (this.Width - 2 * 9 - 3 * (buttonTexts.Length - 1)) / buttonTexts.Length;  // Determine width of one button

            for (int i = 0; i < buttonTexts.Length; i++)
            {
                Button[i] = new Civ2button(buttonTexts[i], btnW, 36, new Font("Times new roman", 11));
                Layout.Add(Button[i], 9 + btnW * i + 3 * i, Height - 46);
            }

            Content = Layout;
        }
示例#6
0
        public TaxRateWindow(Main parent) : base(parent, 622, 432, paddingBtmInnerPanel: 10, title: "How Shall We Distribute The Wealth?")
        {
            main = parent;

            taxRate = Game.GetActiveCiv.TaxRate;
            sciRate = Game.GetActiveCiv.ScienceRate;
            luxRate = Game.GetActiveCiv.LuxRate;
            maxRate = 80;

            DefaultButton = new Civ2button(Labels.Ok, 596, 28, new Font("Times new roman", 11));

            taxCheckbox = new CheckBox()
            {
                Visible = false
            };
            taxCheckbox.CheckedChanged += (_, _) =>
            {
                if (taxCheckbox.Checked == true)
                {
                    sciCheckbox.Checked = false;
                    luxCheckbox.Checked = false;
                }
                Surface.Invalidate();
            };
            taxCheckbox.GotFocus += (_, _) => Surface.Invalidate();
            Layout.Add(taxCheckbox, 561, 207);

            sciCheckbox = new CheckBox()
            {
                Visible = false
            };
            sciCheckbox.CheckedChanged += (_, _) =>
            {
                if (sciCheckbox.Checked == true)
                {
                    taxCheckbox.Checked = false;
                    luxCheckbox.Checked = false;
                }
                Surface.Invalidate();
            };
            sciCheckbox.GotFocus += (_, _) => Surface.Invalidate();
            Layout.Add(sciCheckbox, 561, 268);

            luxCheckbox = new CheckBox()
            {
                Visible = false
            };
            luxCheckbox.CheckedChanged += (_, _) =>
            {
                if (luxCheckbox.Checked == true)
                {
                    taxCheckbox.Checked = false;
                    sciCheckbox.Checked = false;
                }
                Surface.Invalidate();
            };
            luxCheckbox.GotFocus += (_, _) => Surface.Invalidate();
            Layout.Add(luxCheckbox, 561, 329);

            taxBar = new HScrollBar()
            {
                Width = 505, Maximum = 10, Value = taxRate / 10
            };
            sciBar = new HScrollBar()
            {
                Width = 505, Maximum = 10, Value = sciRate / 10
            };
            luxBar = new HScrollBar()
            {
                Width = 505, Maximum = 10, Value = luxRate / 10
            };
            taxBar.ValueChanged += (_, _) =>
            {
                incTax = (taxBar.Value * 10 > taxRate);
                decTax = (taxBar.Value * 10 < taxRate);
                if (decTax)
                {
                    maxWarn = false;
                }

                taxRate = taxBar.Value * 10;

                if (taxRate > maxRate)
                {
                    taxRate = maxRate;
                    maxWarn = true;
                }
                else
                {
                    if (incTax)
                    {
                        if (taxRate + sciRate + luxRate != 100)
                        {
                            if (luxRate != 0 && luxCheckbox.Checked == false)
                            {
                                luxRate -= 10;
                            }
                            else if (sciRate != 0 && sciCheckbox.Checked == false)
                            {
                                sciRate -= 10;
                            }

                            if (taxRate + sciRate + luxRate != 100)
                            {
                                taxRate -= 10;
                            }
                        }
                    }
                    else
                    {
                        if (taxRate + sciRate + luxRate != 100)
                        {
                            if (luxRate != maxRate && luxCheckbox.Checked == false)
                            {
                                luxRate += 10;
                            }
                            else if (sciRate != maxRate && sciCheckbox.Checked == false)
                            {
                                sciRate += 10;
                            }

                            if (taxRate + sciRate + luxRate != 100)
                            {
                                taxRate += 10;
                            }
                        }
                    }
                }

                if ((sciBar.Value * 10 > sciRate) || (luxBar.Value * 10 > luxRate))
                {
                    maxWarn = false;
                }

                taxBar.Value = taxRate / 10;
                sciBar.Value = sciRate / 10;
                luxBar.Value = luxRate / 10;
                Invalidate();
            };
            sciBar.ValueChanged += (_, _) =>
            {
                incSci = (sciBar.Value * 10 > sciRate);
                decSci = (sciBar.Value * 10 < sciRate);
                if (decSci)
                {
                    maxWarn = false;
                }

                sciRate = sciBar.Value * 10;

                if (sciRate > maxRate)
                {
                    sciRate = maxRate;
                    maxWarn = true;
                }
                else
                {
                    if (incSci)
                    {
                        if (taxRate + sciRate + luxRate != 100)
                        {
                            if (luxRate != 0 && luxCheckbox.Checked == false)
                            {
                                luxRate -= 10;
                            }
                            else if (taxRate != 0 && taxCheckbox.Checked == false)
                            {
                                taxRate -= 10;
                            }

                            if (taxRate + sciRate + luxRate != 100)
                            {
                                sciRate -= 10;
                            }
                        }
                    }
                    else
                    {
                        if (taxRate + sciRate + luxRate != 100)
                        {
                            if (luxRate != maxRate && luxCheckbox.Checked == false)
                            {
                                luxRate += 10;
                            }
                            else if (taxRate != maxRate && taxCheckbox.Checked == false)
                            {
                                taxRate += 10;
                            }

                            if (taxRate + sciRate + luxRate != 100)
                            {
                                sciRate += 10;
                            }
                        }
                    }
                }

                if ((taxBar.Value * 10 > taxRate) || (luxBar.Value * 10 > luxRate))
                {
                    maxWarn = false;
                }

                taxBar.Value = taxRate / 10;
                sciBar.Value = sciRate / 10;
                luxBar.Value = luxRate / 10;
                Invalidate();
            };
            luxBar.ValueChanged += (_, _) =>
            {
                incLux = (luxBar.Value * 10 > luxRate);
                decLux = (luxBar.Value * 10 < luxRate);
                if (decLux)
                {
                    maxWarn = false;
                }

                luxRate = luxBar.Value * 10;

                if (luxRate > maxRate)
                {
                    luxRate = maxRate;
                    maxWarn = true;
                }
                else
                {
                    if (incLux)
                    {
                        if (taxRate + sciRate + luxRate != 100)
                        {
                            if (taxRate != 0 && taxCheckbox.Checked == false)
                            {
                                taxRate -= 10;
                            }
                            else if (sciRate != 0 && sciCheckbox.Checked == false)
                            {
                                sciRate -= 10;
                            }

                            if (taxRate + sciRate + luxRate != 100)
                            {
                                luxRate -= 10;
                            }
                        }
                    }
                    else
                    {
                        if (taxRate + sciRate + luxRate != 100)
                        {
                            if (taxRate != maxRate && taxCheckbox.Checked == false)
                            {
                                taxRate += 10;
                            }
                            else if (sciRate != maxRate && sciCheckbox.Checked == false)
                            {
                                sciRate += 10;
                            }

                            if (taxRate + sciRate + luxRate != 100)
                            {
                                luxRate += 10;
                            }
                        }
                    }
                }

                if ((taxBar.Value * 10 > taxRate) || (sciBar.Value * 10 > sciRate))
                {
                    maxWarn = false;
                }

                taxBar.Value = taxRate / 10;
                sciBar.Value = sciRate / 10;
                luxBar.Value = luxRate / 10;
                Invalidate();
            };
            Layout.Add(taxBar, 26, 209);
            Layout.Add(sciBar, 26, 270);
            Layout.Add(luxBar, 26, 331);

            Surface.Paint += Surface_Paint;

            Surface.MouseDown += (_, e) =>
            {
                if (e.Location.X > 560 && e.Location.X < 580 && e.Location.Y > 206 && e.Location.Y < 226)
                {
                    taxCheckbox.Checked = !taxCheckbox.Checked;
                    taxCheckbox.Focus();
                    taxCheckbox.Invalidate();
                }

                if (e.Location.X > 560 && e.Location.X < 580 && e.Location.Y > 267 && e.Location.Y < 287)
                {
                    sciCheckbox.Checked = !sciCheckbox.Checked;
                    sciCheckbox.Focus();
                    sciCheckbox.Invalidate();
                }

                if (e.Location.X > 560 && e.Location.X < 580 && e.Location.Y > 328 && e.Location.Y < 348)
                {
                    luxCheckbox.Checked = !luxCheckbox.Checked;
                    luxCheckbox.Focus();
                    luxCheckbox.Invalidate();
                }
            };

            DefaultButton.Click += (sender, e) => CloseWindow();

            KeyDown += (sender, args) =>
            {
                if (args.Key is Keys.Escape)
                {
                    CloseWindow();
                }
            };

            Layout.Add(DefaultButton, 13, 392);
            Content = Layout;
        }
示例#7
0
        public SelectUnitDialog(Main parent, List <Unit> units) : base(parent, 514 + 2 * 11, 46 * Math.Min(units.Count, 9) + 38 + 46, 38, 46, "Select Unit To Activate")
        {
            var shownUnits = units.Take(9).ToList();

            radioBtnList = new RadioButtonList()
            {
                DataStore   = shownUnits,
                Orientation = Orientation.Vertical
            };
            radioBtnList.SelectedIndexChanged += (sender, e) => innerPanel.Invalidate();
            radioBtnList.GotFocus             += (sender, e) => innerPanel.Invalidate();
            Layout.Add(radioBtnList, 11 + 10, 40);

            innerPanel = new Drawable()
            {
                Size = new Size(514, 46 * shownUnits.Count)
            };
            innerPanel.Paint += (sender, e) =>
            {
                e.Graphics.AntiAlias = false;

                // Background
                var imgSize = MapImages.PanelInnerWallpaper.Size;
                for (int row = 0; row < this.Height / imgSize.Height + 1; row++)
                {
                    for (int col = 0; col < this.Width / imgSize.Width + 1; col++)
                    {
                        e.Graphics.DrawImage(MapImages.PanelInnerWallpaper, col * imgSize.Width, row * imgSize.Height);
                    }
                }

                // Draw units, unit outline, text
                for (int row = 0; row < shownUnits.Count; row++)
                {
                    Draw.Unit(e.Graphics, shownUnits[row], false, -1, new Point(2, 2 + 46 * row));

                    string _homeCity = shownUnits[row].HomeCity == null ? "NONE" : shownUnits[row].HomeCity.Name;
                    Draw.Text(e.Graphics, $"{shownUnits[row].Owner.Adjective} {shownUnits[row].Name} ({_homeCity})", new Font("Times New Roman", 18), Color.FromArgb(51, 51, 51), new Point(61, 9 + 46 * row), false, false, Color.FromArgb(191, 191, 191), 1, 1);

                    using var _pen = new Pen(Color.FromArgb(223, 223, 223));
                    if (radioBtnList.SelectedIndex == row)
                    {
                        e.Graphics.DrawRectangle(_pen, new Rectangle(1, 1 + 46 * row, 57, 42));
                    }
                }
            };
            innerPanel.MouseDown += (sender, e) =>
            {
                int clickedRow = ((int)e.Location.Y - 1) / 46;

                shownUnits[clickedRow].Order = OrderType.NoOrders;

                radioBtnList.SelectedIndex = clickedRow;
                innerPanel.Invalidate();
            };
            Layout.Add(innerPanel, 11, 38);

            // Buttons
            DefaultButton = new Civ2button("OK", 258, 36, new Font("Times new roman", 11));
            AbortButton   = new Civ2button("Cancel", 258, 36, new Font("Times new roman", 11));
            Layout.Add(DefaultButton, 9, 42 + innerPanel.Height);
            Layout.Add(AbortButton, 11 + DefaultButton.Width, 42 + innerPanel.Height);

            DefaultButton.Click += (sender, e) =>
            {
                foreach (MenuItem item in parent.Menu.Items)
                {
                    item.Enabled = true;
                }
                SelectedIndex = radioBtnList.SelectedIndex;
                Close();
            };

            AbortButton.Click += (sender, e) =>
            {
                foreach (MenuItem item in parent.Menu.Items)
                {
                    item.Enabled = true;
                }
                SelectedIndex = int.MinValue;
                Close();
            };

            Content = Layout;
        }
示例#8
0
        public CheckboxPanel(Main parent, int width, int height, string title, string[] checkboxNames, string[] buttonTexts) : base(parent, width, height, 38, 46, title)
        {
            // Define formatted texts
            var _font1  = new Font("Times New Roman", 18);
            var _brush1 = new SolidBrush(Color.FromArgb(51, 51, 51));

            FormattedText[] formattedText = new FormattedText[checkboxNames.Length];
            for (int i = 0; i < checkboxNames.Length; i++)
            {
                formattedText[i] = new FormattedText()
                {
                    Font            = _font1,
                    ForegroundBrush = _brush1,
                    Text            = checkboxNames[i]
                };
            }

            CheckBox = new CheckBox[checkboxNames.Length];
            for (int row = 0; row < checkboxNames.Length; row++)
            {
                CheckBox[row] = new CheckBox()
                {
                    Text = checkboxNames[row], Font = new Font("Times New Roman", 18), TextColor = Color.FromArgb(51, 51, 51), BackgroundColor = Colors.Transparent
                };
                CheckBox[row].CheckedChanged += (sender, e) => innerPanel.Invalidate();
                CheckBox[row].GotFocus       += (sender, e) => innerPanel.Invalidate();
                Layout.Add(CheckBox[row], 11 + 10, 40 + 32 * row);
            }

            innerPanel = new Drawable()
            {
                Size = new Size(width - 2 * 11, height - 38 - 46), BackgroundColor = Colors.Black
            };
            innerPanel.Paint += (sender, e) =>
            {
                // Background
                var imgSize = MapImages.PanelInnerWallpaper.Size;
                for (int row = 0; row < this.Height / imgSize.Height + 1; row++)
                {
                    for (int col = 0; col < this.Width / imgSize.Width + 1; col++)
                    {
                        e.Graphics.DrawImage(MapImages.PanelInnerWallpaper, col * imgSize.Width, row * imgSize.Height);
                    }
                }

                // Draw checkbox, text, text outline
                for (int row = 0; row < checkboxNames.Length; row++)
                {
                    Draw.Checkbox(e.Graphics, CheckBox[row].Checked == true, new Point(9, 5 + 32 * row));

                    e.Graphics.DrawText(formattedText[row], new Point(36, 32 * row + 4));

                    using var _pen = new Pen(Color.FromArgb(64, 64, 64));
                    var textSize = formattedText[row].Measure();
                    if (CheckBox[row].HasFocus)
                    {
                        e.Graphics.DrawRectangle(_pen, new Rectangle(36, 32 * row + 4, (int)textSize.Width, (int)textSize.Height));
                    }
                }
            };
            innerPanel.MouseDown += (sender, e) =>
            {
                for (int row = 0; row < checkboxNames.Length; row++)
                {
                    // Update if checkbox is clicked
                    if (e.Location.X > 7 && e.Location.X < 33 && e.Location.Y > 3 + 32 * row && e.Location.Y < 28 + 32 * row)
                    {
                        CheckBox[row].Checked = !CheckBox[row].Checked;
                        innerPanel.Invalidate();
                    }

                    // Update if text is clicked
                    if (e.Location.X > 36 && e.Location.X < 36 + (int)formattedText[row].Measure().Width&& e.Location.Y > 32 * row + 4 && e.Location.Y < 32 * row + 4 + (int)formattedText[row].Measure().Height)
                    {
                        CheckBox[row].Checked = !CheckBox[row].Checked;
                        CheckBox[row].Focus();
                        innerPanel.Invalidate();
                    }
                }
            };
            Layout.Add(innerPanel, 11, 38);

            // Buttons
            Button = new Civ2button[buttonTexts.Length];
            int btnW = (this.Width - 2 * 9 - 3 * (buttonTexts.Length - 1)) / buttonTexts.Length;  // Determine width of one button

            for (int i = 0; i < buttonTexts.Length; i++)
            {
                Button[i] = new Civ2button(buttonTexts[i], btnW, 36, new Font("Times new roman", 11));
                Layout.Add(Button[i], 9 + btnW * i + 3 * i, Height - 46);
            }

            Content = Layout;
        }
示例#9
0
        //private readonly DoubleBufferedPanel _resourceMap, _cityResources, _foodStorage, _unitsFromCity, _unitsInCity, _productionPanel, _improvListPanel;
        //private readonly VScrollBar _improvementsBar;

        public CityPanel(Main parent, City city, int width, int height) : base(width, height, 27, 11, "")   // TODO: correct padding for max/min zoom
        {
            _main     = parent;
            _thisCity = city;

            MainPanel.Paint  += MainPanel_Paint;
            InnerPanel.Paint += InnerPanel_Paint;

            //this.Paint += CityPanel_Paint;

            // Faces panel
            var faces = new Drawable();

            faces.Size   = new Size(433, 44);
            faces.Paint += Faces_Paint;
            InnerPanelLayout.Add(faces, 3, 2);

            // Resource map panel
            var resourceMap = new Drawable();

            resourceMap.Size   = new Size(196, 145);
            resourceMap.Paint += ResourceMap_Paint;
            InnerPanelLayout.Add(resourceMap, 3, 61);

            // City resources panel
            var cityResources = new Drawable();

            cityResources.Size   = new Size(226, 151);
            cityResources.Paint += CityResources_Paint;
            InnerPanelLayout.Add(cityResources, 205, 61);

            // Units from city panel
            var unitsFromCity = new Drawable();

            unitsFromCity.Size   = new Size(181, 69);
            unitsFromCity.Paint += UnitsFromCity_Paint;
            InnerPanelLayout.Add(unitsFromCity, 7, 216);

            // Units in city panel
            var unitsInCity = new Drawable();

            unitsInCity.Size   = new Size(242, 206);
            unitsInCity.Paint += UnitsInCity_Paint;
            InnerPanelLayout.Add(unitsInCity, 193, 212);

            // Food storage panel
            var foodStorage = new Drawable();

            foodStorage.Size   = new Size(195, 146);
            foodStorage.Paint += FoodStorage_Paint;
            InnerPanelLayout.Add(foodStorage, 437, 15);

            // Production panel
            var productionPanel = new Drawable();

            productionPanel.Size   = new Size(195, 191);
            productionPanel.Paint += ProductionPanel_Paint;
            InnerPanelLayout.Add(productionPanel, 437, 165);

            // Buy button
            var buyButton = new Civ2button("Buy", 68, 24, new Font("Arial", 9));

            buyButton.Click += BuyButton_Click;

            // Change button
            var changeButton = new Civ2button("Change", 68, 24, new Font("Arial", 9));

            changeButton.Click += ChangeButton_Click;

            // Add buy/change buttons to production panel
            var ProductionPanelLayout = new PixelLayout();

            ProductionPanelLayout.Size = new Size(productionPanel.Width, productionPanel.Height);
            ProductionPanelLayout.Add(buyButton, 5, 16);
            ProductionPanelLayout.Add(changeButton, 120, 16);
            productionPanel.Content = ProductionPanelLayout;

            // Improvements list panel
            var improvListPanel = new Drawable();

            improvListPanel.Size   = new Size(166, 108);
            improvListPanel.Paint += ImprovementsList_Paint;
            InnerPanelLayout.Add(improvListPanel, 6, 306);

            //// Improvements vertical scrollbar
            //_improvementsBar = new VScrollBar()
            //{
            //    Location = new Point(174, 291),
            //    Size = new Size(17, 128),
            //    Maximum = 66 - 9 + 9    // Max improvements=66, 9 can be shown, because of slider size it's 9 elements smaller
            //};
            //DrawPanel.Controls.Add(_improvementsBar);
            //_improvementsBar.ValueChanged += ImprovementsBarValueChanged;

            // Info button
            var infoButton = new Civ2button("Info", 57, 24, new Font("Arial", 9));  // norm=(57,24), big=(86,36)

            infoButton.Click += InfoButton_Click;
            InnerPanelLayout.Add(infoButton, 461, 364); // norm=(461,364), big=(692,549)

            // Map button
            var mapButton = new Civ2button("Map", 57, 24, new Font("Arial", 9));  // norm=(57,24), big=(86,36)

            mapButton.Click += MapButton_Click;
            InnerPanelLayout.Add(mapButton, infoButton.Location.X + 58, infoButton.Location.Y);

            // Rename button
            var renameButton = new Civ2button("Rename", 57, 24, new Font("Arial", 9));  // norm=(57,24), big=(86,36)

            renameButton.Click += RenameButton_Click;
            InnerPanelLayout.Add(renameButton, infoButton.Location.X + 116, infoButton.Location.Y);

            // Happy button
            var happyButton = new Civ2button("Happy", 57, 24, new Font("Arial", 9));  // norm=(57,24), big=(86,36)

            happyButton.Click += HappyButton_Click;
            InnerPanelLayout.Add(happyButton, infoButton.Location.X, infoButton.Location.Y + 25);

            // View button
            var viewButton = new Civ2button("View", 57, 24, new Font("Arial", 9));  // norm=(57,24), big=(86,36)

            viewButton.Click += ViewButton_Click;
            InnerPanelLayout.Add(viewButton, infoButton.Location.X + 58, infoButton.Location.Y + 25);

            // Exit button
            var exitButton = new Civ2button("Exit", 57, 24, new Font("Arial", 9));  // norm=(57,24), big=(86,36)

            exitButton.Click += ExitButton_Click;
            InnerPanelLayout.Add(exitButton, infoButton.Location.X + 116, infoButton.Location.Y + 25);

            //// Next city (UP) button
            //var _nextCityButton = new NoSelectButton
            //{
            //    Location = new Point(440, 364), // norm=(440,364), big=(660,550)
            //    Size = new Size(21, 24),  // norm=(21,24), big=(32,36)
            //    BackColor = Color.FromArgb(107, 107, 107)
            //};
            //_nextCityButton.FlatStyle = FlatStyle.Flat;
            //DrawPanel.Controls.Add(_nextCityButton);
            //_nextCityButton.Click += NextCityButton_Click;
            //_nextCityButton.Paint += NextCityButton_Paint;

            //// Previous city (DOWN) button
            //var _prevCityButton = new NoSelectButton
            //{
            //    Location = new Point(440, 389), // norm=(440,389), big=(660,550)
            //    Size = new Size(21, 24),  // norm=(21,24), big=(32,36)
            //    BackColor = Color.FromArgb(107, 107, 107)
            //};
            //_prevCityButton.FlatStyle = FlatStyle.Flat;
            //DrawPanel.Controls.Add(_prevCityButton);
            //_prevCityButton.Click += PrevCityButton_Click;
            //_prevCityButton.Paint += PrevCityButton_Paint;

            InnerPanel.Content = InnerPanelLayout;
        }