Пример #1
0
        public override void InitScreen(ScreenType screenName)
        {
            base.InitScreen(screenName);
            BaseAllyShip.Dead += new EventHandler(BaseAllyShip_Dead);
            Texture2D buttonImage = GameContent.Assets.Images.Controls.Button;
            SpriteFont SegoeUIMono = GameContent.Assets.Fonts.NormalText;
            BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            gameOverLabel = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f), SegoeUIMono, string.Format("\n    GAME OVER\n you had {0} points,\n {1} spacebucks,\n and was on {2}", StateManager.SpacePoints, StateManager.SpaceBucks, StateManager.HighestUnlockedLevel));
            gameOverLabel.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f - gameOverLabel.Width / 2, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f - gameOverLabel.Height / 2);
            gameOverLabel.Color = Color.Red;

            Sprite MainMenuButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .5f), Sprites.SpriteBatch);
            MainMenuButton.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f - MainMenuButton.Width / 2, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .5f - MainMenuButton.Height / 2);
            mainMenuLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Main Menu");
            mainMenuLabel.Position = new Vector2((MainMenuButton.X + MainMenuButton.Width / 2) - mainMenuLabel.Width / 2, (MainMenuButton.Y + MainMenuButton.Height / 2) - mainMenuLabel.Height / 2);
            #if WINDOWS
            mainMenuLabel.CallKeyboardClickEvent = false;
            #endif
            mainMenuLabel.Color = Color.White;
            mainMenuLabel.IsHoverable = true;
            mainMenuLabel.IsManuallySelectable = true;
            mainMenuLabel.NonHoverColor = Color.White;
            mainMenuLabel.HoverColor = Color.MediumAquamarine;

            AdditionalSprites.Add(mainMenuLabel);
            Sprites.Add(MainMenuButton);
            AdditionalSprites.Add(gameOverLabel);

            #if WINDOWS
            MainMenuButton.MouseEnter +=new EventHandler(MainMenuButton_MouseEnter);
            MainMenuButton.MouseLeave +=new EventHandler(MainMenuButton_MouseLeave);
            #endif
        }
Пример #2
0
        public override void InitScreen(ScreenType screenType)
        {
            Shop.PurchaseScreenSelected += new EventHandler(Shop_PurchaseScreenSelected);
            Texture2D tempImage = GameContent.Assets.Images.NonPlayingObjects.Planet;
            Texture2D ScannerImage = GameContent.Assets.Images.Equipment[EquipmentType.Scanner, TextureDisplayType.ShopDisplay];
            SpriteFont font = GameContent.Assets.Fonts.NormalText;

            //scanner

            SpaceBuckAmount = new TextSprite(Sprites.SpriteBatch, font, string.Format("You have {0} credits", StateManager.SpaceBucks), Color.White);
            SpaceBuckAmount.Position = Vector2.Zero;
            AdditionalSprites.Add(SpaceBuckAmount);
            Sprite Scanner = new Sprite(ScannerImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.6f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), Sprites.SpriteBatch);
            TextSprite scannerText = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.1f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 1.5f), font, "Scanner", Color.White);
            text4 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.1f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 1.5f), font,
            "\n\nScanner\nCost: 2500\nShows enemy health bars as well as\ntheir health and rotation on the minimap\nCurrently lasts until game ends", Color.White);
            text4.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.01f);
            Scanner.Scale = new Vector2(0.5f, 0.5f);
            scannerText.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.4f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.01f);
            itemsShown.Add(new KeyValuePair<Sprite, string>(Scanner, StateManager.SpaceBucks.ToString()));
            items.Add(new KeyValuePair<Sprite, TextSprite>(Scanner, text4));

            ChangeItem += new EventHandler(UpgradeScreen_ChangeItem);

            nextButtonClicked += new EventHandler(UpgradeScreen_nextButtonClicked);

            base.InitScreen(screenType);
            acceptLabel.Text = "Buy";
        }
Пример #3
0
 /// <summary>
 /// Create a new TextBoxSprite.
 /// </summary>
 /// <param name="texture">The texture to show beneath the text (must be scalable).</param>
 /// <param name="color">The color to tint the texture under the text.</param>
 /// <param name="pos">The position of the TextBoxSprite.</param>
 /// <param name="font">The SpriteFont to draw the text with.</param>
 /// <param name="sb">The SpriteBatch to draw to.</param>
 public TextBoxSprite(Texture2D texture, Vector2 pos, Color color, SpriteBatch sb, SpriteFont font)
     : base(texture, pos, color, sb)
 {
     _textView          = new TextSprite(SpriteBatch, font, "");
     _textView.Position = Position + Vector2.One;
     Height             = font.LineSpacing + 1;
     Scale                  = new Vector2(0, Scale.Y);
     movementInternal       = new EventHandler(this.TextBoxSprite_Moved);
     Moved                 += movementInternal;
     base.UseCenterAsOrigin = false;
 }
Пример #4
0
        public override void InitScreen(ScreenType screenType)
        {
            ChangeItem +=new EventHandler(LevelSelect_ChangeItem);
            Texture2D planet1 = GameContent.Assets.Images.NonPlayingObjects.Planet;
            Texture2D planet2 = GameContent.Assets.Images.NonPlayingObjects.AltPlanet;
            Texture2D planet3 = GameContent.Assets.Images.NonPlayingObjects.Planet3;
            Texture2D planet4 = GameContent.Assets.Images.NonPlayingObjects.Planet4;

            //level1
            level1 = new Sprite(planet1, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.68f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.22f), Sprites.SpriteBatch);
            level1Label = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "  Level 1");
            level1.Scale = new Vector2(0.7f);
            level1Label.Color = Color.Transparent;
            level1.Color = Color.White;

            //level2
            level2 = new Sprite(planet2, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.60f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), Sprites.SpriteBatch);
            level2Label = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "  Level 2");
            level2.Scale = new Vector2(0.7f);

            //level3
            level3 = new Sprite(planet3, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.58f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), Sprites.SpriteBatch);
            level3Label = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "  Level 3");
            level3Label.Color = Color.Transparent;
            level3.Scale = new Vector2(0.6f);

            //level4
            level4 = new Sprite(planet4, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.63f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), Sprites.SpriteBatch);
            level4Label = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "  Level 4");
            level4.Scale = new Vector2(0.4f);

            items.Add(new KeyValuePair<Sprite, TextSprite>(level1, level1Label));
            items.Add(new KeyValuePair<Sprite, TextSprite>(level2, level2Label));
            items.Add(new KeyValuePair<Sprite, TextSprite>(level3, level3Label));
            items.Add(new KeyValuePair<Sprite, TextSprite>(level4, level4Label));

            nextButtonClicked += new EventHandler(LevelSelect_nextButtonClicked);
            ChangeItem += new System.EventHandler(LevelSelect_ChangeItem);

            base.InitScreen(screenType);
            acceptLabel.Text = "Shop";

            level1Label.Position = nameLabel.Position;
            level2Label.Position = nameLabel.Position;
            level3Label.Position = nameLabel.Position;
            level4Label.Position = nameLabel.Position;
        }
        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);
        }
        public override void InitScreen(ScreenType screenName)
        {
            StateManager.ScreenStateChanged += new EventHandler(StateManager_ScreenStateChanged);
            StateManager.ScreenResolutionChanged += new EventHandler<ViewportEventArgs>(Options_ScreenResolutionChanged);

            base.InitScreen(screenName);
            BackgroundSprite = GameContent.Assets.Images.NonPlayingObjects.GlobalBackground;
            title = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.BoldText, "You Won!", Color.White);
            title.X = title.GetCenterPosition(Graphics.Viewport).X;
            title.Y = 12.5f;
            AdditionalSprites.Add(title);
            planet = Sprites.AddNewSprite(new Vector2(-3, Graphics.Viewport.Height - GameContent.Assets.Images.NonPlayingObjects.Planet.Height + 11), GameContent.Assets.Images.NonPlayingObjects.Planet);
            msg = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, MessageText, Color.White);
            msg.Y = title.Y + title.Font.LineSpacing;
            AdditionalSprites.Add(msg);

            netScreenButton = Sprites.AddNewSprite(Vector2.Zero, GameContent.Assets.Images.Controls.Button);
            netScreenButton.Position = netScreenButton.GetCenterPosition(Graphics.Viewport);
            netScreenLabel = StateManager.CreateButtonTextSprite(false, "Multiplayer", netScreenButton, this);
            netScreenLabel.Pressed += StateManager.ButtonSFXHelper;
            netScreenLabel.Pressed += new EventHandler(netScreenLabel_Pressed);
        }
        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
        }
