示例#1
0
        public override void InitScreen(ScreenType screenType)
        {
            base.InitScreen(screenType);
            #if WINDOWS
            GameScreen.Paused += new EventHandler(GameScreen_Paused);
            #endif
            Texture2D button = GameContent.Assets.Images.Controls.Button;

            StateManager.Options.ScreenResolutionChanged += new EventHandler<ViewportEventArgs>(Options_ScreenResolutionChanged);

            PauseLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.BoldText, "Paused");
            PauseLabel.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width / 2 - PauseLabel.Width / 2, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f);
            PauseLabel.Color = Color.White;
            AdditionalSprites.Add(PauseLabel);

            LevelLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "Points:" + StateManager.SpacePoints + "\nCurrent Level: Level " + StateManager.CurrentLevel.ToInt() + "\n" + StateManager.Lives + " extra lives remaining\nYou have " + StateManager.SpaceBucks + " credits");
            LevelLabel.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width / 2 - LevelLabel.Width / 2, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .50f);
            LevelLabel.Color = Color.White;
            AdditionalSprites.Add(LevelLabel);

            ResumeButton = new Sprite(button, Vector2.Zero, Sprites.SpriteBatch);
            ResumeButton.Position = new Vector2(ResumeButton.GetCenterPosition(Sprites.SpriteBatch.GraphicsDevice.Viewport).X, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .2f);
            Sprites.Add(ResumeButton);

            ResumeLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "Resume");
            ResumeLabel.ParentSprite = ResumeButton;
            ResumeLabel.Color = Color.White;
            #if WINDOWS
            ResumeLabel.CallKeyboardClickEvent = false;
            #endif
            ResumeLabel.IsHoverable = true;
            ResumeLabel.HoverColor = Color.MediumAquamarine;
            ResumeLabel.NonHoverColor = Color.White;
            AdditionalSprites.Add(ResumeLabel);

            ExitButton = new Sprite(button, new Vector2(ResumeButton.X, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .8f), Sprites.SpriteBatch);
            Sprites.Add(ExitButton);

            ExitLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "Exit");
            ExitLabel.Color = Color.White;
            ExitLabel.IsHoverable = true;
            #if WINDOWS
            ExitLabel.CallKeyboardClickEvent = false;
            #endif
            ExitLabel.ParentSprite = ExitButton;
            ExitLabel.HoverColor = Color.MediumAquamarine;
            ExitLabel.NonHoverColor = Color.White;
            AdditionalSprites.Add(ExitLabel);

            OptionButton = new Sprite(button, Vector2.Zero, Sprites.SpriteBatch);
            OptionButton.Position = new Vector2(ResumeButton.X, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .37f);
            Sprites.Add(OptionButton);

            OptionsLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "Options");
            OptionsLabel.ParentSprite = OptionButton;
            OptionsLabel.Color = Color.White;
            OptionsLabel.IsHoverable = true;
            #if WINDOWS
            OptionsLabel.CallKeyboardClickEvent = false;
            #endif
            OptionsLabel.HoverColor = Color.MediumAquamarine;
            OptionsLabel.NonHoverColor = Color.White;
            AdditionalSprites.Add(OptionsLabel);
            #if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[,]
                {
                    {ResumeLabel},
                    {OptionsLabel},
                    {ExitLabel}
                }, InputType.LeftJoystick);
            AllButtons.FireTextSpritePressed = true;
            #endif
            ResumeLabel.Pressed += new EventHandler(ResumeLabel_Pressed);
            ExitLabel.Pressed += new EventHandler(ExitLabel_Pressed);
            OptionsLabel.Pressed += new EventHandler(OptionsLabel_Pressed);
        }
