public static bool delete; // boolean for delete tool private void Start() { BeatSaberSong.DifficultyBeatmapSet set = BeatSaberSongContainer.Instance.difficultyData.parentBeatmapSet; //ChromaToggle notes will be disabled until the mod is revived with some pretty breaking changes I have in mind. //The biggest of that is to create a new ChromaToggle characteristic that'll hold maps made for CT. foreach (Toggle toggle in chromaToggles) { if (set.beatmapCharacteristicName != "ChromaToggle") { toggle.interactable = false; Tooltip tooltip = toggle.GetComponent <Tooltip>(); if (tooltip != null) { tooltip.tooltip = "ChromaToggle coming soon!"; } } } foreach (Toggle toggle in singleSaberDisabledToggles) { if (set.beatmapCharacteristicName == "OneSaber") { toggle.interactable = false; Tooltip tooltip = toggle.GetComponent <Tooltip>(); if (tooltip != null) { tooltip.tooltip = "Single Saber only allows the right saber!"; } } } }
public static IEnumerator LoadMapper() { if (SceneManager.GetActiveScene().name.StartsWith("03")) { yield break; } Settings.Instance.Reminder_Loading360Levels = false; CMInputCallbackInstaller.TestMode = true; yield return(SceneManager.LoadSceneAsync("00_FirstBoot", LoadSceneMode.Single)); PersistentUI.Instance.enableTransitions = false; // On pipeline this may be run fresh if (!Settings.ValidateDirectory(null)) { var firstBootMenu = Object.FindObjectOfType <FirstBootMenu>(); Settings.Instance.BeatSaberInstallation = "/root/bs"; firstBootMenu.HandleGenerateMissingFolders(0); } yield return(new WaitUntil(() => SceneManager.GetActiveScene().name.StartsWith("01") && !SceneTransitionManager.IsLoading)); BeatSaberSongContainer.Instance.song = new BeatSaberSong("testmap", new JSONObject()); var parentSet = new BeatSaberSong.DifficultyBeatmapSet("Lawless"); var diff = new BeatSaberSong.DifficultyBeatmap(parentSet); diff.customData = new JSONObject(); BeatSaberSongContainer.Instance.difficultyData = diff; BeatSaberSongContainer.Instance.loadedSong = AudioClip.Create("Fake", 44100 * 2, 1, 44100, false); SceneTransitionManager.Instance.LoadScene("03_Mapper"); yield return(new WaitUntil(() => !SceneTransitionManager.IsLoading)); }
public void Save(bool auto = false) { PersistentUI.Instance.DisplayMessage($"{(auto ? "Auto " : "")}Saving...", PersistentUI.DisplayMessageType.BOTTOM); SelectionController.RefreshMap(); //Make sure our map is up to date. if (BeatSaberSongContainer.Instance.map._customEvents.Any()) { if (Settings.Instance.Reminder_SavingCustomEvents) { //Example of advanced dialog box options. PersistentUI.Instance.ShowDialogBox("ChroMapper has detected you are using custom events in your map.\n\n" + "The current format for Custom Events goes against BeatSaver's enforced schema.\n" + "If you try to upload this map to BeatSaver, it will fail.", HandleCustomEventsDecision, "Ok", "Don't Remind Me"); } } new Thread(() => //I could very well move this to its own function but I need access to the "auto" variable. { Thread.CurrentThread.IsBackground = true; //Making sure this does not interfere with game thread //Fixes weird shit regarding how people write numbers (20,35 VS 20.35), causing issues in JSON //This should be thread-wide, but I have this set throughout just in case it isnt. Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; //Saving Map Data string originalMap = BeatSaberSongContainer.Instance.map.directoryAndFile; string originalSong = BeatSaberSongContainer.Instance.song.directory; if (auto) { Queue <string> directory = new Queue <string>(originalSong.Split('/').ToList()); directory.Enqueue("autosaves"); directory.Enqueue($"{DateTime.Now:dd-MM-yyyy_HH-mm-ss}"); //timestamp string autoSaveDir = string.Join("/", directory.ToArray()); Debug.Log($"Auto saved to: {autoSaveDir}"); //We need to create the autosave directory before we can save the .dat difficulty into it. System.IO.Directory.CreateDirectory(autoSaveDir); BeatSaberSongContainer.Instance.map.directoryAndFile = $"{autoSaveDir}\\{BeatSaberSongContainer.Instance.difficultyData.beatmapFilename}"; BeatSaberSongContainer.Instance.song.directory = autoSaveDir; } BeatSaberSongContainer.Instance.map.Save(); BeatSaberSongContainer.Instance.map.directoryAndFile = originalMap; BeatSaberSong.DifficultyBeatmapSet set = BeatSaberSongContainer.Instance.difficultyData.parentBeatmapSet; //Grab our set BeatSaberSongContainer.Instance.song.difficultyBeatmapSets.Remove(set); //Yeet it out BeatSaberSong.DifficultyBeatmap data = BeatSaberSongContainer.Instance.difficultyData; //Grab our diff data set.difficultyBeatmaps.Remove(data); //Yeet out our difficulty data if (BeatSaberSongContainer.Instance.difficultyData.customData == null) //if for some reason this be null, make new customdata { BeatSaberSongContainer.Instance.difficultyData.customData = new JSONObject(); } set.difficultyBeatmaps.Add(BeatSaberSongContainer.Instance.difficultyData); //Add back our difficulty data BeatSaberSongContainer.Instance.song.difficultyBeatmapSets.Add(set); //Add back our difficulty set BeatSaberSongContainer.Instance.song.SaveSong(); //Save BeatSaberSongContainer.Instance.song.directory = originalSong; //Revert directory if it was changed by autosave }).Start(); }
public void CreateNewDifficultyData() { if (!songDifficultySets.Any() || SelectedSet == null) { BeatSaberSong.DifficultyBeatmapSet set = new BeatSaberSong.DifficultyBeatmapSet( CharacteristicDropdownToBeatmapName[characteristicDropdown.value]); songDifficultySets.Add(set); } BeatSaberSong.DifficultyBeatmap data = new BeatSaberSong.DifficultyBeatmap(SelectedSet); songDifficultyData.Add(data); selectedDifficultyIndex = songDifficultyData.IndexOf(data); InitializeDifficultyPanel(selectedDifficultyIndex); PersistentUI.Instance.ShowDialogBox("Be sure to save the difficulty before editing!", null, PersistentUI.DialogBoxPresetType.Ok); }
// Start is called before the first frame update void Start() { BeatSaberSong.DifficultyBeatmapSet set = BeatSaberSongContainer.Instance.difficultyData.parentBeatmapSet; IsActive = enabledCharacteristics.Contains(set.beatmapCharacteristicName); if (IsActive && Settings.Instance.Reminder_Loading360Levels) { PersistentUI.Instance.ShowDialogBox( "360 Mapping is relatively new and can easily make the map unplayable if left untested.\n\n" + "For the love of all that is holy, have yourself and others playtest your map frequently." , Handle360LevelReminder, "Ok", "Don't Remind Me"); } interfaceCallback.EventPassedThreshold += EventPassedThreshold; atsc.OnPlayToggle += PlayToggle; }
// Start is called before the first frame update internal void Start() { BeatSaberSong.DifficultyBeatmapSet set = BeatSaberSongContainer.Instance.difficultyData.parentBeatmapSet; IsActive = enabledCharacteristics.Contains(set.beatmapCharacteristicName); if (IsActive && Settings.Instance.Reminder_Loading360Levels) { PersistentUI.Instance.ShowDialogBox( "PersistentUI", "360warning" , Handle360LevelReminder, PersistentUI.DialogBoxPresetType.OkIgnore); } interfaceCallback.EventPassedThreshold += EventPassedThreshold; atsc.OnPlayToggle += PlayToggle; atsc.OnTimeChanged += OnTimeChanged; Settings.NotifyBySettingName("RotateTrack", UpdateRotateTrack); }
public void CreateNewDifficultyData() { if (songDifficultySets.Any()) { BeatSaberSong.DifficultyBeatmap data = new BeatSaberSong.DifficultyBeatmap(songDifficultySets[selectedBeatmapSet]); songDifficultyData.Add(data); InitializeDifficultyPanel(); } else { BeatSaberSong.DifficultyBeatmapSet set = new BeatSaberSong.DifficultyBeatmapSet(); songDifficultySets.Add(set); BeatSaberSong.DifficultyBeatmap data = new BeatSaberSong.DifficultyBeatmap(songDifficultySets[selectedBeatmapSet]); songDifficultyData.Add(data); InitializeDifficultyPanel(); } PersistentUI.Instance.DisplayMessage("Be sure to save before editing the map!", PersistentUI.DisplayMessageType.BOTTOM); }
private void HandleNewSongName(string res) { if (res is null) { return; } if (list.songs.Any(x => x.songName == res)) { PersistentUI.Instance.ShowInputBox("There already exists a beatmap with that name.\n\n" + "Please enter the name for the new beatmap.", HandleNewSongName, "New Beatmap"); return; } BeatSaberSong song = new BeatSaberSong(list.WIPLevels, res); BeatSaberSong.DifficultyBeatmapSet standardSet = new BeatSaberSong.DifficultyBeatmapSet(); song.difficultyBeatmapSets.Add(standardSet); BeatSaberSongContainer.Instance.SelectSongForEditing(song); PersistentUI.Instance.DisplayMessage("Be sure to save info.dat before editing!", PersistentUI.DisplayMessageType.BOTTOM); }
private void HandleNewSongName(string res) { if (res is null) { return; } var song = new BeatSaberSong(list.WIPLevels, res); if (list.songs.Any(x => Path.GetFullPath(x.directory).Equals( Path.GetFullPath(Path.Combine(list.WIPLevels ? Settings.Instance.CustomWIPSongsFolder : Settings.Instance.CustomSongsFolder, song.cleanSongName)), StringComparison.CurrentCultureIgnoreCase ))) { PersistentUI.Instance.ShowInputBox("SongSelectMenu", "newmap.dialog.duplicate", HandleNewSongName, "newmap.dialog.default"); return; } var standardSet = new BeatSaberSong.DifficultyBeatmapSet(); song.difficultyBeatmapSets.Add(standardSet); BeatSaberSongContainer.Instance.SelectSongForEditing(song); PersistentUI.Instance.DisplayMessage("SongSelectMenu", "newmap.message", PersistentUI.DisplayMessageType.BOTTOM); }
public void Save(bool auto = false) { PersistentUI.Instance.DisplayMessage($"{(auto ? "Auto " : "")}Saving...", PersistentUI.DisplayMessageType.BOTTOM); SelectionController.RefreshMap(); //Make sure our map is up to date. if (BeatSaberSongContainer.Instance.map._customEvents.Any()) { if (Settings.Instance.Saving_CustomEventsSchemaReminder) { //Example of advanced dialog box options. PersistentUI.Instance.ShowDialogBox("ChroMapper has detected you are using custom events in your map.\n\n" + "The current format for Custom Events goes against BeatSaver's enforced schema.\n" + "If you try to upload this map to BeatSaver, it will fail.", HandleCustomEventsDecision, "Ok", "Don't Remind Me"); } } new Thread(() => //I could very well move this to its own function but I need access to the "auto" variable. { Thread.CurrentThread.IsBackground = true; //Making sure this does not interfere with game thread //Saving Map Data string originalMap = BeatSaberSongContainer.Instance.map.directoryAndFile; string originalSong = BeatSaberSongContainer.Instance.song.directory; if (auto) { Queue <string> directory = new Queue <string>(originalSong.Split('/').ToList()); directory.Enqueue("autosaves"); directory.Enqueue($"{DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss")}"); //timestamp string autoSaveDir = string.Join("/", directory.ToArray()); Debug.Log($"Auto saved to: {autoSaveDir}"); //We need to create the autosave directory before we can save the .dat difficulty into it. System.IO.Directory.CreateDirectory(autoSaveDir); BeatSaberSongContainer.Instance.map.directoryAndFile = $"{autoSaveDir}/{BeatSaberSongContainer.Instance.difficultyData.beatmapFilename}"; BeatSaberSongContainer.Instance.song.directory = autoSaveDir; } BeatSaberSongContainer.Instance.map.Save(); BeatSaberSongContainer.Instance.map.directoryAndFile = originalMap; //Saving Map Requirement Info JSONArray requiredArray = new JSONArray(); //Generate suggestions and requirements array JSONArray suggestedArray = new JSONArray(); if (HasChromaEvents()) { suggestedArray.Add(new JSONString("Chroma Lighting Events")); } if (HasMappingExtensions()) { requiredArray.Add(new JSONString("Mapping Extensions")); } if (HasChromaToggle()) { requiredArray.Add(new JSONString("ChromaToggle")); } BeatSaberSong.DifficultyBeatmapSet set = BeatSaberSongContainer.Instance.song.difficultyBeatmapSets.Where(x => x == BeatSaberSongContainer.Instance.difficultyData.parentBeatmapSet).First(); //Grab our set BeatSaberSongContainer.Instance.song.difficultyBeatmapSets.Remove(set); //Yeet it out BeatSaberSong.DifficultyBeatmap data = set.difficultyBeatmaps.Where(x => x.beatmapFilename == BeatSaberSongContainer.Instance.difficultyData.beatmapFilename).First(); //Grab our diff data set.difficultyBeatmaps.Remove(data); //Yeet out our difficulty data if (BeatSaberSongContainer.Instance.difficultyData.customData == null) //if for some reason this be null, make new customdata { BeatSaberSongContainer.Instance.difficultyData.customData = new JSONObject(); } BeatSaberSongContainer.Instance.difficultyData.customData["_suggestions"] = suggestedArray; //Set suggestions BeatSaberSongContainer.Instance.difficultyData.customData["_requirements"] = requiredArray; //Set requirements set.difficultyBeatmaps.Add(BeatSaberSongContainer.Instance.difficultyData); //Add back our difficulty data BeatSaberSongContainer.Instance.song.difficultyBeatmapSets.Add(set); //Add back our difficulty set BeatSaberSongContainer.Instance.song.SaveSong(); //Save BeatSaberSongContainer.Instance.song.directory = originalSong; //Revert directory if it was changed by autosave }).Start(); }
public void Save(bool auto = false) { if (savingThread != null && savingThread.IsAlive) { Debug.LogError(":hyperPepega: :mega: STOP TRYING TO SAVE THE SONG WHILE ITS ALREADY SAVING TO DISK"); return; } var notification = PersistentUI.Instance.DisplayMessage("Mapper", $"{(auto ? "auto" : "")}save.message", PersistentUI.DisplayMessageType.BOTTOM); notification.skipFade = true; notification.waitTime = 5.0f; SelectionController.RefreshMap(); //Make sure our map is up to date. savingThread = new Thread(() => //I could very well move this to its own function but I need access to the "auto" variable. { Thread.CurrentThread.IsBackground = true; //Making sure this does not interfere with game thread //Fixes weird shit regarding how people write numbers (20,35 VS 20.35), causing issues in JSON //This should be thread-wide, but I have this set throughout just in case it isnt. Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; //Saving Map Data string originalMap = BeatSaberSongContainer.Instance.map.directoryAndFile; string originalSong = BeatSaberSongContainer.Instance.song.directory; if (auto) { var directory = originalSong.Split('/').ToList(); directory.Add("autosaves"); directory.Add($"{DateTime.Now:dd-MM-yyyy_HH-mm-ss}"); //timestamp string autoSaveDir = string.Join("/", directory.ToArray()); Debug.Log($"Auto saved to: {autoSaveDir}"); //We need to create the autosave directory before we can save the .dat difficulty into it. Directory.CreateDirectory(autoSaveDir); BeatSaberSongContainer.Instance.map.directoryAndFile = $"{autoSaveDir}\\{BeatSaberSongContainer.Instance.difficultyData.beatmapFilename}"; BeatSaberSongContainer.Instance.song.directory = autoSaveDir; var newDirectoryInfo = new DirectoryInfo(autoSaveDir); currentAutoSaves.Add(newDirectoryInfo); CleanAutosaves(); } BeatSaberSongContainer.Instance.map.Save(); BeatSaberSongContainer.Instance.map.directoryAndFile = originalMap; BeatSaberSong.DifficultyBeatmapSet set = BeatSaberSongContainer.Instance.difficultyData.parentBeatmapSet; //Grab our set BeatSaberSongContainer.Instance.song.difficultyBeatmapSets.Remove(set); //Yeet it out BeatSaberSong.DifficultyBeatmap data = BeatSaberSongContainer.Instance.difficultyData; //Grab our diff data set.difficultyBeatmaps.Remove(data); //Yeet out our difficulty data if (BeatSaberSongContainer.Instance.difficultyData.customData == null) //if for some reason this be null, make new customdata { BeatSaberSongContainer.Instance.difficultyData.customData = new JSONObject(); } set.difficultyBeatmaps.Add(BeatSaberSongContainer.Instance.difficultyData); //Add back our difficulty data BeatSaberSongContainer.Instance.song.difficultyBeatmapSets.Add(set); //Add back our difficulty set BeatSaberSongContainer.Instance.song.SaveSong(); //Save BeatSaberSongContainer.Instance.song.directory = originalSong; //Revert directory if it was changed by autosave notification.skipDisplay = true; }); savingThread.Start(); }