Пример #8
0
        public override void InitScreen(ScreenType screenName)
        {
            base.InitScreen(screenName);

            BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

            invincible = StateManager.CreateButtonTextSprite(false, null, null, this);
            invincible.Pressed += new EventHandler(invincible_Pressed);
            invincible.Pressed += new EventHandler(event_OnPressGeneral);

            infimoney = StateManager.CreateButtonTextSprite(false, null, null, this);
            infimoney.Y = invincible.Height;
            infimoney.Pressed += new EventHandler(infimoney_Pressed);
            infimoney.Pressed += new EventHandler(event_OnPressGeneral);

            shipSpeed = StateManager.CreateButtonTextSprite(false, null, null, this);
            shipSpeed.Y = infimoney.Height + infimoney.Y;
            shipSpeed.Pressed += new EventHandler(shipSpeed_Pressed);
            shipSpeed.Pressed += new EventHandler(event_OnPressGeneral);

            killall = StateManager.CreateButtonTextSprite(false, null, null, this);
            killall.Y = shipSpeed.Height + shipSpeed.Y;
            killall.Pressed += new EventHandler(killall_Pressed);
            killall.Pressed += new EventHandler(event_OnPressGeneral);

            emergencyheal = StateManager.CreateButtonTextSprite(false, null, null, this);
            emergencyheal.Y = killall.Height + killall.Y;
            emergencyheal.Pressed += new EventHandler(emergencyheal_Pressed);
            emergencyheal.Pressed += new EventHandler(event_OnPressGeneral);

            fowEnabled = StateManager.CreateButtonTextSprite(false, null, null, this);
            fowEnabled.Y = emergencyheal.Height + emergencyheal.Y;
            fowEnabled.Pressed += new EventHandler(fowEnabled_Pressed);
            fowEnabled.Pressed += new EventHandler(event_OnPressGeneral);

            UpdateTextSprites();
        }
Пример #9
0
        public override void InitScreen(ScreenType screenType)
        {
            base.InitScreen(screenType);

            //Adding a background
            this.BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;

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

            #if XBOX
             MoveLabel = new TextSprite(Sprites.SpriteBatch, font, ("Move: Right Joystick"));
             MoveLabel.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f);
             MoveLabel.Color = Color.White;
            #endif

            #if WINDOWS
            MoveLabel = new TextSprite(Sprites.SpriteBatch, font, String.Format("Move:{0}", StateManager.Options.LeftButtonEnabled ? "Arrow Keys" : "WASD"));
            MoveButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f), Sprites.SpriteBatch);
            MoveLabel.Position = new Vector2((MoveButton.X + MoveButton.Width / 2) - MoveLabel.Width / 2, (MoveButton.Y + MoveButton.Height / 2) - MoveLabel.Height / 2);
            MoveLabel.Color = Color.White;
            MoveLabel.IsManuallySelectable = true;
            MoveLabel.IsHoverable = true;
            MoveLabel.HoverColor = Color.MediumAquamarine;
            MoveLabel.NonHoverColor = Color.White;

            MoveButton.MouseEnter += new EventHandler(MoveButton_MouseEnter);
            MoveButton.MouseLeave += new EventHandler(MoveButton_MouseLeave);
            #endif

            #if XBOX
             FireLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, font, ("Fire: RTrigger"));
             FireLabel.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .35f);
             FireLabel.Color = Color.White;
            #endif

            #if WINDOWS
            FireLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, font, String.Format("Fire:{0}", StateManager.Options.ArrowKeysEnabled ? "LClick" : "Space"));
            FireButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .35f), Sprites.SpriteBatch);
            FireLabel.Position = new Vector2(FireButton.Position.X + (FireButton.Width / 2 - FireLabel.Width / 2), FireButton.Position.Y + (FireButton.Height / 2 - FireLabel.Height / 2));
            FireLabel.Color = Color.White;
            FireLabel.IsManuallySelectable = true;
            FireLabel.IsHoverable = true;
            FireLabel.HoverColor = Color.MediumAquamarine;
            FireLabel.NonHoverColor = Color.White;

            FireButton.MouseEnter += new EventHandler(FireButton_MouseEnter);
            FireButton.MouseLeave += new EventHandler(FireButton_MouseLeave);
            #endif

            #if WINDOWS
            SecondWeap = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .4f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f), Sprites.SpriteBatch);
            SecondWeapLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, font, String.Format("Use Weapon:{0}", StateManager.Options.SecondaryButtonEnabled ? "RShift" : "R"));
            SecondWeapLabel.Position = new Vector2(SecondWeap.Position.X + (SecondWeap.Width / 2 - SecondWeapLabel.Width / 2), SecondWeap.Position.Y + (SecondWeap.Height / 2 - SecondWeapLabel.Height / 2));
            SecondWeapLabel.Color = Color.White;
            SecondWeapLabel.IsManuallySelectable = true;
            SecondWeapLabel.IsHoverable = true;
            SecondWeapLabel.HoverColor = Color.MediumAquamarine;
            SecondWeapLabel.NonHoverColor = Color.White;
            SecondWeap.Scale = new Vector2(1.4f, SecondWeap.Scale.Y);

            SecondWeap.MouseEnter += new EventHandler(SecondWeap_MouseEnter);
            SecondWeap.MouseLeave += new EventHandler(SecondWeap_MouseLeave);
            #endif

            #if XBOX
             SecondWeapLabel = new TextSprite(Sprites.SpriteBatch, font, ("Use Secondary Weapon: LTrigger"));
             SecondWeapLabel.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .4f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .10f);
             SecondWeapLabel.Color = Color.White;
            #endif

            #if WINDOWS
            SwitchWeap = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .4f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .35f), Sprites.SpriteBatch);
            SwitchSecondWeapLabel = new TextSprite(Sprites.SpriteBatch, font, String.Format("Switch Weapon:{0}", StateManager.Options.LeftButtonEnabled ? "PgUp/PgDn" : "Q/E"));
            SwitchSecondWeapLabel.Color = Color.White;
            SwitchSecondWeapLabel.IsManuallySelectable = true;
            SwitchSecondWeapLabel.IsHoverable = true;
            SwitchSecondWeapLabel.HoverColor = Color.MediumAquamarine;
            SwitchSecondWeapLabel.NonHoverColor = Color.White;
            SwitchWeap.Scale = new Vector2(1.4f, SwitchWeap.Scale.Y);
            SwitchSecondWeapLabel.Position = new Vector2(SwitchWeap.Position.X + (SwitchWeap.Width / 2 - SwitchSecondWeapLabel.Width / 2), SwitchWeap.Position.Y + (SwitchWeap.Height / 2 - SwitchSecondWeapLabel.Height / 2));

            SwitchWeap.MouseEnter += new EventHandler(SwitchWeap_MouseEnter);
            SwitchWeap.MouseLeave += new EventHandler(SwitchWeap_MouseLeave);
            #endif

            #if XBOX
             SwitchSecondWeapLabel = new TextSprite(Sprites.SpriteBatch, font, ("Switch Secondary Weapons: \n Left and Right Bumpers"));
             SwitchSecondWeapLabel.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .4f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .35f);
             SwitchSecondWeapLabel.Color = Color.White;
            #endif

            #if WINDOWS
            DeployDrones = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .4f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .6f), Sprites.SpriteBatch);
            DeployDronesLabel = new TextSprite(Sprites.SpriteBatch, font, String.Format("Drones:{0}", StateManager.Options.LeftButtonEnabled ? "RControl" : "LShift"));
            DeployDronesLabel.Position = new Vector2(DeployDrones.Position.X + (DeployDrones.Width / 2 - DeployDronesLabel.Width / 2), DeployDrones.Position.Y + (DeployDrones.Height / 2 - DeployDronesLabel.Height / 2));
            DeployDronesLabel.Color = Color.White;
            DeployDronesLabel.IsManuallySelectable = true;
            DeployDronesLabel.IsHoverable = true;
            DeployDronesLabel.HoverColor = Color.MediumAquamarine;
            DeployDronesLabel.NonHoverColor = Color.White;
            DeployDrones.Scale = new Vector2(1.1f, DeployDrones.Scale.Y);

            DeployDrones.MouseEnter += new EventHandler(DeployDrones_MouseEnter);
            DeployDrones.MouseLeave += new EventHandler(DeployDrones_MouseLeave);

            #elif XBOX
             DeployDronesLabel = new TextSprite(Sprites.SpriteBatch, font, ("Deploy Fighter Carrier Drones: A Button"));
             DeployDronesLabel.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .4f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .60f);
             DeployDronesLabel.Color = Color.White;
            #endif
            BackButton = new Sprite(button, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .60f), Sprites.SpriteBatch);
            BackLabel = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .139f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .62f), 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);
            BackLabel.Color = Color.White;
            BackLabel.IsManuallySelectable = true;
            BackLabel.IsHoverable = true;
            BackLabel.HoverColor = Color.MediumAquamarine;
            BackLabel.NonHoverColor = Color.White;
            #if WINDOWS
            BackButton.MouseEnter += new EventHandler(BackButton_MouseEnter);
            BackButton.MouseLeave += new EventHandler(BackButton_MouseLeave);
            #endif
            //Add all buttons
            #if WINDOWS
            Sprites.Add(MoveButton);
            Sprites.Add(FireButton);
            Sprites.Add(SecondWeap);
            Sprites.Add(SwitchWeap);
            Sprites.Add(DeployDrones);
            #endif
            Sprites.Add(BackButton);

            //Add all text sprites
            AdditionalSprites.Add(BackLabel);
            AdditionalSprites.Add(MoveLabel);
            AdditionalSprites.Add(FireLabel);
            AdditionalSprites.Add(SecondWeapLabel);
            AdditionalSprites.Add(SwitchSecondWeapLabel);
            AdditionalSprites.Add(DeployDronesLabel);

            StateManager.Options.ScreenResolutionChanged += new EventHandler<ViewportEventArgs>(Options_ScreenResolutionChanged);
        }