示例#2
0
        public override void InitScreen(ScreenType screenType)
        {
            base.InitScreen(screenType);

            //Add background to this screen
            this.BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            Texture2D button = GameContent.Assets.Images.Controls.Button;
            SpriteFont font = GameContent.Assets.Fonts.NormalText;

            #if WINDOWS
            StateManager.Options.ScreenResolutionChanged += new EventHandler<ViewportEventArgs>(Options_ScreenResolutionChanged);
            #endif

            //Move Controls (aka Controls)
            ControlButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f), Sprites.SpriteBatch);

            #if WINDOWS
            ControlButton.MouseEnter += new EventHandler(ControlButton_MouseEnter);
            ControlButton.MouseLeave += new EventHandler(ControlButton_MouseLeave);
            #endif
            ControlLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, font, ("Controls"));
            ControlLabel.Position = new Vector2(ControlButton.Position.X + (ControlButton.Width / 2 - ControlLabel.Width / 2), ControlButton.Position.Y + (ControlButton.Height / 2 - ControlLabel.Height / 2));
            ControlLabel.Color = Color.White;
            ControlLabel.IsManuallySelectable = true;
            #if WINDOWS
            ControlLabel.CallKeyboardClickEvent = false;
            #endif
            ControlLabel.IsHoverable = true;
            ControlLabel.HoverColor = Color.MediumAquamarine;
            ControlLabel.NonHoverColor = Color.White;

            #if WINDOWS
            //GFX
            Sprite GraphicsButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .35f), Sprites.SpriteBatch);

            GraphicsButton.MouseEnter += new EventHandler(GraphicsButton_MouseEnter);
            GraphicsButton.MouseLeave += new EventHandler(GraphicsButton_MouseLeave);

            GFXLabel = new TextSprite(Sprites.SpriteBatch, font, String.Format("GFX: {0}", StateManager.GraphicsManager.IsFullScreen ? "Full" : "Standard"));
            GFXLabel.Position = new Vector2((GraphicsButton.X + GraphicsButton.Width / 2) - GFXLabel.Width / 2, (GraphicsButton.Y + GraphicsButton.Height / 2) - GFXLabel.Height / 2);
            GFXLabel.Color = Color.White;
            GFXLabel.CallKeyboardClickEvent = false;
            GFXLabel.IsManuallySelectable = true;
            GFXLabel.IsHoverable = true;
            GFXLabel.HoverColor = Color.MediumAquamarine;
            GFXLabel.NonHoverColor = Color.White;
            #endif

            //SFX
            Sprite SFXButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .10f), Sprites.SpriteBatch);

            #if WINDOWS
            SFXButton.MouseEnter += new EventHandler(SFXButton_MouseEnter);
            SFXButton.MouseLeave += new EventHandler(SFXButton_MouseLeave);
            #endif
            SFXLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, font, "SFX: " + (StateManager.Options.SFXEnabled ? "On" : "Off"));
            SFXLabel.Position = new Vector2((SFXButton.X + SFXButton.Width / 2) - SFXLabel.Width / 2, (SFXButton.Y + SFXButton.Height / 2) - SFXLabel.Height / 2);
            SFXLabel.Color = Color.White;
            SFXLabel.IsHoverable = true;
            #if WINDOWS
            SFXLabel.CallKeyboardClickEvent = false;
            #endif
            SFXLabel.IsManuallySelectable = true;
            SFXLabel.HoverColor = Color.MediumAquamarine;
            SFXLabel.NonHoverColor = Color.White;

            //Back button
            #if WINDOWS
            Sprite BackButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .60f), Sprites.SpriteBatch);
            #elif XBOX
            Sprite BackButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .35f), Sprites.SpriteBatch);
            #endif
            BackLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "Back");
            BackLabel.Position = new Vector2((BackButton.X + BackButton.Width / 2) - BackLabel.Width / 2, (BackButton.Y + BackButton.Height / 2) - BackLabel.Height / 2);
            #if WINDOWS
            BackLabel.CallKeyboardClickEvent = false;
            #endif
            BackLabel.Color = Color.White;

            #if WINDOWS
            BackButton.MouseEnter += new EventHandler(BackButton_MouseEnter);
            BackButton.MouseLeave += new EventHandler(BackButton_MouseLeave);
            #endif

            //Music (volume; currently on/off)

            Sprite MusicButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .35f), Sprites.SpriteBatch);
            MusicButton.Color = Color.White;

            #if WINDOWS
            MusicButton.MouseEnter += new EventHandler(MusicButton_MouseEnter);
            MusicButton.MouseLeave += new EventHandler(MusicButton_MouseLeave);
            #endif
            StateManager.Options.MusicStateChanged += new EventHandler(Options_MusicStateChanged);
            MusicVolumeLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, font, "Music: " + (StateManager.Options.MusicEnabled ? "On" : "Off"));
            MusicVolumeLabel.Position = new Vector2((MusicButton.X + MusicButton.Width / 2) - MusicVolumeLabel.Width / 2, (MusicButton.Y + MusicButton.Height / 2) - MusicVolumeLabel.Height / 2);
            MusicVolumeLabel.Color = Color.White;
            #if WINDOWS
            MusicVolumeLabel.CallKeyboardClickEvent = false;
            #endif
            MusicVolumeLabel.IsHoverable = true;
            MusicVolumeLabel.IsManuallySelectable = true;
            MusicVolumeLabel.HoverColor = Color.MediumAquamarine;
            MusicVolumeLabel.NonHoverColor = Color.White;

            //Add all buttons
            Sprites.Add(ControlButton);
            Sprites.Add(SFXButton);
            Sprites.Add(BackButton);
            Sprites.Add(MusicButton);

            //Add all text sprites
            AdditionalSprites.Add(ControlLabel);
            #if WINDOWS
            Sprites.Add(GraphicsButton);
            AdditionalSprites.Add(GFXLabel);
            #endif
            AdditionalSprites.Add(SFXLabel);
            AdditionalSprites.Add(BackLabel);
            AdditionalSprites.Add(MusicVolumeLabel);

            CheatsButton = new Sprite(button, new Vector2(MusicButton.X, BackButton.Y), Sprites.SpriteBatch);
            CheatsButton.Visible = StateManager.GamerServicesAreAvailable && Gamer.SignedInGamers.Count > 0;
            Sprites.Add(CheatsButton);

            CheatsLabel = StateManager.CreateButtonTextSprite(false, "Cheats", CheatsButton, this);
            CheatsLabel.Pressed += new EventHandler(CheatsLabel_Pressed);
            #if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[,] { { ControlLabel,  SFXLabel}, { BackLabel,  MusicVolumeLabel}}, InputType.LeftJoystick);
            AllButtons.ButtonPress += new EventHandler(AllButtons_ButtonPress);
            ControlLabel.IsSelected = true;
            #endif

            #if WINDOWS
            StateManager.Options.ScreenResolutionChanged += new EventHandler<ViewportEventArgs>(Options_ScreenResolutionChanged);
            #endif
        }
        public override void InitScreen(ScreenType screenName)
        {
            this.BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            StateManager.levelCompleted += new EventHandler(StateManager_levelCompleted);
            ship = new Ship_Sprite(GameContent.Assets.Images.Ships[ShipType.FighterCarrier, ShipTier.Tier1], Vector2.Zero, Sprites.SpriteBatch);

            ship.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width, (float)StateManager.GraphicsManager.GraphicsDevice.Viewport.Height / 2 - 70);
            ship.Scale = new Vector2(0);
            ship.XSpeed = -3.5f;
            ship.YSpeed = -ship.XSpeed * .8f;
            ship.Rotation.Degrees = -90;

            planetTexture = GameContent.Assets.Images.NonPlayingObjects.Planet;
            Sprites.AddNewSprite(Vector2.Zero, planetTexture);
            Sprites.Add(ship);
            Sprites[0].Position = new Vector2((float)StateManager.GraphicsManager.GraphicsDevice.Viewport.Width - (float)Sprites[0].Texture.Width / 2, (float)StateManager.GraphicsManager.GraphicsDevice.Viewport.Height / 2 - 70);

            Sprite Button;
            Texture2D ButtonImage = GameContent.Assets.Images.Controls.Button;
            Vector2 ButtonPosition = new Vector2(155);
            Button = new Sprite(ButtonImage, ButtonPosition, Sprites.SpriteBatch);
            AdditionalSprites.Add(Button);

            TextSprite Continue = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, string.Format("Continue"));
            Continue.Color = Color.Beige;
            Continue.ParentSprite = Button;
            AdditionalSprites.Add(Continue);
            Continue.Pressed += new EventHandler(Continue_Pressed);
            Continue.IsHoverable = true;
            Continue.NonHoverColor = Color.White;
            Continue.HoverColor = Color.MediumAquamarine;
            Button.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .40f, 300);

            winText = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, "");
            winText.Color = Color.Beige;
            AdditionalSprites.Add(winText);
            winText.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .30f, 50);

            #if XBOX
            allButton = new GamePadButtonEnumerator(new TextSprite[,] { { Continue } }, InputType.LeftJoystick) { FireTextSpritePressed = true };
            #endif

            base.InitScreen(screenName);
        }
