Exemplo n.º 1
0
        public override void Load(ContentManager content)
        {
            Screen.soundController.LoadGameSounds(content, this, map.CurrentMap.backgroundMusic);

            this.camera = new CameraController(Screen, map.Model.zoomBox);

            //The effects image for hits
            this.effectImg = new ImageController(Screen, "GameStuff/GameEffects", 110);
            this.effectImg.OriginDefault = new Vector2(130 / 2, 130 / 2);
            this.effectImg.ScaleDefault = 0.1f;
            this.effectImg.OnAnimationDone += OnHitAnimationDone;
            this.effectImg.SetFrameRectangle(200, 200);
            this.effectImg.FramesPerRow = 2;
            AddController(effectImg);

            //Creates the countdown before starting game
            countDown = new ImageController(Screen, "GameStuff/CountDown", 900, true);
            countDown.OriginDefault = new Vector2(150, 150);
            countDown.ScaleDefault = 0;
            countDown.SetFrameRectangle(300, 300);
            countDown.FramesPerRow = 2;
            var imgModel = countDown.SetPosition(Constants.WindowWidth / 2, Constants.WindowHeight / 2);
            //Set callback to determin when the game is finished
            imgModel.Callback = countDownNext;
            countDown.AnimateScale(0.7f, (countDownTime/4) * 1000, true);
            AddController(countDown);

            gameOver = new ImageController(Screen, "GameStuff/GameOver", 150, true);
            gameOver.OriginDefault = new Vector2(300, 100);
            gameOver.ScaleDefault = 0;

            this.powerUps = new PowerUpController(Screen, map.Model.DropZone);
            AddController(powerUps);

            //Creates characterController, and PlayerStatsController
            createCharacters(content);

            if (!Screen.GameOptions.UseLifes)
            {
                timeLeft = new TimeSpan(0, Screen.GameOptions.Minutes, 0);
                timer = new TextBox(getTimeLeft(), FontDefualt, new Vector2(Constants.WindowWidth - 80, 10), Color.White);
                timer.Layer = 150;
                timer.StaticPosition = true;
                AddView(timer);
            }

            AddController(camera);
            AddController(this.map);

            SubscribeToGameState = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads all the textboxes on the menu
        /// </summary>
        private void LoadText()
        {
            //Initialize tips text
            tipsText = new TextBox("Press H for helpmenu", FontDefualt, 10, 690, Color.White, 0.8f);
            tipsText.Layer = 100;

            //Init continiue text
            continueText = new TextBox("Press ENTER or START to continue", GetFont("Impact.large"), 250, 320, Color.White, 1f);
            continueText.StaticPosition = true;
            continueText.Layer = 900;
            continueText.TextBackground = Draw.ColoredRectangle(Screen.GraphicsDevice, 900, 80, new Color(237, 27, 36));
            continueText.BackgroundOffset = new Vector2(-70, -5);

            //Change tip text if xbox
            #if XBOX
            tipsText.Text = "Press back button for help";
            #endif
            //Inits the player select labels
            playerSelect = new List<TextBox>();

            for (int i = 1; i < 5; i++)
            {
                var l = new TextBox("Player " + i + " DONE!", FontDefualt, 270 * (i - 1) + 60, 680, Color.White, 1.1f);
                l.Layer = 100;
                l.StaticPosition = true;
                l.TextBackground = Draw.ColoredRectangle(Screen.GraphicsDevice, 210, 50, GamePadControllers[i - 1].PlayerModel.Color);
                l.BackgroundOffset = new Vector2(-10, -5);
                playerSelect.Add(l);
            }

            if (gameStats != null)
            {
                for (int i = 0; i < 4; i++)
                {
                    TextBox textBox = new TextBox("", FontDefualt, new Vector2(Constants.WindowWidth / 4 * i, Constants.WindowHeight - 300), Color.White);
                    textBox.TextBackground = Draw.ColoredRectangle(Screen.GraphicsDevice, Constants.WindowWidth / 4, 300, new Color(237, 27, 36));
                    textBox.Layer = 10;
                    textBox.StaticPosition = true;

                    if (gameStats.Count() > i)
                    {
                        textBox.Text = gameStats[i].ToString();
                    }
                    gameStatsText.Add(textBox);

                }
            }
        }
Exemplo n.º 3
0
        public override void Load(ContentManager content)
        {
            Vector2 percentPos = new Vector2(330 * characterModel.playerIndex + 30, Constants.WindowHeight - 120);

            thumb = new ImageView(content.Load<Texture2D>(GamePadControllers[characterModel.playerIndex].PlayerModel.SelectedCharacter.thumbnail),
                percentPos, 159, true);
            thumb.Scale = 0.6f;
            AddView(thumb);

            percentBox = new TextBox("0%", GetFont("Impact.large"), percentPos + new Vector2(180, 40), Color.White, 1f);
            percentBox.StaticPosition = true;
            percentBox.Layer = 150;
            percentBox.Origin = new Vector2(20, 0);
            AddView(percentBox);

            percentBg = new ImageView(content.Load<Texture2D>("GameStuff/PlayerPercentBg"), percentPos + new Vector2(0, 94), 149, true);
            AddView(percentBg);

            if (gameOptions.UseLifes)
            {
                lifes = new ImageController(Screen, "GameStuff/Life", 160, true);
                AddController(lifes);
                for (int i = 0; i < gameOptions.Lifes; i++)
                {
                    lifes.AddPosition(percentPos + new Vector2(i * 16 + 130, 100), 400);
                }
            }
        }