Пример #10
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
        }
Пример #11
0
 /// <summary>
 /// Creates a new GamePadButtonEnumerator with the specified buttons and parameters.
 /// </summary>
 /// <param name="allButtons">All of the buttons to include in the GamePadButtonEnumerator.</param>
 /// <param name="inputType">The type of input to accept for GamePad-based button enumeration.</param>
 /// <param name="axisDifference">The difference along the X or Y axis required on a GamePad joystick to trigger movement (after delay). This parameter does nothing if inputType is DPad.</param>
 /// <param name="delay">The time required to pass between button selection changes. This parameter does nothing if inputType is DPad.</param>
 /// <param name="submitButton">The button on the GamePad controller which must be pushed to trigger a ButtonPress event.</param>
 /// <param name="player">The PlayerIndex to accept GamePad input from.</param>
 public GamePadButtonEnumerator(TextSprite[,] allButtons, InputType inputType, float axisDifference, TimeSpan delay, Buttons submitButton, PlayerIndex player)
 {
     if (allButtons == null)
     {
         throw new ArgumentNullException("allButtons");
     }
     else if (allButtons.GetLength(0) < 1 || allButtons.GetLength(1) < 1)
     {
         throw new ArgumentException("allButtons must have a length in both dimensions.");
     }
     if (axisDifference <= 0 || axisDifference > 1)
     {
         throw new ArgumentException("axisDifference must be greater than zero and less than or equal to 1.");
     }
     if (delay < TimeSpan.Zero)
     {
         throw new ArgumentException("delay must be greater than zero.");
     }
     if (submitButton == Buttons.BigButton)
     {
         throw new ArgumentException("submitButton must not be the BigButton.");
     }
     else if (submitButton == Buttons.DPadDown || submitButton == Buttons.DPadLeft || submitButton == Buttons.DPadRight || submitButton == Buttons.DPadUp)
     {
         throw new ArgumentException("submitButton must be a non-DPad button.");
     }
     foreach (TextSprite ts in allButtons)
     {
         if (ts != null)
         {
             ts.IsManuallySelectable = true;
             ts.IsSelected = false;
         }
     }
     for (int i = 0; i < allButtons.GetLength(1); i++)
     {
         if (allButtons[0, i] != null && allButtons[0,i].Visible)
         {
             allButtons[0, i].IsSelected = true;
             _rowCurrent = 0;
             _columnCurrent = i;
             break;
         }
         if (i == allButtons.GetLength(1) - 1)
         {
             throw new ArgumentException("The allButtons array must contain at least one non-null, visible button in each row and column.");
         }
     }
     _delay = delay;
     _allButtons = allButtons;
     _axisDifference = axisDifference;
     _submitButton = submitButton;
     this.Player = player;
     Input = inputType;
     _lastState = new GamePadState(new GamePadThumbSticks(), new GamePadTriggers(), new GamePadButtons(_submitButton), new GamePadDPad(ButtonState.Pressed, ButtonState.Pressed, ButtonState.Pressed, ButtonState.Pressed));
 }
Пример #12
0
 public override void InitScreen(ScreenType screenName)
 {
     base.InitScreen(screenName);
     BackgroundSprite = HorizontalMenuBGSprite.CurrentBG;
     loadingText = new TextSprite(this.Sprites.SpriteBatch, GameContent.Assets.Fonts.NormalText, _loadingText, Color.White);
     loadingText.Position = loadingText.GetCenterPosition(Graphics.Viewport);
     loadingText.TextChanged += new EventHandler(loadingText_TextChanged);
     AdditionalSprites.Add(loadingText);
 }
Пример #13
0
        public override void InitScreen(ScreenType screenType)
        {
            upgradeShips = new List<ShipInfo>();

            if (!_firstTimeInit)
            {
                items.Clear();
                Sprites.Clear();
                AdditionalSprites.Clear();
            }

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

            ShipTier upgradeTier = StateManager.SelectedTier == ShipTier.Tier4 ? ShipTier.Tier4 : StateManager.SelectedTier + 1;

            //Configure current credit balance display

            Credits = new TextSprite(Sprites.SpriteBatch, SegoeUIMono, String.Format("You Have {0} Credits", StateManager.SpaceBucks));
            Credits.Position = new Vector2(5, 5);
            Credits.Color = Color.White;
            Shop.PurchaseScreenSelected += new EventHandler(Shop_PurchaseScreenSelected);

            //Configure Battle Cruiser
            battleCruiser = new ShipInfo();
            battleCruiser.Image = new Sprite(GameContent.Assets.Images.Ships[ShipType.BattleCruiser, upgradeTier], Vector2.Zero, Sprites.SpriteBatch);
            battleCruiser.Image.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.81f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .12f);
            battleCruiser.Image.Rotation = new SpriteRotation(90);

            battleCruiser.Cost = BattleCruiser.Cost[upgradeTier];

            battleCruiser.Type = ShipType.BattleCruiser;
            battleCruiser.Tier = upgradeTier;

            battleCruiser.Description = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "\n\n This is the strongest class \n in the fleet, but also the slowest.\n What it lacks in speed it makes \n up for in strength.\n\n Damage Per Shot: 20\n Amount of Health: 120");
            battleCruiser.Description.Color = Color.White;

            items.Add(new KeyValuePair<Sprite, TextSprite>(battleCruiser.Image, battleCruiser.Description));

            upgradeShips.Add(battleCruiser);

            //Configure Fighter Carrier

            fighterCarrier.Image = new Sprite(GameContent.Assets.Images.Ships[ShipType.FighterCarrier, upgradeTier], Vector2.Zero, Sprites.SpriteBatch);
            fighterCarrier.Image.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.85f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .01f);
            fighterCarrier.Image.Rotation = new SpriteRotation(90);

            fighterCarrier.Cost = FighterCarrier.Cost[upgradeTier];

            fighterCarrier.Type = ShipType.FighterCarrier;
            fighterCarrier.Tier = upgradeTier;

            fighterCarrier.Description = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "\n\n This class fires an extremely fast\n Flak Cannon and has the ability to\n deploy drones. However, the drones\n and Flak Cannon aren't that powerful.\n After the Carrier gets destroyed, the\n drones die with it.\n\n Damage Per Shot: 2\n Amount of Health: 100\n Amount of Drones: 2\n Damage Per Drone Shot: 1\n Health Per Drone: 10");
            fighterCarrier.Description.Color = Color.White;

            items.Add(new KeyValuePair<Sprite, TextSprite>(fighterCarrier.Image, fighterCarrier.Description));

            upgradeShips.Add(fighterCarrier);

            //Configure Torpedo Ship
            torpedoShip = new ShipInfo();
            torpedoShip.Image = new Sprite(GameContent.Assets.Images.Ships[ShipType.TorpedoShip, upgradeTier], Vector2.Zero, Sprites.SpriteBatch);
            torpedoShip.Image.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.81f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .12f);
            torpedoShip.Image.Rotation = new SpriteRotation(90);

            torpedoShip.Cost = TorpedoShip.Cost[upgradeTier];

            torpedoShip.Type = ShipType.TorpedoShip;
            torpedoShip.Tier = upgradeTier;
            torpedoShip.Description = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, "\n\n This class is the most balanced\n ship in the game. The torpedos do\n a lot of damage and \n are hard to dodge!\n\n Damege Per Shot: 5\n Amount of Health: 110");
            torpedoShip.Description.Color = Color.White;

            items.Add(new KeyValuePair<Sprite, TextSprite>(torpedoShip.Image, torpedoShip.Description));

            upgradeShips.Add(torpedoShip);

            //Add event handlers
            if (_firstTimeInit)
            {
                ChangeItem += new EventHandler(TierSelect_ChangeItem);
                nextButtonClicked += new EventHandler(TierSelect_nextButtonClicked);
            }

            AdditionalSprites.Add(Credits);
            base.InitScreen(screenType);

            acceptLabel.Text = "Buy";
            nameLabel.X -= 40;
        }
