public InvUnit(DataCards.Planet invUnitPlanet) { startingLocation = invUnitPlanet.Name; invUnitType = Model.DataCardType.Planet; iuPlanet = invUnitPlanet; _underConstruction = false; transitObj = new GameEngine.GalacticComponents.TravelObj(); _remainingConstructionDays = 0; id = getID(); }
public InvUnit(DataCards.Ship invUnitShip, string _startingPlanetName) { startingLocation = _startingPlanetName; invUnitType = Model.DataCardType.Ship; iuShip = invUnitShip; _underConstruction = false; transitObj = new GameEngine.GalacticComponents.TravelObj(); _remainingConstructionDays = 0; id = getID(); }
public InvUnit(DataCards.Troops invUnitTroops, string _startingPlanetName) { //Create a Troops unit and set it at a planet //Implies that this might mean its a starting unit. Generally they would need a construction.//Possibly loading from a save file in the future :) startingLocation = _startingPlanetName; invUnitType = Model.DataCardType.Troops; iuTroops = invUnitTroops; _underConstruction = false; transitObj = new GameEngine.GalacticComponents.TravelObj(); _remainingConstructionDays = 0; id = getID(); }
public void startEntityConstruction(DataCards.Facility invUnitFacility, string _startingPlanetName) { startingLocation = _startingPlanetName; invUnitType = Model.DataCardType.Facility; iuFacility = invUnitFacility; _underConstruction = true; transitObj = new GameEngine.GalacticComponents.TravelObj(); _remainingConstructionDays = iuFacility.baseManufactureCost.BaseConstructionTime; id = getID(); }
public void OnEndDrag(PointerEventData data) { if (main.transform.parent.gameObject.name != "ThrowingCase") { float fromcase = Vector2.Distance(throwed_case.transform.position, this.gameObject.transform.position); float fromCards = Vector2.Distance(cards.transform.position, this.gameObject.transform.position); if (fromcase < fromCards) { // TODO: ANIMATE THIS THING HERE if (main.gameObject.name == "Freeze") { if (GameObject.Find("BlackBackground")) { //Stop the monk if the smashing monk has apeeared main.transform.SetParent(throwed_case.transform); Destroy(main.GetComponent <LayoutElement>()); EventHandles.GetComponent <Events>().isSmashingMonk = false; GameObject.Find("BlackBackground").SetActive(false); EventHandles.GetComponent <Events>().PlaceSmashingMonk(); } EventHandles.GetComponent <Events>().CanceltheTimerInvoke(); // Cancel the TImerInvoke For Reintalization EventHandles.GetComponent <Events>().StartTheTimer(); // Start the TimerInvoke again } else { if (GameObject.Find("BlackBackground")) { // If card other than Freeze card is passed to the placeholder. Just Return it back Debug.Log("DOING THIS"); // Do nothing main.transform.SetParent(container.transform); if (GameObject.Find("Empty")) { main.transform.SetSiblingIndex(GameObject.Find("Empty").transform.GetSiblingIndex()); } DestroyImmediate(GameObject.Find("Empty")); Vector3 positionSe = this.gameObject.GetComponent <RectTransform>().position; positionSe.z = 1; this.gameObject.GetComponent <RectTransform>().localPosition = positionSe; main.GetComponent <CanvasGroup>().blocksRaycasts = true; // Lets make it Default as true inside = true; } else { if (main.gameObject.name == "Freeze") { // THis means the user have given this card without any reason. Just return it back Debug.Log("DOING THIS"); // Do nothing main.transform.SetParent(container.transform); if (GameObject.Find("Empty")) { main.transform.SetSiblingIndex(GameObject.Find("Empty").transform.GetSiblingIndex()); } DestroyImmediate(GameObject.Find("Empty")); Vector3 positionSe = this.gameObject.GetComponent <RectTransform>().position; positionSe.z = 1; this.gameObject.GetComponent <RectTransform>().localPosition = positionSe; main.GetComponent <CanvasGroup>().blocksRaycasts = true; // Lets make it Default as true inside = true; } else { if (EventHandles.GetComponent <Events>().isSteal == true && EventHandles.GetComponent <Events>().currentlyGotSteal == true) { // If i am in the steal mode, means i have to give a card to other just send the selected card to him. EventHandles.GetComponent <Events>().SendMonkaCard(main.gameObject); EventHandles.GetComponent <Events>().StopMyChances(); EventHandles.GetComponent <Events>().animationHand.SetActive(false); // This is only to give cards EventHandles.GetComponent <Events>().isSteal = false; EventHandles.GetComponent <Events>().currentlyGotSteal = false; Destroy(main.GetComponent <LayoutElement>()); if (GameObject.Find("Empty")) { DestroyImmediate(GameObject.Find("Empty")); } } else { if (this.gameObject.name == "Shuffle") { // If the dragged card is Shuffle just shuffle the cardDeck main.transform.SetParent(throwed_case.transform); Destroy(main.GetComponent <LayoutElement>()); Destroy(GameObject.Find("Empty")); EventHandles.GetComponent <Events>().ShuffleCard(); } if (this.gameObject.name == "Skip") { // If the dragged Card is Skip just skip your one turn EventHandles.GetComponent <Events>().CanceltheTimerInvoke(); main.transform.SetParent(throwed_case.transform); Destroy(main.GetComponent <LayoutElement>()); Destroy(GameObject.Find("Empty")); EventHandles.GetComponent <Events>().TurnEvent(); } if (this.gameObject.name == "Futurex3") { // If The dragged card is Future(x3) just show it in the future scene main.transform.SetParent(throwed_case.transform); Destroy(main.GetComponent <LayoutElement>()); Destroy(GameObject.Find("Empty")); List <string> topCards = new List <string>(); GameObject cardDeck = GameObject.Find("CardDeck"); topCards.Add(cardDeck.transform.GetChild(cardDeck.transform.childCount - 1).gameObject.name); // Add toppest card topCards.Add(cardDeck.transform.GetChild(cardDeck.transform.childCount - 2).gameObject.name); // Add second card topCards.Add(cardDeck.transform.GetChild(cardDeck.transform.childCount - 3).gameObject.name); // Add third card EventHandles.GetComponent <Events>().SeeFuture(topCards); } if (this.gameObject.name == "Futurex1") { // If the dragged card is Future(x1) just show them in the future scene main.transform.SetParent(throwed_case.transform); Destroy(main.GetComponent <LayoutElement>()); Destroy(GameObject.Find("Empty")); List <string> topCards = new List <string>(); GameObject cardDeck = GameObject.Find("CardDeck"); topCards.Add(cardDeck.transform.GetChild(cardDeck.transform.childCount - 1).gameObject.name); // Add toppest card EventHandles.GetComponent <Events>().SeeFuture(topCards); } if (this.gameObject.name == "Futurex5") { // If the dragged card is Future(x5) just show them the 5 future cards in future scene main.transform.SetParent(throwed_case.transform); Destroy(main.GetComponent <LayoutElement>()); Destroy(GameObject.Find("Empty")); List <string> topCards = new List <string>(); GameObject cardDeck = GameObject.Find("CardDeck"); topCards.Add(cardDeck.transform.GetChild(cardDeck.transform.childCount - 1).gameObject.name); // Add toppest card topCards.Add(cardDeck.transform.GetChild(cardDeck.transform.childCount - 2).gameObject.name); // Add second card topCards.Add(cardDeck.transform.GetChild(cardDeck.transform.childCount - 3).gameObject.name); // Add third card topCards.Add(cardDeck.transform.GetChild(cardDeck.transform.childCount - 4).gameObject.name); // Add fourth card topCards.Add(cardDeck.transform.GetChild(cardDeck.transform.childCount - 5).gameObject.name); // Add fifth card EventHandles.GetComponent <Events>().SeeFuture(topCards); } if (this.gameObject.name == "Attackx1") { // If the dragged car is Attack(x1) just ask the user the player to attack on the desired player.... Meanwhile don't allow him to play any other card EventHandles.GetComponent <Events>().isAttackMode = true; EventHandles.GetComponent <Events>().turnForAttack = 1; EventHandles.GetComponent <Events>().myChance = false; EventHandles.GetComponent <Events>().ShowArrows(); EventHandles.GetComponent <Events>().StopMyChance(); } if (this.gameObject.name == "Attackx2") { // If the dragged car is Attack(x2) just ask the user the player to attack on the desired player.... Meanwhile don't allow him to play any other card EventHandles.GetComponent <Events>().isAttackMode = true; EventHandles.GetComponent <Events>().turnForAttack = 2; EventHandles.GetComponent <Events>().myChance = false; EventHandles.GetComponent <Events>().ShowArrows(); EventHandles.GetComponent <Events>().StopMyChance(); } if (this.gameObject.name == "Attackx3") { // If the dragged car is Attack(x3) just ask the user the player to attack on the desired player.... Meanwhile don't allow him to play any other card EventHandles.GetComponent <Events>().isAttackMode = true; EventHandles.GetComponent <Events>().turnForAttack = 3; EventHandles.GetComponent <Events>().myChance = false; EventHandles.GetComponent <Events>().ShowArrows(); EventHandles.GetComponent <Events>().StopMyChance(); } if (this.gameObject.name == "WhatTheDuck") { // If the dragged card is what the duck. Ask the user to select his desired player..... Meanwhile stop him to do any activity related to cards EventHandles.GetComponent <Events>().isWhattheDuck = true; EventHandles.GetComponent <Events>().myChance = false; EventHandles.GetComponent <Events>().ShowArrows(); } if (this.gameObject.name == "Reverse") { // If the dragged card is reverse just reverse the turn sequence EventHandles.GetComponent <Events>().ReverseTurn(); } if (this.gameObject.name == "Steal") { // Here is somebug so i am not describing it now. EventHandles.GetComponent <Events>().isSteal = true; EventHandles.GetComponent <Events>().myChance = false; EventHandles.GetComponent <Events>().ShowArrows(); EventHandles.GetComponent <Events>().StopMyChance(); // Lets do something } Debug.Log("DOING THIS"); main.transform.SetParent(throwed_case.transform); Destroy(main.GetComponent <LayoutElement>()); Destroy(GameObject.Find("Empty")); } } } } EventHandles.GetComponent <Events>().UpdateTotalCards(container.transform.childCount); // Lets just remove this } else { // TODO: ANIMATE THIS THING HERE main.transform.SetParent(container.transform); main.GetComponent <CanvasGroup>().blocksRaycasts = true; inside = true; List <DataCards> dataAll = new List <DataCards>(); for (int l = 0; l < allCards.Count; l++) { float distance = Vector3.Distance(transform.position, allCards[l].transform.position); DataCards dC = new DataCards(); dC.card = allCards[l]; dC.distance = distance; dataAll.Add(dC); } dataAll.Sort((IComparer <DataCards>) new sort()); if ((dataAll[1].distance - dataAll[0].distance) < 0.1) { if (main) { if (GameObject.Find("Empty")) { main.transform.SetSiblingIndex(GameObject.Find("Empty").transform.GetSiblingIndex()); } } Vector3 position = main.transform.position; position.z = 1; main.transform.position = position; Destroy(GameObject.Find("Empty")); Vector3 positionSe = this.gameObject.GetComponent <RectTransform>().position; positionSe.z = 1; this.gameObject.GetComponent <RectTransform>().localPosition = positionSe; } else { int index = container.transform.childCount - 1; if (dataAll[0].card.name == container.transform.GetChild(index).gameObject.name) { // Its the last card if (!GameObject.Find("Empty")) { GameObject EmptyCard = Instantiate(EmptyPrefab); EmptyCard.transform.SetParent(container.transform); EmptyCard.gameObject.name = "Empty"; EmptyCard.transform.SetAsFirstSibling(); } else { // THere already exists Empty Card main.transform.SetAsLastSibling(); Destroy(GameObject.Find("Empty")); Vector3 positionSe = this.gameObject.GetComponent <RectTransform>().position; positionSe.z = 1; this.gameObject.GetComponent <RectTransform>().localPosition = positionSe; } } else { // This means it should be first card if (!GameObject.Find("Empty")) { GameObject EmptyCard = Instantiate(EmptyPrefab); EmptyCard.transform.SetParent(container.transform); EmptyCard.gameObject.name = "Empty"; EmptyCard.transform.SetAsFirstSibling(); ChangeWidth(EmptyCard, 230); } else { main.transform.SetAsFirstSibling(); Destroy(GameObject.Find("Empty")); Vector3 positionSe = this.gameObject.GetComponent <RectTransform>().position; positionSe.z = 1; this.gameObject.GetComponent <RectTransform>().localPosition = positionSe; } } } } } cards.SendMessage("OnEndDrag", data); }
public void OnDrag(PointerEventData data) { if (inside == true) { Vector3 value = data.position - ContainerPos; if (Mathf.Abs(value.y) > 125) { this.gameObject.transform.SetParent(this.gameObject.transform.parent.parent.parent); this.gameObject.GetComponent <CanvasGroup>().blocksRaycasts = false; inside = false; } else { cards.SendMessage("OnDrag", data); } } else { Vector3 position1 = data.position; position1.z = 21; main.gameObject.transform.GetComponent <RectTransform>().position = GameObject.Find("Camera").GetComponent <Camera>().ScreenToWorldPoint(position1); List <DataCards> dataAll = new List <DataCards>(); for (int l = 0; l < allCards.Count; l++) { float distance = Vector3.Distance(transform.position, allCards[l].transform.position); DataCards dC = new DataCards(); dC.card = allCards[l]; dC.distance = distance; dataAll.Add(dC); } dataAll.Sort((IComparer <DataCards>) new sort()); if (dataAll != null) { GameObject first = dataAll[0].card; GameObject second = dataAll[1].card; int index = first.gameObject.transform.GetSiblingIndex(); if (GameObject.Find("Empty")) { if (GameObject.Find("Empty").transform.GetSiblingIndex() == (index + 1)) { } else { GameObject.Find("Empty").transform.SetSiblingIndex(index); GameObject.Find("Empty").GetComponent <LayoutElement>().preferredWidth = 114.86f; ChangeWidth(GameObject.Find("Empty"), 230); } } else { GameObject EmptyCard = Instantiate(EmptyPrefab); EmptyCard.transform.SetParent(container.transform); EmptyCard.gameObject.name = "Empty"; EmptyCard.transform.SetSiblingIndex(index); ChangeWidth(EmptyCard, 230); } } else { int index = container.transform.childCount - 1; if (dataAll[0].card.name == container.transform.GetChild(index).gameObject.name) { // Its the last card if (!GameObject.Find("Empty")) { GameObject EmptyCard = Instantiate(EmptyPrefab); EmptyCard.transform.SetParent(container.transform); EmptyCard.gameObject.name = "Empty"; EmptyCard.transform.SetAsLastSibling(); ChangeWidth(EmptyCard, 220); } else { GameObject.Find("Empty").transform.SetAsLastSibling(); // There already exists Empty Card } } else { // This means it should be first card if (!GameObject.Find("Empty")) { if (dataAll[0].card.name == container.transform.GetChild(0).gameObject.name) { GameObject EmptyCard = Instantiate(EmptyPrefab); EmptyCard.transform.SetParent(container.transform); EmptyCard.gameObject.name = "Empty"; EmptyCard.transform.SetAsFirstSibling(); ChangeWidth(EmptyCard, 230); } } } } } }
public void CreateOrbitCommandMenu(GameUpdateClassComponents curGameUpdateComponents, DataCards.Planet curPlanet) { //Create a Orbit Command Menu //Disable other controls this.disableAllControls(); Rectangle myAvgRect = new Rectangle(300, 200, 600, 400); List<GameEngine.PlayerInvObjs.InvUnit> shipInvUnits = new List<GameEngine.PlayerInvObjs.InvUnit>(); shipInvUnits = curGameUniverse.getPlanetByName(curPlanet.Name).Orbit.StarshipFleetsInOrbit; List<Controls.DataCardIconControl> dataCards = new List<GalacticConquest.Controls.DataCardIconControl>(); foreach (GameEngine.PlayerInvObjs.InvUnit curIU in shipInvUnits) { Controls.DataCardIconControl curDataCard = new GalacticConquest.Controls.DataCardIconControl(); //If Under construction@!!///// if (curIU._underConstruction) { curDataCard.imgControl = curGameUpdateComponents._staticTextureImages._underConstructionFacility; curDataCard.strControlText = curIU.iuShip.HeaderText + " (U/C " + curIU._remainingConstructionDays.ToString() + " days left)"; } else { curDataCard.imgControl = Texture2D.FromFile(curGameUpdateComponents._graphicsDevice, Model.DataUtilities._ShipsImagePath + curIU.iuShip.Name + ".jpg"); curDataCard.strControlText = curIU.iuShip.HeaderText; } Rectangle curDataCardRect = new Rectangle(myAvgRect.X + 10, myAvgRect.Y + 10, curDataCard.imgControl.Width, curDataCard.imgControl.Height); curDataCard.rectControl = curDataCardRect; curDataCard._isNull = false; dataCards.Add(curDataCard); } ///////////////////////////////// //Create Orbit Planet Menu ////////////////////////////////// Texture2D curTexture = curGameUpdateComponents._staticTextureImages._orbitCommandMenu; //Vector2 curVector = new Vector2(100, 100); //Rectangle curRect = new Rectangle(100, 100, 300, 300); Controls.PlanetOrbitControl curMenuControl = new Controls.PlanetOrbitControl(); //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("btnExitOrbitMenu", curButtonTexture, curButtonVector, curButtonRect, "Exit")); //Create the Menu Control curMenuControl = new Controls.PlanetOrbitControl("mnuOrbit", curPlanet.Name, curTexture, Model.OrientationType.Left, curPlanet.Name, "...Settings List Here...", menuButtons, curGameUniverse.getAllPlanetsList(), curGameUpdateComponents, this.curGameUniverse.getPlanetByName(curPlanet.Name).Orbit.StarshipFleetsInOrbit); this.LeftPlanetOrbitMenu = curMenuControl; //Add menu control to list //activeImgMenus.Add(curMenuControl); }
public void CreatePlanetInfoMenu(GameUpdateClassComponents curGameUpdateComponents, DataCards.Planet curPlanet) { //Create a Info Menu //Disable other controls this.disableAllControls(); Controls.GameInformationMenu newGameInfoMenu = new Controls.GameInformationMenu(); newGameInfoMenu.dataCardType = Model.DataCardType.Planet; newGameInfoMenu.imageToDisplay = curGameUpdateComponents._staticTextureImages._infoMenu; newGameInfoMenu.menuVector = new Vector2(100, 100); newGameInfoMenu.HeaderText = curPlanet.HeaderText; newGameInfoMenu.Description = curPlanet.Description; newGameInfoMenu.tag = curPlanet; newGameInfoMenu.Name = "menuInfo"; newGameInfoMenu._isEnabled = true; newGameInfoMenu._isNull = false; //Add the Scroll Panel Vector2 scrollPanelVector = new Vector2(550, 175); int spWidth = 320; int spHeight = 480; Rectangle scrollPanelRect = new Rectangle(Convert.ToInt32(scrollPanelVector.X), Convert.ToInt32(scrollPanelVector.Y), spWidth, spHeight); Controls.ScrollPanel.ScrollPanelTextControl scrlPnlDescription = new Controls.ScrollPanel.ScrollPanelTextControl(curGameUpdateComponents._staticTextureImages._scrollingPanel, scrollPanelVector, scrollPanelRect); newGameInfoMenu.scrlPnlDescriptionText = scrlPnlDescription; //Add the Exit Button newGameInfoMenu.menuButtons.Add(new Controls.FancyButtonControl("btnExitInfoMenu", curGameUpdateComponents._staticTextureImages._buttonTexture, new Vector2(365, 600), new Rectangle(365, 650, 130, 50), "Exit")); this.InfoMenu = newGameInfoMenu; }
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; }