////////////////////////////////////////////////////////////////// //Constructors public GalacticGameEngine() { ID = ""; Name = ""; Player1 = new Player(); _gameIsRunning = false; curGalacticDayMang = new GalacticDayManager(); curGameUniverse = new GameUniverse(); MainMapControl = new Controls.GameEngineControls.GalacticMapControl(); TopBarControl = new Controls.GameEngineControls.GameTopBarControl(); RightBarControl = new Controls.GameEngineControls.GameRightBarControl(); LeftPlanetMenu = new Controls.PlanetsInGalaxyMenu(); RightPlanetMenu = new Controls.PlanetsInGalaxyMenu(); LeftPlanetOrbitMenu = new Controls.PlanetOrbitControl(); InfoMenu = new Controls.GameInformationMenu(); PlanetCommandMenu = new Controls.PlanetCommandControl(); ConstructionMenu = new Controls.GameEngineControls.ConstructionMenuControl(); }
//////////////////////////////////////////// //Check Mouse Clicks public void checkGameRunningMouseClick(GameUpdateClassComponents curGameUpdateComponents) { if (this._gameIsRunning) { /////////////////////////////////////// //Check Orbit Planet Menus ////////////////////////////////////// //Check Orbit Menu if (!this.LeftPlanetOrbitMenu._isNull && this.LeftPlanetOrbitMenu._isEnabled) { bool blnExit = false; //foreach(Controls.FancyDropDownBoxControl curDDB in this.LeftPlanetOrbitMenu.menuDropDownBoxControls) //{ for (int i = 0; i < this.LeftPlanetOrbitMenu.menuDropDownBoxControls.Count; i++) { if (LeftPlanetOrbitMenu.menuDropDownBoxControls[i]._isEnabled) { if (LeftPlanetOrbitMenu.menuDropDownBoxControls[i].dropDownBoxArrow.mouseClicked(curGameUpdateComponents)) { if (LeftPlanetOrbitMenu.menuDropDownBoxControls[i].dropDownCollapsed) LeftPlanetOrbitMenu.menuDropDownBoxControls[i].dropDownCollapsed = false; else LeftPlanetOrbitMenu.menuDropDownBoxControls[i].dropDownCollapsed = true; } if (!LeftPlanetOrbitMenu.menuDropDownBoxControls[i].dropDownCollapsed) { LeftPlanetOrbitMenu.menuDropDownBoxControls[i].mouseClicked(curGameUpdateComponents); } } } //} bool blnOrbitLeftClose = false; int menuInc = 0; //Run through each Button foreach (Controls.FancyButtonControl curButton in this.LeftPlanetOrbitMenu.menuButtons) { if (!curButton._isNull) { if (curButton.mouseClicked(curGameUpdateComponents)) { if (curButton.ID == "btnExitOrbitMenu") {//Clicked Exit Galaxy blnOrbitLeftClose = true; } if (curButton.ID.Length > "btnSendShip".Length) { if (curButton.ID.Substring(0, "btnSendShip".Length) == "btnSendShip") { int invUnitID = Convert.ToInt32(curButton.ID.Replace("btnSendShip", "")); string originalPlanetName = LeftPlanetOrbitMenu.strPlanetName; GameEngine.PlayerInvObjs.InvUnit myInv = curGameUniverse.getInvUnitByID(invUnitID, Model.DataCardType.Ship); string desitiantionPlanetName = LeftPlanetOrbitMenu.getDestinationPlanetNameByID(invUnitID); DataCards.Planet oriPlnt = curGameUniverse.getPlanetByName(originalPlanetName); DataCards.Planet destPlnt = curGameUniverse.getPlanetByName(desitiantionPlanetName); oriPlnt.Orbit.removeShipFromOrbitByID(myInv.id); //Takes 5 days to get anywhere! myInv.transitObj.setTravelTime(5); destPlnt.Orbit.StarshipFleetsInOrbit.Add(myInv); LeftPlanetOrbitMenu.menuButtons.RemoveAt(menuInc); blnOrbitLeftClose = true; break; //myInv. } } //if (curButton.ID == "btnExitPlanetCmdMenu") //{//Clicked Exit Planet Command // exitPlntCmdMenu = true; //} //if (curButton.ID == "btnContinue") //{//Clicked Exit Faction form // _continueClicked = true; //} } } menuInc++; } if (blnOrbitLeftClose) { this.LeftPlanetOrbitMenu = new Controls.PlanetOrbitControl(); this.LeftPlanetMenu.Enable(); this.RightPlanetMenu.Enable(); } } /////////////////////////////////////// //Check Galaxy Planet Menus ////////////////////////////////////// //Check Left Menu if (!this.LeftPlanetMenu._isNull && this.LeftPlanetMenu._isEnabled) { bool exitLeftGPMenu = false; bool exitRightGPMenu = false; //Run through each Button foreach (Controls.FancyButtonControl curButton in this.LeftPlanetMenu.menuButtons) { if (!curButton._isNull) { if (curButton.mouseClicked(curGameUpdateComponents)) { if (curButton.ID == "btnExitGalaxyMenu") {//Clicked Exit Galaxy exitLeftGPMenu = true; } //if (curButton.ID == "btnContinue") //{//Clicked Exit Faction form // _continueClicked = true; //} } } } float startingPlanetY = this.LeftPlanetMenu.vectorPos.Y + 50; float infoButtonX = Model.StaticValues.xPaddingForInfoBuutton + this.LeftPlanetMenu.vectorPos.X; float commandButtonX = Model.StaticValues.xPaddingForCommandButton + this.LeftPlanetMenu.vectorPos.X; float orbitButtonX = Model.StaticValues.xPaddingForOrbitButton + this.LeftPlanetMenu.vectorPos.X; foreach (DataCards.Planet curPlanet in this.LeftPlanetMenu.menuPlanetControls) { //Check for Info Button if (curGameUpdateComponents._curMouseState.X > infoButtonX && curGameUpdateComponents._curMouseState.X < (infoButtonX + 30)) { if (curGameUpdateComponents._curMouseState.Y > startingPlanetY && curGameUpdateComponents._curMouseState.Y < (startingPlanetY + 30)) { CreatePlanetInfoMenu(curGameUpdateComponents, curPlanet); } } //Check for Command Button if (curGameUpdateComponents._curMouseState.X > commandButtonX && curGameUpdateComponents._curMouseState.X < (commandButtonX + 30)) { if (curGameUpdateComponents._curMouseState.Y > startingPlanetY && curGameUpdateComponents._curMouseState.Y < (startingPlanetY + 30)) { CreatePlanetCommandMenu(curGameUpdateComponents, curPlanet); } } //Check for Orbit Button if (curGameUpdateComponents._curMouseState.X > orbitButtonX && curGameUpdateComponents._curMouseState.X < (orbitButtonX + 30)) { if (curGameUpdateComponents._curMouseState.Y > startingPlanetY && curGameUpdateComponents._curMouseState.Y < (startingPlanetY + 30)) { //CreatePlanetCommandMenu(curGameUpdateComponents, curPlanet); CreateOrbitCommandMenu(curGameUpdateComponents, curPlanet); } } startingPlanetY += 60; } if (exitLeftGPMenu) { this.LeftPlanetMenu = new Controls.PlanetsInGalaxyMenu(); } if (exitRightGPMenu) { this.RightPlanetMenu = new Controls.PlanetsInGalaxyMenu(); } } //Check Info Menu if (!this.InfoMenu._isNull && this.InfoMenu._isEnabled) { bool exitInfoMenu = false; //Run through each Button foreach (Controls.FancyButtonControl curButton in this.InfoMenu.menuButtons) { if (!curButton._isNull) { if (curButton.mouseClicked(curGameUpdateComponents)) { if (curButton.ID == "btnExitInfoMenu") {//Clicked Exit Galaxy exitInfoMenu = true; } //if (curButton.ID == "btnExitPlanetCmdMenu") //{//Clicked Exit Planet Command // exitPlntCmdMenu = true; //} //if (curButton.ID == "btnContinue") //{//Clicked Exit Faction form // _continueClicked = true; //} } } } if (exitInfoMenu) { this.InfoMenu = new Controls.GameInformationMenu(); this.LeftPlanetMenu.Enable(); this.RightPlanetMenu.Enable(); } //if (exitPlntCmdMenu) //{ // this.PlanetCommandMenu = new Controls.PlanetCommandControl(); // this.LeftPlanetMenu.Enable(); // this.RightPlanetMenu.Enable(); //} } //Check Planet Control Menu if (!this.PlanetCommandMenu._isNull && this.PlanetCommandMenu._isEnabled) { bool exitPlntCmdMenu = false; //Run through each Button foreach (Controls.FancyButtonControl curButton in this.PlanetCommandMenu.menuButtons) { if (!curButton._isNull) { if (curButton.mouseClicked(curGameUpdateComponents)) { // if (curButton.ID == "btnExitInfoMenu") // {//Clicked Exit Galaxy // exitInfoMenu = true; // } if (curButton.ID == "btnExitPlanetCmdMenu") {//Clicked Exit Planet Command exitPlntCmdMenu = true; } //if (curButton.ID == "btnContinue") //{//Clicked Exit Faction form // _continueClicked = true; //} } } } foreach (Controls.TabPanel.TabPanel curTP in PlanetCommandMenu.tabControl.tabPanels) { Controls.PanelControl curPnl = curTP.panel; //Prolly dont need a loop here but whatevs/// if (curTP.selected) { foreach (Controls.FancyButtonControl curBtn in curPnl.menuButtons) { if (curBtn.mouseClicked(curGameUpdateComponents)) { if (curBtn.ID == "btnFacilityMFR") { buildConstructionMenu(curGameUpdateComponents, curBtn.ID); } if (curBtn.ID == "btnShipMFR") { buildConstructionMenu(curGameUpdateComponents, curBtn.ID); //buildShipMenu(curGameUpdateComponents, curBtn.ID); } if (curBtn.ID == "btnTroopsMFR") { buildConstructionMenu(curGameUpdateComponents, curBtn.ID); //buildShipMenu(curGameUpdateComponents, curBtn.ID); } if (curBtn.ID == "btnTroops") { loadAsManyTroopsOnShipsAsPossible(PlanetCommandMenu.SelectedPlanetName); } } } } } PlanetCommandMenu.CheckMouseClick(curGameUpdateComponents); if (exitPlntCmdMenu) { this.PlanetCommandMenu = new Controls.PlanetCommandControl(); this.LeftPlanetMenu.Enable(); this.RightPlanetMenu.Enable(); } } //Check Construction Menu if (!ConstructionMenu._isNull) { if (ConstructionMenu.destinationDropDown._isEnabled) { //Collapse or close menu if arrow clicked if (ConstructionMenu.destinationDropDown.dropDownBoxArrow.mouseClicked(curGameUpdateComponents)) { if (ConstructionMenu.destinationDropDown.dropDownCollapsed) ConstructionMenu.destinationDropDown.dropDownCollapsed = false; else ConstructionMenu.destinationDropDown.dropDownCollapsed = true; } //Select a new test option as "selected" if (!ConstructionMenu.destinationDropDown.dropDownCollapsed) { ConstructionMenu.destinationDropDown.mouseClicked(curGameUpdateComponents); } } if (ConstructionMenu.facilityTypeDropDown._isEnabled) { //Collapse or close menu if arrow clicked if (ConstructionMenu.facilityTypeDropDown.dropDownBoxArrow.mouseClicked(curGameUpdateComponents)) { if (ConstructionMenu.facilityTypeDropDown.dropDownCollapsed) ConstructionMenu.facilityTypeDropDown.dropDownCollapsed = false; else ConstructionMenu.facilityTypeDropDown.dropDownCollapsed = true; } //Select a new test option as "selected" if (!ConstructionMenu.facilityTypeDropDown.dropDownCollapsed) { ConstructionMenu.facilityTypeDropDown.mouseClicked(curGameUpdateComponents); } } //Check buttons foreach (Controls.FancyButtonControl curBtn in ConstructionMenu.menuButtons) { if (curBtn.mouseClicked(curGameUpdateComponents)) { //Exit if (curBtn.ID == "btnExitManuFacilityMenu") { ConstructionMenu = new Controls.GameEngineControls.ConstructionMenuControl(); } //Build new facility if (curBtn.ID == "btnContructManuFacilityMenu") {/////////Under construction is going on Type not Entity!!! string strFacilityTypeName = ConstructionMenu.facilityTypeDropDown.textOptions[ConstructionMenu.facilityTypeDropDown.selectedIndex]; string strPlanetName = ConstructionMenu.destinationDropDown.textOptions[ConstructionMenu.destinationDropDown.selectedIndex]; DataCards.Facility facilCheck = staticDataCards.getFacilityByName(strFacilityTypeName); //InvUnit will be like... An Entity. Maybe I will rename it that later when its a pain in the ass to change it :P GameEngine.PlayerInvObjs.InvUnit newUnit = new GameEngine.PlayerInvObjs.InvUnit(); newUnit._underConstruction = true; newUnit.startEntityConstruction(facilCheck, strPlanetName); newUnit.FacilityOwner = new GameEngine.GalacticComponents.Owner(Player1); //Add the Inventory Object to the GroundSpaces->Facilites array curGameUniverse.getPlanetByName(strPlanetName).GroundSpaces.Facilities.Add(newUnit); Player1.curGameResourceMang.invRawMaterials -= facilCheck.baseManufactureCost.ResourceCost; ConstructionMenu = new Controls.GameEngineControls.ConstructionMenuControl(); } //Build new Ship if (curBtn.ID == "btnContructManuShipMenu") {/////////Under construction is going on Type not Entity!!! string strFacilityTypeShipName = ConstructionMenu.facilityTypeDropDown.textOptions[ConstructionMenu.facilityTypeDropDown.selectedIndex]; string strPlanetName = ConstructionMenu.destinationDropDown.textOptions[ConstructionMenu.destinationDropDown.selectedIndex]; DataCards.Ship shipCheck = staticDataCards.getShipByName(strFacilityTypeShipName); //InvUnit will be like... An Entity. Maybe I will rename it that later when its a pain in the ass to change it :P GameEngine.PlayerInvObjs.InvUnit newUnit = new GameEngine.PlayerInvObjs.InvUnit(); newUnit._underConstruction = true; newUnit.startEntityConstruction(shipCheck, strPlanetName); newUnit.FacilityOwner = new GameEngine.GalacticComponents.Owner(Player1); //Add ship to orbit curGameUniverse.getPlanetByName(strPlanetName).Orbit.StarshipFleetsInOrbit.Add(newUnit); Player1.curGameResourceMang.invRawMaterials -= 100;//Charging 100 by default ConstructionMenu = new Controls.GameEngineControls.ConstructionMenuControl(); } //Build new Troop if (curBtn.ID == "btnContructManuTroopsMenu") {/////////Under construction is going on Type not Entity!!! string strFacilityTypeTroopsName = ConstructionMenu.facilityTypeDropDown.textOptions[ConstructionMenu.facilityTypeDropDown.selectedIndex]; string strPlanetName = ConstructionMenu.destinationDropDown.textOptions[ConstructionMenu.destinationDropDown.selectedIndex]; DataCards.Troops TroopsCheck = staticDataCards.getTroopsByName(strFacilityTypeTroopsName); //InvUnit will be like... An Entity. Maybe I will rename it that later when its a pain in the ass to change it :P GameEngine.PlayerInvObjs.InvUnit newUnit = new GameEngine.PlayerInvObjs.InvUnit(); newUnit._underConstruction = true; newUnit.startEntityConstruction(TroopsCheck, strPlanetName); newUnit.FacilityOwner = new GameEngine.GalacticComponents.Owner(Player1); //Add troops to planet curGameUniverse.getPlanetByName(strPlanetName).GroundSpaces.Troops.Add(newUnit); Player1.curGameResourceMang.invRawMaterials -= 10;//Charging 10 by default ConstructionMenu = new Controls.GameEngineControls.ConstructionMenuControl(); } } } } //Only Check if GP menus are not displayed if (this.LeftPlanetMenu._isNull && this.RightPlanetMenu._isNull) { //Check Galaxy Clicks foreach (DataCards.Galaxy curGalaxy in this.curGameUniverse.TheUniverse) { string[] strArryXYBounds = curGalaxy.MouseImageAreaCoordinates.Split(';'); Model.XYStringToInt topLeft = new Model.XYStringToInt(strArryXYBounds[0]); Model.XYStringToInt bottomRight = new Model.XYStringToInt(strArryXYBounds[1]); if (curGameUpdateComponents._curMouseState.X > topLeft.X && curGameUpdateComponents._curMouseState.X < bottomRight.X) { if (curGameUpdateComponents._curMouseState.Y > topLeft.Y && curGameUpdateComponents._curMouseState.Y < bottomRight.Y) { ///////////////////////////////// //Create Galaxy Planets Menu ////////////////////////////////// Texture2D curTexture = curGameUpdateComponents._staticTextureImages._galacticPlanetView; //Vector2 curVector = new Vector2(100, 100); //Rectangle curRect = new Rectangle(100, 100, 300, 300); Controls.PlanetsInGalaxyMenu curMenuControl = new Controls.PlanetsInGalaxyMenu(); //Start Menu Button List List<Controls.FancyButtonControl> menuButtons = new List<Controls.FancyButtonControl>(); //Get Continue Button Settings Texture2D curButtonTexture = curGameUpdateComponents._staticTextureImages._buttonTexture; Vector2 curButtonVector = new Vector2(110, 340); Rectangle curButtonRect = new Rectangle(110, 340, 130, 50); //Add the Continue Button //menuButtons.Add(new GalacticConquest.Controls.FancyButtonControl("btnSaveSettings", curButtonTexture, curButtonVector, curButtonRect, "Save")); //Add the Exit Button curButtonVector = new Vector2(365, 650); curButtonRect = new Rectangle(365, 650, 130, 50); menuButtons.Add(new Controls.FancyButtonControl("btnExitGalaxyMenu", curButtonTexture, curButtonVector, curButtonRect, "Exit")); //Create the Menu Control curMenuControl = new Controls.PlanetsInGalaxyMenu("mnuGalaxy", curTexture, Model.OrientationType.Left, curGalaxy.Name, "...Settings List Here...", menuButtons); curMenuControl.menuPlanetControls = this.curGameUniverse.getPlanetListByGalaxyName(curGalaxy.Name); this.LeftPlanetMenu = curMenuControl; //Add menu control to list //activeImgMenus.Add(curMenuControl); } } } } checkTopBarMouseClick(curGameUpdateComponents); } }
public void CreatePlanetCommandMenu(GameUpdateClassComponents curGameUpdateComponents, DataCards.Planet curPlanet) { //Create a Planet Command Menu //Disable other controls this.disableAllControls(); Rectangle myAvgRect = new Rectangle(300, 200, 600, 400); List<GameEngine.PlayerInvObjs.InvUnit> facilityInvUnits = new List<GameEngine.PlayerInvObjs.InvUnit>(); facilityInvUnits = curGameUniverse.getPlanetByName(curPlanet.Name).GroundSpaces.Facilities; List<GameEngine.PlayerInvObjs.InvUnit> troopsInvUnits = new List<GameEngine.PlayerInvObjs.InvUnit>(); troopsInvUnits = curGameUniverse.getPlanetByName(curPlanet.Name).GroundSpaces.Troops; List<Controls.DataCardIconControl> facilityDataCards = new List<GalacticConquest.Controls.DataCardIconControl>(); List<Controls.DataCardIconControl> troopsDataCards = new List<GalacticConquest.Controls.DataCardIconControl>(); foreach (GameEngine.PlayerInvObjs.InvUnit curIU in facilityInvUnits) { Controls.DataCardIconControl curDataCard = new GalacticConquest.Controls.DataCardIconControl(); //If Under construction@!!///// if (curIU._underConstruction) { curDataCard.imgControl = curGameUpdateComponents._staticTextureImages._underConstructionFacility; curDataCard.strControlText = curIU.iuFacility.HeaderText + " (U/C " + curIU._remainingConstructionDays.ToString() + " days left)"; } else { curDataCard.imgControl = Texture2D.FromFile(curGameUpdateComponents._graphicsDevice, Model.DataUtilities._FacilitiesImagePath + curIU.iuFacility.Name + ".jpg"); curDataCard.strControlText = curIU.iuFacility.HeaderText; } Rectangle curDataCardRect = new Rectangle(myAvgRect.X + 10, myAvgRect.Y + 10, curDataCard.imgControl.Width, curDataCard.imgControl.Height); curDataCard.rectControl = curDataCardRect; curDataCard._isNull = false; facilityDataCards.Add(curDataCard); } foreach (GameEngine.PlayerInvObjs.InvUnit curIU in troopsInvUnits) { Controls.DataCardIconControl curDataCard = new GalacticConquest.Controls.DataCardIconControl(); //If Under construction@!!///// if (curIU._underConstruction) { curDataCard.imgControl = curGameUpdateComponents._staticTextureImages._underConstructionFacility; // Use a troops Under Construction image when you get one... curDataCard.strControlText = curIU.iuTroops.HeaderText + " (U/C " + curIU._remainingConstructionDays.ToString() + " days left)"; } else { curDataCard.imgControl = Texture2D.FromFile(curGameUpdateComponents._graphicsDevice, Model.DataUtilities._TroopsImagePath + curIU.iuTroops.Name + ".jpg"); curDataCard.strControlText = curIU.iuTroops.HeaderText; } Rectangle curDataCardRect = new Rectangle(myAvgRect.X + 10, myAvgRect.Y + 10, curDataCard.imgControl.Width, curDataCard.imgControl.Height); curDataCard.rectControl = curDataCardRect; curDataCard._isNull = false; troopsDataCards.Add(curDataCard); } Controls.PlanetCommandControl newPlanetCmdMenu = new Controls.PlanetCommandControl(); newPlanetCmdMenu.menuImageToDisplay = curGameUpdateComponents._staticTextureImages._planetCommandMenu; newPlanetCmdMenu.menuVector = new Vector2(50, 100); newPlanetCmdMenu.HeaderText = curPlanet.HeaderText; newPlanetCmdMenu.Description = curPlanet.Description; newPlanetCmdMenu.Name = "plntCmdMenu"; newPlanetCmdMenu.tag = curPlanet; newPlanetCmdMenu.SelectedPlanetName = curPlanet.Name; newPlanetCmdMenu._isEnabled = true; newPlanetCmdMenu._isNull = false; /////////////////////////////////////////////////////////////////// //Create Tab Control Controls.TabPanel.TabPanelControl tabControl = new Controls.TabPanel.TabPanelControl(); tabControl.TabSelectedTexture = curGameUpdateComponents._staticTextureImages._tabSelected; tabControl.TabUnselectedTexture = curGameUpdateComponents._staticTextureImages._tabUnselected; tabControl.VectorPosition = new Vector2(300,157); Controls.TabPanel.TabPanel tabPanelCmd = new Controls.TabPanel.TabPanel(); Controls.PanelControl btnPanel = new Controls.PanelControl(); btnPanel._isEnabled = true; btnPanel._isNull = false; btnPanel.backColor = Color.LightSalmon; btnPanel.borderColor = Color.Black; btnPanel.borderSize = 2; btnPanel.panelRect = myAvgRect; if (curPlanet.GroundSpaces.hasFacilityMFR()) //If the planet has a manufactoring facility then let them build { Controls.FancyButtonControl btnFacilityMFR = new Controls.FancyButtonControl(); Vector2 btnFacilVector = new Vector2(350,270); Rectangle btnFacilRect = new Rectangle((int)btnFacilVector.X, (int)btnFacilVector.Y, curGameUpdateComponents._staticTextureImages._buttonTexture.Width, curGameUpdateComponents._staticTextureImages._buttonTexture.Height); btnFacilityMFR = new Controls.FancyButtonControl("btnFacilityMFR", curGameUpdateComponents._staticTextureImages._buttonTexture, btnFacilVector, btnFacilRect, "Construct Buildings"); btnPanel.menuButtons.Add(btnFacilityMFR); } if (curPlanet.GroundSpaces.hasShipMFR())//If the planet has a ship building facility then let them build { Controls.FancyButtonControl btnShipMFR = new Controls.FancyButtonControl(); Vector2 btnFacilVector = new Vector2(curGameUpdateComponents._staticTextureImages._buttonTexture.Width + 350 + 75, 270); Rectangle rectShipMFR = new Rectangle((int)btnFacilVector.X, (int)btnFacilVector.Y, curGameUpdateComponents._staticTextureImages._buttonTexture.Width, curGameUpdateComponents._staticTextureImages._buttonTexture.Height); btnShipMFR = new Controls.FancyButtonControl("btnShipMFR", curGameUpdateComponents._staticTextureImages._buttonTexture, btnFacilVector, rectShipMFR, "Construct Ships"); btnPanel.menuButtons.Add(btnShipMFR); } if (curPlanet.GroundSpaces.hasTroopsMFR())//If the planet has a troops building facility then let them build { Controls.FancyButtonControl btnTroopsMFR = new Controls.FancyButtonControl(); Vector2 btnFacilVector = new Vector2(350, curGameUpdateComponents._staticTextureImages._buttonTexture.Height + 270 + 50); Rectangle rectTroopsMFR = new Rectangle((int)btnFacilVector.X, (int)btnFacilVector.Y, curGameUpdateComponents._staticTextureImages._buttonTexture.Width, curGameUpdateComponents._staticTextureImages._buttonTexture.Height); btnTroopsMFR = new Controls.FancyButtonControl("btnTroopsMFR", curGameUpdateComponents._staticTextureImages._buttonTexture, btnFacilVector, rectTroopsMFR, "Construct Troops"); btnPanel.menuButtons.Add(btnTroopsMFR); } if (curPlanet.GroundSpaces.hasTroops() && curPlanet.Orbit.hasShipsInOrbit())//If the planet has troops and ship then let them move them { Controls.FancyButtonControl btnTroops = new Controls.FancyButtonControl(); Vector2 btnFacilVector = new Vector2(curGameUpdateComponents._staticTextureImages._buttonTexture.Width + 350 + 75, curGameUpdateComponents._staticTextureImages._buttonTexture.Height + 270 + 50); Rectangle rectTroopsMFR = new Rectangle((int)btnFacilVector.X, (int)btnFacilVector.Y, curGameUpdateComponents._staticTextureImages._buttonTexture.Width, curGameUpdateComponents._staticTextureImages._buttonTexture.Height); btnTroops = new Controls.FancyButtonControl("btnTroops", curGameUpdateComponents._staticTextureImages._buttonTexture, btnFacilVector, rectTroopsMFR, "Move Troops"); btnPanel.menuButtons.Add(btnTroops); } //btnPanel. tabPanelCmd.Name = "Command"; tabPanelCmd.TabText = "Command"; tabPanelCmd.selected = true; tabPanelCmd.panel = btnPanel; tabPanelCmd._isNull = false; Controls.TabPanel.TabPanel tabPanelFacility = new Controls.TabPanel.TabPanel(); Controls.PanelControl facilityPanel = new Controls.PanelControl(); facilityPanel._isEnabled = true; facilityPanel._isNull = false; facilityPanel.backColor = Color.LightGreen; facilityPanel.borderColor = Color.Black; facilityPanel.borderSize = 2; facilityPanel.panelRect = myAvgRect; //Add Facility DataCards //facilityPanel. facilityPanel.dataCards = facilityDataCards; tabPanelFacility.Name = "Facilities"; tabPanelFacility.TabText = "Facilities"; tabPanelFacility.panel = facilityPanel; tabPanelFacility._isNull = false; Controls.TabPanel.TabPanel tabPanelTroops = new Controls.TabPanel.TabPanel(); Controls.PanelControl troopsPanel = new Controls.PanelControl(); troopsPanel._isEnabled = true; troopsPanel._isNull = false; troopsPanel.backColor = Color.Gray; troopsPanel.borderColor = Color.Red; troopsPanel.borderSize = 2; troopsPanel.panelRect = myAvgRect; troopsPanel.dataCards = troopsDataCards; tabPanelTroops.Name = "Troops"; tabPanelTroops.TabText = "Troops"; tabPanelTroops.panel = troopsPanel; tabPanelTroops._isNull = false; //Insert all panels intoTab control tabControl.tabPanels.Add(tabPanelCmd); tabControl.tabPanels.Add(tabPanelFacility); tabControl.tabPanels.Add(tabPanelTroops); //Add the Tab Control newPlanetCmdMenu.tabControl = tabControl; //Add the Exit Button newPlanetCmdMenu.menuButtons.Add(new Controls.FancyButtonControl("btnExitPlanetCmdMenu", curGameUpdateComponents._staticTextureImages._buttonTexture, new Vector2(800, 680), new Rectangle(800, 680, 130, 50), "Exit")); this.PlanetCommandMenu = newPlanetCmdMenu; }