Пример #14
0
 /// <summary>
 /// Creates a new GamePadButtonEnumerator with the specified buttons and input type, using an axis difference of 0.6, a delay of 250 milliseconds, player one's GamePad, and the A button.
 /// </summary>
 /// <param name="allButtons">All of the buttons to include in the GamePadButtonEnumerator.</param>
 /// <param name="inputType">The type of input to accept for GamePad-based button enumeration.</param>
 public GamePadButtonEnumerator(TextSprite[,] allButtons, InputType inputType)
     : this(allButtons, inputType, 0.6f, TimeSpan.FromMilliseconds(250), Buttons.A, PlayerIndex.One)
 {
 }
 private void ErrLinkOpen(TextSprite clicked)
 {
     clicked.IsHoverable = false;
     clicked.Text = "Error opening website, please report manually";
     clicked.ParentSprite.Visible = false;
     clicked.X = clicked.GetCenterPosition(GraphicsDevice.Viewport).X;
 }
Пример #16
0
 void session_GamerJoined(object sender, GamerJoinedEventArgs e)
 {
     Screen playerList = allScreens["playerList"];
     Texture2D newGamerImage = new TextureFactory(GraphicsDevice).CreateSquare(64, Color.Red);
     try
     {
         newGamerImage = Texture2D.FromStream(GraphicsDevice, e.Gamer.GetProfile().GetGamerPicture());
     }
     catch { };
     Vector2 pos = new Vector2(100, 50);
     foreach (Sprite s in playerList.Sprites)
     {
         pos.Y += s.Height + 5;
     }
     Sprite gamerIcon = new Sprite(newGamerImage, pos, spriteBatch);
     playerList.Sprites.Add(gamerIcon);
     TextSprite gamerName = new TextSprite(spriteBatch, new Vector2(pos.X + gamerIcon.Width + 5, pos.Y), font, e.Gamer.Gamertag);
     allScreens["playerList"].AdditionalSprites.Add(gamerName);
     if (session.AllGamers.Count >= 2 && session.IsHost)
     {
         //TODO
         session.StartGame();
     }
 }
Пример #17
0
        public void InitializeScreen(ShipStats ship, bool spawnEnemies)
        {
            //Reset any active ships, since we're re-initializing the game screen
            StateManager.EnemyShips.Clear();
            StateManager.AllyShips.Clear();
            playerMinimapVisible = null;
            _minimapYou = null;

            //Reset music
            _gameHasStarted = false;
            //_allowMusicHandling = false;
            playerSbObjects.Clear();
            Sprites.Clear();
            enemies.Clear();

            wcMovePrettyCode = new EventHandler(wcMovePreUpdate);

            SpriteFont SegoeUIMono = GameContent.Assets.Fonts.NormalText;

            secondaryWeaponLabel = new TextSprite(playerSb, SegoeUIMono, "No Secondary Weapon");
            secondaryWeaponLabel.Position = new Vector2((Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .1f - secondaryWeaponLabel.Width / 2) + 30, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f - secondaryWeaponLabel.Height / 2);
            secondaryWeaponLabel.Color = Color.White;
            playerSbObjects.Add(secondaryWeaponLabel);

            //Initialize the game map (world)
            bgspr = new BackgroundSprite(bgImg, Sprites.SpriteBatch, 10, 2);
            bgspr.Drawn += new EventHandler(bgspr_Drawn);
            worldCam.Pos = new Vector2(bgspr.TotalWidth / 2, bgspr.TotalHeight - (bgspr.Height / 2));
            BackgroundSprite = bgspr;

            //Set the world size in StateManager for later access
            StateManager.WorldSize = new Rectangle(0, 0, (int)bgspr.TotalWidth, (int)bgspr.TotalHeight);

            StateManager.SpawnArea = new Rectangle(500, 500, bgspr.TotalWidth.Round() - 1000, bgspr.TotalHeight.Round() - 1000);

            Vector2 minSpawnArea = _playableAreaOffset;
            Vector2 maxSpawnArea = new Vector2(bgspr.TotalWidth, bgspr.TotalHeight) - _playableAreaOffset;

            _enemies = spawnEnemies;

            #region Enemy Spawns
            if (spawnEnemies)
            {

                if (StateManager.CurrentLevel.ToInt() == 4)
                {
                    foreach (SignedInGamer sig in Gamer.SignedInGamers)
                    {
                        sig.Presence.PresenceMode = GamerPresenceMode.BattlingBoss;
                    }
                    CloneBoss enemyBoss = new CloneBoss(GameContent.Assets.Images.Ships[ShipType.EnemyFighterCarrier, ShipTier.Tier4], Vector2.Zero, Sprites.SpriteBatch);
                    CloneBoss enemyCloneOne = new CloneBoss(GameContent.Assets.Images.Ships[ShipType.EnemyFighterCarrier, ShipTier.Tier4], Vector2.Zero, Sprites.SpriteBatch);
                    CloneBoss enemyCloneTwo = new CloneBoss(GameContent.Assets.Images.Ships[ShipType.EnemyFighterCarrier, ShipTier.Tier4], Vector2.Zero, Sprites.SpriteBatch);

                    enemyBoss.WorldCoords = StateManager.RandomGenerator.NextVector2(minSpawnArea, maxSpawnArea);
                    enemyCloneOne.WorldCoords = enemyBoss.WorldCoords;
                    enemyCloneTwo.WorldCoords = enemyBoss.WorldCoords;

                    enemyBoss.isClone = false;

                    enemyBoss.targetPosition = StateManager.RandomGenerator.NextVector2(new Vector2(500), new Vector2(StateManager.WorldSize.Width - 500, StateManager.WorldSize.Height - 500));
                    enemyCloneOne.targetPosition = StateManager.RandomGenerator.NextVector2(new Vector2(500), new Vector2(StateManager.WorldSize.Width - 500, StateManager.WorldSize.Height - 500));
                    enemyCloneTwo.targetPosition = StateManager.RandomGenerator.NextVector2(new Vector2(500), new Vector2(StateManager.WorldSize.Width - 500, StateManager.WorldSize.Height - 500));

                    enemyCloneOne.EnemyCounts = false;
                    enemyCloneTwo.EnemyCounts = false;

                    Sprites.Add(enemyBoss);
                    enemies.Add(enemyBoss);

                    if (StateManager.Options.SFXEnabled)
                    {
                        ClonesMade.Play();
                    }

                    Sprites.Add(enemyCloneOne);
                    enemies.Add(enemyCloneOne);

                    if (StateManager.Options.SFXEnabled)
                    {
                        ClonesMade.Play();
                    }

                    Sprites.Add(enemyCloneTwo);
                    enemies.Add(enemyCloneTwo);
                }
                else
                {
                    foreach (SignedInGamer sig in Gamer.SignedInGamers)
                    {
                        sig.Presence.PresenceMode = GamerPresenceMode.InCombat;
                    }
                    for (int i = 0; i < 4 * StateManager.CurrentLevel.ToInt(); i++)
                    {
                        Texture2D enemyTexture = GameContent.Assets.Images.Ships[ShipType.Drone, StateManager.RandomGenerator.NextShipTier(ShipTier.Tier1, ShipTier.Tier2)];
                        EnemyBattleCruiser enemy = new EnemyBattleCruiser(GameContent.Assets.Images.Ships[ShipType.EnemyBattleCruiser, ShipTier.Tier1], Vector2.Zero, Sprites.SpriteBatch);

                        enemy.WorldCoords = StateManager.RandomGenerator.NextVector2(minSpawnArea, maxSpawnArea);

                        enemy.DistanceToNose = .5f;

                        enemy.Tier = ShipTier.Tier1;

                        Sprites.Add(enemy);
                        enemies.Add(enemy);
                    }
                }
            }
            #endregion

            TextureFactory creator = new TextureFactory(Graphics);

            miniMap = new Sprite(creator.CreateSquare(1, new Color(Color.Navy.R, Color.Navy.G, Color.Navy.B, 128)), Vector2.Zero, playerSb);
            miniMap.Width = bgspr.TotalWidth / MinimapDivAmount;
            miniMap.Color = Color.White;
            miniMap.Height = bgspr.TotalHeight / MinimapDivAmount;
            miniMap.Y = Graphics.Viewport.TitleSafeArea.Y + 7.5f;
            miniMap.X = Graphics.Viewport.TitleSafeArea.X + Graphics.Viewport.TitleSafeArea.Width - miniMap.Width - 7.5f;
            miniMap.Updated += new EventHandler(miniMap_Updated);
            miniShipInfoBg = new Sprite(creator.CreateSquare(1, new Color(0, 0, 0, 192)), new Vector2(7.5f, miniMap.Y), playerSb);
            miniShipInfoBg.Height = 0.01f;
            miniShipInfoBg.Width = 767.5f - miniShipInfoBg.X - 7.5f - miniMap.Width - 266.6666667f;
            miniShipInfoBg.X = miniMap.X - miniShipInfoBg.Width - 7.5f;
            miniShipInfoBg.Color = Color.Transparent;
            playerSbObjects.Add(miniShipInfoBg);
            playerSbObjects.Add(miniMap);

            if (StateManager.DebugData.FogOfWarEnabled)
            {
                //Create fog of war array
                // > 9x15 = Xbox lag
                // TODO: RenderTarget conversion
                fogOfWar = new Sprite[9, 15];
            }

            if (ship.Type == ShipType.Drone)
            {
                throw new Exception("Can't create a Drone as the main ship");
            }

            playerShip = BaseAllyShip.CreateShip(ship, playerSb);

            playerShip.WorldSb = Sprites.SpriteBatch;
            playerShip.Position = playerShip.GetCenterPosition(Sprites.SpriteBatch.GraphicsDevice.Viewport, playerShip.Origin * playerShip.Scale);
            playerShip.WCMoved += new EventHandler(playerShip_WCMoved);
            playerShip.WCMoved += wcMovePrettyCode;
            playerShip.IsPlayerShip = true;
            playerShip.RotateTowardsMouse = true;
            playerSbObjects.Add(playerShip);

            //TODO: Tier change event handles this
            //playerShip.InitialHealth = 100;

            //Set as own ship
            playerShip.PlayerType = PlayerType.MyShip;
            playerShip.WorldCoords = worldCam.Pos;

            if (fogOfWar != null)
            {
                for (int row = 0; row <= fogOfWar.GetUpperBound(1); row++)
                {
                    for (int column = 0; column <= fogOfWar.GetUpperBound(0); column++)
                    {
                        fogOfWar[column, row] = new Sprite(creator.CreateSquare(1, Color.DarkGray), Vector2.Zero, playerSb);
                        fogOfWar[column, row].Width = miniMap.Width / fogOfWar.GetLength(0);
                        fogOfWar[column, row].Height = miniMap.Height / fogOfWar.GetLength(1);
                        fogOfWar[column, row].X = miniMap.X + fogOfWar[0, 0].Width * column;
                        fogOfWar[column, row].Y = miniMap.Y + fogOfWar[0, 0].Height * row;
                        fogOfWar[column, row].Color = Color.White;
                        StateManager.KnownMap[column, row] = false;
                    }
                }
            }

            World = Sprites.SpriteBatch;
            playerShip.BulletFired += new EventHandler<BulletEventArgs>(playerShip_BulletFired);

            _bulletsInProgress.Clear();
        }
