Ejemplo n.º 1
0
        public EndMenu()
        {
            session = Network.ActiveSession;

            quitBinding = new InputBinding();
            quitBinding.Add(Keys.Escape).Add(Buttons.Back).DefineGamePadIndex(0)
                .DefineInputType(InputType.Pressed);

            titleText = new Text(TestProject.Assets.GetFont("TitleFont"), "Game Over", new Vector2(Engine.Instance.Screen.Width / 2, 5), AlignX.Center, AlignY.Top);
            Add(titleText);

            subtitleText = new Text(TestProject.Assets.GetFont("MenuFont"), "Let's look at some results...", titleText.Position + new Vector2(0, titleText.Height + 5), AlignX.Center, AlignY.Top);
            Add(subtitleText);

            errorText = new Text(TestProject.Assets.GetFont("MenuFont"), "", subtitleText.Position + new Vector2(0, subtitleText.Height + 16), AlignX.Center, AlignY.Top);
            Add(errorText);
            errorText.Color = Color.Red;
            errorText.Alpha = 0;

            myGamer = Network.FirstLocalGamer;

            if (Network.ActiveSession.Winners.Count > 0)
                subtitleText.DrawText = String.Format(winString, Network.ActiveSession.Winners[0].GamerTag);
            else
                subtitleText.DrawText = tieString;
        }
Ejemplo n.º 2
0
        public MainMenu()
        {
            quitBinding = new InputBinding();
            quitBinding.Add(Keys.Escape).Add(Buttons.Back).DefineGamePadIndex(0)
                .DefineInputType(InputType.Pressed);

            upBinding = new InputBinding();
            upBinding.Add(Keys.Up, Keys.W).Add(Buttons.DPadUp, Buttons.LeftThumbstickUp)
                .DefineGamePadIndex(0).DefineInputType(InputType.Pressed);

            downBinding = new InputBinding();
            downBinding.Add(Keys.Down, Keys.S).Add(Buttons.DPadDown, Buttons.LeftThumbstickDown)
                .DefineGamePadIndex(0).DefineInputType(InputType.Pressed);

            selectBinding = new InputBinding();
            selectBinding.Add(Keys.Enter, Keys.Space).Add(Buttons.A).DefineGamePadIndex(0)
                .DefineInputType(InputType.Pressed);

            titleText = new Text(TestProject.Assets.GetFont("TitleFont"), "Forward Explosion Run", new Vector2(Engine.Instance.Screen.Width / 2, 5), AlignX.Center, AlignY.Top);
            Add(titleText);

            subtitleText = new Text(TestProject.Assets.GetFont("MenuFont"), "A Networked game by Alex Beauchesne", titleText.Position + new Vector2(0, titleText.Height + 5), AlignX.Center, AlignY.Top);
            Add(subtitleText);

            var instructionsText = new Text(TestProject.Assets.GetFont("MenuFont"), "[Arrow Keys] Choose\n[Space] Select\n[Escape] Quit", new Vector2(Engine.Instance.Screen.Width - 5, 120), AlignX.Right);
            Add(instructionsText);
        }
Ejemplo n.º 3
0
 public AxisBinding()
 {
     Left = new InputBinding();
     Right = new InputBinding();
     Up = new InputBinding();
     Down = new InputBinding();
 }
Ejemplo n.º 4
0
        public CreateMenu()
        {
            quitBinding = new InputBinding();
            quitBinding.Add(Keys.Escape).Add(Buttons.Back).DefineGamePadIndex(0)
                .DefineInputType(InputType.Pressed);

            upBinding = new InputBinding();
            upBinding.Add(Keys.Up, Keys.W).Add(Buttons.DPadUp, Buttons.LeftThumbstickUp)
                .DefineGamePadIndex(0).DefineInputType(InputType.Pressed);

            downBinding = new InputBinding();
            downBinding.Add(Keys.Down, Keys.S).Add(Buttons.DPadDown, Buttons.LeftThumbstickDown)
                .DefineGamePadIndex(0).DefineInputType(InputType.Pressed);

            selectBinding = new InputBinding();
            selectBinding.Add(Keys.Enter, Keys.Space).Add(Buttons.A).DefineGamePadIndex(0)
                .DefineInputType(InputType.Pressed);

            titleText = new Text(TestProject.Assets.GetFont("TitleFont"), "Create New Session", new Vector2(Engine.Instance.Screen.Width / 2, 5), AlignX.Center, AlignY.Top);
            Add(titleText);

            subtitleText = new Text(TestProject.Assets.GetFont("MenuFont"), "Start your own multiplayer session.", titleText.Position + new Vector2(0, titleText.Height + 5), AlignX.Center, AlignY.Top);
            Add(subtitleText);

            errorText = new Text(TestProject.Assets.GetFont("MenuFont"), "", subtitleText.Position + new Vector2(0, subtitleText.Height + 16), AlignX.Center, AlignY.Top);
            Add(errorText);
            errorText.Color = Color.Red;
            errorText.Alpha = 0;

            var instructionsText = new Text(TestProject.Assets.GetFont("MenuFont"), "[Arrow Keys] Choose\n[Space] Select\n[Escape] Back", new Vector2(Engine.Instance.Screen.Width - 5, 120), AlignX.Right);
            Add(instructionsText);

            waitingSprite = new Sprite(TestProject.Assets.GetSprite("WaitSprite"));
            waitingSprite.Position = Engine.Instance.Screen.Center;
            waitingSprite.Y = errorText.Y + errorText.Height + 64;
            waitingSprite.Origin = waitingSprite.Center;
            waitingSprite.AnimationCollection.Add(0, TestProject.Assets.GetSpriteAnimation("WaitSprite", "Normal"));
            waitingSprite.Visible = false;
            Add(waitingSprite);

            UpdateProperties();
        }
