Ejemplo n.º 1
0
        public void GetControllers()
        {
            scoreController = Resources.FindObjectsOfTypeAll <ScoreController>().FirstOrDefault();
            energyCounter   = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().FirstOrDefault();
            rankCounter     = Resources.FindObjectsOfTypeAll <RelativeScoreAndImmediateRankCounter>().FirstOrDefault();
            endActions      = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault();
            if (endActions == null)
            {
                endActions = Resources.FindObjectsOfTypeAll <MissionLevelGameplayManager>().FirstOrDefault();
            }

            if (scoreController != null && energyCounter != null && rankCounter != null && endActions != null)
            {
                scoreController.noteWasCutEvent    += NoteHit;
                scoreController.noteWasMissedEvent += NoteMiss;
                endActions.levelFinishedEvent      += LevelFinished;
                endActions.levelFailedEvent        += LevelFinished;
                Logger.log.Debug("PerformanceMeter reloaded successfully");
            }
            else
            {
                Logger.log.Error("Could not reload PerformanceMeter");
                scoreController = null;
                energyCounter   = null;
                rankCounter     = null;
                endActions      = null;
            }
        }
Ejemplo n.º 2
0
        static bool Prefix(ref ImmediateRankUIPanel __instance, ref RelativeScoreAndImmediateRankCounter ____relativeScoreAndImmediateRankCounter,
                           ref RankModel.Rank ____prevImmediateRank, ref float ____prevRelativeScore, ref TextMeshProUGUI ____rankText,
                           ref TextMeshProUGUI ____relativeScoreText)
        {
            if (!CountersController.settings.Enabled)
            {
                return(true);                                      //Dont use Score Counters decimal precision if the plugin is disabled
            }
            if (model == null)
            {
                model = CountersController.settings.scoreConfig;
            }
            RankModel.Rank rank = ____relativeScoreAndImmediateRankCounter.immediateRank;
            if (rank != ____prevImmediateRank)
            {
                ____rankText.text     = model.Mode != ICounterMode.BaseGame ? $"\n{RankModel.GetRankName(rank)}" : RankModel.GetRankName(rank);
                ____prevImmediateRank = rank;
            }
            float score = ____relativeScoreAndImmediateRankCounter.relativeScore;

            if (Mathf.Abs(____prevRelativeScore - score) >= 0.001f)
            {
                float roundedScore = (float)Math.Round((decimal)score * 100, model.DecimalPrecision);
                ____relativeScoreText.text = $"{roundedScore.ToString($"F{model.DecimalPrecision}")}%";
            }
            return(false);
        }
Ejemplo n.º 3
0
        public void GetControllers()
        {
            DismissGraph(null);
            levelOk                      = false;
            averageHitValue              = 0.0f;
            averageHitValueSize          = 0;
            secondaryAverageHitValue     = 0.0f;
            secondaryAverageHitValueSize = 0;
            energyList.Clear();
            secondaryEnergyList.Clear();
            misses.Clear();

            if (PluginConfig.Instance.mode == PluginConfig.MeasurementMode.Energy)
            {
                energyList.Add(new Pair <float, float>(0.0f, 0.5f));
            }
            if (PluginConfig.Instance.secondaryMode == PluginConfig.MeasurementMode.Energy)
            {
                secondaryEnergyList.Add(new Pair <float, float>(0.0f, 0.5f));
            }

            scoreController = Resources.FindObjectsOfTypeAll <ScoreController>().LastOrDefault();
            ComboUIController comboUIController = Resources.FindObjectsOfTypeAll <ComboUIController>().LastOrDefault();

            energyCounter   = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().LastOrDefault();
            rankCounter     = Resources.FindObjectsOfTypeAll <RelativeScoreAndImmediateRankCounter>().LastOrDefault();
            audioController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().LastOrDefault();
            endActions      = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().LastOrDefault();
            if (endActions == null)
            {
                endActions = Resources.FindObjectsOfTypeAll <MissionLevelGameplayManager>().LastOrDefault();
            }

            if (endActions != null && scoreController != null && energyCounter != null && rankCounter != null && audioController != null && comboUIController != null)
            {
                objectManager   = (BeatmapObjectManager)_beatmapObjectManager.GetValue(scoreController);
                comboController = (ComboController)_comboController.GetValue(comboUIController);
                objectManager.noteWasCutEvent    += NoteHit;
                objectManager.noteWasMissedEvent += NoteMiss;
                comboController.comboBreakingEventHappenedEvent += ComboBreak;
                endActions.levelFinishedEvent += LevelFinished;
                endActions.levelFailedEvent   += LevelFinished;
                Logger.log.Debug("PerformanceMeter reloaded successfully");
            }
            else
            {
                Logger.log.Error("Could not reload PerformanceMeter. This may occur when playing online - if so, disregard this message.");
                scoreController = null;
                objectManager   = null;
                comboController = null;
                energyCounter   = null;
                rankCounter     = null;
                audioController = null;
                endActions      = null;
            }
        }