示例#4
0
        public override void InitScreen(ScreenType screenName)
        {
            base.InitScreen(screenName);

            Viewport viewport = Sprites.SpriteBatch.GraphicsDevice.Viewport;

            this.BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            Texture2D planetTexture = GameContent.Assets.Images.NonPlayingObjects.Planet;
            Texture2D buttonTexture = GameContent.Assets.Images.Controls.Button;
            SpriteFont SegoeUIMono = GameContent.Assets.Fonts.NormalText;
            Texture2D altPlanetTexture = GameContent.Assets.Images.NonPlayingObjects.AltPlanet;
            Texture2D fighterCarrier = GameContent.Assets.Images.Ships[ShipType.FighterCarrier, ShipTier.Tier1];

            planet = new Sprite(planetTexture, Vector2.Zero, Sprites.SpriteBatch);
            planet.Scale = new Vector2(.7f);
            planet.Position = new Vector2(viewport.Width * 0.1f, viewport.Height * .16f);
            Sprites.Add(planet);

            planettwo = new Sprite(altPlanetTexture, Vector2.Zero, Sprites.SpriteBatch);
            planettwo.Scale = new Vector2(1f);
            planettwo.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.8f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .75f);
            Sprites.Add(planettwo);

            setupTitleShip();

            Sprites.Add(ship);

            //title image
            TitleImage = new Sprite(GameContent.Assets.Images.Controls.Title, Vector2.Zero, Sprites.SpriteBatch);
            TitleImage.Position = new Vector2(viewport.Width / 2 - TitleImage.Texture.Width / 2, viewport.Height * 0.2f);
            Sprites.Add(TitleImage);

            PlayButton = new Sprite(buttonTexture, new Vector2(viewport.Width * 0.375f, viewport.Height * 0.4f), Sprites.SpriteBatch);
            Sprites.Add(PlayButton);

            PlayLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Play");

            PlayLabel.IsHoverable = true;

            PlayLabel.NonHoverColor = Color.White;
            PlayLabel.HoverColor = Color.MediumAquamarine;
            AdditionalSprites.Add(PlayLabel);

            ExitButton = new Sprite(buttonTexture, new Vector2(PlayButton.X, PlayButton.Y + (PlayButton.Height * 1.6f)), Sprites.SpriteBatch);

            Sprites.Add(ExitButton);

            ExitLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Exit");

            ExitLabel.IsHoverable = true;

            ExitLabel.NonHoverColor = Color.White;
            ExitLabel.HoverColor = Color.MediumAquamarine;
            AdditionalSprites.Add(ExitLabel);
            ExitLabel.ParentSprite = ExitButton;
            PlayLabel.ParentSprite = PlayButton;

            #if WINDOWS

            ExitLabel.Pressed += new EventHandler(ExitLabel_Clicked);
            PlayLabel.Pressed += new EventHandler(PlayLabel_Clicked);

            #elif XBOX
            ButtonManagement = new GamePadButtonEnumerator(new TextSprite[,] { { PlayLabel }, { ExitLabel } }, InputType.LeftJoystick);
            ButtonManagement.ButtonPress += new EventHandler(ButtonManagement_ButtonPress);
            #endif
        }
        public override void InitScreen(ScreenType screenName)
        {
            base.InitScreen(screenName);
            BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;
            TitleLabel = new TextSprite(Sprites.SpriteBatch, new Vector2(0, 5), GameContent.Assets.Fonts.BoldText, "Select Match Type", Color.White);
            TitleLabel.X = TitleLabel.GetCenterPosition(Graphics.Viewport).X;
            AdditionalSprites.Add(TitleLabel);

            CoopButton = new Sprite(GameContent.Assets.Images.Controls.Button, new Vector2(0, 10 + TitleLabel.Height), Sprites.SpriteBatch);
            CoopButton.X = CoopButton.GetCenterPosition(Graphics.Viewport).X;

            CoopLabel = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, "Co-op", Color.White);
            CoopLabel.HoverColor = Color.MediumAquamarine;
            CoopLabel.NonHoverColor = Color.White;
            CoopLabel.IsHoverable = true;
            CoopLabel.ParentSprite = CoopButton;
            CoopLabel.Pressed += StateManager.ButtonSFXHelper;
            CoopLabel.Pressed += new EventHandler(CoopLabel_Pressed);

            Sprites.Add(CoopButton);
            AdditionalSprites.Add(CoopLabel);

            LMS = new Sprite(GameContent.Assets.Images.Controls.Button, new Vector2(0, 20 + CoopLabel.Height + CoopLabel.Y), Sprites.SpriteBatch);
            LMS.X = CoopButton.GetCenterPosition(Graphics.Viewport).X;

            LMSLabel = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, "LMS", Color.White);
            LMSLabel.HoverColor = Color.MediumAquamarine;
            LMSLabel.NonHoverColor = Color.White;
            LMSLabel.IsHoverable = true;
            LMSLabel.ParentSprite = LMS;
            LMSLabel.Pressed += StateManager.ButtonSFXHelper;
            LMSLabel.Pressed += new EventHandler(DeathMatchLabel_Pressed);

            Sprites.Add(LMS);
            AdditionalSprites.Add(LMSLabel);

            TDM = new Sprite(GameContent.Assets.Images.Controls.Button, new Vector2(0, 20 + LMSLabel.Height + LMSLabel.Y), Sprites.SpriteBatch);
            TDM.X = LMS.GetCenterPosition(Graphics.Viewport).X;

            TDMLabel = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, "Team Deathmatch", Color.White);
            TDMLabel.HoverColor = Color.MediumAquamarine;
            TDMLabel.NonHoverColor = Color.White;
            TDMLabel.IsHoverable = true;
            TDMLabel.ParentSprite = TDM;
            TDMLabel.Pressed += StateManager.ButtonSFXHelper;
            TDMLabel.Pressed += new EventHandler(TDMLabel_Pressed);

            Sprites.Add(TDM);
            AdditionalSprites.Add(TDMLabel);

            BackButton = new Sprite(GameContent.Assets.Images.Controls.Button, new Vector2(0, 0), Sprites.SpriteBatch);
            BackButton.X = BackButton.GetCenterPosition(Graphics.Viewport).X;
            BackButton.Y = StateManager.GraphicsManager.GraphicsDevice.Viewport.Height - 50 - BackButton.Height;

            BackLabel = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, "Back", Color.White);
            BackLabel.HoverColor = Color.MediumAquamarine;
            BackLabel.NonHoverColor = Color.White;
            BackLabel.IsHoverable = true;
            BackLabel.ParentSprite = BackButton;
            BackLabel.Pressed += StateManager.ButtonSFXHelper;
            BackLabel.Pressed += new EventHandler(BackLabel_Pressed);

            Sprites.Add(BackButton);
            AdditionalSprites.Add(BackLabel);

            #if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[,] { { CoopLabel }, { LMSLabel }, { TDMLabel }, { BackLabel } }, InputType.LeftJoystick);
            AllButtons.FireTextSpritePressed = true;
            #endif
        }
        public override void InitScreen(ScreenType screenName)
        {
            Sprites.Clear();
            AdditionalSprites.Clear();
            _firstInit = true;
            gamerInfos = null;
            GamerInfos.Clear();
            SelectedShips.Clear();

            base.InitScreen(screenName);

            BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;
            title = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.BoldText, StateManager.NetworkData.SessionMode.ToFriendlyString() + " Lobby", Color.White);
            title.Y = 5;
            title.X = title.GetCenterPosition(Graphics.Viewport).X;
            AdditionalSprites.Add(title);

            StartButton = new Sprite(GameContent.Assets.Images.Controls.Button, new Vector2(0, Graphics.Viewport.Height), Sprites.SpriteBatch);
            StartButton.X = StartButton.GetCenterPosition(Graphics.Viewport).X;
            StartButton.Y -= StartButton.Height + 20;
            StartLabel = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, "Start", Color.White) { ParentSprite = StartButton, IsHoverable = true, HoverColor = Color.MediumAquamarine, NonHoverColor = Color.White };
            StartLabel.Pressed += new EventHandler(StartLabel_Pressed);
            StartButton.Visible = false;
            StartLabel.Visible = false;
            Sprites.Add(StartButton);
            AdditionalSprites.Add(StartLabel);

            #if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[,] { { StartLabel } }, InputType.LeftJoystick);
            AllButtons.FireTextSpritePressed = true;
            #endif
        }
        public override void InitScreen(ScreenType screenName)
        {
            base.InitScreen(screenName);
            BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;
            title = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.BoldText, "Available " + (StateManager.NetworkData.SessionType == NetworkSessionType.SystemLink ? "LAN" : "LIVE") + " Sectors");
            title.Color = Color.White;
            title.Y = 5;
            title.X = title.GetCenterPosition(Graphics.Viewport).X;

            reloadButton = new Sprite(GameContent.Assets.Images.Controls.Button, new Vector2(0, title.Y + title.Font.LineSpacing + 10), Sprites.SpriteBatch);
            reloadButton.X = reloadButton.GetCenterPosition(Graphics.Viewport).X;

            reload = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, "Refresh");
            reload.ParentSprite = reloadButton;
            reload.NonHoverColor = Color.White;
            reload.HoverColor = Color.MediumAquamarine;

            reload.IsHoverable = true;
            reload.Pressed += new EventHandler(reload_Pressed);

            BackButton = new Sprite(GameContent.Assets.Images.Controls.Button, new Vector2(20, Graphics.Viewport.Height), Sprites.SpriteBatch);
            BackButton.Y -= BackButton.Height + 20;
            BackLabel = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, "Back", Color.White) { IsHoverable = true, HoverColor = Color.MediumAquamarine, NonHoverColor = Color.White };
            BackLabel.ParentSprite = BackButton;
            BackLabel.Pressed += new EventHandler(BackLabel_Pressed);
            BackLabel.Visible = true;

            Sprites.Add(BackButton);

            AdditionalSprites.Add(title);
            AdditionalSprites.Add(reload);
            Sprites.Add(reloadButton);

            #if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[,] { { reload }, { BackLabel } }, InputType.LeftJoystick);
            AllButtons.FireTextSpritePressed = true;
            #endif
        }
        private void netSessionRegrab()
        {
            AdditionalSprites.Clear();
            #if XBOX
            List<TextSprite> allItems = new List<TextSprite>(new TextSprite[] { reload });
            #endif
            title.Text = "Available " + (StateManager.NetworkData.SessionType == NetworkSessionType.SystemLink ? "LAN" : "LIVE") + " Sectors";
            AdditionalSprites.Add(title);
            AdditionalSprites.Add(reload);
            AdditionalSprites.Add(BackLabel);

            AvailableNetworkSessionDisplayTextSprite prev = null;
            foreach (AvailableNetworkSession ans in StateManager.NetworkData.AvailableSessions)
            {
                AvailableNetworkSessionDisplayTextSprite curr = new AvailableNetworkSessionDisplayTextSprite(Sprites.SpriteBatch, prev == null ? reloadButton.Y + reloadButton.Height : prev.Y, ans);
                curr.Pressed += new EventHandler(curr_Pressed);
                AdditionalSprites.Add(curr);
            #if XBOX
                allItems.Add(curr);
            #endif
                prev = curr;
            }
            #if XBOX
            allItems.Add(BackLabel);
            TextSprite[,] buttons = new TextSprite[allItems.Count, 1];
            for (int i = 0; i < allItems.Count; i++)
            {
                buttons[i, 0] = allItems[i];
            }

            AllButtons = new GamePadButtonEnumerator(buttons, InputType.LeftJoystick);
            AllButtons.FireTextSpritePressed = true;
            #endif
        }
