Пример #1
0
        private void SwitchToWaitingForCoordinatorMode()
        {
            if (Plugin.IsInMenu())
            {
                Match = null;

                //The results view and detail view aren't my own, they're the *real* views used in the
                //base game. As such, we should give them back them when we leave
                if (_resultsViewController.isInViewControllerHierarchy)
                {
                    _resultsViewController.GetField <Button>("_restartButton").gameObject.SetActive(true);
                    _menuLightsManager.SetColorPreset(_defaultLights, false);
                    DismissViewController(_resultsViewController, immediately: true);
                }

                if (_songDetail.isInViewControllerHierarchy)
                {
                    DismissViewController(_songDetail, immediately: true);
                }

                //Re-enable back button if it's disabled
                var screenSystem = this.GetField <ScreenSystem>("_screenSystem", typeof(FlowCoordinator));
                if (screenSystem != null)
                {
                    var backButton = screenSystem.GetField <Button>("_backButton");
                    if (!backButton.interactable)
                    {
                        backButton.interactable = true;
                    }
                }

                _splashScreen.StatusText = "Waiting for the coordinator to create your match...";
            }
        }
 private void resultsViewController_continueButtonPressedEvent(ResultsViewController results)
 {
     _resultsViewController.continueButtonPressedEvent -= resultsViewController_continueButtonPressedEvent;
     _menuLightsManager.SetColorPreset(_defaultLights, true);
     DismissViewController(_resultsViewController);
 }
Пример #3
0
        private void SongFinished(StandardLevelScenesTransitionSetupDataSO standardLevelScenesTransitionSetupData, LevelCompletionResults results)
        {
            standardLevelScenesTransitionSetupData.didFinishEvent -= SongFinished;

            var map          = _communityLeaderboard.selectedSong.Beatmap;
            var localPlayer  = _playerDataModel.playerData;
            var localResults = localPlayer.GetPlayerLevelStatsData(map.level.levelID, map.difficulty, map.parentDifficultyBeatmapSet.beatmapCharacteristic);
            var highScore    = localResults.highScore < results.modifiedScore;

            var scoreLights   = _soloFreePlayFlowCoordinator.GetField <MenuLightsPresetSO>("_resultsLightsPreset");
            var redLights     = _campaignFlowCoordinator.GetField <MenuLightsPresetSO>("_newObjectiveLightsPreset");
            var defaultLights = _soloFreePlayFlowCoordinator.GetField <MenuLightsPresetSO>("_defaultLightsPreset");

            if (results.levelEndAction == LevelCompletionResults.LevelEndAction.Restart)
            {
                PlaySong(_communityLeaderboard.selectedSong);
            }
            else
            {
                if (results.levelEndStateType == LevelCompletionResults.LevelEndStateType.Cleared) //Didn't quit and didn't die
                {
                    //If bs_utils disables score submission, we do too
                    if (BSUtilsScoreDisabled())
                    {
                        return;
                    }

                    IBeatmapLevel level    = _communityLeaderboard.selectedSong.Beatmap.level;
                    string        songHash = SongUtils.GetHashFromLevelId(level.levelID);

                    //Community leaderboards
                    var    song   = _communityLeaderboard.selectedSong;
                    string signed = RSA.SignScore(Plugin.UserId, song.Hash, (int)_communityLeaderboard.selectedSong.Beatmap.difficulty, _communityLeaderboard.selectedSong.Characteristic, results.fullCombo, results.rawScore, (int)song.PlayerOptions, (int)song.GameOptions);

                    Action <bool> scoreUpdateComplete = (b) =>
                    {
                        Logger.Success($"Score upload {(b ? "compete" : "failed")}!");
                        if (b && _communityLeaderboard)
                        {
                            UnityMainThreadDispatcher.Instance().Enqueue(() =>
                            {
                                _communityLeaderboard.Refresh();
                            });
                        }
                    };
                    Client.SubmitScore(Plugin.UserId, song.Hash, (int)_communityLeaderboard.selectedSong.Beatmap.difficulty, _communityLeaderboard.selectedSong.Characteristic, results.fullCombo, results.rawScore, signed, (int)song.PlayerOptions, (int)song.GameOptions, scoreUpdateComplete);

                    Action <ResultsViewController> resultsContinuePressed = null;
                    resultsContinuePressed = (e) =>
                    {
                        _resultsViewController.continueButtonPressedEvent -= resultsContinuePressed;
                        _menuLightsManager.SetColorPreset(defaultLights, true);
                        DismissViewController(_resultsViewController);
                    };

                    _menuLightsManager.SetColorPreset(scoreLights, true);
                    _resultsViewController.Init(results, map, false, highScore);
                    _resultsViewController.continueButtonPressedEvent += resultsContinuePressed;
                    PresentViewController(_resultsViewController, null, true);
                }
            }
        }
Пример #4
0
 public void SetColor(Color color)
 {
     defaultMenuLights = _menuLightsManager.GetField <MenuLightsPresetSO, MenuLightsManager>("_defaultPreset");
     _menuLightsManager?.SetColorPreset(CreateMenuLights(color), true);
     _menuLightsManager?.RefreshColors();
 }