Example #1
0
        public void Update(GameEngine gameEngine, GameTime gameTime)
        {
            if (IsTransitioning)
            {
                return;
            }
            MouseState = Mouse.GetState();

            /*** Update Components ***/
            // Notebook sections (Constant)
            PeopleTab.Update();
            OptionsTab.Update();
            StatsTab.Update();
            TestimonyTab.Update();

            // Tab-specific components (Variable)
            MainOptionsList?.Update();
            TopicOptionsList?.Update();
            QuitButton?.Update();
            SaveButton?.Update();
            SelectTestimonyButton?.Update();
            ConfirmQuitMenu?.Update(gameTime);
            ConfirmContradictMenu?.Update(gameTime);

            if (PrevMouseState.LeftButton == ButtonState.Pressed && MouseState.LeftButton == ButtonState.Released)
            {
                MouseClicked(MouseState);
            }

            if (GState == NotebookState.Returning)
            {
                gameEngine.Pop(true, true);
                IsTransitioning = true;
            }

            if (GState == NotebookState.ConfirmedQuitGame)
            {
                gameEngine.PopAll(true, true);
                IsTransitioning = true;
            }

            PrevMouseState = MouseState;
        }
Example #2
0
        public void Update(GameEngine gameEngine, GameTime gameTime)
        {
            if (IsTransitioning)
            {
                return;
            }

            // Update Dynamic Components
            PeopleList?.Update();
            ActivitiesList?.Update();

            MouseState = Mouse.GetState();
            if (PrevMouseState.LeftButton == ButtonState.Pressed && MouseState.LeftButton == ButtonState.Released)
            {
                MouseClicked(MouseState.X, MouseState.Y);
            }

            switch (GState)
            {
            case CalendarState.NextDay:
                if (Calendar.IsMoving())
                {
                    Calendar.Update(gameTime);
                }
                else if (Calendar.DayIndex < 5)
                {
                    GState = CalendarState.ActivityChoice;
                }
                else
                {
                    GState = CalendarState.ToWeekend;
                }
                // update position of box
                break;

            case CalendarState.ToWeekend:
                gameEngine.Push(new MapManager(), true, true);
                MainCharacter.ToWeekend();
                IsTransitioning = true;
                break;

            case CalendarState.ToNotebook:
                int[] Null = new int[] { -1 };
                gameEngine.Push(new NotebookManager(false, ref Null), true, true);
                IsTransitioning = true;
                break;

            case CalendarState.ConfirmActivity:
                ConfirmButton?.Update();
                if (PeopleList?.SelectedOption == null || ActivitiesList?.SelectedOption == null)
                {
                    GState = CalendarState.ActivityChoice;
                }
                break;

            case CalendarState.ActivityChoice:
                if (PeopleList?.SelectedOption != null && ActivitiesList?.SelectedOption != null)
                {
                    GState        = CalendarState.ConfirmActivity;
                    ConfirmButton = new Button("Go!", JustBreathe,
                                               new Vector2(ActivityRect.X + ActivityRect.Width / 2,
                                                           ActivityRect.Y + ActivityRect.Height - 50));
                }
                break;

            default:
                break;
            }
            PrevMouseState = MouseState;
        }