示例#9
0
        public override void InitScreen(ScreenType screnType)
        {
            base.InitScreen(screnType);

            Texture2D planetTexture = GameContent.Assets.Images.NonPlayingObjects.Planet;
            Texture2D altPlanetTexture = GameContent.Assets.Images.NonPlayingObjects.AltPlanet;
            Texture2D buttonImage = GameContent.Assets.Images.Controls.Button;
            SpriteFont SegoeUIMono = GameContent.Assets.Fonts.NormalText;

            StateManager.Options.ScreenResolutionChanged += new EventHandler<ViewportEventArgs>(Options_ScreenResolutionChanged);

            this.BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            TitleSprite = new Sprite(GameContent.Assets.Images.Controls.Title, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .05f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .07f), Sprites.SpriteBatch);
            Sprites.Add(TitleSprite);

            planet = new Sprite(altPlanetTexture, Vector2.Zero, Sprites.SpriteBatch);
            planet.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.6f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1515f);
            planet.Scale = new Vector2(.7f);
            Sprites.Add(planet);

            planettwo = new Sprite(planetTexture, Vector2.Zero, Sprites.SpriteBatch);
            planettwo.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.8f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .75f);
            planettwo.Scale = new Vector2(1f);
            Sprites.Add(planettwo);

            SinglePlayerButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .21f), Sprites.SpriteBatch);

            Sprites.Add(SinglePlayerButton);

            SinglePlayerLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Singleplayer");
            SinglePlayerLabel.IsHoverable = true;
            #if WINDOWS
            SinglePlayerLabel.CallKeyboardClickEvent = false;
            #endif
            SinglePlayerLabel.NonHoverColor = Color.White;
            SinglePlayerLabel.HoverColor = Color.MediumAquamarine;

            SinglePlayerLabel.ParentSprite = SinglePlayerButton;

            AdditionalSprites.Add(SinglePlayerLabel);

            MultiPlayerButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .405f), Sprites.SpriteBatch);

            Sprites.Add(MultiPlayerButton);

            MultiPlayerLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Multiplayer");
            MultiPlayerLabel.IsHoverable = true;
            #if WINDOWS
            MultiPlayerLabel.CallKeyboardClickEvent = false;
            #endif
            MultiPlayerLabel.NonHoverColor = Color.White;
            MultiPlayerLabel.HoverColor = Color.MediumAquamarine;
            MultiPlayerLabel.ParentSprite = MultiPlayerButton;
            AdditionalSprites.Add(MultiPlayerLabel);

            BackButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .60f), Sprites.SpriteBatch);

            Sprites.Add(BackButton);

            BackLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Exit");
            BackLabel.IsHoverable = true;

            #if WINDOWS
            BackLabel.CallKeyboardClickEvent = false;
            #endif
            BackLabel.ParentSprite = BackButton;
            BackLabel.NonHoverColor = Color.White;
            BackLabel.HoverColor = Color.MediumAquamarine;
            AdditionalSprites.Add(BackLabel);

            OptionsButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .362f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .21f), Sprites.SpriteBatch);

            Sprites.Add(OptionsButton);

            OptionsLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Options");
            #if WINDOWS
            OptionsLabel.CallKeyboardClickEvent = false;
            #endif
            OptionsLabel.ParentSprite = OptionsButton;
            OptionsLabel.IsHoverable = true;
            OptionsLabel.NonHoverColor = Color.White;
            OptionsLabel.HoverColor = Color.MediumAquamarine;
            AdditionalSprites.Add(OptionsLabel);

            CreditsButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .362f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .405f), Sprites.SpriteBatch);

            Sprites.Add(CreditsButton);

            CreditsLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Credits");
            CreditsLabel.IsHoverable = true;
            #if WINDOWS
            CreditsLabel.CallKeyboardClickEvent = false;
            #endif
            CreditsLabel.ParentSprite = CreditsButton;
            CreditsLabel.NonHoverColor = Color.White;
            CreditsLabel.HoverColor = Color.MediumAquamarine;
            AdditionalSprites.Add(CreditsLabel);

            #if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[,] { { SinglePlayerLabel, OptionsLabel }, { MultiPlayerLabel, CreditsLabel }, { BackLabel, null } }, InputType.LeftJoystick);
            SinglePlayerLabel.IsSelected = true;
            AllButtons.FireTextSpritePressed = true;
            #endif
            BackLabel.Pressed += new EventHandler(delegate(object src, EventArgs e) { if (!Guide.IsVisible && this.Visible && elapsedButtonDelay > totalButtonDelay) { StateManager.Exit(); ButtonClick.Play(); } });
            CreditsLabel.Pressed += new EventHandler(delegate(object src, EventArgs e) { if (!Guide.IsVisible && this.Visible && elapsedButtonDelay > totalButtonDelay) { StateManager.ScreenState = ScreenType.Credits; if (StateManager.Options.SFXEnabled) ButtonClick.Play(); } });
            OptionsLabel.Pressed += new EventHandler(delegate(object src, EventArgs e) { if (!Guide.IsVisible && this.Visible && elapsedButtonDelay > totalButtonDelay) { StateManager.ScreenState = ScreenType.Options; if (StateManager.Options.SFXEnabled)  ButtonClick.Play(); } });
            SinglePlayerLabel.Pressed += new EventHandler(SinglePlayerLabel_Pressed);
            MultiPlayerLabel.Pressed += new EventHandler(delegate(object src, EventArgs e) { if (!Guide.IsVisible && this.Visible && elapsedButtonDelay > totalButtonDelay) { StateManager.ScreenState = ScreenType.NetworkSelectScreen; if (StateManager.Options.SFXEnabled) ButtonClick.Play(); } });
        }
