示例#1
0
        /// <summary>
        /// initialiserar knappar och annat så allt hamnar i förhållande till new game-rutan
        /// laddar texturer och klasser
        /// </summary>
        /// <param name="game1"></param>
        public NewGame(Game1 game1)
        {
            game      = game1;
            Newbox    = game.Content.Load <Texture2D>("NewGame");
            NewBoxpos = new Vector2((game.graphics.PreferredBackBufferWidth / 2) - (Newbox.Width / 2), (game.graphics.PreferredBackBufferHeight / 2) - (Newbox.Height / 2));
            Xmid      = (game.graphics.PreferredBackBufferWidth / 2);

            moneybar = new SliderBar(game, Newbox.Width - 64, 2141, new Vector2(NewBoxpos.X + 32, NewBoxpos.Y + 64));
            text     = game.Content.Load <SpriteFont>("UnitFont");
            unitbar  = new SliderBar(game, Newbox.Width - 64, 27, new Vector2(NewBoxpos.X + 32, NewBoxpos.Y + 64 + 64));
            musb     = game.Content.Load <Texture2D>("mus2");

            maplist = new MapList(game, new Vector2(NewBoxpos.X + 32, NewBoxpos.Y + 180));
            maplist.LoadInfo("Maps\\");

            BG = game.Content.Load <Texture2D>("grassBack");

            Start          = new MenuButton(game);
            Start.Position = new Vector2((Newbox.Width - 256 - 16), (Newbox.Height - 64 - 8));
            Start.Text     = "   START";

            mainmenu          = new MenuButton(game);
            mainmenu.Position = new Vector2((NewBoxpos.X + 32 + 16), (Newbox.Height - 64 - 8));
            mainmenu.Text     = "Main Menu";

            BGrect = new Rectangle(0, 0, 1920, 1080);
        }
示例#2
0
        /// <summary>
        /// laddar knapparna
        /// </summary>
        /// <param name="game"></param>
        public UnitMenu(Game1 game, Vector2 unitpos, Player player)
        {
            Texture2D unitMenuButtons = game.Content.Load <Texture2D>("soldierbuttons");

            // Retrieve sub texture
            Rectangle r = new Rectangle(1 * 32, 0, 32, 32);

            //Texture2D t = new Texture2D(game.GraphicsDevice, 32, 32);
            //Color[] data = new Color[32*32];
            //unitMenuButtons.GetData(0, r, data, 0, data.Length);
            //t.SetData(data);
            Move = new TouchButton(game, new Vector2(unitpos.X, unitpos.Y - 1) * 32, unitMenuButtons, r);

            r = new Rectangle(0, 0, 32, 32);
            //t = new Texture2D(game.GraphicsDevice, 32, 32);
            //unitMenuButtons.GetData(0, r, data, 0, data.Length);
            //t.SetData(data);
            Attack = new TouchButton(game, new Vector2(unitpos.X + 1, unitpos.Y) * 32, unitMenuButtons, r);

            r = new Rectangle(3 * 32, 0, 32, 32);
            //t = new Texture2D(game.GraphicsDevice, 32, 32);
            //unitMenuButtons.GetData(0, r, data, 0, data.Length);
            //t.SetData(data);
            Occupy = new TouchButton(game, new Vector2(unitpos.X - 1, unitpos.Y) * 32, unitMenuButtons, r);

            r = new Rectangle(1 * 32, 1 * 32, 32, 32);
            //t = new Texture2D(game.GraphicsDevice, 32, 32);
            //unitMenuButtons.GetData(0, r, data, 0, data.Length);
            //t.SetData(data);
            Finish = new TouchButton(game, new Vector2(unitpos.X, unitpos.Y + 1) * 32, unitMenuButtons, r);
        }
示例#3
0
        public MainMenu(Game1 game1)
        {
            game     = game1;
            NewGame  = new MenuButton(game);
            LoadGame = new MenuButton(game);
            Exit     = new MenuButton(game);

            BG = game.Content.Load <Texture2D>("grassBack");
        }
        /// <summary>
        /// laddar knappar och texturer
        /// </summary>
        /// <param name="game"></param>
        public PauseMenu(Game1 game1)
        {
            game       = game1;
            ResumeGame = new MenuButton(game);
            LoadGame   = new MenuButton(game);
            SaveGame   = new MenuButton(game);
            Exit       = new MenuButton(game);

            musb = game.Content.Load <Texture2D>("mus2");
            BG   = game.Content.Load <Texture2D>("Black");
        }
示例#5
0
        public void Initialize(Player pplayer)
        {
            player = pplayer;


            if (player.TeamColor == "Blue")
            {
                color = 0;
            }
            else if (player.TeamColor == "Red")
            {
                color = 1;
            }

            purchase          = new UnitMenuButton(game);
            purchase.Position = new Vector2(backpos.X + (background.Width - 288), (background.Height - 64 - 8));
            purchase.Text     = " Purchase";

            cancel          = new UnitMenuButton(game);
            cancel.Position = new Vector2((backpos.X + 32), (background.Height - 64 - 8));
            cancel.Text     = "   Cancel";



            for (int box = 0; box <= 5; box++)
            {
                /*PictureButton pb = new PictureButton(game,
                 *                          backpos + new Vector2(64, 64) + new Vector2(box * 64, 0) + new Vector2(box * 24, 0),
                 *                          game.Content.Load<Texture2D>("PicBox"),
                 *                          );*/
                boxes.Add(new PictureButton(game));
                boxes[box].state      = PictureButton.State.normal;
                boxes[box].background = game.Content.Load <Texture2D>("PicBox");
                boxes[box].Initialize(backpos + new Vector2(64, 64) + new Vector2(box * 32, 0) + new Vector2(box * 24, 0));
                boxes[box].image    = unitset;
                boxes[box].sour_img = new Rectangle(box * 32, color * 32, 32, 32);
            }

            purchase.active = true;
            //boxes[0].marked = true;
            //boxes[0].background = game.Content.Load<Texture2D>("PicBox3");
        }