コード例 #1
0
ファイル: MainMenu.cs プロジェクト: BeauPrime/Networking
        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);
        }
コード例 #2
0
ファイル: EndMenu.cs プロジェクト: BeauPrime/Networking
        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;
        }
コード例 #3
0
ファイル: GameIntro.cs プロジェクト: BeauPrime/Networking
        public GameIntro()
        {
            Depth = 95;

            #if XBOX
            flyText = new Text(TestProject.Assets.GetFont("MenuFont"), "[A] Fly", Vector2.Zero);
            shootText = new Text(TestProject.Assets.GetFont("MenuFont"), "[X] Toss Bomb", Vector2.UnitY * (flyText.Height + 20f));
            #else
            flyText = new Text(TestProject.Assets.GetFont("MenuFont"), "[Space] Fly", Vector2.Zero);
            shootText = new Text(TestProject.Assets.GetFont("MenuFont"), "[X] Toss Bomb", Vector2.UnitY * (flyText.Height + 20f));
            #endif

            Add(flyText, shootText);
        }
コード例 #4
0
ファイル: CreateMenu.cs プロジェクト: BeauPrime/Networking
        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();
        }
コード例 #5
0
ファイル: LobbyMenu.cs プロジェクト: BeauPrime/Networking
        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;
        }