private int _barValue;   // Starting value of view of horizontal bar

        public CityStatusPanel(Main parent, int _width, int _height) : base(_width, _height, null, 11, 10)
        {
            _main = parent;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.BackgroundImage = Images.CityStatusWallpaper;
            DrawPanel.Paint          += DrawPanel_Paint;

            // Close button
            var _closeButton = new Civ2button
            {
                Location = new Point(2, 373),
                Size     = new Size(596, 24),
                Text     = "Close"
            };

            DrawPanel.Controls.Add(_closeButton);
            _closeButton.Click += CloseButton_Click;

            // Vertical bar
            _verticalBar = new VScrollBar()
            {
                Location    = new Point(581, 66),
                Size        = new Size(17, 305),
                LargeChange = 1
                              // TODO: determine maximum value of Vscrollbar
            };
            DrawPanel.Controls.Add(_verticalBar);
            _verticalBar.ValueChanged += VerticalBarValueChanged;
        }
        public GraphicOptionsPanel(Main parent, int _width, int _height) : base(_width, _height, "Select Graphic Options", 38, 46)
        {
            _main = parent;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.Paint += DrawPanel_Paint;

            // OK button
            var _OKButton = new Civ2button
            {
                Location = new Point(9, 238),
                Size     = new Size(363, 36),
                Text     = "OK"
            };

            Controls.Add(_OKButton);
            _OKButton.Click += OKButton_Click;

            // Cancel button
            var _cancelButton = new Civ2button
            {
                Location = new Point(374, 238),
                Size     = new Size(363, 36),
                Text     = "Cancel"
            };

            Controls.Add(_cancelButton);
            _cancelButton.Click += CancelButton_Click;

            // Make an options array
            _choiceOptions = new bool[6] {
                Game.Options.ThroneRoomGraphics, Game.Options.DiplomacyScreenGraphics, Game.Options.AnimatedHeralds,
                Game.Options.CivilopediaForAdvances, Game.Options.HighCouncil, Game.Options.WonderMovies
            };
            // Individual options text
            _textOptions = new string[6] {
                "Throne Room",
                "Diplomacy Screen",
                "Animated Heralds (Requires 16 megabytes RAM)",
                "Civilopedia for Advances",
                "High Council",
                "Wonder Movies"
            };
            // Make click panels for each options
            _clickPanels = new List <DoubleBufferedPanel>();
            for (int i = 0; i < 6; i++)
            {
                var panel = new DoubleBufferedPanel
                {
                    Location  = new Point(10, 32 * i + 4),
                    Size      = new Size(100, 27), // You will set the correct width once you measure text size below
                    BackColor = Color.Transparent
                };
                DrawPanel.Controls.Add(panel);
                panel.Click += ClickPanels_Click;
                _clickPanels.Add(panel);
            }
        }
        public WondersOfWorldPanel(Main parent, int _width, int _height) : base(_width, _height, null, 11, 10)
        {
            _main = parent;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.BackgroundImage = Images.WondersOfWorldWallpaper;
            DrawPanel.Paint          += DrawPanel_Paint;

            // Close button
            var _closeButton = new Civ2button
            {
                Location = new Point(2, 373),
                Size     = new Size(596, 24),
                Text     = "Close"
            };

            DrawPanel.Controls.Add(_closeButton);
            _closeButton.Click += CloseButton_Click;

            // Vertical bar
            _verticalBar = new VScrollBar()
            {
                Location    = new Point(581, 4),
                Size        = new Size(17, 370),
                LargeChange = 1
                              //Maximum = TO-DO...
            };
            DrawPanel.Controls.Add(_verticalBar);
            _verticalBar.ValueChanged += VerticalBarValueChanged;

            // Find if wonders are built and who owns them
            _wonderBuilt   = new bool[28];
            _whoOwnsWonder = new int[28];
            _cityWonder    = new string[28];
            foreach (City city in _game.GetCities)
            {
                for (int i = 0; i < city.Improvements.Length; i++) // Check for each improvement
                {
                    int Id = city.Improvements[i].Id;
                    if (Id > 38)    // Improvements Id>38 are wonders
                    {
                        _wonderBuilt[Id - 39]   = true;
                        _whoOwnsWonder[Id - 39] = city.Owner.Id;
                        _cityWonder[Id - 39]    = city.Name;
                    }
                }
            }

            //for (int i = 0; i < 28; i++)
            //{
            //    if (WonderBuilt[i]) Console.Write("\n Wonder {0}, {1}, owner {2}", Rules.ImprovementName[i + 39], CityWonder[i], Game.Civs[WhoOwnsWonder[i]].TribeName);
            //}

            _barValue = 0;
        }