Пример #18
0
        public void Load(SpriteBatch spriteBatch, ContentManager Content, Viewport viewport, bool useCustTexture, Texture2D custTexture)
        {
            SpriteFactory ballBuilder = new SpriteFactory(Content.Load<Texture2D>("PongCircle"), new Vector2(370, 180), spriteBatch).SetUpdateParamaters(new UpdateParamaters(true, true, false));
            ball = ballBuilder.Build();
            Sprite p1 = new SpriteFactory(useCustTexture ? custTexture : Content.Load<Texture2D>("PongSprite1"), new Vector2(0, 160), spriteBatch).SetScale(useCustTexture ? new Vector2(80f / custTexture.Width, 80f / custTexture.Height) : new Vector2(1, 1)).Build();
            Sprite p2 = new Sprite(Content.Load<Texture2D>("PongSprite2"), new Vector2(720, 160), spriteBatch);
            bullet = Content.Load<Texture2D>("bullet");
            p2gun = new Sprite(Content.Load<Texture2D>("gun"), new Vector2(viewport.Width - 150, 150 + p2.Height - 40), spriteBatch);
            p2gun.Scale /= 3;
            p2gun.UseCenterAsOrigin = false;
            p1gun = new Sprite(Content.Load<Texture2D>("gun"), new Vector2(10, 150 + p1.Height - 40), spriteBatch);
            p1gun.Scale /= 3;
            p1gun.UseCenterAsOrigin = false;

            p1gun2 = new Sprite(Content.Load<Texture2D>("gun2"), new Vector2(10, 150 + p1.Height - 40), spriteBatch);
            p2gun2 = new Sprite(Content.Load<Texture2D>("gun2"), new Vector2(viewport.Width - 150, 150 + p2.Height - 40), spriteBatch);

            p1gun2.Color = Color.Transparent;
            p2gun2.Color = Color.Transparent;

            p1gun2.UseCenterAsOrigin = false;
            p2gun2.UseCenterAsOrigin = false;

            p1gun3 = new Sprite(Content.Load<Texture2D>("gun3"), new Vector2(10, 150 + p1.Height - 40), spriteBatch);
            p2gun3 = new Sprite(Content.Load<Texture2D>("gun3"), new Vector2(viewport.Width - 150, 150 + p2.Height - 40), spriteBatch);

            p1gun3.Color = Color.Transparent;
            p2gun3.Color = Color.Transparent;

            p1gun3.UseCenterAsOrigin = false;
            p2gun3.UseCenterAsOrigin = false;

            p1gun3.Scale /= 1;
            p2gun3.Scale /= 1;

            p1healthbar = new Sprite(Content.Load<Texture2D>("full healf"), new Vector2(0), spriteBatch);
            p1healthempty = new Sprite(Content.Load<Texture2D>("healftempty"), new Vector2(0), spriteBatch);

            p2healthbar = new Sprite(Content.Load<Texture2D>("full healf"), new Vector2(605, 0), spriteBatch);
            p2healthempty = new Sprite(Content.Load<Texture2D>("healftempty"), new Vector2(605, 0), spriteBatch);

            p2healthbar.UseCenterAsOrigin = false;
            p2healthempty.UseCenterAsOrigin = false;

            p1healthbar.UseCenterAsOrigin = false;
            p1healthempty.UseCenterAsOrigin = false;

            p1healthbar.Color = Color.Transparent;
            p1healthempty.Color = Color.Transparent;

            p2healthbar.Color = Color.Transparent;
            p2healthempty.Color = Color.Transparent;

            p1gun.Color = Color.Transparent;
            p1gun.Updated += new EventHandler(gun_Updated);
            p2gun.Updated += new EventHandler(gun_Updated);
            p2gun.Color = Color.Transparent;

            ball.Updated += new EventHandler(ball_Updated);
            p1.Updated += new EventHandler(p1_Updated);
            p1.Move += new SpriteMoveEventHandler(p1_Move);
            p2.Updated += new EventHandler(p2_Updated);
            p2.Move += new SpriteMoveEventHandler(p2_Move);
            p2gun.Effect = SpriteEffects.FlipHorizontally;

            gameOver = new TextSprite(spriteBatch, new Vector2(170, 220), Content.Load<SpriteFont>("SpriteFont1"), "GAME OVER", Color.Black);
            gameOver.Color = Color.Transparent;

            _spriteManager = new SpriteManager(spriteBatch, ball, p1, p2, p2gun, p1gun, p1healthempty, p1healthbar, p2healthempty, p2healthbar, p1gun2, p2gun2, p1gun3, p2gun3);

            _viewport = viewport;

            resetTimer = new TimeSpan(0, 0, 0, 0, 500);
            elapsedTime = new TimeSpan(0, 0, 0, 0, 0);

            gun = Content.Load<Song>("Truth of the Legend");
            song = Content.Load<Song>("Cut and Run");

            state = GameState.Play;
        }
Пример #19
0
        void miniMap_Updated(object sender, EventArgs e)
        {
            foreach (Sprite s in miniShips)
            {
                playerSbObjects.Remove(s);
            }
            if (miniShipInfoTitle != null)
            {
                playerSbObjects.Remove(miniShipInfoTitle);
            }
            if (miniShipInfo != null)
            {
                playerSbObjects.Remove(miniShipInfo);
            }
            miniShips.Clear();

            Ship activeMiniShipDisplay = null;

            foreach (Ship ship in StateManager.AllyShips)
            {
                addShipToMinimap(ship, ref activeMiniShipDisplay);
            }

            foreach (Ship ship in StateManager.EnemyShips)
            {
                addShipToMinimap(ship, ref activeMiniShipDisplay);
            }

            miniShipInfoBg.Color = activeMiniShipDisplay != null ? Color.White : Color.Transparent;
            if (activeMiniShipDisplay != null)
            {
                miniShipInfoTitle = new TextSprite(playerSb, bold, activeMiniShipDisplay.FriendlyName);
                miniShipInfoTitle.Color = Color.White;
                miniShipInfoTitle.Position = new Vector2(miniShipInfoBg.X + (miniShipInfoBg.Width / 2f) - (miniShipInfoTitle.Width / 2f), miniShipInfoBg.Y + (miniShipInfoBg.Height / 12.5f));
                playerSbObjects.Add(miniShipInfoTitle);
                miniShipInfoBg.Height = (miniShipInfoTitle.Y - miniShipInfoBg.Y) + miniShipInfoTitle.Height + (miniShipInfoTitle.Y - miniShipInfoBg.Y);
                string shipIdStr = activeMiniShipDisplay.ShipID.ToString();
                string[] digits = shipIdStr.Split('-');
                shipIdStr = digits[0] + "..." + digits[digits.Length - 1];
                miniShipInfo = new TextSprite(playerSb, normal, string.Format("Tier {4}\nHP: {0}/{1}\nDamage: {2}{3}", activeMiniShipDisplay.CurrentHealth, activeMiniShipDisplay.InitialHealth, activeMiniShipDisplay.DamagePerShot, StateManager.DebugData.ShowShipIDs ? "\nID: " + shipIdStr : "", activeMiniShipDisplay.Tier.ToInt()));
                miniShipInfo.Color = Color.White;
                miniShipInfo.Position = new Vector2(miniShipInfoBg.X + (miniShipInfoBg.Width / 2f) - (miniShipInfo.Width / 2f), miniShipInfoTitle.Y + bold.LineSpacing);
                if (StateManager.ShowShipData || StateManager.DebugData.ShowShipIDs)
                {
                    miniShipInfoBg.Height += miniShipInfo.Height;
                    playerSbObjects.Add(miniShipInfo);
                }

            }

            //This extension method (IEnumerable cast, NOT Glib cast) shouldn't be neccesary on XBOX, but I think it may be
            //Casting the Sprites to ISprites
            playerSbObjects.AddRange(miniShips.Cast<ISprite>());

            if (fogOfWar != null)
            {
                for (int row = 0; row <= fogOfWar.GetUpperBound(1); row++)
                {
                    for (int column = 0; column <= fogOfWar.GetUpperBound(0); column++)
                    {
                        playerSbObjects.Remove(fogOfWar[column, row]);
                        if (!StateManager.KnownMap[column, row])
                        {
                            playerSbObjects.Add(fogOfWar[column, row]);
                        }
                    }
                }
            }
        }
