From 9b9bfea627874aaca1e683ead79b564e244a3f50 Mon Sep 17 00:00:00 2001 From: Saraistupid <37207067+Saraistupid@users.noreply.github.com> Date: Sat, 4 Jun 2022 05:15:45 +0200 Subject: [PATCH] Fix Importing Music files on Linux (#89) * fix importing music files on linux * oops --- Assets/Scripts/LevelEditor/Editor.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index c7b628d2..fb0ac5cf 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -224,6 +224,7 @@ namespace HeavenStudio.Editor new ExtensionFilter("Music Files", "mp3", "ogg", "wav") }; + #if UNITY_STANDALONE_WINDOWS StandaloneFileBrowser.OpenFilePanelAsync("Open File", "", extensions, false, async (string[] paths) => { if (paths.Length > 0) @@ -235,6 +236,19 @@ namespace HeavenStudio.Editor } } ); + #else + StandaloneFileBrowser.OpenFilePanelAsync("Open File", "", extensions, false, async (string[] paths) => + { + if (paths.Length > 0) + { + Conductor.instance.musicSource.clip = await LoadClip("file://" + Path.Combine(paths)); + changedMusic = true; + + Timeline.FitToSong(); + } + } + ); + #endif } private async Task LoadClip(string path) @@ -300,7 +314,7 @@ namespace HeavenStudio.Editor { new ExtensionFilter("Heaven Studio Remix File", "tengoku") }; - + StandaloneFileBrowser.SaveFilePanelAsync("Save Remix As", "", "remix_level", extensions, (string path) => { if (path != String.Empty) @@ -343,6 +357,7 @@ namespace HeavenStudio.Editor Timeline.instance.TempoInfo.UpdateStartingBPMText(); Timeline.instance.VolumeInfo.UpdateStartingVolumeText(); Timeline.instance.TempoInfo.UpdateOffsetText(); + Timeline.FitToSong(); } public void OpenRemix() @@ -470,4 +485,4 @@ namespace HeavenStudio.Editor } } } -} \ No newline at end of file +}