Exemplo n.º 1
0
        protected void update_message_skip_buttons()
        {
            _EventSkip = false;

            bool no_convo           = Message_Window == null || !Message_Window.active;
            bool skip_button_active = this.skip_convo_button_active;

            // Create buttons if needed
            if (SkipButton == null)
            {
                if (skip_button_active)
                {
                    create_convo_skip_buttons();
                    SkipButtonOffset    = new Vector2(0, 16);
                    SkipButtonsOnScreen = false;
                }
            }

            if (SkipButton != null)
            {
                // Bring buttons onscreen if needed
                if (!SkipButtonsOnScreen)
                {
                    SkipButtonOffset.Y = MathHelper.Min(16, SkipButtonOffset.Y + 2);
                    if (skip_button_active &&
                        Global.Input.gesture_triggered(TouchGestures.SwipeUp))
                    {
                        SkipButtonsOnScreen      = true;
                        TimeSinceSkipInteraction = 0;
                    }
                }
                // Move buttons offscreen if needed
                else if (SkipButtonsOnScreen)
                {
                    if (TimeSinceSkipInteraction < SKIP_INTERACTION_TIMEOUT)
                    {
                        TimeSinceSkipInteraction++;
                    }

                    SkipButtonOffset.Y = MathHelper.Max(0, SkipButtonOffset.Y - 2);
                    if (!skip_button_active ||
                        TimeSinceSkipInteraction >= SKIP_INTERACTION_TIMEOUT ||
                        (skip_button_active &&
                         Global.Input.gesture_triggered(TouchGestures.SwipeDown)))
                    {
                        SkipButtonsOnScreen = false;
                    }
                }

                skip_button_active &= SkipButtonsOnScreen && SkipButtonOffset.Y == 0;

                TextSkips skip = TextSkips.None;

                if (Input.ControlSchemeSwitched ||
                    (has_convo_scene_button && SceneButton == null))
                {
                    create_convo_skip_buttons();
                }
                if (SceneButton != null && !has_convo_scene_button)
                {
                    SceneButton = null;
                }

                // Update scene button and consume inputs
                if (SceneButton != null)
                {
                    SceneButton.Update(skip_button_active && !no_convo,
                                       -SkipButtonOffset);
                    if (no_convo)
                    {
                        SceneButton.tint = new Color(128, 128, 128, 255);
                    }
                    if (SceneButton.consume_trigger(MouseButtons.Left) ||
                        SceneButton.consume_trigger(TouchGestures.Tap))
                    {
                        skip = TextSkips.NextScene;
                        TimeSinceSkipInteraction = SKIP_INTERACTION_TIMEOUT - 60;
                    }
                }

                // Update skip button and consume inputs
                SkipButton.Update(skip_button_active, -SkipButtonOffset);
                if (SkipButton.consume_trigger(MouseButtons.Left) ||
                    SkipButton.consume_trigger(TouchGestures.Tap))
                {
                    skip = TextSkips.SkipEvent;
                    TimeSinceSkipInteraction = 0;
                }

                if (!no_convo)
                {
                    Message_Window.ConvoSkip = skip;
                }
                else if (skip == TextSkips.SkipEvent)
                {
                    _EventSkip = true;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update the elements of the scene that respond to input from the user.
        /// </summary>
        public override void Update()
        {
            base.Update();

            // Update the buttons.
            ChooseFolderButton.Update();
            AcceptButton.Update();
            DenyButton.Update();

            // Scroll the background back and forth.
            backgroundOffset += 0.2 * Math.Sin(LocalTime / 5000);

            // If we've already selected a folder (i.e. the user pressed okay in the dialog box)
            if (currentState == SceneStates.AfterFolderChosen)
            {
                // If the user denied the path they selected.
                if (DenyButton.IsClicked())
                {
                    chosenPath = null;

                    currentState = SceneStates.BeforeFolderChosen;
                    AcceptButton.FadeOut();
                    DenyButton.FadeOut();
                }
                // If the user accepted the path they selected.
                else if (AcceptButton.IsClicked())
                {
                    Options.SongFolder = chosenPath;
                    new UserInfoLoader().Write();

                    AcceptButton.FadeOut();
                    DenyButton.FadeOut();

                    // Transition to the main menu.
                    manager.AlmostCurrentScenes.Add("Background");
                    manager.AlmostCurrentScenes.Add("Main Menu");
                    manager.FocusOn("Main Menu");
                    manager.transitioningScenes = true;

                    // Organize the songs folder.
                    SongFolderOrganizer.Organize();
                }
            }

            // If the user presses the Choose Folder button and they haven't already chosen a folder.
            if (currentState == SceneStates.BeforeFolderChosen && ChooseFolderButton.Collide(Globals.currentMouseState.Position) &&
                Globals.currentMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed && // Freakin name collisions
                Globals.previousMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
            {
                var dialog = new FolderBrowserDialog();
                dialog.Description = "Choose a Song Folder for Phosphaze";

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    chosenPath = dialog.SelectedPath;

                    currentState = SceneStates.AfterFolderChosen;
                    AcceptButton.FadeIn();
                    DenyButton.FadeIn();
                }
            }
        }