示例#1
0
        public override bool OnPlayerInput(int playerIndex, DDW.Input.Move move, TimeSpan time)
        {
            bool result = base.OnPlayerInput(playerIndex, move, time);

            if (result && isActive)            // && !Guide.IsVisible)
            {
                if (move == Move.Up)
                {
                    PreviousFocus();
                }
                else if (move == Move.Down)
                {
                    NextFocus();
                }
                else if (focusIndex > -1 && move == Move.ButtonA)
                {
                    selectionDown = true;
                    element[focusIndex].Press();
                }
                else if (move == Move.Empty)
                {
                    element[focusIndex].Release();
                    if (selectionDown && OnClick != null)
                    {
                        OnClick(element[focusIndex], playerIndex, time);
                    }
                    selectionDown = false;
                }
            }
            return(result);
        }
 public override bool OnPlayerInput(int playerIndex, Move move, TimeSpan time)
 {
     bool result = base.OnPlayerInput(playerIndex, move, time);
     if (result && move == Move.ButtonA)
     {
         ((StartScreen)parent).SetPanel(MenuState.QuickGame, playerIndex);
     }
     return result;
 }
示例#3
0
文件: Panel.cs 项目: Hamsand/Swf2XNA
 public override bool OnPlayerInput(int playerIndex, Move move, TimeSpan time)
 {
     bool result = true;
     if (isActive)
     {
         result = base.OnPlayerInput(playerIndex, move, time);
     }
     return result;
 }
 public override bool OnPlayerInput(int playerIndex, Move move, TimeSpan time)
 {
     if (curState != MenuState.MainMenu && move == Move.ButtonB)
     {
         SetPanel(MenuState.MainMenu);
     }
     else
     {
         panelStack.Peek().OnPlayerInput(playerIndex, move, time);
     }
     return false;
 }
        public override bool OnPlayerInput(int playerIndex, DDW.Input.Move move, TimeSpan time)
        {
            bool result = base.OnPlayerInput(playerIndex, move, time);

            if (result && isActive)
            {
                if (move == Move.ButtonA)
                {
                    bool needsSignIn = false;
#if XBOX
                    //needsSignIn = playerIndex >= SignedInGamer.SignedInGamers.Count || SignedInGamer.SignedInGamers[playerIndex] == null;
                    //if (needsSignIn)
                    //{
                    //    ShowSignIn();
                    //}
#endif
                    InputManager im = screen.inputManagers[playerIndex];
                    playerIndicatorLights.piLight[playerIndex].GotoAndStop(1);

                    if (!needsSignIn)
                    {
                        result = false;
                        if (im.PlayerJoinState == PlayerJoinState.NotJoined)
                        {
                            im.PlayerJoinState = PlayerJoinState.Joined;
                            needsUpdate        = true;
                        }
                        else
                        {
                            ((StartScreen)parent).SetPanel(MenuState.MainMenu, playerIndex);
                        }
                    }
                }
                else if (move == Move.ButtonB || ((int)move.Releases & (int)Microsoft.Xna.Framework.Input.Buttons.B) > 0)
                {
                    result = false;
                    playerIndicatorLights.piLight[playerIndex].GotoAndStop(0);
                    if (screen.inputManagers[playerIndex].PlayerJoinState > PlayerJoinState.NotJoined)
                    {
                        screen.inputManagers[playerIndex].PlayerJoinState = PlayerJoinState.NotJoined;
                        needsUpdate = true;
                    }
                }
                if (move == Move.ButtonX)
                {
                    ShowSignIn();
                }
            }
            return(result);
        }
示例#6
0
        public override bool OnPlayerInput(int playerIndex, DDW.Input.Move move, TimeSpan time)
        {
            bool result = base.OnPlayerInput(playerIndex, move, time);

            if (result && isActive)
            {
                if (move == Move.Start)
                {
                    Unpause(this, null);
                    result = false;
                }
            }
            return(result);
        }
        public override bool OnPlayerInput(int playerIndex, DDW.Input.Move move, TimeSpan time)
        {
            bool result = base.OnPlayerInput(playerIndex, move, time);

            if (result && isActive && Visible)
            {
                if ((move.Releases & Buttons.A) != 0)
                {
                    if (delayTime > 2000)
                    {
                        Continue(this, null);
                        result = false;
                    }
                    else
                    {
                        canAdvance = true;
                    }
                }
            }
            return(result);
        }
        public override bool OnPlayerInput(int playerIndex, Move move, TimeSpan time)
        {
            //base.OnPlayerInput(playerIndex, move, time);

            if (!Guide.IsVisible)
            {
                if (curState != MenuState.MainMenu && move == Move.ButtonB)
                {
                    if (curState != MenuState.Begin)
                    {
                        SetPanel(MenuState.MainMenu, playerIndex);
                        stage.audio.PlaySound(Sfx.closePanel);
                    }
                    else
                    {
                        if (panelStack.Count > 0)
                        {
                            panelStack.Peek().OnPlayerInput(playerIndex, move, time);
                        }
                    }
                }
                else if (curState == MenuState.MainMenu && move == Move.ButtonB)
                {
                    SetPanel(MenuState.Begin, playerIndex);
                    stage.audio.PlaySound(Sfx.closePanel);
                }
                else
                {
                    if (panelStack.Count > 0)
                    {
                        panelStack.Peek().OnPlayerInput(playerIndex, move, time);
                    }
                }
            }
            return true;
        }