示例#4
0
        private int _barValue;       // Starting value of view of horizontal bar

        public ScienceAdvisorPanel(Main parent, int _width, int _height) : base(_width, _height, null, 11, 10)
        {
            _main = parent;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.BackgroundImage = Images.ScienceAdvWallpaper;
            DrawPanel.Paint          += DrawPanel_Paint;

            _barValue = 0;

            // Goal button
            var _goalButton = new Civ2button
            {
                Location = new Point(2, 373),
                Size     = new Size(297, 24),
                Text     = "Goal"
            };

            DrawPanel.Controls.Add(_goalButton);
            _goalButton.Click += GoalButton_Click;

            // Close button
            var _closeButton = new Civ2button
            {
                Location = new Point(301, 373),
                Size     = new Size(297, 24),
                Text     = "Close"
            };

            DrawPanel.Controls.Add(_closeButton);
            _closeButton.Click += CloseButton_Click;

            // Horizontal bar
            _techsPerColumn = (_game.ActiveCiv.ReseachingTech == 255) ? 11 : 8;  // 11 techs per column = you discovered all advances. Otherwise 8.
            _horizontalBar  = new HScrollBar()
            {
                Location    = new Point(2, 353),
                Size        = new Size(596, 17),
                LargeChange = 1,
                Maximum     = _game.ActiveCiv.Techs.Sum(x => x ? 1 : 0) / _techsPerColumn // Maximum=0 if no of techs <= 8, maximum=1 for techs=9...16, etc.
                                                                                          // (slider cannot move if maximum=0, it can move 1 move if maximum=1, it can move 2 moves if maximum=2, ...)
            };
            DrawPanel.Controls.Add(_horizontalBar);
            _horizontalBar.ValueChanged += HorizontalBarValueChanged;

            // Create a list of discovered advances
            _discoveredAdvances = new List <int>();
            for (int i = 0; i < 89; i++)    // Browse through all advances
            {
                if (_game.ActiveCiv.Techs[i])
                {
                    _discoveredAdvances.Add(i);
                }
            }
        }
        public _SetGameYearForm()
        {
            InitializeComponent();
            this.Paint += new PaintEventHandler(SetGameYearForm_Paint);

            //Main panel
            MainPanel = new DoubleBufferedPanel
            {
                Location        = new Point(9, 36),
                Size            = new Size(458, 78),
                BackgroundImage = Images.PanelOuterWallpaper
            };
            Controls.Add(MainPanel);
            MainPanel.Paint += new PaintEventHandler(MainPanel_Paint);

            //OK button
            Civ2button OKButton = new Civ2button
            {
                Location = new Point(9, 116),
                Size     = new Size(228, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "OK"
            };

            Controls.Add(OKButton);
            OKButton.Click += new EventHandler(OKButton_Click);

            //Cancel button
            Civ2button CancelButton = new Civ2button
            {
                Location = new Point(239, 116),
                Size     = new Size(228, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "Cancel"
            };

            Controls.Add(CancelButton);
            CancelButton.Click += new EventHandler(CancelButton_Click);

            //Textbox for changeing turn number
            ChangeTextBox = new TextBox
            {
                Location = new Point(134, 36),
                Size     = new Size(95, 30),
                //Text = Data.TurnNumber.ToString(),
                Font = new Font("Times New Roman", 14)
            };
            MainPanel.Controls.Add(ChangeTextBox);
        }
示例#6
0
        public _NameCityPanel(Main parent, MapPanel mapPanel, int _width, int _height) : base(_width, _height, "", 38, 46)
        {
            //InitializeComponent();
            Main            = parent;
            MapPanel        = mapPanel;
            Size            = new Size(686, 126);
            Location        = new Point(MapPanel.Width / 2 - this.Width / 2, MapPanel.Height / 2 - this.Height / 2);
            BackgroundImage = Images.PanelOuterWallpaper;
            Paint          += new PaintEventHandler(NameCityPanel_Paint);

            MainPanel = new Panel
            {
                Location        = new Point(9, 36),
                Size            = new Size(668, 46),
                BackgroundImage = Images.PanelOuterWallpaper
            };
            Controls.Add(MainPanel);
            MainPanel.Paint += MainPanel_Paint;

            //OK button
            Civ2button OKButton = new Civ2button
            {
                Location = new Point(9, 84),
                Size     = new Size(333, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "OK"
            };

            Controls.Add(OKButton);
            OKButton.Click += new EventHandler(OKButton_Click);

            //Cancel button
            Civ2button CancelButton = new Civ2button
            {
                Location = new Point(344, 84),
                Size     = new Size(333, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "Cancel"
            };

            Controls.Add(CancelButton);
            CancelButton.Click += new EventHandler(CancelButton_Click);
        }
示例#7
0
        public DemographicsPanel(Main parent, int _width, int _height) : base(_width, _height, null, 11, 10)
        {
            _main = parent;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.BackgroundImage = Images.DemographicsWallpaper;
            DrawPanel.Paint          += DrawPanel_Paint;

            //Close button
            var _closeButton = new Civ2button
            {
                Location = new Point(2, 373),
                Size     = new Size(596, 24),
                Text     = "Close"
            };

            DrawPanel.Controls.Add(_closeButton);
            _closeButton.Click += CloseButton_Click;
        }
        public ChoiceMenuPanel(Main mainForm) :
            base((int)(mainForm.ClientSize.Width * 0.174), (int)(mainForm.ClientSize.Height * 0.34), "Civilization II Multiplayer Gold", 38, 46)
        {
            _mainForm = mainForm;

            // Radio buttons
            _radioBtn = new Civ2radioBtn[8];
            string[] txt = { "Start a New Game", "Start on Premade World", "Customize World", "Begin Scenario", "Load a Game", "Multiplayer Game", "View Hall of Fame", "View Credits" };
            for (int i = 0; i < 7; i++)
            {
                _radioBtn[i] = new Civ2radioBtn
                {
                    Text     = txt[i],
                    Location = new Point(10, (int)(DrawPanel.Height / 7) * i),
                };
                DrawPanel.Controls.Add(_radioBtn[i]);
            }
            _radioBtn[0].Checked = true;

            // OK button
            var _OKbutton = new Civ2button
            {
                Location = new Point(9, Height - 42),
                Size     = new Size(156, 36),
                Text     = "OK"
            };

            Controls.Add(_OKbutton);
            _OKbutton.Click += OKButton_Click;

            // Cancel button
            var _cancelButton = new Civ2button
            {
                Location = new Point(168, Height - 42),
                Size     = new Size(157, 36),
                Text     = "Cancel"
            };

            Controls.Add(_cancelButton);
            _cancelButton.Click += CancelButton_Click;
        }
        public CityRenamePanel(CityPanel parent, City city) : base(686, 126, "What Shall We Rename This City?", 38, 46)
        {
            _parent = parent;
            _city   = city;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.Paint += DrawPanel_Paint;

            //Textbox for renaming city
            _renameTextBox = new TextBox
            {
                Location = new Point(163, 2),
                Size     = new Size(225, 30),
                Text     = _city.Name,
                Font     = new Font("Times New Roman", 11)
            };
            DrawPanel.Controls.Add(_renameTextBox);

            // OK button
            var _OKButton = new Civ2button
            {
                Location = new Point(9, 84),
                Size     = new Size(333, 36),
                Text     = "OK"
            };

            Controls.Add(_OKButton);
            _OKButton.Click += OKButton_Click;

            // Cancel button
            var _cancelButton = new Civ2button
            {
                Location = new Point(344, 84),
                Size     = new Size(333, 36),
                Text     = "Cancel"
            };

            Controls.Add(_cancelButton);
            _cancelButton.Click += CancelButton_Click;
        }
示例#10
0
        public CityBuyPanel(CityPanel parent, City city) : base(814, 212, "", 38, 46)
        {
            _parent = parent;
            _city   = city;

            this.Paint += CityBuyPanel_Paint;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.Paint += DrawPanel_Paint;

            // OK button
            var _OKButton = new Civ2button
            {
                Location = new Point(9, 170),
                Size     = new Size(796, 36),
                Text     = "OK"
            };

            Controls.Add(_OKButton);
            _OKButton.Click += OKButton_Click;

            // Radio button 1
            _completeitButton = new Civ2radioBtn
            {
                Text     = "Complete it.",
                Location = new Point(140, 69),
            };
            DrawPanel.Controls.Add(_completeitButton);

            // Radio button 2
            _nevermindButton = new Civ2radioBtn
            {
                Text     = "Never mind.",
                Location = new Point(140, 98),
            };
            DrawPanel.Controls.Add(_nevermindButton);
            _nevermindButton.Checked = true;
        }
        public CityChangePanel(CityPanel parent, City city) : base(686, 389, $"What shall we build in {city.Name}?", 38, 46)
        {
            _parent = parent;
            _city   = city;

            // Initial states
            _totalNoUnits  = 62; // TO-DO: Calculate total number of units+improvements for CityChangePanel
            _totalNoImprov = 66;
            // BarValue should always be so that the chosen item is in the center. But the BarValue should be corrected once you are at the edges.
            _barValue = Math.Max(0, _city.ItemInProduction - 8);                  // Correction for the lower value
            _barValue = Math.Min(_totalNoUnits + _totalNoImprov - 16, _barValue); // Correction for the upper value

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.Paint += DrawPanel_Paint;

            // Choice panel
            _choicePanel = new DoubleBufferedPanel
            {
                Location    = new Point(2, 2),
                Size        = new Size(DrawPanel.Width - 4, DrawPanel.Height - 4),
                BackColor   = Color.FromArgb(207, 207, 207),
                BorderStyle = BorderStyle.None
            };
            DrawPanel.Controls.Add(_choicePanel);
            _choicePanel.Paint     += ChoicePanel_Paint;
            _choicePanel.MouseDown += ChoicePanel_MouseDown;

            // Vertical bar for choosing production
            _verticalBar = new VScrollBar()
            {
                Location = new Point(643, 0),
                Size     = new Size(18, 301),
                Maximum  = _totalNoUnits + _totalNoImprov - 7   // 16 can be shown
            };
            _choicePanel.Controls.Add(_verticalBar);
            _verticalBar.ValueChanged += VerticalBarValueChanged;

            // Auto button
            var _autoButton = new Civ2button
            {
                Location = new Point(9, 347),
                Size     = new Size(165, 36),
                Text     = "Auto"
            };

            Controls.Add(_autoButton);
            _autoButton.Click += AutoButton_Click;

            // Help button
            var _helpButton = new Civ2button
            {
                Location = new Point(177, 347),
                Size     = new Size(165, 36),
                Text     = "Help"
            };

            Controls.Add(_helpButton);
            _helpButton.Click += HelpButton_Click;

            // Cheat! button
            var _cheatButton = new Civ2button
            {
                Location = new Point(344, 347),
                Size     = new Size(165, 36),
                Text     = "Cheat!"
            };

            Controls.Add(_cheatButton);
            _cheatButton.Click += CheatButton_Click;

            // OK button
            var _OKButton = new Civ2button
            {
                Location = new Point(512, 347),
                Size     = new Size(165, 36),
                Text     = "OK"
            };

            Controls.Add(_OKButton);
            _OKButton.Click += OKButton_Click;
        }
示例#12
0
        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;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.BackgroundImage = Images.CityWallpaper;
            DrawPanel.Paint          += DrawPanel_Paint;

            this.Paint += CityPanel_Paint;

            // Faces panel
            var _faces = new DoubleBufferedPanel
            {
                Location  = new Point(3, 2),
                Size      = new Size(433, 44),
                BackColor = Color.Transparent
            };

            DrawPanel.Controls.Add(_faces);
            _faces.Paint += Faces_Paint;

            // Resource map panel
            _resourceMap = new DoubleBufferedPanel
            {
                Location  = new Point(3, 61),
                Size      = new Size(196, 145),
                BackColor = Color.Transparent
            };
            DrawPanel.Controls.Add(_resourceMap);
            _resourceMap.Paint += ResourceMap_Paint;

            // City resources panel
            _cityResources = new DoubleBufferedPanel
            {
                Location  = new Point(205, 61),
                Size      = new Size(226, 151),
                BackColor = Color.Transparent
            };
            DrawPanel.Controls.Add(_cityResources);
            _cityResources.Paint += CityResources_Paint;

            // Units from city panel
            _unitsFromCity = new DoubleBufferedPanel
            {
                Location  = new Point(7, 216),
                Size      = new Size(181, 69),
                BackColor = Color.Transparent
            };
            DrawPanel.Controls.Add(_unitsFromCity);
            _unitsFromCity.Paint += UnitsFromCity_Paint;

            // Units in city panel
            _unitsInCity = new DoubleBufferedPanel
            {
                Location  = new Point(193, 212),
                Size      = new Size(242, 206),
                BackColor = Color.Transparent
            };
            DrawPanel.Controls.Add(_unitsInCity);
            _unitsInCity.Paint += UnitsInCity_Paint;

            // Food storage panel
            _foodStorage = new DoubleBufferedPanel
            {
                Location  = new Point(437, 15),
                Size      = new Size(195, 146),
                BackColor = Color.Transparent
            };
            DrawPanel.Controls.Add(_foodStorage);
            _foodStorage.Paint += FoodStorage_Paint;

            // Production panel
            _productionPanel = new DoubleBufferedPanel
            {
                Location  = new Point(437, 165),
                Size      = new Size(195, 191),
                BackColor = Color.Transparent
            };
            DrawPanel.Controls.Add(_productionPanel);
            _productionPanel.Paint += ProductionPanel_Paint;

            // Buy button
            var _buyButton = new Civ2button
            {
                Location = new Point(5, 16),
                Size     = new Size(68, 24),
                Font     = new Font("Arial", 9),
                Text     = "Buy"
            };

            _productionPanel.Controls.Add(_buyButton);
            _buyButton.Click += BuyButton_Click;

            // Change button
            var _changeButton = new Civ2button
            {
                Location = new Point(120, 16),
                Size     = new Size(68, 24),
                Font     = new Font("Arial", 9),
                Text     = "Change"
            };

            _productionPanel.Controls.Add(_changeButton);
            _changeButton.Click += ChangeButton_Click;

            // Improvements list panel
            _improvListPanel = new DoubleBufferedPanel()
            {
                Location  = new Point(6, 306),
                Size      = new Size(166, 108),
                BackColor = Color.Transparent
            };
            DrawPanel.Controls.Add(_improvListPanel);
            _improvListPanel.Paint += ImprovementsList_Paint;

            // 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
            {
                Location = new Point(461, 364), // norm=(461,364), big=(692,549)
                Size     = new Size(57, 24),    // norm=(57,24), big=(86,36)
                Font     = new Font("Arial", 9),
                Text     = "Info"
            };

            DrawPanel.Controls.Add(_infoButton);
            _infoButton.Click += InfoButton_Click;

            // Map button
            var _mapButton = new Civ2button
            {
                Location = new Point(_infoButton.Location.X + 58, _infoButton.Location.Y),
                Size     = new Size(57, 24), // norm=(57,24), big=(86,36)
                Font     = new Font("Arial", 9),
                Text     = "Map"
            };

            DrawPanel.Controls.Add(_mapButton);
            _mapButton.Click += MapButton_Click;

            // Rename button
            var _renameButton = new Civ2button
            {
                Location = new Point(_infoButton.Location.X + 116, _infoButton.Location.Y),
                Size     = new Size(57, 24), // norm=(57,24), big=(86,36)
                Font     = new Font("Arial", 9),
                Text     = "Rename"
            };

            DrawPanel.Controls.Add(_renameButton);
            _renameButton.Click += RenameButton_Click;

            // Happy button
            var _happyButton = new Civ2button
            {
                Location = new Point(_infoButton.Location.X, _infoButton.Location.Y + 25),
                Size     = new Size(57, 24), // norm=(57,24), big=(86,36)
                Font     = new Font("Arial", 9),
                Text     = "Happy"
            };

            DrawPanel.Controls.Add(_happyButton);
            _happyButton.Click += HappyButton_Click;

            // View button
            var _viewButton = new Civ2button
            {
                Location = new Point(_infoButton.Location.X + 58, _infoButton.Location.Y + 25),
                Size     = new Size(57, 24), // norm=(57,24), big=(86,36)
                Font     = new Font("Arial", 9),
                Text     = "View"
            };

            DrawPanel.Controls.Add(_viewButton);
            _viewButton.Click += ViewButton_Click;

            // Exit button
            var _exitButton = new Civ2button
            {
                Location = new Point(_infoButton.Location.X + 116, _infoButton.Location.Y + 25),
                Size     = new Size(57, 24), // norm=(57,24), big=(86,36)
                Font     = new Font("Arial", 9),
                Text     = "Exit"
            };

            DrawPanel.Controls.Add(_exitButton);
            _exitButton.Click += ExitButton_Click;

            // 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;
        }
示例#13
0
        public TradeAdvisorPanel(Main parent, int _width, int _height) : base(_width, _height, null, 11, 10)
        {
            _main = parent;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.BackgroundImage = Images.TradeAdvWallpaper;
            DrawPanel.Paint          += DrawPanel_Paint;

            // Casualties button
            var _supplyDemandButton = new Civ2button
            {
                Location = new Point(2, 373),
                Size     = new Size(297, 24),
                Text     = "Supply and Demand"
            };

            DrawPanel.Controls.Add(_supplyDemandButton);
            _supplyDemandButton.Click += SupplyDemandButton_Click;

            // Close button
            var _closeButton = new Civ2button
            {
                Location = new Point(301, 373),
                Size     = new Size(297, 24),
                Text     = "Close"
            };

            DrawPanel.Controls.Add(_closeButton);
            _closeButton.Click += CloseButton_Click;

            // Vertical bar
            _verticalBar = new VScrollBar()
            {
                Location    = new Point(581, 66),
                Size        = new Size(17, 305),
                LargeChange = 1
                              // TODO: determine maximum value of Vscrollbar
            };
            DrawPanel.Controls.Add(_verticalBar);
            _verticalBar.ValueChanged += VerticalBarValueChanged;

            // Calculate total numbers
            _totalCost            = 0;
            _totalIncome          = 0;
            _totalScience         = 0;
            _discoveries          = 0;
            _noOfImprovements     = new int[67];
            _upkeepOfImprovements = new int[67];
            foreach (City city in _game.GetCities.Where(n => n.Owner == _game.ActiveCiv))
            {
                for (int i = 0; i < city.Improvements.Count(); i++)
                {
                    _noOfImprovements[city.Improvements[i].Id]++;
                    _upkeepOfImprovements[city.Improvements[i].Id] += city.Improvements[i].Upkeep;
                    _totalCost += city.Improvements[i].Upkeep;
                }
                _totalIncome  += city.Trade;
                _totalScience += city.Science;
                _discoveries  += 0;
            }
        }
示例#14
0
        public CityreportOptionsPanel(Main parent, int _width, int _height) : base(_width, _height, "Select City Report Options", 38, 46)
        {
            _main = parent;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.Paint += DrawPanel_Paint;

            // OK button
            var _OKButton = new Civ2button
            {
                Location = new Point(9, 398),
                Size     = new Size(363, 36),
                Text     = "OK"
            };

            Controls.Add(_OKButton);
            _OKButton.Click += OKButton_Click;

            // Cancel button
            var _cancelButton = new Civ2button
            {
                Location = new Point(374, 398),
                Size     = new Size(363, 36),
                Text     = "Cancel"
            };

            Controls.Add(_cancelButton);
            _cancelButton.Click += CancelButton_Click;

            // Make an options array
            _choiceOptions = new bool[11] {
                Game.Options.WarnWhenCityGrowthHalted, Game.Options.ShowCityImprovementsBuilt, Game.Options.ShowNonCombatUnitsBuilt, Game.Options.ShowInvalidBuildInstructions, Game.Options.AnnounceCitiesInDisorder, Game.Options.AnnounceOrderRestored, Game.Options.AnnounceWeLoveKingDay, Game.Options.WarnWhenFoodDangerouslyLow, Game.Options.WarnWhenPollutionOccurs, Game.Options.WarnChangProductWillCostShields, Game.Options.ZoomToCityNotDefaultAction
            };
            // Write here individual options
            _textOptions = new string[11] {
                "Warn when city growth halted (Aqueduct/Sewer System).",
                "Show city improvements built.",
                "Show non-combat units built.",
                "Show invalid build instructions.",
                "Announce cities in disorder.",
                "Announce order restored in city.",
                "Announce \"We Love The King Day\".",
                "Warn when food dangerously low.",
                "Warn when new pollution occurs.",
                "Warn when changing production will cost shields.",
                "\"Zoom-to-City\" NOT default action."
            };
            // Make click panels for each options
            _clickPanels = new List <DoubleBufferedPanel>();
            for (int i = 0; i < 11; i++)
            {
                var panel = new DoubleBufferedPanel
                {
                    Location  = new Point(10, (32 * i) + 4),
                    Size      = new Size(100, 27), // You will set the correct width once you measure text size below
                    BackColor = Color.Transparent
                };
                DrawPanel.Controls.Add(panel);
                panel.Click += ClickPanels_Click;
                _clickPanels.Add(panel);
            }
        }
示例#15
0
        int[] ActiveCivId;// = new int[Game.CivsInPlay.Sum()];

        public _ForeignCreateUnitForm(int chosenUnit, bool isVeteran)
        {
            InitializeComponent();
            ChosenUnit = chosenUnit;
            IsVeteran  = IsVeteran;

            //Main panel
            MainPanel = new DoubleBufferedPanel
            {
                Location        = new Point(9, 36),
                Size            = new Size(668, Game.CivsInPlay.Sum(x => x ? 1 : 0) * 32 + 4),
                BackgroundImage = Images.PanelOuterWallpaper
            };
            Controls.Add(MainPanel);
            MainPanel.Paint += new PaintEventHandler(MainPanel_Paint);

            //OK button
            Civ2button OKButton = new Civ2button
            {
                Location = new Point(9, Game.CivsInPlay.Sum(x => x ? 1 : 0) * 32 + 42),
                Size     = new Size(333, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "OK"
            };

            Controls.Add(OKButton);
            OKButton.Click += new EventHandler(OKButton_Click);

            //Cancel button
            Civ2button CancelButton = new Civ2button
            {
                Location = new Point(344, Game.CivsInPlay.Sum(x => x ? 1 : 0) * 32 + 42),
                Size     = new Size(333, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "Cancel"
            };

            Controls.Add(CancelButton);
            CancelButton.Click += new EventHandler(CancelButton_Click);

            //Radio buttons
            int count = 0;

            for (int civ = 0; civ < 8; civ++)
            {
                if (Game.CivsInPlay[civ])
                {
                    //Make a radio button
                    RadioButton[count] = new RadioButton
                    {
                        Text      = Game.GetCivs[civ].TribeName,
                        Location  = new Point(40, 2 + 32 * count),
                        BackColor = Color.Transparent,
                        Font      = new Font("Times New Roman", 18.0f),
                        ForeColor = Color.FromArgb(51, 51, 51),
                        AutoSize  = true
                    };
                    MainPanel.Controls.Add(RadioButton[count]);

                    //Also get indexes of active civs
                    ActiveCivId[count] = civ;

                    count++;
                }
            }
            RadioButton[0].Checked = true;  //set initial value
        }
        private int _barValue;        // Starting value of view of horizontal bar

        public DefenseMinisterPanel(Main parent, int _width, int _height) : base(_width, _height, null, 11, 10)
        {
            _main = parent;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.BackgroundImage = Images.DefenseMinWallpaper;
            DrawPanel.Paint          += DrawPanel_Paint;

            _showStatistics = true;

            // Casualties button
            _casualtiesButton = new Civ2button
            {
                Location = new Point(2, 373),
                Size     = new Size(297, 24),
                Text     = "Casualties"
            };
            DrawPanel.Controls.Add(_casualtiesButton);
            _casualtiesButton.Click += CasualtiesButton_Click;

            // Close button
            var _closeButton = new Civ2button
            {
                Location = new Point(301, 373),
                Size     = new Size(297, 24),
                Text     = "Close"
            };

            DrawPanel.Controls.Add(_closeButton);
            _closeButton.Click += CloseButton_Click;

            // Vertical bar
            _verticalBar = new VScrollBar()
            {
                Location    = new Point(581, 66),
                Size        = new Size(17, 305),
                LargeChange = 1
                              // TODO: determine maximum value of Vscrollbar
            };
            DrawPanel.Controls.Add(_verticalBar);
            _verticalBar.ValueChanged += VerticalBarValueChanged;

            // Count active units, units in production
            _activeUnitCount       = new int[62];
            _unitInProductionCount = new int[62];
            for (int i = 0; i < 62; i++)
            {
                // Count active units
                foreach (IUnit unit in _game.GetUnits.Where(n => n.Owner == _game.ActiveCiv))
                {
                    if (unit.Name == _game.Rules.UnitName[i])
                    {
                        _activeUnitCount[i]++;
                    }
                }
                // Count units in production
                foreach (City city in _game.GetCities.Where(n => n.Owner == _game.ActiveCiv))
                {
                    if (city.ItemInProduction == i)
                    {
                        _unitInProductionCount[i]++;
                    }
                }
            }
        }
        public GameOptionsPanel(Main parent, int _width, int _height) : base(_width, _height, "Civilization II Multiplayer Gold", 38, 46)
        {
            _main = parent;

            // Add DrawPanel from base control
            Controls.Add(DrawPanel);
            DrawPanel.Paint += DrawPanel_Paint;

            // OK button
            var _OKButton = new Civ2button
            {
                Location = new Point(9, 398),
                Size     = new Size(363, 36),
                Text     = "OK"
            };

            Controls.Add(_OKButton);
            _OKButton.Click += OKButton_Click;

            // Cancel button
            var _cancelButton = new Civ2button
            {
                Location = new Point(374, 398),
                Size     = new Size(363, 36),
                Text     = "Cancel"
            };

            Controls.Add(_cancelButton);
            _cancelButton.Click += CancelButton_Click;

            // Make an options array
            _choiceOptions = new bool[11] {
                Game.Options.SoundEffects, Game.Options.Music, Game.Options.AlwaysWaitAtEndOfTurn, Game.Options.AutosaveEachTurn, Game.Options.ShowEnemyMoves, Game.Options.NoPauseAfterEnemyMoves, Game.Options.FastPieceSlide, Game.Options.InstantAdvice, Game.Options.TutorialHelp, Game.Options.MoveUnitsWithoutMouse, Game.Options.EnterClosestCityScreen
            };
            // Individual options text
            _textOptions = new string[11] {
                "Sound Effects",
                "Music",
                "Always wait at end of turn.",
                "Autosave each turn.",
                "Show enemy moves.",
                "No pause after enemy moves.",
                "Fast piece slide.",
                "Instant advice.",
                "Tutorial help.",
                "Move units w/ mouse (cursor arrows).",
                "ENTER key closes City Screen."
            };
            // Make click panels for each options
            _clickPanels = new List <DoubleBufferedPanel>();
            for (int i = 0; i < 11; i++)
            {
                var panel = new DoubleBufferedPanel
                {
                    Location  = new Point(10, 32 * i + 4),
                    Size      = new Size(100, 27), // You will set the correct width once you measure text size below
                    BackColor = Color.Transparent
                };
                DrawPanel.Controls.Add(panel);
                panel.Click += ClickPanels_Click;
                _clickPanels.Add(panel);
            }
        }
        public _CreateUnitForm()
        {
            InitializeComponent();
            this.Paint += new PaintEventHandler(CreateUnitForm_Paint);

            //Initial states
            //Calculate here total number of choices
            //TO-DO
            totalNoUnits = 62;
            ChosenUnit   = 0; //beginning choice
            IsVeteran    = false;

            //Main panel
            MainPanel = new DoubleBufferedPanel
            {
                Location = new Point(9, 36),
                Size     = new Size(728, 378),
                //BackgroundImage = Images.WallpaperStatusForm
            };
            Controls.Add(MainPanel);
            MainPanel.Paint += new PaintEventHandler(MainPanel_Paint);

            //Panel of choices
            ChoicePanel = new DoubleBufferedPanel
            {
                Location    = new Point(4, 4),
                Size        = new Size(MainPanel.Width - 8, MainPanel.Height - 8),
                BackColor   = Color.FromArgb(207, 207, 207),
                BorderStyle = BorderStyle.None
            };
            MainPanel.Controls.Add(ChoicePanel);
            ChoicePanel.Paint     += new PaintEventHandler(ChoicePanel_Paint);
            ChoicePanel.MouseDown += new MouseEventHandler(ChoicePanel_MouseDown);

            //Foreign button
            Civ2button ForeignButton = new Civ2button
            {
                Location = new Point(9, 416),
                Size     = new Size(119, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "Foreign"
            };

            Controls.Add(ForeignButton);
            ForeignButton.Click += new EventHandler(ForeignButton_Click);

            //Veteran button
            Civ2button VeteranButton = new Civ2button
            {
                Location = new Point(131, 416),
                Size     = new Size(119, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "Veteran"
            };

            Controls.Add(VeteranButton);
            VeteranButton.Click += new EventHandler(VeteranButton_Click);

            //Obs. button
            Civ2button ObsButton = new Civ2button
            {
                Location = new Point(253, 416),
                Size     = new Size(119, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "Obs."
            };

            Controls.Add(ObsButton);
            ObsButton.Click += new EventHandler(ObsButton_Click);

            //Adv. button
            Civ2button AdvButton = new Civ2button
            {
                Location = new Point(374, 416),
                Size     = new Size(119, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "Adv."
            };

            Controls.Add(AdvButton);
            AdvButton.Click += new EventHandler(AdvButton_Click);

            //OK button
            Civ2button OKButton = new Civ2button
            {
                Location = new Point(496, 416),
                Size     = new Size(119, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "OK"
            };

            Controls.Add(OKButton);
            OKButton.Click += new EventHandler(OKButton_Click);

            //Cancel button
            Civ2button CancelButton = new Civ2button
            {
                Location = new Point(618, 416),
                Size     = new Size(119, 36),
                Font     = new Font("Times New Roman", 11),
                Text     = "Cancel"
            };

            Controls.Add(CancelButton);
            CancelButton.Click += new EventHandler(CancelButton_Click);

            //Vertical bar
            VerticalBar = new VScrollBar()
            {
                Location = new Point(ChoicePanel.Width - 18, 1),
                Size     = new Size(17, 368),
                Maximum  = totalNoUnits - 7   //16 can be shown
            };
            ChoicePanel.Controls.Add(VerticalBar);
            VerticalBar.ValueChanged += new EventHandler(VerticalBarValueChanged);

            if (totalNoUnits < 17)
            {
                VerticalBar.Visible = false;                    //don't show it if there are less than 17 units
            }
        }