private void SceneManagerOnActiveSceneChanged(Scene current, Scene next) { ChromaLogger.Log("Scene change " + current.name + " -> " + next.name, ChromaLogger.Level.DEBUG); doRefreshLights = true; if (current.name == "GameCore") { if (next.name != "GameCore") { Time.timeScale = 1f; //ChromaBehaviour.ClearInstance(); //if (ChromaConfig.reloadGameModes) ChromaGameMode.InitializeGameModes(); //ChromaConfig.LoadSettings(ChromaConfig.LoadSettingsType.MENU_LOADED); MainMenuLoadedEvent?.Invoke(); } } else { if (next.name == "GameCore") { //overrideGameMode = null; //ChromaBehaviour.CreateNewInstance(GetSelectedGameMode()); ChromaBehaviour.CreateNewInstance(); SongSceneLoadedEvent?.Invoke(); } } }
private BeatmapData CreateTransformedBeatmapData(BeatmapData beatmapData, PlayerSpecificSettings playerSettings, BaseGameModeType baseGameMode) { try { if (beatmapData == null) { throw new Exception("Null beatmapData"); } if (ChromaConfig.CustomMapCheckingEnabled) { /*if (ModeActive(ChromaMode.DOUBLES_DOTS) || ModeActive(ChromaMode.DOUBLES_MONO) || ModeActive(ChromaMode.DOUBLES_REMOVED) || ModeActive(ChromaMode.INVERT_COLOUR) || ModeActive(ChromaMode.MIRROR_DIRECTION) || ModeActive(ChromaMode.MIRROR_POSITION) || ModeActive(ChromaMode.MONOCHROME) || ModeActive(ChromaMode.NO_ARROWS) || ModeActive(ChromaMode.RANDOM_COLOURS_CHROMA) || ModeActive(ChromaMode.RANDOM_COLOURS_INTENSE) || ModeActive(ChromaMode.RANDOM_COLOURS_ORIGINAL) || ModeActive(ChromaMode.RANDOM_COLOURS_TRUE)) {*/ ChromaLogger.Log("Attempting map modification..."); //return ChromaToggle.Beatmap.Z_MapModifier.CreateTransformedData(beatmapData, modes); ChromaBehaviour chroma = this; CustomBeatmap customBeatmap = ChromaMapModifier.CreateTransformedData(beatmapData, ref chroma, ref playerSettings, ref baseGameMode, ref songBPM); if (customBeatmap == null) { ChromaLogger.Log("Major error sir, beatmap data failed!", ChromaLogger.Level.WARNING); return(beatmapData); } else { return(customBeatmap.BeatmapData); } } } catch (Exception e) { ChromaLogger.Log("Error creating transformed map data..."); ChromaLogger.Log(e, ChromaLogger.Level.ERROR); } return(beatmapData); }
public static void ClearInstance() { if (_instance != null) { Destroy(_instance.gameObject); _instance = null; } }
internal static ChromaBehaviour CreateNewInstance() { IsLoadingSong = true; ChromaLogger.Log("ChromaBehaviour attempting creation.", ChromaLogger.Level.DEBUG); ClearInstance(); //if (SceneUtils.IsTargetGameScene(SceneManager.GetActiveScene().buildIndex)) { GameObject instanceObject = new GameObject("ChromaBehaviour"); ChromaBehaviour behaviour = instanceObject.AddComponent <ChromaBehaviour>(); _instance = behaviour; ChromaLogger.Log("ChromaBehaviour instantiated.", ChromaLogger.Level.DEBUG); return(behaviour); /*} else { * ChromaLogger.Log("Invalid scene index."); * return null; * }*/ }