Пример #20
0
        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
        }
        //bool bought = false;
        public override void InitScreen(ScreenType screenType)
        {
            Shop.PurchaseScreenSelected += new EventHandler(Shop_PurchaseScreenSelected);
            Texture2D image = GameContent.Assets.Images.NonPlayingObjects.Planet;
            Texture2D EMP = GameContent.Assets.Images.SecondaryWeapon[SecondaryWeaponType.EMP, TextureDisplayType.ShopDisplay];
            Texture2D RayGun = GameContent.Assets.Images.SecondaryWeapon[SecondaryWeaponType.ShrinkRay, TextureDisplayType.ShopDisplay];
            Texture2D Bomb = GameContent.Assets.Images.SecondaryWeapon[SecondaryWeaponType.SpaceMine, TextureDisplayType.ShopDisplay];
            Texture2D HealthPack = GameContent.Assets.Images.Equipment[EquipmentType.HealthPack, TextureDisplayType.ShopDisplay];

            SpaceBucksAmount = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, string.Format("You have {0} credits", StateManager.SpaceBucks), Color.White);
            //SpaceBucksAmount.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width / 2 - SpaceBucksAmount.Width, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .1f);

            ItemAmount = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, GameContent.Assets.Fonts.NormalText, string.Format("You have x{0} EMPs", StateManager.PowerUps[2].Count), Color.White);
            ItemAmount.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width / 2 - SpaceBucksAmount.Width, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .15f);

            AdditionalSprites.Add(SpaceBucksAmount);
            AdditionalSprites.Add(ItemAmount);

            SpriteFont font = GameContent.Assets.Fonts.NormalText;

            //EMP
            EMP weapon1 = new EMP(EMP, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.75f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.3f), Sprites.SpriteBatch);
            TextSprite text1 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), font, "\n\nAn electro magnetic pulse. \nThis device disables all \nnearby enemy ships \nwithin your ship's range. \n\ncost: 1000 credits", Color.White);

            weapon1.Scale = new Vector2(0.5f, 0.5f);

            itemsShown.Add(weapon1);

            //Ray Gun
            ShrinkRay weapon2 = new ShrinkRay(RayGun, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.64f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.2f), Sprites.SpriteBatch);
            weapon2.Scale = new Vector2(0.5f, 0.5f);

            itemsShown.Add(weapon2);

            //Space Mine
            SpaceMine weapon3 = new SpaceMine(Bomb, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.69f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.3f), Sprites.SpriteBatch);
            weapon3.Scale = new Vector2(2f, 2f);

            itemsShown.Add(weapon3);

            TextSprite text2 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), font, "\n\nThis weapon causes the targeted enemy\nto shrink losing 33% of their health. \nThis does not affect bosses.\n\ncost: 2000 credits", Color.White);
            TextSprite text3 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.1f), font, "\n\nYou place this mine anywhere in space \nand when an enemy crashes into it the mine \nexplodes \n\ncost: 500 credits.", Color.White);

            items.Add(new KeyValuePair<Sprite, TextSprite>(weapon2, text2));
            items.Add(new KeyValuePair<Sprite, TextSprite>(weapon3, text3));

            //HealthPack

            HealthPack weapon4 = new HealthPack(HealthPack, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.74f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.3f), Sprites.SpriteBatch);
            TextSprite text4 = new TextSprite(Sprites.SpriteBatch, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.1f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 1.5f), font, "\n\n\nThis power up regenerates\nyour health up\nby 50%\n\nCost: " + weapon4.Cost, Color.White);
            text4.Position = new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * 0.01f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * 0.05f);
            weapon4.Scale = new Vector2(0.5f, 0.5f);

            items.Add(new KeyValuePair<Sprite, TextSprite>(weapon4, text4));
            itemsShown.Add(weapon4);

            ChangeItem += new EventHandler(WeaponSelectScreen_ChangeItem);

            items.Add(new KeyValuePair<Sprite, TextSprite>(weapon1, text1));

            base.InitScreen(screenType);

            acceptLabel.Text = "Buy";
            //In clicked code
            this.nextButtonClicked += new EventHandler(WeaponSelectScreen_nextButtonClicked);
        }
Пример #22
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);
        }
Пример #23
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
        }
Пример #24
0
        public override void InitScreen(ScreenType screenType)
        {
            base.InitScreen(screenType);

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

            acceptButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .7f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .8f), Sprites.SpriteBatch);
            acceptLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Play");
            acceptLabel.Position = new Vector2((acceptButton.X + acceptButton.Width / 2) - acceptLabel.Width / 2, (acceptButton.Y + acceptButton.Height / 2) - acceptLabel.Height / 2);
            acceptLabel.Color = Color.White;
            acceptLabel.IsHoverable = true;
            acceptLabel.IsManuallySelectable = true;
            acceptLabel.NonHoverColor = Color.White;
            acceptLabel.HoverColor = Color.MediumAquamarine;
            acceptLabel.ParentSprite = acceptButton;

            #if WINDOWS
            acceptButton.MouseEnter += new EventHandler(playButton_MouseEnter);
            acceptButton.MouseLeave += new EventHandler(playButton_MouseLeave);
            #endif

            Sprites.Add(acceptButton);
            AdditionalSprites.Add(acceptLabel);

            #if WINDOWS
            backButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .06f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .8f), Sprites.SpriteBatch);
            backLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Back");
            backLabel.Position = new Vector2((backButton.X + backButton.Width / 2) - backLabel.Width / 2, (backButton.Y + backButton.Height / 2) - backLabel.Height / 2);
            backLabel.Color = Color.White;
            backLabel.IsHoverable = true;
            backLabel.IsManuallySelectable = true;
            backLabel.NonHoverColor = Color.White;
            backLabel.HoverColor = Color.MediumAquamarine;

            backButton.MouseEnter += new EventHandler(backButton_MouseEnter);
            backButton.MouseLeave += new EventHandler(backButton_MouseLeave);

            Sprites.Add(backButton);
            AdditionalSprites.Add(backLabel);
            #endif

            Sprite leftButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .5f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .5f), Sprites.SpriteBatch);
            leftButton.Scale = new Vector2(0.5f, 1);
            leftLabel = new TextSprite(Sprites.SpriteBatch, new Vector2(5, 5), SegoeUIMono, "<<<");
            leftLabel.Position = new Vector2((leftButton.X + leftButton.Width / 2) - leftLabel.Width / 2, (leftButton.Y + leftButton.Height / 2) - leftLabel.Height / 2);
            leftLabel.Color = Color.White;
            leftLabel.IsHoverable = true;
            leftLabel.IsManuallySelectable = true;
            leftLabel.NonHoverColor = Color.White;
            leftLabel.HoverColor = Color.MediumAquamarine;

            #if WINDOWS
            leftButton.MouseEnter += new EventHandler(leftButton_MouseEnter);
            leftButton.MouseLeave += new EventHandler(leftButton_MouseLeave);
            #endif

            Sprites.Add(leftButton);
            AdditionalSprites.Add(leftLabel);

            Sprite rightButton = new Sprite(buttonImage, new Vector2(Sprites.SpriteBatch.GraphicsDevice.Viewport.Width * .9f, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height * .5f), Sprites.SpriteBatch);
            rightButton.Scale = new Vector2(0.5f, 1);
            rightLabel = new TextSprite(Sprites.SpriteBatch, new Vector2(5, 5), SegoeUIMono, ">>>");
            rightLabel.Position = new Vector2((rightButton.X + rightButton.Width / 2) - rightLabel.Width / 2, (rightButton.Y + rightButton.Height / 2) - rightLabel.Height / 2);
            rightLabel.Color = Color.White;
            rightLabel.IsHoverable = true;
            rightLabel.IsManuallySelectable = true;
            rightLabel.NonHoverColor = Color.White;
            rightLabel.HoverColor = Color.MediumAquamarine;

            #if WINDOWS
            rightButton.MouseEnter += new EventHandler(rightButton_MouseEnter);
            rightButton.MouseLeave += new EventHandler(rightButton_MouseLeave);
            #endif
            Sprites.Add(rightButton);
            AdditionalSprites.Add(rightLabel);

            nameLabel = new TextSprite(Sprites.SpriteBatch, Vector2.Zero, SegoeUIMono, "Name Of Item");
            //right side of left button              //left of right button   //right side of left button
            nameLabel.Position = new Vector2(((leftButton.X + leftButton.Texture.Width * leftButton.Scale.X) + (rightButton.X - (leftButton.X + leftButton.Texture.Width * leftButton.Scale.X)) / 2) - nameLabel.Width * .5f, (leftButton.Y + leftButton.Texture.Height / 2) - nameLabel.Height / 2);
            nameLabel.Color = Color.White;

            AdditionalSprites.Add(nameLabel);

            for (int i = 0; i < items.Count; i++)
            {
                if (i != 0)
                {
                    items[i].Key.Color = Color.Transparent;
                    items[i].Value.Color = Color.Transparent;
                }

                Sprites.Add(items[i].Key);
                AdditionalSprites.Add(items[i].Value);
            }

            if (ChangeItem != null)
            {
                ChangeItem(this, new EventArgs());
            }

            _firstTimeInit = false;
        }
