コード例 #1
0
        public static void Update(GameTime gameTime, bool AllowJoining)
        {
            MessageAlpha -= gameTime.ElapsedGameTime.Milliseconds * 60.0f / 1000.0f * AlphaChange;

            if (AllowJoining)
            {
#if WINDOWS
                if (!KeyboardTaken && Keyboard.GetState().GetPressedKeys().Count() > 0)
                {
                    if (AddPlayer(new KeyboardController(), null, ControllerIndex.Keyboard) != null)
                    {
                        KeyboardTaken = true;
                    }
                }
#endif
                foreach (PlayerIndex i in FreePlayerIndecies)
                {
                    GamePadState g = GamePad.GetState(i);
                    if (g.IsConnected && XboxController.TestAny(g))
                    {
                        if (AddPlayer(new XboxController(i), null, Convert(i)) != null)
                        {
                            RemovePlayerIndecies.AddLast(i);
                        }
                    }
                }
                foreach (PlayerIndex i in RemovePlayerIndecies)
                {
                    FreePlayerIndecies.Remove(i);
                }
                RemovePlayerIndecies.Clear();
            }
            else
            {
                /*
                 #if WINDOWS
                 * if (!KeyboardTaken && Keyboard.GetState().GetPressedKeys().Count() > 0)
                 *  PlayerNoJoinMessage(ControllerIndex.Keyboard);
                 * else
                 *  foreach (PlayerIndex i in FreePlayerIndecies)
                 * {
                 *  GamePadState g = GamePad.GetState(i);
                 *  if (g.IsConnected && XboxController.TestAny(g))
                 *      PlayerNoJoinMessage(Convert(i));
                 * }
                 #endif
                 */
            }

            foreach (PlayerProfile p in Players)
            {
                p.MemberUpdate(gameTime);
            }
        }
コード例 #2
0
        private static void TestSignIn(object o, SignedInEventArgs e)
        {
            BasicController b = null;
            ControllerIndex c = ControllerIndex.Keyboard;

#if EDITOR && WINDOWS
            if (signInState == SignInState.Controller)
            {
#endif
            b = new XboxController(e.Gamer.PlayerIndex);
            c = Convert(e.Gamer.PlayerIndex);
#if EDITOR && WINDOWS
        }

        else
        {
            b = new KeyboardController();
        }
#endif

            AddPlayer(b, e.Gamer, c);
        }