Exemplo n.º 1
0
        /****
        ** Methods
        ****/
        /// <summary>Skip the intro if the game is ready.</summary>
        /// <param name="menu">The title menu whose intro to skip.</param>
        /// <returns>Returns whether the intro was skipped successfully.</returns>
        private bool TrySkipIntro(TitleMenu menu)
        {
            // wait until the game is ready
            if (Game1.currentGameTime == null)
            {
                return(false);
            }

            // skip to title screen
            menu.receiveKeyPress(Keys.Escape);
            menu.update(Game1.currentGameTime);

            // skip button transition
            if (!this.Config.SkipToLoadScreen)
            {
                while (this.Helper.Reflection.GetPrivateValue <int>(menu, "buttonsToShow") < TitleMenu.numberOfButtons)
                {
                    menu.update(Game1.currentGameTime);
                }
            }

            // skip to load screen
            if (this.Config.SkipToLoadScreen)
            {
                menu.performButtonAction("Load");
                while (TitleMenu.subMenu == null)
                {
                    menu.update(Game1.currentGameTime);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        /****
        ** Methods
        ****/
        /// <summary>Skip the intro if the game is ready.</summary>
        /// <param name="menu">The title menu whose intro to skip.</param>
        /// <returns>Returns whether the intro was skipped successfully.</returns>
        private bool TrySkipIntro(TitleMenu menu)
        {
            // wait until the game is ready
            if (Game1.currentGameTime == null)
            {
                return(false);
            }

            // skip to title screen
            menu.receiveKeyPress(Keys.Escape);
            menu.update(Game1.currentGameTime);

            // skip to other screen
            switch (this.Config.SkipTo)
            {
            case Screen.Title:
                // skip button transition
                while (this.Helper.Reflection.GetField <int>(menu, "buttonsToShow").GetValue() < TitleMenu.numberOfButtons)
                {
                    menu.update(Game1.currentGameTime);
                }
                break;

            case Screen.Load:
                // skip to load screen
                menu.performButtonAction("Load");
                while (TitleMenu.subMenu == null)
                {
                    menu.update(Game1.currentGameTime);
                }
                break;

            case Screen.JoinCoop:
            case Screen.HostCoop:
                // skip to co-op screen
                menu.performButtonAction("Co-op");
                while (TitleMenu.subMenu == null)
                {
                    menu.update(Game1.currentGameTime);
                }

                // skip to host tab
                if (this.Config.SkipTo == Screen.HostCoop && TitleMenu.subMenu is CoopMenu submenu)
                {
                    ClickableComponent hostTab = submenu.hostTab;
                    submenu.receiveLeftClick(hostTab.bounds.X, hostTab.bounds.Y, playSound: false);
                }
                break;
            }

            return(true);
        }
Exemplo n.º 3
0
        /****
        ** Methods
        ****/
        /// <summary>Apply the next skip step.</summary>
        /// <param name="menu">The title menu to update.</param>
        /// <param name="step">The step to apply (starting at 0).</param>
        /// <returns>Returns whether there are more skip steps.</returns>
        /// <remarks>The skip logic is applied over several update ticks to let the game update itself smoothly. This prevents a few issues like a long pause before the game window opens, or the title menu not resizing itself for full-screen display.</remarks>
        private bool ApplySkip(TitleMenu menu, int step)
        {
            switch (step)
            {
            // skip to main menu
            case 1:
                menu.receiveKeyPress(Keys.Escape);
                return(true);

            // skip to loading screen
            case 2:
                if (this.Config.SkipToLoadScreen)
                {
                    menu.performButtonAction("Load");
                }
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>Skip the intro if the game is ready.</summary>
        /// <param name="menu">The title menu whose intro to skip.</param>
        /// <param name="currentStage">The current step in the mod logic.</param>
        /// <returns>Returns the next step in the skip logic.</returns>
        private Stage Skip(TitleMenu menu, Stage currentStage)
        {
            // wait until the game is ready
            if (Game1.currentGameTime == null)
            {
                return(currentStage);
            }

            // do nothing if a confirmation box is on-screen (e.g. multiplayer disconnect error)
            if (TitleMenu.subMenu is ConfirmationDialog)
            {
                return(Stage.None);
            }

            // main skip logic
            if (currentStage == Stage.SkipIntro)
            {
                if (Constants.TargetPlatform == GamePlatform.Android)
                {
                    // skip to title screen
                    menu.skipToTitleButtons();

                    // skip button transition
                    while (this.Helper.Reflection.GetField <bool>(menu, "isTransitioningButtons").GetValue())
                    {
                        menu.update(Game1.currentGameTime);
                    }
                }
                else
                {
                    // skip to title screen
                    menu.receiveKeyPress(Keys.Escape);
                    menu.update(Game1.currentGameTime);

                    // skip button transition
                    while (this.Helper.Reflection.GetField <int>(menu, "buttonsToShow").GetValue() < TitleMenu.numberOfButtons)
                    {
                        menu.update(Game1.currentGameTime);
                    }
                }

                // skip to next screen
                switch (this.Config.SkipTo)
                {
                case Screen.Title:
                    return(Stage.None);

                case Screen.Load:
                    // skip to load screen
                    menu.performButtonAction("Load");
                    while (TitleMenu.subMenu == null)
                    {
                        menu.update(Game1.currentGameTime);
                    }
                    return(Stage.None);

                case Screen.JoinCoop:
                case Screen.HostCoop:
                    // skip to co-op screen
                    menu.performButtonAction("Co-op");
                    while (TitleMenu.subMenu == null)
                    {
                        menu.update(Game1.currentGameTime);
                    }

                    return(this.Config.SkipTo == Screen.JoinCoop
                            ? Stage.None
                            : Stage.WaitingForConnection);
                }
            }

            // skip to host tab after connection is established
            if (currentStage == Stage.WaitingForConnection)
            {
                // not applicable
                if (this.Config.SkipTo != Screen.HostCoop || !(TitleMenu.subMenu is CoopMenu submenu))
                {
                    return(Stage.None);
                }

                // not connected yet
                if (submenu.hostTab == null)
                {
                    return(currentStage);
                }

                // select host tab
                submenu.receiveLeftClick(submenu.hostTab.bounds.X, submenu.hostTab.bounds.Y, playSound: false);
            }

            // ???
            return(Stage.None);
        }