Ejemplo n.º 5
0
        public GameSceneController()
        {
            Tag(TAG);

            switch (Network.ActiveSession[0].Value)
            {
                case 0:
                    MotionMultiplier = 0.75f;
                    break;
                case 1:
                    MotionMultiplier = 1.0f;
                    break;
                case 2:
                    MotionMultiplier = 1.4f;
                    break;
            }

            SideWallsEnabled = Network.ActiveSession[1] == 1;
            BombsAllowed = true;

            updateBombAlarm = new Alarm(AlarmMode.Loop, OnUpdateBombAlarm, 2, false);
            updateShipAlarm = new Alarm(AlarmMode.Loop, OnUpdateShipAlarm, 3, false);
            gameStartAlarm = new Alarm(AlarmMode.Single, OnGameStartAlarm, 30, true);
            gameEndAlarm = new Alarm(AlarmMode.Single, OnGameEndAlarm, 30, false);
            Add(updateBombAlarm, updateShipAlarm, gameStartAlarm, gameEndAlarm);

            Network.FirstLocalGamer.Actions = new Actions(this);

            bombSwitchBinding = new InputBinding();
            bombSwitchBinding.DefineGamePadIndex(0).DefineInputType(InputType.Pressed)
                .Add(Keys.B).Add(Buttons.LeftStick);

            quitBinding = new InputBinding();
            quitBinding.DefineGamePadIndex(0).DefineInputType(InputType.Pressed)
                .Add(Keys.Escape).Add(Buttons.Back);

            HookEvents();
        }
Ejemplo n.º 6
0
        public LobbyMenu()
        {
            session = Network.ActiveSession;

            quitBinding = new InputBinding();
            quitBinding.Add(Keys.Escape).Add(Buttons.Back).DefineGamePadIndex(0)
                .DefineInputType(InputType.Pressed);

            upBinding = new InputBinding();
            upBinding.Add(Keys.Up, Keys.W).Add(Buttons.DPadUp, Buttons.LeftThumbstickUp)
                .DefineGamePadIndex(0).DefineInputType(InputType.Pressed);

            downBinding = new InputBinding();
            downBinding.Add(Keys.Down, Keys.S).Add(Buttons.DPadDown, Buttons.LeftThumbstickDown)
                .DefineGamePadIndex(0).DefineInputType(InputType.Pressed);

            selectBinding = new InputBinding();
            selectBinding.Add(Keys.Enter, Keys.Space).Add(Buttons.A).DefineGamePadIndex(0)
                .DefineInputType(InputType.Pressed);

            titleText = new Text(TestProject.Assets.GetFont("TitleFont"), "Game Lobby", new Vector2(Engine.Instance.Screen.Width / 2, 5), AlignX.Center, AlignY.Top);
            Add(titleText);

            subtitleText = new Text(TestProject.Assets.GetFont("MenuFont"), "Join with others and play a multiplayer game.", titleText.Position + new Vector2(0, titleText.Height + 5), AlignX.Center, AlignY.Top);
            Add(subtitleText);

            errorText = new Text(TestProject.Assets.GetFont("MenuFont"), "", subtitleText.Position + new Vector2(0, subtitleText.Height + 16), AlignX.Center, AlignY.Top);
            Add(errorText);
            errorText.Color = Color.Red;
            errorText.Alpha = 0;

            var instructionsText = new Text(TestProject.Assets.GetFont("MenuFont"), "[Arrow Keys] Choose\n[Space] Select\n[Escape] Back", new Vector2(Engine.Instance.Screen.Width - 5, 120), AlignX.Right);
            Add(instructionsText);

            speed = session.SessionProperties[0].Value;
            map = session.SessionProperties[1].Value;
        }
Ejemplo n.º 7
0
        public override void SceneBegin()
        {
            base.SceneBegin();

            quitBinding = new InputBinding();
            quitBinding.DefineGamePadIndex(0).DefineInputType(InputType.Pressed)
                .Add(Keys.Escape, Keys.Q).Add(Buttons.Back);

            foreach (Gamer player in Network.ActiveSession.Gamers)
            {
                float percent = (float)(player.PlayerIndex + 1) / (Network.ActiveSession.NumGamers + 1);

                Ships.CreateObject(player,
                    (PlayerShip ship) =>
                    {
                        ship.Position = new Vector2(Calc.Lerp(128, Engine.Instance.Screen.Width - 128, percent), Calc.Lerp(80, Engine.Instance.Screen.Height - 80, percent));
                    });
            }
        }