From 757e1c2c5ed87bf09d33006551c2d7ea40a3b786 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Mon, 12 Jun 2023 17:18:37 -0400 Subject: [PATCH 1/2] update Jukebox to latest version fixes for inferred entity loading --- Assets/Scripts/GameInitializer.cs | 2 +- Assets/Scripts/GameManager.cs | 12 ++++++++++-- Assets/Scripts/LevelEditor/Editor.cs | 2 -- Assets/Scripts/Minigames.cs | 6 ++---- Packages/packages-lock.json | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/GameInitializer.cs b/Assets/Scripts/GameInitializer.cs index 99868746..ff110493 100644 --- a/Assets/Scripts/GameInitializer.cs +++ b/Assets/Scripts/GameInitializer.cs @@ -55,7 +55,7 @@ namespace HeavenStudio { if (editorGO == null && OpeningManager.OnOpenFile.IndexOfAny(Path.GetInvalidPathChars()) == -1) { - if (File.Exists(OpeningManager.OnOpenFile)) + if (File.Exists(OpeningManager.OnOpenFile) && Path.GetExtension(OpeningManager.OnOpenFile) == ".riq") { input = OpeningManager.OnOpenFile; fromCmd = true; diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 03ea53f4..4111f2ca 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -6,8 +6,7 @@ using UnityEngine; using Starpelly; using Jukebox; -using Jukebox.Legacy; -using Newtonsoft.Json; +using HeavenStudio.Util; using HeavenStudio.Games; using HeavenStudio.Common; @@ -237,6 +236,15 @@ namespace HeavenStudio { SetGame("noGame"); } + + if (editor) + { + Debug.Log(Beatmap.data.riqOrigin); + if (Beatmap.data.riqOrigin != "HeavenStudio") + { + GlobalGameManager.ShowErrorMessage("Warning", "This chart was made for another game,\nand thus may not be playable in Heaven Studio.\nYou may be able to edit this chart in Heaven Studio to be used in its original game.\n\nChart Origin: " + Beatmap.data.riqOrigin.DisplayName()); + } + } } public void ScoreInputAccuracy(double accuracy, bool late, double time, double weight = 1, bool doDisplay = true) diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index 072f9a78..c67e9871 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -386,9 +386,7 @@ namespace HeavenStudio.Editor { var extensions = new[] { - new ExtensionFilter("All Supported Files ", new string[] { "riq", "tengoku", "rhmania" }), new ExtensionFilter("Heaven Studio Remix File ", new string[] { "riq" }), - new ExtensionFilter("Legacy Heaven Studio Remix ", new string[] { "tengoku", "rhmania" }) }; StandaloneFileBrowser.OpenFilePanelAsync("Open Remix", "", extensions, false, (string[] paths) => diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 3006fe06..3637ff8f 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -170,15 +170,13 @@ namespace HeavenStudio if (item.Key == "track") continue; if (item.Value == null) - { - e[item.Key] = 0; - } + continue; var value = item.Value; if (value.GetType() == typeof(long)) value = new EntityTypes.Integer(int.MinValue, int.MaxValue, (int)value); else if (value.GetType() == typeof(double)) value = new EntityTypes.Float(float.NegativeInfinity, float.PositiveInfinity, (float)value); - parameters.Add(new Minigames.Param(item.Key, value, item.Key, "[inferred from remix.json]")); + parameters.Add(new Minigames.Param(item.Key, value, item.Key.DisplayName(), "[inferred from remix.json]")); } action = new Minigames.GameAction(actionName, actionName.DisplayName(), e.length, true, parameters); game.actions.Add(action); diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index de7ccdd0..cfc09516 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -7,7 +7,7 @@ "dependencies": { "com.unity.nuget.newtonsoft-json": "3.2.1" }, - "hash": "619442ba26163fb6a00dd50ba52e2fdeaea33e37" + "hash": "769b4fe2c85792b34defb00e051e823442b78564" }, "com.unity.2d.sprite": { "version": "1.0.0", From 8df235a85b0557a6e2e6622582253634ebcb57f6 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Tue, 13 Jun 2023 16:55:02 -0400 Subject: [PATCH 2/2] let play mode start if no song file is loaded fix issue with loading large audio files --- Assets/Scripts/GameManager.cs | 21 +++++++++++++++++++-- Assets/Scripts/UI/PauseMenu.cs | 1 + Packages/packages-lock.json | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 4111f2ca..9df92edc 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -46,6 +46,9 @@ namespace HeavenStudio [NonSerialized] public RiqEntity currentSection, nextSection; public double sectionProgress { get; private set; } + bool AudioLoadDone; + bool ChartLoadError; + public event Action onBeatChanged; public event Action onSectionChange; @@ -104,6 +107,8 @@ namespace HeavenStudio public void Init(bool preLoaded = false) { + AudioLoadDone = false; + ChartLoadError = false; currentPreEvent= 0; currentPreSwitch = 0; currentPreSequence = 0; @@ -141,6 +146,7 @@ namespace HeavenStudio } else { + RiqFileHandler.ClearCache(); NewRemix(); } @@ -163,7 +169,8 @@ namespace HeavenStudio } public void NewRemix() - { + { + AudioLoadDone = false; Beatmap = new("1", "HeavenStudio"); Beatmap.data.properties = Minigames.propertiesModel; Beatmap.AddNewTempoChange(0, 120f); @@ -171,10 +178,12 @@ namespace HeavenStudio Beatmap.data.offset = 0f; Conductor.instance.musicSource.clip = null; RiqFileHandler.WriteRiq(Beatmap); + AudioLoadDone = true; } public IEnumerator LoadMusic() { + ChartLoadError = false; IEnumerator load = RiqFileHandler.LoadSong(); while (true) { @@ -191,20 +200,27 @@ namespace HeavenStudio { Debug.LogWarning("chart has no music: " + f.Message); Conductor.instance.musicSource.clip = null; + AudioLoadDone = true; + yield break; } catch (Exception e) { Debug.LogError($"Failed to load music: {e.Message}"); GlobalGameManager.ShowErrorMessage("Error Loading Music", e.Message + "\n\n" + e.StackTrace); + AudioLoadDone = true; + ChartLoadError = true; yield break; } yield return current; } Conductor.instance.musicSource.clip = RiqFileHandler.StreamedAudioClip; + AudioLoadDone = true; } public void LoadRemix(bool editor = false) { + AudioLoadDone = false; + ChartLoadError = false; try { Beatmap = RiqFileHandler.ReadRiq(); @@ -213,6 +229,7 @@ namespace HeavenStudio { Debug.LogError($"Failed to load remix: {e.Message}"); GlobalGameManager.ShowErrorMessage("Error Loading RIQ", e.Message + "\n\n" + e.StackTrace); + ChartLoadError = true; return; } if (!editor) @@ -559,7 +576,7 @@ namespace HeavenStudio // wait for first game to be loaded yield return new WaitUntil(() => Beatmap != null && Beatmap.Entities.Count > 0); //wait for audio clip to be loaded - yield return new WaitUntil(() => Conductor.instance.musicSource.clip != null); + yield return new WaitUntil(() => AudioLoadDone || (ChartLoadError && !GlobalGameManager.IsShowingDialog)); SkillStarManager.instance.KillStar(); TimingAccuracyDisplay.instance.StopStarFlash(); diff --git a/Assets/Scripts/UI/PauseMenu.cs b/Assets/Scripts/UI/PauseMenu.cs index bdf87db2..81c9f19d 100644 --- a/Assets/Scripts/UI/PauseMenu.cs +++ b/Assets/Scripts/UI/PauseMenu.cs @@ -42,6 +42,7 @@ namespace HeavenStudio.Common void Pause() { + if (GlobalGameManager.IsShowingDialog) return; if (!Conductor.instance.isPlaying) return; Conductor.instance.Pause(); pauseBeat = Conductor.instance.songPositionInBeatsAsDouble; diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index cfc09516..d80b6b2f 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -7,7 +7,7 @@ "dependencies": { "com.unity.nuget.newtonsoft-json": "3.2.1" }, - "hash": "769b4fe2c85792b34defb00e051e823442b78564" + "hash": "f1813255c1d322b6fe207de4361bbf288f9cda03" }, "com.unity.2d.sprite": { "version": "1.0.0",