Пример #25
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("SpriteFont1");

            Screen title = new Screen(spriteBatch, Color.CornflowerBlue);
            TextSprite createSession = new TextSprite(spriteBatch, font, "Host session");
            createSession.IsHoverable = true;
            createSession.NonHoverColor = Color.Black;
            createSession.HoverColor = Color.White;
            createSession.Pressed += new EventHandler(createSession_Pressed);
            TextSprite joinSession = new TextSprite(spriteBatch, font, "Join session");
            joinSession.Y += createSession.Font.LineSpacing+1;
            joinSession.IsHoverable = true;
            joinSession.NonHoverColor = Color.Black;
            joinSession.HoverColor = Color.White;
            joinSession.Pressed += new EventHandler(joinSession_Pressed);
            title.AdditionalSprites.Add(createSession);
            title.AdditionalSprites.Add(joinSession);
            title.Name = "titleScreen";
            title.Visible = true;

            Screen waitForPlayers = new Screen(spriteBatch, Color.CornflowerBlue);
            waitForPlayers.Name = "playerList";

            Screen listSessions = new Screen(spriteBatch, Color.CornflowerBlue);
            listSessions.Name = "listSessions";
            TextSprite refreshSessions = new TextSprite(spriteBatch, font, "Refresh");
            refreshSessions.IsHoverable = true;
            refreshSessions.NonHoverColor = Color.Black;
            refreshSessions.HoverColor = Color.LimeGreen;
            refreshSessions.Pressed += new EventHandler(joinSession_Pressed);
            listSessions.AdditionalSprites.Add(refreshSessions);

            Screen chatScreen = new Screen(spriteBatch, Color.CornflowerBlue);
            TextBoxSprite tbs = new TextBoxSprite(new Vector2(1, GraphicsDevice.Viewport.Height-20), spriteBatch, font);
            tbs.TextSubmitted += new EventHandler(tbs_TextSubmitted);
            tbs.Width = GraphicsDevice.Viewport.Width-2;
            tbs.Height = 19;
            chatScreen.Name = "chatScreen";
            chatScreen.Sprites.Add(tbs);

            allScreens = new ScreenManager(spriteBatch, Color.Red, title, waitForPlayers, listSessions, chatScreen);

            packetReader = new PacketReader();

            // TODO: use this.Content to load your game content here
        }
        /// <summary>
        /// Load Game Assets and initialize all screens
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            mainScreen = new Screen(spriteBatch, Color.Black);
            mainScreen.Name = "ErrorDisplay";
            mainScreen.Visible = true;
            Sprite parentButton = mainScreen.Sprites.AddNewSprite(Vector2.Zero, Content.Load<Texture2D>("Images\\Controls\\Button"));
            parentButton.Position = parentButton.GetCenterPosition(GraphicsDevice.Viewport);

            TextSprite title = new TextSprite(spriteBatch, Content.Load<SpriteFont>("Fonts\\SegoeUIMonoBold"), "Runtime Error in PGCGame", Color.Red);

            title.Text += ": " + this.error.GetType().FullName;

            title.X = title.GetCenterPosition(GraphicsDevice.Viewport).X;
            title.Y = 5;
            mainScreen.AdditionalSprites.Add(title);

            TextSprite details = new TextSprite(spriteBatch, Content.Load<SpriteFont>("Fonts\\SegoeUIMono"), "Please report this error at: \nhttp://pgcgame.com/ReportError", Color.White);
            details.Y = title.Y + title.Font.LineSpacing;
            details.X = details.GetCenterPosition(GraphicsDevice.Viewport).X;
            mainScreen.AdditionalSprites.Add(details);

            TextSprite exceptMsg = new TextSprite(spriteBatch, Content.Load<SpriteFont>("Fonts\\SegoeUIMono"), error.Message, Color.White);
            exceptMsg.X = exceptMsg.GetCenterPosition(GraphicsDevice.Viewport).X;
            exceptMsg.Y = details.Y + 1 + details.Height;
            mainScreen.AdditionalSprites.Add(exceptMsg);

            TextSprite reportError = new TextSprite(spriteBatch, Content.Load<SpriteFont>("Fonts\\SegoeUIMono"), "Report Error", Color.White);
            reportError.IsHoverable = true;
            reportError.ParentSprite = parentButton;
            reportError.HoverColor = Color.MediumAquamarine;
            reportError.NonHoverColor = Color.White;
            reportError.Pressed += new EventHandler(reportError_Pressed);
            mainScreen.AdditionalSprites.Add(reportError);
            screenManager = new ScreenManager(spriteBatch, Color.DarkRed, mainScreen);
            base.LoadContent();
        }
        public override void InitScreen(ScreenType screenName)
        {
            Lose = new TextSprite(Sprites.SpriteBatch, GameContent.Assets.Fonts.BoldText, "You Lose =(", Color.White);

            base.InitScreen(screenName);
        }
Пример #28
0
 /// <summary>
 /// Create a new TextBoxSprite.
 /// </summary>
 /// <param name="texture">The texture to show beneath the text (must be scalable).</param>
 /// <param name="color">The color to tint the texture under the text.</param>
 /// <param name="pos">The position of the TextBoxSprite.</param>
 /// <param name="font">The SpriteFont to draw the text with.</param>
 /// <param name="sb">The SpriteBatch to draw to.</param>
 /// <param name="up">The UpdateParameters to use when updating this Sprite.</param>
 public TextBoxSprite(Texture2D texture, Vector2 pos, Color color, SpriteBatch sb, UpdateParamaters up, SpriteFont font)
     : base(texture, pos, color, sb, up)
 {
     _textView = new TextSprite(SpriteBatch, font, "");
     _textView.Position = Position + Vector2.One;
     Height = font.LineSpacing + 1;
     Scale.X = 0;
     movementInternal = new EventHandler(this.TextBoxSprite_Moved);
     Moved += movementInternal;
     base.UseCenterAsOrigin = false;
 }
