Пример #1
0
        private void HandleSplits()
        {
            bool   shouldSplit = false;
            string nextScene   = mem.NextSceneName();
            string sceneName   = mem.SceneName();

            if (currentSplit == -1)
            {
                shouldSplit = (nextScene.Equals("Tutorial_01", StringComparison.OrdinalIgnoreCase) && mem.GameState() == GameState.ENTERING_LEVEL) || nextScene == "GG_Vengefly_V" || nextScene == "GG_Boss_Door_Entrance";
            }
            else if (Model.CurrentState.CurrentPhase == TimerPhase.Running && settings.Splits.Count > 0)
            {
                GameState gameState  = mem.GameState();
                SplitName finalSplit = settings.Splits[settings.Splits.Count - 1];

                if (currentSplit + 1 < Model.CurrentState.Run.Count || (currentSplit + 1 == Model.CurrentState.Run.Count && (finalSplit == SplitName.ElderbugFlower || finalSplit == SplitName.ZoteKilled || finalSplit == SplitName.HuskMiner || finalSplit == SplitName.KingsPass || finalSplit == SplitName.GreatHopper || finalSplit == SplitName.PathOfPain)))
                {
                    if (!settings.Ordered)
                    {
                        foreach (SplitName split in settings.Splits)
                        {
                            if (splitsDone.Contains(split) || gameState != GameState.PLAYING)
                            {
                                continue;
                            }

                            shouldSplit = CheckSplit(split, nextScene, sceneName);

                            if (shouldSplit)
                            {
                                splitsDone.Add(split);
                                break;
                            }
                        }
                    }
                    else if (currentSplit < settings.Splits.Count)
                    {
                        SplitName split = settings.Splits[currentSplit];
                        shouldSplit = CheckSplit(split, nextScene, sceneName);
                    }
                }
                else
                {
                    shouldSplit = nextScene.StartsWith("Cinematic_Ending", StringComparison.OrdinalIgnoreCase) || nextScene == "GG_End_Sequence";
                }

                UIState uiState     = mem.UIState();
                bool    loadingMenu = (string.IsNullOrEmpty(nextScene) && sceneName != "Menu_Title") || (nextScene == "Menu_Title" && sceneName != "Menu_Title");
                if (gameState == GameState.PLAYING && lastGameState == GameState.MAIN_MENU)
                {
                    lookForTeleporting = true;
                }
                bool teleporting = mem.CameraTeleporting();
                if (lookForTeleporting && (teleporting || (gameState != GameState.PLAYING && gameState != GameState.ENTERING_LEVEL)))
                {
                    lookForTeleporting = false;
                }

                Model.CurrentState.IsGameTimePaused =
                    (gameState == GameState.PLAYING && teleporting && !mem.HazardRespawning()) ||
                    lookForTeleporting ||
                    ((gameState == GameState.PLAYING || gameState == GameState.ENTERING_LEVEL) && uiState != UIState.PLAYING) ||
                    (gameState != GameState.PLAYING && !mem.AcceptingInput()) ||
                    gameState == GameState.EXITING_LEVEL ||
                    gameState == GameState.LOADING ||
                    mem.HeroTransitionState() == HeroTransitionState.WAITING_TO_ENTER_LEVEL ||
                    (uiState != UIState.PLAYING &&
                     (uiState != UIState.PAUSED || loadingMenu) &&
                     (!string.IsNullOrEmpty(nextScene) || sceneName == "_test_charms" || loadingMenu) &&
                     nextScene != sceneName) ||
                    (nextScene != sceneName && mem.TileMapDirty() && !mem.UsesSceneTransitionRoutine());

                lastGameState = gameState;
            }

            HandleSplit(shouldSplit);
        }