コード例 #1
0
        public override void Update(GameTime gameTime)
        {
            if (MenuIndex == 1 && TheLastSliceGame.InputManager.IsInputPressed(Keys.Up))
            {
                MenuIndex           = 0;
                ArrowLeft.Position  = new Vector2(ArrowLeftX0, ArrowY0);
                ArrowRight.Position = new Vector2(ArrowRightX0, ArrowY0);
            }
            else if (MenuIndex == 0 && TheLastSliceGame.InputManager.IsInputPressed(Keys.Down))
            {
                MenuIndex           = 1;
                ArrowLeft.Position  = new Vector2(ArrowLeftX1, ArrowY1);
                ArrowRight.Position = new Vector2(ArrowRightX1, ArrowY1);
            }
            else if (TheLastSliceGame.InputManager.IsInputPressed(Keys.Enter))
            {
                if (MenuIndex == 0)
                {
                    TheLastSliceGame.Instance.ChangeState(GameState.NewGame);
                }
                else if (MenuIndex == 1)
                {
                    TheLastSliceGame.Instance.ChangeState(GameState.Menu, UIType.MainMenu);
                }
            }

            Frog.Update(gameTime);
            ArrowLeft.Update(gameTime);
            ArrowRight.Update(gameTime);
            Menu.Update(gameTime);
        }
コード例 #2
0
        public override void Update(GameTime gameTime)
        {
            //"Chief, let's see if we can find a way to open this door." - Cortana
            if (!HasInputScore)
            {
                if (TheLastSliceGame.Instance.IsUserLoggedIn() && !HasLoggedOut)
                {
                    TheLastSliceGame.Instance.GameService.Logout();
                    HasLoggedOut = true;
                }

                if (gameTime.TotalGameTime.TotalMilliseconds > CursorTimerMS.TotalMilliseconds)
                {
                    ShowCursor    = !ShowCursor;
                    CursorTimerMS = TimeSpan.FromMilliseconds(gameTime.TotalGameTime.TotalMilliseconds + 500);
                }

                if (!String.IsNullOrEmpty(Initials) && Initials.Count() <= 3 && TheLastSliceGame.InputManager.IsInputPressed(Keys.Back))
                {
                    Initials = Initials.Remove(Initials.Length - 1);
                }

                if (Initials.Count() < 3)
                {
                    Vector2 vector = Name.MeasureString(Initials);
                    foreach (Keys key in ValidKeys)
                    {
                        if (TheLastSliceGame.InputManager.IsInputPressed(key))
                        {
                            Initials += key.ToString();
                            break;
                        }
                    }
                }
                else
                {
                    if (CustomWinStrings.Count() == 0 && TheLastSliceGame.InputManager.IsInputPressed(Keys.Enter))
                    {
                        TheLastSliceGame.Instance.GameWinAsync();
                        HasInputScore = true;
                    }
                }
            }
            else
            {
                if (TheLastSliceGame.Instance.IsUserLoggedIn() && !Posted)
                {
                    TheLastSliceGame.Instance.PostScoreAsync(LastPlayerScore.ToString(), Initials);
                    Posted = true;
                    TheLastSliceGame.Instance.AppInsights.PostScoreSuccess();
                }
            }

            ArrowLeft.Update(gameTime);
            ArrowRight.Update(gameTime);
            Menu.Update(gameTime);
        }
コード例 #3
0
        public override void Update(GameTime time)
        {
            if (TheLastSliceGame.InputManager.IsInputPressed(Keys.Enter))
            {
                TheLastSliceGame.Instance.ChangeState(GameState.Menu, UIType.MainMenu);
            }

            SnakeInTheBox.Update(time);
            ArrowLeft.Update(time);
            ArrowRight.Update(time);
        }
コード例 #4
0
        public override void Update(GameTime time)
        {
            if (TransitionTimer != TimeSpan.Zero)
            {
                if (time.TotalGameTime.TotalMilliseconds > TransitionTimer.TotalMilliseconds)
                {
                    if (MenuIndex == 0)
                    {
                        TheLastSliceGame.Instance.ChangeState(GameState.NewGame);
                    }
                    else if (MenuIndex == 1)
                    {
                        TheLastSliceGame.Instance.ChangeState(GameState.Menu, UIType.Leaderboard);
                    }
                    TransitionTimer = TimeSpan.Zero;
                }
            }
            else
            {
                KeyboardState keyboardState = Keyboard.GetState();
                if (TheLastSliceGame.InputManager.IsInputPressed(Keys.Up))
                {
                    if (MenuIndex == 1)
                    {
                        MenuIndex           = 0;
                        ArrowLeft.Position  = new Vector2(ArrowLeftX0, ArrowY0);
                        ArrowRight.Position = new Vector2(ArrowRightX0, ArrowY0);
                    }
                    else if (MenuIndex == 2)
                    {
                        MenuIndex           = 1;
                        ArrowLeft.Position  = new Vector2(ArrowLeftX1, ArrowY1);
                        ArrowRight.Position = new Vector2(ArrowRightX1, ArrowY1);
                    }
                }
                else if (TheLastSliceGame.InputManager.IsInputPressed(Keys.Down))
                {
                    if (MenuIndex == 0)
                    {
                        MenuIndex           = 1;
                        ArrowLeft.Position  = new Vector2(ArrowLeftX1, ArrowY1);
                        ArrowRight.Position = new Vector2(ArrowRightX1, ArrowY1);
                    }
                    else if (MenuIndex == 1)
                    {
                        MenuIndex           = 2;
                        ArrowLeft.Position  = new Vector2(ArrowLeftX2, ArrowY2);
                        ArrowRight.Position = new Vector2(ArrowRightX2, ArrowY2);
                    }
                }
                else if (TheLastSliceGame.InputManager.IsInputPressed(Keys.Enter))
                {
                    if (MenuIndex == 0)
                    {
                        TheLastSliceGame.Instance.PauseMusic();
                        StartGame.Play();
                        TransitionTimer = TimeSpan.FromMilliseconds(time.TotalGameTime.TotalMilliseconds + 3000);
                    }
                    else if (MenuIndex == 1)
                    {
                        TheLastSliceGame.Instance.PauseMusic();
                        Leaderboard.Play();
                        TransitionTimer = TimeSpan.FromMilliseconds(time.TotalGameTime.TotalMilliseconds + 3000);
                    }
                    else if (MenuIndex == 2)
                    {
                        Application.Current.Exit();
                    }
                }
            }

            ArrowLeft.Update(time);
            ArrowRight.Update(time);
            Menu.Update(time);
        }