예제 #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 BlockParticle(BlockRain blockRain)
        {
            this.blockRain = blockRain;

            int width = random.Next(blockRain.Screen.ScreenManager.Game.WorldViewport.Width > blockRain.Screen.ScreenManager.Game.WorldViewport.Height ?
                                    blockRain.Screen.ScreenManager.Game.WorldViewport.Height / 5 :
                                    blockRain.Screen.ScreenManager.Game.WorldViewport.Width / 5);
            int height = width;
            int x      = random.Next(blockRain.Screen.ScreenManager.Game.WorldViewport.Width);
            int y      = -1 * height;

            rectangle    = new Rectangle(x, y, width, height);
            velocity     = Vector2.Zero;
            acceleration = new Vector2(0, 0.25f);
            texture      = blockRain.Textures[random.Next(blockRain.Textures.Count)];
        }
예제 #3
0
        public BlockParticle(BlockRain blockRain)
        {
            this.blockRain = blockRain;

            int width = random.Next(blockRain.Screen.ScreenManager.Game.WorldViewport.Width > blockRain.Screen.ScreenManager.Game.WorldViewport.Height ?
                blockRain.Screen.ScreenManager.Game.WorldViewport.Height / 5 :
                blockRain.Screen.ScreenManager.Game.WorldViewport.Width / 5);
            int height = width;
            int x = random.Next(blockRain.Screen.ScreenManager.Game.WorldViewport.Width);
            int y = -1 * height;

            rectangle = new Rectangle(x, y, width, height);
            velocity = Vector2.Zero;
            acceleration = new Vector2(0, 0.25f);
            texture = blockRain.Textures[random.Next(blockRain.Textures.Count)];
        }