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; } }
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; } }