diff --git a/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/2. Groups/LibraryEditorGroupsTab.cs b/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/2. Groups/LibraryEditorGroupsTab.cs index a4f2db3..33383f4 100644 --- a/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/2. Groups/LibraryEditorGroupsTab.cs +++ b/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/2. Groups/LibraryEditorGroupsTab.cs @@ -148,6 +148,7 @@ protected override void LeftSectionControl() UtilEditor.DrawHorizontalGUILine(); GUILayout.Space(7.5f); + PerUserSettings.GroupBtnScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.GroupBtnScrollRectPos); base.LeftSectionControl(); EditorGUILayout.EndScrollView(); @@ -160,9 +161,11 @@ protected override void LeftSectionControl() /// protected override void RightSectionControl() { + PerUserSettings.GroupScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.GroupScrollRectPos); EditorGUILayout.BeginVertical("Box"); base.RightSectionControl(); EditorGUILayout.EndVertical(); + EditorGUILayout.EndScrollView(); } @@ -205,7 +208,7 @@ protected override void OnLeftGUI() GUILayout.Space(5f); } - PerUserSettings.GroupScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.GroupScrollRectPos, GUILayout.MaxWidth(250)); + foreach (var key in groupKeys) { diff --git a/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/3. Mixers/LibraryEditorMixerTab.cs b/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/3. Mixers/LibraryEditorMixerTab.cs index 7b492e7..0f7f53e 100644 --- a/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/3. Mixers/LibraryEditorMixerTab.cs +++ b/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/3. Mixers/LibraryEditorMixerTab.cs @@ -105,12 +105,25 @@ protected override void LeftSectionControl() UtilEditor.DrawHorizontalGUILine(); GUILayout.Space(7.5f); - PerUserSettings.MixerScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.MixerScrollRectPos); + PerUserSettings.MixerBtnScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.MixerBtnScrollRectPos); base.LeftSectionControl(); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); } + + + /// + /// Changes the right GUI control to something else. + /// + protected override void RightSectionControl() + { + PerUserSettings.MixerScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.MixerScrollRectPos); + EditorGUILayout.BeginVertical("Box"); + base.RightSectionControl(); + EditorGUILayout.EndVertical(); + EditorGUILayout.EndScrollView(); + } /// diff --git a/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/4. Music/LibraryEditorMusicTab.cs b/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/4. Music/LibraryEditorMusicTab.cs index e117420..c0785df 100644 --- a/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/4. Music/LibraryEditorMusicTab.cs +++ b/Carter Games/Audio Manager/Code/Editor/Custom Editors/Editor Windows/Library Window/Sub-Menus/4. Music/LibraryEditorMusicTab.cs @@ -134,8 +134,6 @@ protected override void LeftSectionControl() GUILayout.Space(7.5f); UtilEditor.DrawHorizontalGUILine(); GUILayout.Space(7.5f); - - PerUserSettings.MusicScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.MusicScrollRectPos); if (UtilEditor.LibraryObject.Fp("tracks").Fpr("list").arraySize > 0) { @@ -168,11 +166,25 @@ protected override void LeftSectionControl() } } + PerUserSettings.MusicBtnScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.MusicBtnScrollRectPos); base.LeftSectionControl(); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); } + + + /// + /// Changes the right GUI control to something else. + /// + protected override void RightSectionControl() + { + PerUserSettings.MusicScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.MusicScrollRectPos); + EditorGUILayout.BeginVertical("Box"); + base.RightSectionControl(); + EditorGUILayout.EndVertical(); + EditorGUILayout.EndScrollView(); + } /// diff --git a/Carter Games/Audio Manager/Code/Editor/Systems/Scanning/AudioScanner.cs b/Carter Games/Audio Manager/Code/Editor/Systems/Scanning/AudioScanner.cs index 517139a..5c8d15d 100644 --- a/Carter Games/Audio Manager/Code/Editor/Systems/Scanning/AudioScanner.cs +++ b/Carter Games/Audio Manager/Code/Editor/Systems/Scanning/AudioScanner.cs @@ -40,6 +40,20 @@ public sealed class AudioScanner : AssetPostprocessor ───────────────────────────────────────────────────────────────────────────────────────────────────────────── */ private static bool LibraryExists => ScriptableRef.HasLibraryFile; + + + /// + /// Returns if any audio is found in the project or not. + /// + public static bool AnyAudioInProject + { + get + { + var assets = AssetDatabase.FindAssets("t:AudioClip", null); + if (assets == null) return false; + return assets.Length > 0; + } + } /* ───────────────────────────────────────────────────────────────────────────────────────────────────────────── | Menu Items @@ -113,13 +127,16 @@ public static void ScanForAudio(bool cleanScan) { AudioRemover.RemoveNullLibraryEntries(); - if (GetAllClipsInProject(cleanScan, out var lookup)) + if (AnyAudioInProject) { - UtilEditor.SetLibraryData(lookup, cleanScan); - - StructHandler.RefreshClips(); - - AudioManagerEditorEvents.OnLibraryRefreshed.Raise(); + if (GetAllClipsInProject(cleanScan, out var lookup)) + { + UtilEditor.SetLibraryData(lookup, cleanScan); + + StructHandler.RefreshClips(); + + AudioManagerEditorEvents.OnLibraryRefreshed.Raise(); + } } var mixers = GetAllMixersInProject(); diff --git a/Carter Games/Audio Manager/Code/Editor/Systems/Scanning/FirstScan.cs b/Carter Games/Audio Manager/Code/Editor/Systems/Scanning/FirstScan.cs index bcd6b78..371f622 100644 --- a/Carter Games/Audio Manager/Code/Editor/Systems/Scanning/FirstScan.cs +++ b/Carter Games/Audio Manager/Code/Editor/Systems/Scanning/FirstScan.cs @@ -76,9 +76,14 @@ private static void ShowFirstScan() return; } - if (EditorUtility.DisplayDialog("Audio Library Scan", "Your library has no entries, do you want to scan for audio and mixer groups now?", "Scan", "Cancel")) + if (AudioScanner.AnyAudioInProject) { - AudioScanner.ScanForAudio(true); + if (EditorUtility.DisplayDialog("Audio Library Scan", + "Your library has no entries, do you want to scan for audio and mixer groups now?", "Scan", + "Cancel")) + { + AudioScanner.ScanForAudio(true); + } } PerUserSettings.ScannerInitialized = true; diff --git a/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionChecker.cs b/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionChecker.cs index da80cfc..837e2a1 100644 --- a/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionChecker.cs +++ b/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionChecker.cs @@ -46,6 +46,12 @@ public static class VersionChecker /// Gets if the latest version is this version. /// public static bool IsLatestVersion => Versions.Data.Match(VersionInfo.ProjectVersionNumber); + + + /// + /// Gets if the version here is higher that the latest version. + /// + public static bool IsNewerVersion => Versions.Data.IsHigherVersion(VersionInfo.ProjectVersionNumber); /// diff --git a/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionData.cs b/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionData.cs index 93a341d..0381a8b 100644 --- a/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionData.cs +++ b/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionData.cs @@ -95,5 +95,24 @@ public bool Match(string toCompare) return aVN.Major.Equals(bVN.Major) && aVN.Minor.Equals(bVN.Minor) && aVN.Patch.Equals(bVN.Patch); } + + + /// + /// Gets if the entry is a higher version than the converted version. + /// + /// The version string to compare. + /// If the entry is greater on any (major/minor/patch) value. + public bool IsHigherVersion(string toCompare) + { + var aVN = VersionNumber; + var bVN = new VersionNumber(toCompare); + + if (Match(toCompare)) + { + return false; + } + + return (aVN.Major < bVN.Major) || (aVN.Minor < bVN.Minor) || (aVN.Patch < bVN.Patch); + } } } \ No newline at end of file diff --git a/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionEditorGUI.cs b/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionEditorGUI.cs index 8b905ad..e2e4540 100644 --- a/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionEditorGUI.cs +++ b/Carter Games/Audio Manager/Code/Editor/Systems/Version Validation/VersionEditorGUI.cs @@ -55,9 +55,16 @@ public static void ShowResponseDialogue(bool showIfUptoDate = true) { VersionChecker.ResponseReceived.RemoveAnonymous("versionCheckManual"); - if (!VersionChecker.IsLatestVersion) + if (VersionChecker.IsNewerVersion) { - if (EditorUtility.DisplayDialog($"{VersionInfo.Key} | Update Checker", + if (!showIfUptoDate) return; + EditorUtility.DisplayDialog("Update Checker", + $"You are using a newer version than the currently released one.\n\nYours: {VersionInfo.ProjectVersionNumber}\nLatest: {VersionChecker.LatestVersionNumberString}", + "Continue"); + } + else if (!VersionChecker.IsLatestVersion) + { + if (EditorUtility.DisplayDialog("Update Checker", $"You are using an older version of this package.\n\nCurrent: {VersionInfo.ProjectVersionNumber}\nLatest: {VersionChecker.LatestVersionNumberString}", "Latest Release", "Continue")) { @@ -67,8 +74,7 @@ public static void ShowResponseDialogue(bool showIfUptoDate = true) else { if (!showIfUptoDate) return; - - EditorUtility.DisplayDialog($"{VersionInfo.Key} | Update Checker", + EditorUtility.DisplayDialog("Update Checker", "You are using the latest version!", "Continue"); } diff --git a/Carter Games/Audio Manager/Code/Editor/Utility/AssetVersionData.cs b/Carter Games/Audio Manager/Code/Editor/Utility/AssetVersionData.cs index e7b7672..7e4ee6b 100644 --- a/Carter Games/Audio Manager/Code/Editor/Utility/AssetVersionData.cs +++ b/Carter Games/Audio Manager/Code/Editor/Utility/AssetVersionData.cs @@ -31,7 +31,7 @@ public static class AssetVersionData /// /// The version number of the asset. /// - public static string VersionNumber => "3.0.2"; + public static string VersionNumber => "3.0.4"; /// @@ -40,6 +40,6 @@ public static class AssetVersionData /// /// Asset owner is in the UK, so its D/M/Y format. /// - public static string ReleaseDate => "27/12/2023"; + public static string ReleaseDate => "11/01/2024"; } } \ No newline at end of file diff --git a/Carter Games/Audio Manager/Code/Editor/Utility/Per User Settings/PerUserSettings.cs b/Carter Games/Audio Manager/Code/Editor/Utility/Per User Settings/PerUserSettings.cs index d6d253c..f741d7a 100644 --- a/Carter Games/Audio Manager/Code/Editor/Utility/Per User Settings/PerUserSettings.cs +++ b/Carter Games/Audio Manager/Code/Editor/Utility/Per User Settings/PerUserSettings.cs @@ -56,12 +56,15 @@ public static class PerUserSettings private static readonly string LibScrollRectPosId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab01_LibScrollRectPos"; private static readonly string LastLibraryGroupEntryId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab02_LibGroupIndex"; + private static readonly string GroupBtnScrollRectPosId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab02_GroupBtnScrollRectPos"; private static readonly string GroupScrollRectPosId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab02_ScrollRectPos"; private static readonly string LastLibMixerEntryId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab03_LibMixerIndex"; + private static readonly string MixerBtnScrollRectPosId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab03_MixerBtnScrollRectPos"; private static readonly string MixerScrollRectPosId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab03_ScrollRectPos"; private static readonly string LastLibMusicEntryId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab04_LibMusicIndex"; + private static readonly string MusicBtnScrollRectPosId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab04_MusicBtnScrollRectPos"; private static readonly string MusicScrollRectPosId = $"{UniqueId}_CarterGames_AudioManager_EditorWindow_Tab04_ScrollRectPos"; /* ───────────────────────────────────────────────────────────────────────────────────────────────────────────── @@ -207,6 +210,16 @@ public static int LastLibraryGroupEntry /// /// The scroll rect pos of the group tab left GUI section. /// + public static Vector2 GroupBtnScrollRectPos + { + get => (Vector2) GetOrCreateValue(GroupBtnScrollRectPosId, SettingType.EditorPref); + set => SetValue(GroupBtnScrollRectPosId, SettingType.EditorPref, value); + } + + + /// + /// The scroll rect pos of the group tab right GUI section. + /// public static Vector2 GroupScrollRectPos { get => (Vector2) GetOrCreateValue(GroupScrollRectPosId, SettingType.EditorPref); @@ -225,7 +238,17 @@ public static int LastLibMixerEntry /// - /// The scroll rect pos of the group tab left GUI section. + /// The scroll rect pos of the mixer tab left GUI section. + /// + public static Vector2 MixerBtnScrollRectPos + { + get => (Vector2) GetOrCreateValue(MixerBtnScrollRectPosId, SettingType.EditorPref); + set => SetValue(MixerBtnScrollRectPosId, SettingType.EditorPref, value); + } + + + /// + /// The scroll rect pos of the group tab right GUI section. /// public static Vector2 MixerScrollRectPos { @@ -245,7 +268,17 @@ public static int LastLibMusicEntry /// - /// The scroll rect pos of the music track list tab left GUI section. + /// The scroll rect pos of the music tab left GUI section. + /// + public static Vector2 MusicBtnScrollRectPos + { + get => (Vector2) GetOrCreateValue(MusicBtnScrollRectPosId, SettingType.EditorPref); + set => SetValue(MusicBtnScrollRectPosId, SettingType.EditorPref, value); + } + + + /// + /// The scroll rect pos of the music track list tab right GUI section. /// public static Vector2 MusicScrollRectPos { diff --git a/Carter Games/Audio Manager/Code/Runtime/Audio/Player/AudioPlayerSequence.cs b/Carter Games/Audio Manager/Code/Runtime/Audio/Player/AudioPlayerSequence.cs index 1ad106e..1737c4f 100644 --- a/Carter Games/Audio Manager/Code/Runtime/Audio/Player/AudioPlayerSequence.cs +++ b/Carter Games/Audio Manager/Code/Runtime/Audio/Player/AudioPlayerSequence.cs @@ -23,6 +23,7 @@ using System; using System.Collections.Generic; +using System.Linq; using CarterGames.Common; using UnityEngine; @@ -81,6 +82,12 @@ public sealed class AudioPlayerSequence : MonoBehaviour /// private bool IsLoopCompleted => !LoopInfo.IsInfiniteLoop && LoopInfo.CurrentLoopCount.Equals(LoopInfo.LoopCount); + + /// + /// Returns if any audio is currently being played from this sequence. + /// + public bool IsPlaying => Players.Any(t => t.IsPlaying); + /* ───────────────────────────────────────────────────────────────────────────────────────────────────────────── | Events ───────────────────────────────────────────────────────────────────────────────────────────────────────────── */