Ejemplo n.º 4
0
 void DismissGraph(ResultsViewController vc)
 {
     if (panel != null)
     {
         Destroy(panel);
         panel             = null;
         resultsController = null;
         scoreController   = null;
         energyCounter     = null;
         rankCounter       = null;
         endActions        = null;
     }
 }
Ejemplo n.º 5
0
        static bool Prefix(ref ImmediateRankUIPanel __instance, ref RelativeScoreAndImmediateRankCounter ____relativeScoreAndImmediateRankCounter,
                           ref RankModel.Rank ____prevImmediateRank, ref float ____prevRelativeScore, ref TextMeshProUGUI ____rankText,
                           ref TextMeshProUGUI ____relativeScoreText)
        {
            if (!CountersController.settings.Enabled)
            {
                return(true);                                      //Dont use Score Counters decimal precision if the plugin is disabled
            }
            if (model == null)
            {
                model = CountersController.settings.scoreConfig;
            }
            RankModel.Rank rank = ____relativeScoreAndImmediateRankCounter.immediateRank;
            if (rank != ____prevImmediateRank)
            {
                ____rankText.text     = model.Mode != ICounterMode.BaseGame ? $"\n{RankModel.GetRankName(rank)}" : RankModel.GetRankName(rank);
                ____prevImmediateRank = rank;
                //I am moving this code down here so that it only runs if the rank changes instead of every time the game refreshes the UI.
                //Because of how cosmic brain Beat Games is, this code should run on game startup, because SSS != SS, so should work fine.
                if (model.CustomRankColors)
                {
                    string color = "#FFFFFF";                //Blank white shall be used for the default color in case like some SSS shit happens
                    switch (RankModel.GetRankName(rank))     //Using PogU switch case instead of Pepega If chain
                    {
                    case "SS": color = model.SSColor; break; //Even compressing this shit down to one liners, look at me!

                    case "S": color = model.SColor; break;

                    case "A": color = model.AColor; break;

                    case "B": color = model.BColor; break;

                    case "C": color = model.CColor; break;

                    case "D": color = model.DColor; break;

                    case "E": color = model.EColor; break;
                    }
                    ColorUtility.TryParseHtmlString(color, out Color RankColor); //converts config hex color to unity RGBA value
                    ____rankText.color = RankColor;                              //sets color of ranktext
                }
            }
            float score = ____relativeScoreAndImmediateRankCounter.relativeScore;

            if (Mathf.Abs(____prevRelativeScore - score) >= 0.001f)
            {
                float roundedScore = (float)Math.Round((decimal)score * 100, model.DecimalPrecision);
                ____relativeScoreText.text = $"{roundedScore.ToString($"F{model.DecimalPrecision}")}%";
            }
            return(false);
        }
Ejemplo n.º 6
0
        private void OnGameSceneLoaded()
        {
            //Logger.log.Debug("Game scene loaded!");
            //Logger.log.Debug($"Does InstaFailAccuracy is enabled?: {InstaFailAccuracyGameplaySetup.instance.EnableInstaFailAcc}");
            //Logger.log.Debug($"Current threshold: {InstaFailAccuracyGameplaySetup.instance.FailThresholdValue}");
            if (InstaFailAccuracyGameplaySetup.instance.EnableInstaFailAcc)
            {
                _alreadyFailed = false;
                _rankCounter   = Resources.FindObjectsOfTypeAll <RelativeScoreAndImmediateRankCounter>().First();
                _standardLevelFailedController =
                    Resources.FindObjectsOfTypeAll <StandardLevelFailedController>().First();
                _rankCounter.relativeScoreOrImmediateRankDidChangeEvent += OnRelativeScoreOrImmediateRankDidChangeEvent;
            }

            CurrentGameStatus = GameStatus.Game;
        }
 protected void Constractor(
     IStatusManager statusManager,
     GameStatus gameStatus,
     RelativeScoreAndImmediateRankCounter relativeScoreAndImmediateRankCounter,
     IAudioTimeSource audioTimeSource,
     GameplayCoreSceneSetupData gameplayCoreSceneSetupData,
     ISongDataUtil songDataUtil,
     IGamePause gamePause)
 {
     this._statusManager = statusManager;
     this._relativeScoreAndImmediateRankCounter = relativeScoreAndImmediateRankCounter;
     this._audioTimeSource            = audioTimeSource;
     this._gameplayCoreSceneSetupData = gameplayCoreSceneSetupData;
     this._songDataUtil = songDataUtil;
     this._gamePause    = gamePause;
     this._gameStatus   = gameStatus;
 }
