Ejemplo n.º 1
0
        private void MouseClicked(MouseState mouseState)
        {
            Point     MouseClick     = new Point(mouseState.X, mouseState.Y);
            Rectangle MouseClickRect = new Rectangle(MouseClick, new Point(10, 10));

            switch (GState)
            {
            case NotebookState.SelectedTestimony:
                if (ConfirmContradictMenu.IsConfirming(MouseClickRect))
                {
                    GState = NotebookState.Returning;
                }
                if (ConfirmContradictMenu.IsCancelling(MouseClickRect))
                {
                    GState = NotebookState.Testimonies;
                }
                break;

            case NotebookState.ClickedQuitGame:
                if (ConfirmQuitMenu.IsConfirming(MouseClickRect))
                {
                    GState = NotebookState.ConfirmedQuitGame;
                }
                if (ConfirmQuitMenu.IsCancelling(MouseClickRect))
                {
                    GState = NotebookState.Options;     // replace with whichever state exposes the quit button
                }
                break;

            default:
                if (MouseClickRect.Intersects(StatsTab.Rect))
                {
                    GState           = NotebookState.Stats;
                    MainOptionsList  = null;
                    TopicOptionsList = null;
                }
                if (MouseClickRect.Intersects(PeopleTab.Rect))
                {
                    GState           = NotebookState.Profiles;
                    MainOptionsList  = null;
                    TopicOptionsList = null;
                }
                if (MouseClickRect.Intersects(OptionsTab.Rect))
                {
                    GState           = NotebookState.Options;
                    MainOptionsList  = null;
                    TopicOptionsList = null;
                }
                if (MouseClickRect.Intersects(TestimonyTab.Rect))
                {
                    GState           = NotebookState.Testimonies;
                    MainOptionsList  = null;
                    TopicOptionsList = null;
                }
                if (MouseClickRect.Intersects(ReturnIconRect))
                {
                    GState = NotebookState.Returning;
                }

                if (MainOptionsList?.SelectedOption == "savequit")
                {
                    if (QuitButton != null && MouseClickRect.Intersects(QuitButton.Rect))
                    {
                        GState = NotebookState.ClickedQuitGame;
                        string Query = "Are you sure you want to quit the game?";
                        ConfirmQuitMenu = new ConfirmMenu(Query, Content, Arial);
                    }
                    if (SaveButton != null && MouseClickRect.Intersects(SaveButton.Rect))
                    {
                        SaveGame();
                    }
                }

                if (SeekingTestimony && SelectTestimonyButton != null)
                {
                    if (MouseClickRect.Intersects(SelectTestimonyButton.Rect))
                    {
                        GState = NotebookState.SelectedTestimony;
                        string Query = "Are you sure you want to contradict?";
                        ConfirmContradictMenu = new ConfirmMenu(Query, Content, Arial);
                    }
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void MouseClicked(MouseState mouseState)
        {
            Point     MouseClick     = new Point(mouseState.X, mouseState.Y);
            Rectangle MouseClickRect = new Rectangle(MouseClick, new Point(10, 10));

            switch (GState)
            {
            // If nothing selected, check whether location was selected
            case LocationState.Normal:
                foreach (string CharName in CharPics.Keys)
                {
                    if (MouseClickRect.Intersects(CharPics[CharName].Rect))
                    {
                        GState             = LocationState.ClickedPerson;
                        SpeechMenu         = new SpeechMenu(Greetings[CharName], CharPics[CharName].Rect, Content, Arial);
                        SelectedPersonName = CharName;
                    }
                }
                if (MouseClickRect.Intersects(NotebookRect))
                {
                    GState = LocationState.ToNotebook;
                }
                if (MouseClickRect.Intersects(MapIconRect))
                {
                    GState = LocationState.ClickedReturn;
                    string query = "Are you sure you're done exploring for now?";
                    ConfirmMenu = new ConfirmMenu(query, Content, Arial);
                }
                break;

            case LocationState.ClickedPerson:
                if (SpeechMenu.IsCancelling(MouseClickRect))
                {
                    GState     = LocationState.Normal;
                    SpeechMenu = null;
                }
                else if (SpeechMenu.IsConfirming(MouseClickRect))
                {
                    GState = LocationState.ConfirmedPerson;
                    Interviewees.Add(SelectedPersonName);
                    SpeechMenu = null;
                }
                break;

            case LocationState.ClickedReturn:
                if (ConfirmMenu.IsCancelling(MouseClickRect))
                {
                    GState      = LocationState.Normal;
                    ConfirmMenu = null;
                }
                else if (ConfirmMenu.IsConfirming(MouseClickRect))
                {
                    GState      = LocationState.ConfirmedReturn;
                    ConfirmMenu = null;
                }
                break;

            default:
                break;
            }
        }