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 _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); }
public Civ2panel(int width, int height, string title, int paddingTop, int paddingBottom) { _title = title; _paddingTop = paddingTop; _paddingBtm = paddingBottom; Size = new Size(width, height); BackgroundImage = Images.PanelOuterWallpaper; this.Paint += Civ2panel_Paint; DrawPanel = new DoubleBufferedPanel() { Location = new Point(11, _paddingTop), Size = new Size(Width - 22, Height - _paddingTop - _paddingBtm), BackgroundImage = Images.PanelInnerWallpaper }; Controls.Add(DrawPanel); }
public StatusPanel(Main parent, int _width, int _height) { _main = parent; BackgroundImage = Images.PanelOuterWallpaper; Size = new Size(_width, _height); Paint += StatusPanel_Paint; MapPanel.OnMapEvent += MapEventHappened; Main.OnMapEvent += MapEventHappened; Game.OnWaitAtTurnEnd += InitiateWaitAtTurnEnd; Game.OnPlayerEvent += PlayerEventHappened; Game.OnUnitEvent += UnitEventHappened; StatsPanel = new DoubleBufferedPanel() { Location = new Point(11, 38), Size = new Size(240, 60), BackgroundImage = Images.PanelInnerWallpaper }; Controls.Add(StatsPanel); StatsPanel.Paint += StatsPanel_Paint; StatsPanel.MouseClick += Panel_Click; UnitPanel = new DoubleBufferedPanel() { Location = new Point(11, 106), Size = new Size(240, Height - 117), BackgroundImage = Images.PanelInnerWallpaper }; Controls.Add(UnitPanel); UnitPanel.Paint += UnitPanel_Paint; UnitPanel.MouseClick += Panel_Click; // Timer for "end of turn" message Timer.Tick += Timer_Tick; Timer.Interval = 500; // ms }
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; }
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; }
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); } }
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 } }
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 }