Пример #1
0
        //Setup Game Controls
        public void buildGameControls(GameUpdateClassComponents curGameUpdateClassComponents)
        {
            //Build Galaxy Map
            Texture2D curTexture = curGameUpdateClassComponents._staticTextureImages._galacticMap;

            float middleWidth = curGameUpdateClassComponents._screenWidth / 2;
            float middleHeight = curGameUpdateClassComponents._screenHeight / 2;

            float middleBoxX = middleWidth - (curTexture.Width / 2);
            float middleBoxY = middleHeight - (curTexture.Height / 2);

            Vector2 curVector = new Vector2(middleBoxX, middleBoxY);

            MainMapControl.loadMap(curTexture, curVector);

            Texture2D curTopBar = curGameUpdateClassComponents._staticTextureImages._gameTopBar;

            Vector2 curTopBarVector = new Vector2(0, 0);

            TopBarControl.load(curTopBar, curTopBarVector);

            Vector2 btnDayAdvVector = new Vector2(170, 3);
            Rectangle rectDayAdv = new Rectangle((int)btnDayAdvVector.X, (int)btnDayAdvVector.Y, 30, 30);

            Controls.FancyButtonControl btnDayAdvance = new Controls.FancyButtonControl();
            btnDayAdvance = new Controls.FancyButtonControl("btnAdvanceDay", curGameUpdateClassComponents._staticTextureImages._gameTopBarDayAdvance, btnDayAdvVector, rectDayAdv, "");

            TopBarControl.menuButtons.Add(btnDayAdvance);

            Texture2D curRightBar = curGameUpdateClassComponents._staticTextureImages._gameRightBar;

            Vector2 curRightBarVector = new Vector2(862, 65);

            RightBarControl.load(curRightBar, curRightBarVector);

            //curGameDrawComponents._spriteBatch.Begin();

            //curGameDrawComponents._spriteBatch.Draw(curTopBar, curTopBarVector, Color.White);
            //curGameDrawComponents._spriteBatch.Draw(curRightBar, curRightBarVector, Color.White);
            //curGameDrawComponents._spriteBatch.Draw(curTexture, curVector, Color.White);

            //updateTopBarData(curGameDrawComponents._spriteBatch, curGameDrawComponents._staticFonts);
        }
Пример #2
0
        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;
        }