public static void Postfix(scnCLS __instance, bool ___searchMode, string ___levelToSelect, Dictionary <string, bool> ___loadedLevelIsDeleted, Dictionary <string, LevelDataCLS> ___loadedLevels) { if (_infoObject == null) { _infoObject = new GameObject(); } var settings = MiscModule.Settings; if (settings.KeyBinding.CLS.instantJoinKeyActive && !scrController.instance.paused && !___searchMode && settings.KeyBinding.CLS.instantJoinKey.Down()) { if (___loadedLevelIsDeleted[___levelToSelect]) { return; } __instance.EnterLevel(); } if (settings.KeyBinding.CLS.reloadKeyActive && !scrController.instance.paused && !___searchMode && settings.KeyBinding.CLS.reloadKey.Down()) { __instance.Refresh(); } if (settings.KeyBinding.CLS.workshopKeyActive && !scrController.instance.paused && !___searchMode && settings.KeyBinding.CLS.workshopKey.Down()) { SteamWorkshop.OpenWorkshop(); } if (Input.GetKeyDown(KeyCode.Escape) || MiscModule.Settings.KeyBinding.CLS.infoKeyActive && MiscModule.Settings.KeyBinding.CLS.infoKey.Down() && !___searchMode) { if (_levelInfo != null) { Object.DestroyImmediate(_levelInfo); _levelInfo = null; scrController.instance.paused = false; scrController.instance.audioPaused = false; scrController.instance.enabled = true; Time.timeScale = 1.0f; } else if (!__instance.controller.paused && !Input.GetKeyDown(KeyCode.Escape)) { _levelInfo = _infoObject.AddComponent <LevelInfoBehaviour>(); _levelInfo.SetMap(___loadedLevels[___levelToSelect], ___levelToSelect); scrController.instance.paused = true; scrController.instance.audioPaused = true; scrController.instance.enabled = false; Time.timeScale = 0.0f; } } if (MiscModule.Settings.KeyBinding.CLS.editorKeyActive && MiscModule.Settings.KeyBinding.CLS.editorKey.Down() && !___searchMode && !scrController.instance.paused) { if (___loadedLevelIsDeleted[___levelToSelect]) { return; } string levelPath = Path.Combine(__instance.loadedLevelDirs[___levelToSelect], "main.adofai"); GCS.sceneToLoad = "scnEditor"; GCS.customLevelPaths = new string[1]; GCS.customLevelPaths[0] = levelPath; GCS.standaloneLevelMode = false; editor = true; __instance.controller.StartLoadingScene(WipeDirection.StartsFromRight); // __instance.editor.SwitchToEditMode(); return; } }
private static bool Prefix(scnCLS __instance, scrCamera ___camera, bool ___disablePlanets, string ___levelToSelect, ref float ___holdTimer, ref float ___autoscrollTimer, bool ___changingLevel, ref float ___levelTransitionTimer, ref bool ___instantSelect, string ___newSongKey, ref Coroutine ___loadSongCoroutine, Dictionary <string, bool> ___loadedLevelIsDeleted, Dictionary <string, LevelData> ___loadedLevels) { if (_infoGameObject == null) { _infoGameObject = new GameObject(); } void Invoke(MethodBase methodBase, params object[] parameters) { methodBase.Invoke(__instance, parameters); } if (Input.GetKeyDown(KeyCode.Alpha7)) { scnCLS.loadSongMode = (scnCLS.loadSongMode + 1) % 3; if (scnCLS.loadSongMode == 0) { MonoBehaviour.print((object)"loading all"); } if (scnCLS.loadSongMode == 1) { MonoBehaviour.print((object)"not loading mp3s"); } if (scnCLS.loadSongMode == 2) { MonoBehaviour.print((object)"loading none"); } } float num1 = (float)Screen.width * 1f / (float)Screen.height; float num2 = __instance.canvasScaler.referenceResolution.x / __instance.canvasScaler.referenceResolution.y; __instance.canvasScaler.matchWidthOrHeight = (double)num1 >= (double)num2 ? 1f : 0.0f; ___camera.camobj.orthographicSize = 5f * Mathf.Max(1f, num2 / num1); __instance.signContainer.LocalMoveY(___camera.camobj.orthographicSize - 1.4f); SteamIntegration.Instance.CheckCallbacks(); SteamWorkshop.CheckDownloadInfo(); if (___disablePlanets) { __instance.controller.responsive = false; } if (Input.GetKeyDown(KeyCode.I) || Input.GetKeyDown(KeyCode.Escape) && Main.settings.KeyBindSettings.ClsKeyBindSettings.MapInfo) { if (_infoBehavior != null) { Object.DestroyImmediate(_infoBehavior); _infoBehavior = null; scrController.instance.paused = false; scrController.instance.audioPaused = false; scrController.instance.enabled = true; Time.timeScale = 1.0f; } else if (!__instance.controller.paused && !Input.GetKeyDown(KeyCode.Escape)) { _infoBehavior = _infoGameObject.AddComponent <InfoBehavior>(); _infoBehavior.SetMap(___loadedLevels[___levelToSelect], ___levelToSelect); scrController.instance.paused = true; scrController.instance.audioPaused = true; scrController.instance.enabled = false; Time.timeScale = 0.0f; } return(false); } if (!__instance.controller.paused) { if (Input.GetKeyDown(KeyCode.LeftArrow) && Main.settings.KeyBindSettings.ClsKeyBindSettings.EnterMap) { if (___loadedLevelIsDeleted[___levelToSelect]) { return(false); } __instance.EnterLevel(); return(false); } if (Input.GetKeyDown(KeyCode.E) && Main.settings.KeyBindSettings.ClsKeyBindSettings.Editor) { if (___loadedLevelIsDeleted[___levelToSelect]) { return(false); } string levelPath = Path.Combine(__instance.loadedLevelDirs[___levelToSelect], "main.adofai"); GCS.sceneToLoad = "scnEditor"; GCS.customLevelPaths = new string[1]; GCS.customLevelPaths[0] = levelPath; GCS.standaloneLevelMode = false; shouldSkipPlay = true; __instance.controller.StartLoadingScene(WipeDirection.StartsFromRight); __instance.editor.SwitchToEditMode(); return(false); } if (Input.GetKeyDown(KeyCode.R) && Main.settings.KeyBindSettings.ClsKeyBindSettings.Reload) { Invoke(_refresh, false); return(false); } if (Input.GetKeyDown(KeyCode.S)) { Invoke(_toggleSpeedTrial); return(false); } if (Input.GetKeyDown(KeyCode.W) && Main.settings.KeyBindSettings.ClsKeyBindSettings.Workshop) { SteamWorkshop.OpenWorkshop(); return(false); } if (Input.GetKeyDown(KeyCode.Delete)) { Invoke(_deleteLevel, ___levelToSelect); return(false); } if (!__instance.controller.moving) { if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.DownArrow)) { ___holdTimer += Time.deltaTime; } else { ___holdTimer = 0.0f; ___autoscrollTimer = 0.0f; } if ((double)___holdTimer > (double)__instance.secondsForHold) { ___autoscrollTimer += Time.deltaTime * ((double)___holdTimer > (double)__instance.secondsForHoldExtra ? 2f : 1f); if ((double)___autoscrollTimer > (double)__instance.autoScrollInterval) { if (Input.GetKey(KeyCode.UpArrow)) { Invoke(_shiftPlanet, false); } else { Invoke(_shiftPlanet, true); } ___autoscrollTimer = 0.0f; } } else if (Input.GetKeyDown(KeyCode.UpArrow)) { Invoke(_shiftPlanet, false); } else if (Input.GetKeyDown(KeyCode.DownArrow)) { Invoke(_shiftPlanet, true); } } } if (___changingLevel) { if ((double)___levelTransitionTimer >= (___instantSelect ? (double)__instance.portalTransitionTimeInstant : (double)__instance.portalTransitionTimeNormal)) { __instance.DisplayLevel(___levelToSelect); LevelData loadedLevel = __instance.loadedLevels[___levelToSelect]; if (!string.IsNullOrEmpty(loadedLevel.songFilename)) { string path = Path.Combine(__instance.loadedLevelDirs[___levelToSelect], loadedLevel.songFilename); ___newSongKey = Path.GetFileName(path) + "*external"; if (!path.ToLower().EndsWith(".mp3")) { ___loadSongCoroutine = __instance.StartCoroutine( (IEnumerator)_loadSong.Invoke(__instance, new[] { path, ___newSongKey })); } } ___instantSelect = false; } else { ___levelTransitionTimer += Time.deltaTime; } } __instance.portalAndSign.MoveY(___camera.yGlobal); return(false); }
public static bool Prefix(scnCLS __instance, string sub, ref string ___searchParameter, List <string> ___sortedLevelKeys) { void Invoke(MethodBase methodBase, params object[] parameters) { methodBase.Invoke(__instance, parameters); } ___searchParameter = sub; List <CustomLevelTile> source = new List <CustomLevelTile>(); foreach (string sortedLevelKey in ___sortedLevelKeys) { CustomLevelTile loadedLevelTile = __instance.loadedLevelTiles[sortedLevelKey]; LevelData loadedLevel = __instance.loadedLevels[sortedLevelKey]; string[] strArray = { RDUtils.RemoveRichTags(loadedLevel.artist), RDUtils.RemoveRichTags(loadedLevel.author), RDUtils.RemoveRichTags(loadedLevel.song) }; bool flag = false; if (!sub.IsNullOrEmpty()) { foreach (string str in strArray) { if (str.ToLower().Contains(sub.ToLower())) { flag = true; break; } } } else { flag = true; } if (flag) { source.Add(loadedLevelTile); } else { loadedLevelTile.gameObject.SetActive(false); } } int num = Mathf.RoundToInt(__instance.controller.chosenplanet.transform.position.y); for (int index = 0; index < source.Count; ++index) { CustomLevelTile customLevelTile = source[index]; customLevelTile.gameObject.SetActive(true); customLevelTile.transform.MoveY(num - index); } bool flag1 = source.Count >= (double)__instance.levelCountForLoop; if (source.Count != 0) { CustomLevelTile customLevelTile1 = source.First(); CustomLevelTile customLevelTile2 = source.Last(); if (flag1) { __instance.gemTop.MoveY(customLevelTile1.transform.position.y + 1f); __instance.gemTopY = Mathf.RoundToInt(__instance.gemTop.position.y); __instance.gemBottom.MoveY(customLevelTile2.transform.position.y - 1f); __instance.gemBottomY = Mathf.RoundToInt(__instance.gemBottom.position.y); } else { __instance.chainTop.transform.MoveY(customLevelTile1.transform.position.y); __instance.chainBottom.transform.MoveY(customLevelTile2.transform.position.y); } } else { __instance.chainTop.transform.MoveY((float)num); __instance.chainBottom.transform.MoveY((float)num); } __instance.gemTop.gameObject.SetActive(flag1); __instance.gemBottom.gameObject.SetActive(flag1); __instance.chainTop.gameObject.SetActive(!flag1); __instance.chainBottom.gameObject.SetActive(!flag1); if (source.Count != 0) { __instance.SelectLevel(source[0], true); } else { __instance.DisplayLevel(); Invoke(_stopCurrentLevelSong); } string str1 = RDString.Get("cls.shortcut.find"); if (!sub.IsNullOrEmpty()) { str1 = str1 + " <color=#ffd000><i>" + RDString.Get("cls.currentlySearching").Replace("[filter]", sub) + "</i></color>"; } __instance.currentSearchText.text = str1; return(false); }