示例#10
0
        public override void InitScreen(ScreenType screenName)
        {
            base.InitScreen(screenName);

            StateManager.Options.ScreenResolutionChanged += new EventHandler<ViewportEventArgs>(Options_ScreenResolutionChanged);

            Texture2D buttonImage = GameContent.Assets.Images.Controls.Button;
            SpriteFont SegoeUIMono = GameContent.Assets.Fonts.NormalText;

            //Configure backgrounds
            BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;
            Sprites.AddNewSprite(Vector2.Zero, GameContent.Assets.Images.NonPlayingObjects.ShopBackground);
            Sprites[0].Scale = new Vector2((float)StateManager.GraphicsManager.GraphicsDevice.Viewport.Width / (float)Sprites[0].Texture.Width, (float)StateManager.GraphicsManager.GraphicsDevice.Viewport.Height / (float)Sprites[0].Texture.Height);

            upgradeEquipmentButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .1f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .4f), Sprites.SpriteBatch);
            upgradeEquipmentLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Equipment");
            upgradeEquipmentLabel.Color = Color.White;
            upgradeEquipmentLabel.IsHoverable = true;
            upgradeEquipmentLabel.ParentSprite = upgradeEquipmentButton;
            upgradeEquipmentLabel.NonHoverColor = Color.White;
            upgradeEquipmentLabel.HoverColor = Color.MediumAquamarine;

            Sprites.Add(upgradeEquipmentButton);
            AdditionalSprites.Add(upgradeEquipmentLabel);

            shipButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .4f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .4f), Sprites.SpriteBatch);
            shipLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Ship");
            shipLabel.Color = Color.White;
            shipLabel.IsHoverable = true;
            shipLabel.ParentSprite = shipButton;
            shipLabel.NonHoverColor = Color.White;
            shipLabel.HoverColor = Color.MediumAquamarine;

            Sprites.Add(shipButton);
            AdditionalSprites.Add(shipLabel);

            weaponsButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .7f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .4f), Sprites.SpriteBatch);
            weaponsLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Weapons");
            weaponsLabel.ParentSprite = weaponsButton;
            weaponsLabel.Color = Color.White;
            weaponsLabel.IsHoverable = true;
            weaponsLabel.NonHoverColor = Color.White;
            weaponsLabel.HoverColor = Color.MediumAquamarine;

            Sprites.Add(weaponsButton);
            AdditionalSprites.Add(weaponsLabel);

            PlayButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .4f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .65f), Sprites.SpriteBatch);
            PlayLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Play");
            PlayLabel.Color = Color.White;
            PlayLabel.IsHoverable = true;
            PlayLabel.ParentSprite = PlayButton;
            PlayLabel.NonHoverColor = Color.White;
            PlayLabel.HoverColor = Color.MediumAquamarine;

            noShipLabel = new TextSprite(Sprites.SpriteBatch, new Vector2(0, PlayLabel.Y), SegoeUIMono, "You must buy a ship");
            noShipLabel.Color = Color.White;
            noShipLabel.X = noShipLabel.GetCenterPosition(Graphics.Viewport).X;
            noShipLabel.TextChanged += new EventHandler(noShipLabel_TextChanged);

            Sprites.Add(PlayButton);
            AdditionalSprites.Add(noShipLabel);
            AdditionalSprites.Add(PlayLabel);

            PlayLabel.Pressed += new EventHandler(nextLevelLabel_Pressed);
            weaponsLabel.Pressed += new EventHandler(weaponsLabel_Pressed);
            upgradeEquipmentLabel.Pressed += new EventHandler(upgradeEquipmentLabel_Pressed);
            shipLabel.Pressed += new EventHandler(shipLabel_Pressed);

            #if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[,] {
            {upgradeEquipmentLabel, shipLabel, weaponsLabel},
            {null, PlayLabel, null}
            }, InputType.LeftJoystick);
            AllButtons.FireTextSpritePressed = true;
            #endif
        }
        public override void InitScreen(ScreenType screnType)
        {
            base.InitScreen(screnType);

            Texture2D planetTexture = GameContent.Assets.Images.NonPlayingObjects.Planet;
            Texture2D altPlanetTexture = GameContent.Assets.Images.NonPlayingObjects.AltPlanet;
            Texture2D buttonImage = GameContent.Assets.Images.Controls.Button;
            SpriteFont SegoeUIMono = GameContent.Assets.Fonts.NormalText;

            StateManager.Options.ScreenResolutionChanged += new EventHandler<ViewportEventArgs>(Options_ScreenResolutionChanged);

            this.BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            BackButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .60f), Sprites.SpriteBatch);
            //LANButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .6f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .60f), Sprites.SpriteBatch);
            HostLANButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .06f), Sprites.SpriteBatch);
            LANButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .6f, HostLANButton.Y), Sprites.SpriteBatch);

            HostLIVEButton = new Sprite(buttonImage, new Vector2(HostLANButton.X, HostLANButton.Y+HostLANButton.Height+SegoeUIMono.LineSpacing), Sprites.SpriteBatch);
            HostLIVEButton.Scale = new Vector2(1.1775f, 1);
            Sprites.Add(HostLIVEButton);

            HostLIVELabel = new TextSprite(Sprites.SpriteBatch, SegoeUIMono, "Host LIVE Sector");
            HostLIVELabel.ParentSprite = HostLIVEButton;
            HostLIVELabel.IsHoverable = true;
            HostLIVELabel.Pressed += new EventHandler(HostLIVELabel_Pressed);
            HostLIVELabel.HoverColor = Color.MediumAquamarine;
            HostLIVELabel.NonHoverColor = Color.White;
            AdditionalSprites.Add(HostLIVELabel);

            Sprites.Add(BackButton);

            BackLabel = new TextSprite(Sprites.SpriteBatch, Vector2.One * 10, SegoeUIMono, "Back");
            BackLabel.IsHoverable = true;
            #if WINDOWS
            BackLabel.CallKeyboardClickEvent = false;
            #endif
            BackLabel.ParentSprite = BackButton;
            BackLabel.NonHoverColor = Color.White;
            BackLabel.HoverColor = Color.MediumAquamarine;
            AdditionalSprites.Add(BackLabel);

            Sprites.Add(LANButton);
            LANButton.Scale = new Vector2(1.5f, 1);
            LANLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Scan for LAN sectors");
            LANLabel.IsHoverable = true;
            LANLabel.ParentSprite = LANButton;
            #if WINDOWS
            LANLabel.CallKeyboardClickEvent = false;
            #endif
            LANLabel.NonHoverColor = Color.White;

            LANLabel.HoverColor = Color.MediumAquamarine;
            AdditionalSprites.Add(LANLabel);

            Sprites.Add(HostLANButton);
            HostLANButton.Scale = new Vector2(1.1f, 1);
            HostLANLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Host LAN sector");
            HostLANLabel.IsHoverable = true;
            #if WINDOWS
            HostLANLabel.CallKeyboardClickEvent = false;
            #endif
            HostLANLabel.ParentSprite = HostLANButton;

            HostLANLabel.NonHoverColor = Color.White;
            HostLANLabel.HoverColor = Color.MediumAquamarine;
            AdditionalSprites.Add(HostLANLabel);

            ScanLIVEButton = new Sprite(buttonImage, new Vector2(LANButton.X, HostLIVEButton.Y), Sprites.SpriteBatch);
            ScanLIVEButton.Scale = new Vector2(1.5f, 1);
            Sprites.Add(ScanLIVEButton);

            ScanLIVELabel = new TextSprite(Sprites.SpriteBatch, SegoeUIMono, "Scan for LIVE Sectors", Color.White);
            ScanLIVELabel.ParentSprite = ScanLIVEButton;
            ScanLIVELabel.IsHoverable = true;
            ScanLIVELabel.Pressed += new EventHandler(ScanLIVELabel_Pressed);
            ScanLIVELabel.HoverColor = Color.MediumAquamarine;
            ScanLIVELabel.NonHoverColor = Color.White;
            AdditionalSprites.Add(ScanLIVELabel);

            #if XBOX
            AllButtons = new GamePadButtonEnumerator(new TextSprite[,] { { HostLANLabel, LANLabel }, {HostLIVELabel, ScanLIVELabel}, {BackLabel, null} }, InputType.LeftJoystick);
            AllButtons.FireTextSpritePressed = true;
            #endif
            LANLabel.Pressed += new EventHandler(LANLabel_Pressed);
            HostLANLabel.Pressed += StateManager.ButtonSFXHelper;
            HostLANLabel.Pressed += new EventHandler(HostLabel_Pressed);

            BackLabel.Pressed += new EventHandler(BackLabel_Pressed);
        }