Ejemplo n.º 8
0
 void DismissGraph(ResultsViewController vc)
 {
     if (panel != null)
     {
         panel.SetActive(false);
         Destroy(panel, 1);
         panel           = null;
         scoreController = null;
         objectManager   = null;
         comboController = null;
         energyCounter   = null;
         rankCounter     = null;
         audioController = null;
         endActions      = null;
     }
     if (vc != null)
     {
         vc.continueButtonPressedEvent -= DismissGraph;
         vc.restartButtonPressedEvent  -= DismissGraph;
     }
 }
Ejemplo n.º 9
0
        static bool Prefix(ref ImmediateRankUIPanel __instance, ref RelativeScoreAndImmediateRankCounter ____relativeScoreAndImmediateRankCounter,
                           ref RankModel.Rank ____prevImmediateRank, ref float ____prevRelativeScore, ref TextMeshProUGUI ____rankText,
                           ref TextMeshProUGUI ____relativeScoreText)
        {
            if (!CountersController.settings.Enabled)
            {
                return(true);                                      //Dont use Score Counters decimal precision if the plugin is disabled
            }
            if (model == null)
            {
                model = CountersController.settings.scoreConfig;
            }
            RankModel.Rank rank = ____relativeScoreAndImmediateRankCounter.immediateRank;
            if (rank != ____prevImmediateRank)
            {
                ____rankText.text     = model.Mode != ICounterMode.BaseGame ? $"\n{RankModel.GetRankName(rank)}" : RankModel.GetRankName(rank);
                ____prevImmediateRank = rank;
            }
            if (model.CustomRankColors) //checks if custom rank colors is enabled
            {
                if (RankModel.GetRankName(rank) == "SS")
                {
                    ColorUtility.TryParseHtmlString(model.SSColor, out Color RankColor); //converts config hex color to unity RGBA value
                    ____rankText.color = RankColor;                                      //sets color of ranktext
                }
                if (RankModel.GetRankName(rank) == "S")
                {
                    ColorUtility.TryParseHtmlString(model.SColor, out Color RankColor);
                    ____rankText.color = RankColor;
                }
                if (RankModel.GetRankName(rank) == "A")
                {
                    ColorUtility.TryParseHtmlString(model.AColor, out Color RankColor);
                    ____rankText.color = RankColor;
                }
                if (RankModel.GetRankName(rank) == "B")
                {
                    ColorUtility.TryParseHtmlString(model.BColor, out Color RankColor);
                    ____rankText.color = RankColor;
                }
                if (RankModel.GetRankName(rank) == "C")
                {
                    ColorUtility.TryParseHtmlString(model.CColor, out Color RankColor);
                    ____rankText.color = RankColor;
                }
                if (RankModel.GetRankName(rank) == "D")
                {
                    ColorUtility.TryParseHtmlString(model.DColor, out Color RankColor);
                    ____rankText.color = RankColor;
                }
                if (RankModel.GetRankName(rank) == "E")
                {
                    ColorUtility.TryParseHtmlString(model.EColor, out Color RankColor);
                    ____rankText.color = RankColor;
                }
            }
            float score = ____relativeScoreAndImmediateRankCounter.relativeScore;

            if (Mathf.Abs(____prevRelativeScore - score) >= 0.001f)
            {
                float roundedScore = (float)Math.Round((decimal)score * 100, model.DecimalPrecision);
                ____relativeScoreText.text = $"{roundedScore.ToString($"F{model.DecimalPrecision}")}%";
            }
            return(false);
        }