Пример #1
0
        public MainMenuScreen(ScreenManager screenManager)
            : base(screenManager)
        {
            TransitionDuration = TimeSpan.FromSeconds(1);

            // setup the play button
            int playButtonWidth = screenManager.Game.WorldViewport.Width / 5;
            int playButtonHeight = screenManager.Game.WorldViewport.Height / 10;
            playButton = new Button(this, "Play!", Color.White, new Rectangle(screenManager.Game.WorldViewport.Width / 2 - playButtonWidth / 2, screenManager.Game.WorldViewport.Height / 2 - playButtonHeight / 2, playButtonWidth, playButtonHeight), Color.Green);
            playButton.Selected += playButton_Selected;

            // setup the store button
            int storeButtonWidth = screenManager.Game.WorldViewport.Width / 5;
            int storeButtonHeight = screenManager.Game.WorldViewport.Height / 10;
            storeButton = new Button(this, "Store", Color.White, new Rectangle(screenManager.Game.WorldViewport.Width / 2 - storeButtonWidth / 2, screenManager.Game.WorldViewport.Height / 2 - storeButtonHeight / 2 + (int)(playButtonHeight * 1.1f), storeButtonWidth, storeButtonHeight), Color.Green);
            storeButton.Selected += storeButton_Selected;

            // setup the log in button
            string logInButtonText = !screenManager.Game.IsLoggedIn ? "Log In" : "Log Out";
            Vector2 logInButtonSize = new Vector2(screenManager.Game.GraphicsManager.SpriteFont.MeasureString(logInButtonText).X * 1.1f);
            logInButton = new Button(this, logInButtonText, Color.White, new Rectangle((int)(screenManager.Game.WorldViewport.Width * 0.975f - logInButtonSize.X), (int)(screenManager.Game.WorldViewport.Height * 0.025f), (int)logInButtonSize.X, (int)logInButtonSize.Y), new Color(59, 89, 152));
            logInButton.Selected += logInButton_Selected;

            // Setup the audio mute button
            string audioButtonText = ScreenManager.Game.AudioManager.Muted ? "Audio: Off" : "Audio: On";
            Vector2 audioButtonSize = new Vector2(screenManager.Game.GraphicsManager.SpriteFont.MeasureString(audioButtonText).X * 1.1f);
            audioButton = new Button(this, audioButtonText, Color.White, new Rectangle((int)(screenManager.Game.WorldViewport.Width * 0.025f), (int)(screenManager.Game.WorldViewport.Height * 0.975f - audioButtonSize.Y), (int)audioButtonSize.X, (int)audioButtonSize.Y), Color.Red);
            audioButton.Selected += audioButton_Selected;

            playerPictureRectangle = new Rectangle((int)(screenManager.Game.WorldViewport.Width * 0.975f - 2 * logInButtonSize.X), (int)(screenManager.Game.WorldViewport.Height * 0.025f), (int)logInButtonSize.X, (int)logInButtonSize.Y);

            blockRain = new BlockRain(this);
        }
Пример #2
0
        public Screen(ScreenManager screenManager)
        {
            ScreenManager = screenManager;

            blankTexture = new Texture2D(ScreenManager.Game.GraphicsDevice, 1, 1);
            blankTexture.SetData(new Color[] { Color.White });
        }
Пример #3
0
        public GameplayScreen(ScreenManager screenManager)
            : base(screenManager)
        {
            TransitionDuration = TimeSpan.FromSeconds(1);

            board = new Board(this);
            hud = new HUD(this, board);
            menuButton = new Button(this, "Menu", Color.White, new Rectangle(45, 45, 75, 75), Color.Red);
            menuButton.Selected += menuButton_Selected;
        }
Пример #4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Setup the other component managers
            GraphicsManager = new GraphicsManager(this);
            InputManager = new InputManager(this);
            AudioManager = new AudioManager(this);
            screenManager = new ScreenManager(this);
            frameRateCounter = new FrameRateCounter(this);

            base.Initialize();
        }
Пример #5
0
 public SplashScreen(ScreenManager screenManager)
     : base(screenManager)
 {
     TransitionDuration = TimeSpan.FromSeconds(1);
 }