Esempio n. 1
0
        public MainMenu()
        {
            InitializeComponent();
            Instance = this;
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            UstawTlo();

            listaopcji  = MenuOptions.ZwrocOpcje();
            listatrybow = GameMenuOptions.ZwrocTryby();
            lista       = listaopcji;
            czyTryby    = false;
            i           = 1;
            czyZmienic  = false;
            labellist   = new List <Label>();

            bazaWynikow = new BazaWynikow();
            bazaWynikow.InicjalizujBazeWynikow();

            labellist.Add(Opcja0);
            labellist.Add(Opcja1);
            labellist.Add(Opcja2);


            Opcja0.Content = lista[0].zwrocNazwe();
            Opcja1.Content = lista[1].zwrocNazwe();
            Opcja2.Content = lista[2].zwrocNazwe();
        }
        public MenuState(Game1 _game, GraphicsDevice _graphicsDevice, ContentManager _content) : base(_game, _graphicsDevice, _content)
        {
            //initialize instruction object
            gamemenuoptions = new GameMenuOptions(graphicsDevice, content);
            //initializing level selector
            levelSelector = new LevelSelector(_graphicsDevice, _content, _game, _game.gameManager_);


            var buttonTexture = content.Load <Texture2D>("Controls/gameButton");
            var buttonFont    = content.Load <SpriteFont>("Font/Font");

            //Goku = new GameSprite(content.Load<Texture2D>("Background/Goku_UI"), new Vector2(900, 100), Color.White);

            gameBackground.Init(graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, content.Load <Texture2D>("Background/GameBackground"));

            int gap = 50;
            var instructionButton = new Button(buttonTexture, buttonFont)
            {
                Position = new Vector2(50, 550 + gap),
                Text     = "Instructions",
            };

            instructionButton.Click += InstructionButton_Clicked;

            var quitButton = new Button(buttonTexture, buttonFont)
            {
                Position = new Vector2(50, 700 + gap),
                Text     = "Quit",
            };

            quitButton.Click += QuitButton_Clicked;

            var playButton = new Button(buttonTexture, buttonFont)
            {
                Position = new Vector2(50, 250 + gap),
                Text     = "Play Game",
            };

            playButton.Click += PlayGameButton_Clicked;

            var levelButton = new Button(buttonTexture, buttonFont)
            {
                Position = new Vector2(50, 400 + gap),
                Text     = "Select Level",
            };

            levelButton.Click += levelButton_Clicked;

            components = new List <Component>()
            {
                instructionButton,
                playButton,
                quitButton,
                levelButton,
            };
        }