Пример #29
0
        public override void InitScreen(ScreenType screenType)
        {
            base.InitScreen(screenType);
            BackgroundSprite = new Sprite(GameContent.Assets.Images.Backgrounds.Screens[ScreenBackgrounds.Credits], Vector2.Zero, Sprites.SpriteBatch);
            SpriteFont SegoeUIMono = GameContent.Assets.Fonts.NormalText;
            _scrollingSpeed = new Vector2(0, -1);

            Texture2D logo = GameContent.Assets.Images.Controls.Title;
            gameTitle = new Sprite(logo, new Vector2(0, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height), Sprites.SpriteBatch);
            gameTitle.X = gameTitle.GetCenterPosition(Sprites.SpriteBatch.GraphicsDevice.Viewport).X;
            //credits = new TextSprite(Sprites.SpriteBatch, , "\n\n\n\nWeek 1 - Functional Spec, GameState Management\n
            //Week 3 - AI's\n\n\n\n\n\n\n\n\n\n\n\nWeek 4 - Xbox Converson\n\n\n\n\nUnderlying Library written by:\nGlen Husman (glen3b)\nGlib is available on github! \n\n\n\n\n\n\n                Music:\n\nFailing Defense - Kevin MacLeod\n\nAll music obtained from Incompetech.com", Color.White);
            //credits = new TextSprite(Sprites.SpriteBatch, GameContent.GameAssets.Fonts.NormalText, "   Plequarius: Galactic Commanders\n\n\n\n\n\nAll Developement:\nGlen Husman\n\nMinor Assistance:\nAbe", Color.White);

            //credits.Position = new Vector2(credits.GetCenterPosition(Sprites.SpriteBatch.GraphicsDevice.Viewport).X, Sprites.SpriteBatch.GraphicsDevice.Viewport.Height+imgSprite.Height);

            int lastWeekID = 0;
            foreach (KeyValuePair<XmlCredits.Week, XmlCredits.Student> weekStudent in _xmlCredits.Students)
            {
                int weekID = weekStudent.Key.ID;

                if (lastWeekID != weekID)
                {
                    StringBuilder title = new StringBuilder();

                    title.AppendFormat("\n\n\n\nWeek {0} - ", weekID);

                    for (int topicCounter = 0; topicCounter < weekStudent.Key.Topics.Count; topicCounter++)
                    {
                        KeyValuePair<int, string> topic = weekStudent.Key.Topics[topicCounter];
                        title.AppendFormat("{0}{1}", topic.Value, topicCounter == weekStudent.Key.Topics.Count - 1 ? "\n" : ", ");
                    }

                    TextSprite credit = new TextSprite(Sprites.SpriteBatch, _boldCreditsFont, title.ToString());
                    credit.X = credit.GetCenterPosition(Sprites.SpriteBatch.GraphicsDevice.Viewport).X;
                    credit.Color = Color.White;

                    if (credits.Count == 0)
                    {
                        credit.Y = gameTitle.Y + gameTitle.Height;
                    }
                    else
                    {
                        credit.Y = credits[credits.Count - 1].Y + credits[credits.Count - 1].Height + (_creditsFont.LineSpacing - _creditsFont.MeasureString("A").Y);
                    }
                    credits.Add(credit);

                    lastWeekID = weekID;
                }

                TextSprite student = new TextSprite(Sprites.SpriteBatch, _creditsFont, String.Format("{0} {1}\n", weekStudent.Value.FirstName, weekStudent.Value.LastName));
                student.X = student.GetCenterPosition(Sprites.SpriteBatch.GraphicsDevice.Viewport).X;
                student.Color = Color.White;
                student.Y = credits[credits.Count - 1].Y + credits[credits.Count - 1].Height + (_creditsFont.LineSpacing - _creditsFont.MeasureString("A").Y);
                credits.Add(student);
            }

            TextSprite helperLabel = new TextSprite(Sprites.SpriteBatch, _boldCreditsFont, "\n\n\n\nHelpers\n", Color.White);
            helperLabel.X = helperLabel.GetCenterPosition(Sprites.SpriteBatch.GraphicsDevice.Viewport).X;
            helperLabel.Y = credits[credits.Count - 1].Y + credits[credits.Count - 1].Height + (_creditsFont.LineSpacing - _creditsFont.MeasureString("A").Y);
            credits.Add(helperLabel);

            foreach (PGCGame.Xml.XmlTypes.XmlCredits.Helper assistant in _xmlCredits.AllHelpers)
            {
                float targetY = credits[credits.Count - 1].Y + credits[credits.Count - 1].Height + (_creditsFont.LineSpacing - _creditsFont.MeasureString("A").Y);
                TextSprite name = new TextSprite(Sprites.SpriteBatch, new Vector2(0, targetY), _boldCreditsFont, assistant.FullName, Color.White);
                TextSprite job = new TextSprite(Sprites.SpriteBatch, new Vector2(0, targetY+name.Font.LineSpacing), _creditsFont, assistant.Job+"\n", Color.White);
                name.X = name.GetCenterPosition(Graphics.Viewport).X;
                job.X = job.GetCenterPosition(Graphics.Viewport).X;
                credits.Add(name);
                credits.Add(job);
            }

            //The IEnumerable cast method
            AdditionalSprites.AddRange(credits.Cast<IDrawableComponent>());
            Sprites.Add(gameTitle);

            _elapsedTime = TimeSpan.Zero;
        }
Пример #30
0
        public void Load(SpriteBatch spriteBatch, ContentManager Content)
        {
            sb = spriteBatch;
            Sprite logo = new SpriteFactory(Content.Load<Texture2D>("minecraft-text"), new Vector2(210, 5), spriteBatch).SetScale(new Vector2(0.2f, 0.2f)).Build();
            logo.UseCenterAsOrigin = false;
            Sprite singleplayer = new Sprite(Content.Load<Texture2D>("singleplayer"), new Vector2(340, 150), null);
            Sprite singleplayerhighlite = new SpriteFactory(Content.Load<Texture2D>("singleplayerhighlite"), new Vector2(340, 150), spriteBatch).SetScale(new Vector2(0f)).Build();
            Sprite multiplayer = new Sprite(Content.Load<Texture2D>("multiplayer"), new Vector2(270, 220), null);
            Sprite multiplayerhighlite = new Sprite(Content.Load<Texture2D>("multiplayerhighlite"), new Vector2(270, 220), null);
            Sprite options = new Sprite(Content.Load<Texture2D>("Options"), new Vector2(325, 310), null);
            Sprite optionsHighLite = new Sprite(Content.Load<Texture2D>("OptionsHighLite"), new Vector2(325, 310), null);
            Sprite controls = new Sprite(Content.Load<Texture2D>("Controls"), new Vector2(340, 150), null);

            stan = new TextSprite(spriteBatch, new Vector2(170, 220), Content.Load<SpriteFont>("SpriteFont1"), "Stan",  Color.Black);
            stan.Color = Color.Transparent;

            easy = new TextSprite(spriteBatch, new Vector2(250, 220), Content.Load<SpriteFont>("SpriteFont1"), "Easy", Color.Black);
            easy.Color = Color.Transparent;

            medium = new TextSprite(spriteBatch, new Vector2(330, 220), Content.Load<SpriteFont>("SpriteFont1"), "Medium", Color.Black);
            medium.Color = Color.Transparent;

            hard = new TextSprite(spriteBatch, new Vector2(445, 220), Content.Load<SpriteFont>("SpriteFont1"), "Hard", Color.Black);
            hard.Color = Color.Transparent;

            abe = new TextSprite(spriteBatch, new Vector2(525, 220), Content.Load<SpriteFont>("SpriteFont1"), "Abe", Color.Black);
            abe.Color = Color.Transparent;

            controls.Scale = new Vector2(0);
            Sprite controlsHighLite = new Sprite(Content.Load<Texture2D>("ControlsHighLite"), new Vector2(340, 150), null);
            controlsHighLite.Scale = new Vector2(0);
            font = Content.Load<SpriteFont>("SpriteFont1");
            location = new Vector2();
            spriteManager = new SpriteManager(spriteBatch, /*0*/logo, /*1*/singleplayer, /*2*/singleplayerhighlite, /*3*/multiplayer, /*4*/multiplayerhighlite, /*5*/options, /*6*/optionsHighLite, /*7*/controls, /*8*/controlsHighLite);

            multiplayer.Updated += new EventHandler(multiplayer_Updated);
            singleplayer.Updated += new EventHandler(singleplayer_Updated);
            options.Updated += new EventHandler(options_Updated);
            controls.Updated += new EventHandler(controls_Updated);
            easy.Updated += new EventHandler(easy_Updated);
            stan.Updated += new EventHandler(stan_Updated);
            medium.Updated += new EventHandler(medium_Updated);
            hard.Updated += new EventHandler(hard_Updated);
            abe.Updated += new EventHandler(abe_Updated);
        }
Пример #31
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            arrows = new SpriteManager(spriteBatch);
            ts = new TextSprite(spriteBatch, new Vector2(12), Content.Load<SpriteFont>("ScaleFont"), "Current Scale: 1\r\n(Use arrow keys to adjust)", Color.Black);
            arrows.AddNewSprite(new Vector2(75), Content.Load<Texture2D>("arrowincircle"));
            arrows[0].Updated += new EventHandler(arrow_Updated);
            arrows[0].Rotation = new SpriteRotation(90);
            arrows[0].UseCenterAsOrigin = true;
            //arrows[0].Center = new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
            //Enable drag-n-drop support

            System.Windows.Forms.Form underlyingForm = (System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(Window.Handle);
            underlyingForm.AllowDrop = true;
            underlyingForm.DragEnter += new System.Windows.Forms.DragEventHandler(underlyingForm_DragEnter);
            underlyingForm.DragDrop += new System.Windows.Forms.DragEventHandler(underlyingForm_DragDrop);
            //base.Initialize();
            InitializeComponent(ref underlyingForm);
            IsMouseVisible = true;
        }