示例#9
0
文件: Screen.cs 项目: Hamsand/Swf2XNA
 public virtual void BroadcastMove(int playerIndex, Move move, TimeSpan time)
 {
 }
示例#10
0
文件: Screen.cs 项目: Hamsand/Swf2XNA
        protected void ManageInput(GameTime gameTime)
        {
            if (inputManagers != null)
            {
                InputManager.Update();
                for (int i = 0; i < inputManagers.Length; ++i)
                {
                    if (inputManagers[i] != null)
                    {
                        InputManager inputManager = inputManagers[i];

                        // Expire old moves.
                        if (gameTime.TotalGameTime - playerMoveTimes[i] > MoveTimeOut)
                        {
                            playerMoves[i] = null;
                        }

                        // Get the updated input manager.
                        inputManager.Update(gameTime);

                        // Detection and record the current player's most recent move.
                        Move newMove = moveList.DetectMove(inputManager);
                        if (inputManager.Releases != 0)
                        {
                            //Move m = moveList.MatchButtons(new Buttons[]{inputManager.Releases});
                            newMove = new Move("");
                            newMove.Releases = inputManager.Releases;
                        }

                        if (newMove != null)
                        {
                            playerMoves[i] = newMove;
                            playerMoveTimes[i] = gameTime.TotalGameTime;
                            OnPlayerInput(i, playerMoves[i], playerMoveTimes[i]);
            #if !(WINDOWS_PHONE)
                            BroadcastMove(i, playerMoves[i], playerMoveTimes[i]);
            #endif
                        }
                    }
                }
            }
        }
示例#11
0
        /// <summary>
        /// Determines if a move matches the current input history. Unless the move is
        /// a sub-move, the history is "consumed" to prevent it from matching twice.
        /// </summary>
        /// <returns>True if the move matches the input history.</returns>
        public bool Matches(Move move)
        {
            // If the move is longer than the buffer, it can't possibly match.
            if (Buffer.Count < move.Sequence.Length)
                return false;

            // Loop backwards to match against the most recent input.
            for (int i = 1; i <= move.Sequence.Length; ++i)
            {
                if (Buffer[Buffer.Count - i] != move.Sequence[move.Sequence.Length - i])
                {
                    return false;
                }
            }

            // Rnless this move is a component of a larger sequence,
            if (!move.IsSubMove)
            {
                // consume the used inputs.
                Buffer.Clear();
            }

            return true;
        }
示例#12
0
 /// <summary>
 /// The input into this element, based on settings and inputManager.
 /// </summary>
 /// <param name="playerIndex">PlayerInput based on controller.</param>
 /// <param name="move">The Move the user made.</param>
 /// <param name="time">Time of input.</param>
 /// <returns>Returns true if the event should bubble, false is the move should be consumed.</returns>
 public virtual bool OnPlayerInput(int playerIndex, Move move, TimeSpan time)
 {
     return true;
 }
示例#13
0
        public override bool OnPlayerInput(int playerIndex, Move move, TimeSpan time)
        {
            if (move == Move.ButtonA)
            {
                SleepwalkerGame.activeController = (PlayerIndex)playerIndex;
            }

            if (curState != MenuState.MainMenu && move == Move.ButtonB)
            {
                SetPanel(MenuState.MainMenu);
                if (stage != null)
                {
                    stage.audio.PlaySound(Sfx.menuBack);
                }
            }
            else
            {
                panelStack.Peek().OnPlayerInput(playerIndex, move, time);
                if (stage != null)
                {
                    stage.audio.PlaySound(Sfx.menuForward);
                }
            }
            return false;
        }
示例#14
0
        public override bool OnPlayerInput(int playerIndex, Move move, TimeSpan time)
        {
            bool result = base.OnPlayerInput(playerIndex, move, time);

            if (result && players[playerIndex] != null)
            {
                SmuckPlayer pl = players[playerIndex];
                if (move == Move.Start)
                {
                    PauseAllVehicleSounds();
                    gameOverlay.PauseGame();
                }
                else if (gameOverlay.hasActivePanel)
                {
                    gameOverlay.OnPlayerInput(playerIndex, move, time);
                }
                else if (move == Move.ButtonA && !CheckRoundOver())
                {
                    if (pl == null || (pl != null && pl.LivingState == LivingState.Dead))
                    {
                        InputManager im = inputManagers[playerIndex];
                        CreatePlayer(playerIndex);
                    }
                }
                else if (move == Move.ButtonY && !isLevelOver && pl.LivingState == LivingState.Alive)
                {
                    if (rnd.Next(5) == 0)
                    {
                        Cue c = stage.audio.PlaySound(Sfx.screamTaz, onTazFinished);
                        pl.isExploding = true;
                        KillPlayer(pl);
                    }
                    else
                    {
                        stage.audio.PlaySound(Sfx.scream);
                    }
                }
                //else if (move == Move.ButtonA)
                //{
                //    if (pl != null)
                //    {
                //        pl.Jump();
                //    }
                //}
                //else if (move == Move.ButtonY)
                //{
                //   pl.CreateFlameEffect();
                //}
            }
            else
            {
                // new player joining
                if (move == Move.ButtonA)
                {
                    InputManager im = inputManagers[playerIndex];
                    im.PlayerJoinState = PlayerJoinState.Joined;
                    CreatePlayer(playerIndex);
                }
            }
            return result;
        }
示例#15
0
 public override void BroadcastMove(int playerIndex, Move move, TimeSpan time)
 {
 }