Skip to content

Commit

Permalink
📦 3.0.3 & 3.0.4 Releases
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanMCarter committed Jan 11, 2024
1 parent 938d7e4 commit 25ca75d
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ protected override void LeftSectionControl()
UtilEditor.DrawHorizontalGUILine();
GUILayout.Space(7.5f);

PerUserSettings.GroupBtnScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.GroupBtnScrollRectPos);
base.LeftSectionControl();
EditorGUILayout.EndScrollView();

Expand All @@ -160,9 +161,11 @@ protected override void LeftSectionControl()
/// </summary>
protected override void RightSectionControl()
{
PerUserSettings.GroupScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.GroupScrollRectPos);
EditorGUILayout.BeginVertical("Box");
base.RightSectionControl();
EditorGUILayout.EndVertical();
EditorGUILayout.EndScrollView();
}


Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}


/// <summary>
/// Changes the right GUI control to something else.
/// </summary>
protected override void RightSectionControl()
{
PerUserSettings.MixerScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.MixerScrollRectPos);
EditorGUILayout.BeginVertical("Box");
base.RightSectionControl();
EditorGUILayout.EndVertical();
EditorGUILayout.EndScrollView();
}


/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -168,11 +166,25 @@ protected override void LeftSectionControl()
}
}

PerUserSettings.MusicBtnScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.MusicBtnScrollRectPos);
base.LeftSectionControl();
EditorGUILayout.EndScrollView();

EditorGUILayout.EndVertical();
}


/// <summary>
/// Changes the right GUI control to something else.
/// </summary>
protected override void RightSectionControl()
{
PerUserSettings.MusicScrollRectPos = EditorGUILayout.BeginScrollView(PerUserSettings.MusicScrollRectPos);
EditorGUILayout.BeginVertical("Box");
base.RightSectionControl();
EditorGUILayout.EndVertical();
EditorGUILayout.EndScrollView();
}


/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ public sealed class AudioScanner : AssetPostprocessor
───────────────────────────────────────────────────────────────────────────────────────────────────────────── */

private static bool LibraryExists => ScriptableRef.HasLibraryFile;


/// <summary>
/// Returns if any audio is found in the project or not.
/// </summary>
public static bool AnyAudioInProject
{
get
{
var assets = AssetDatabase.FindAssets("t:AudioClip", null);
if (assets == null) return false;
return assets.Length > 0;
}
}

/* ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
| Menu Items
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public static class VersionChecker
/// Gets if the latest version is this version.
/// </summary>
public static bool IsLatestVersion => Versions.Data.Match(VersionInfo.ProjectVersionNumber);


/// <summary>
/// Gets if the version here is higher that the latest version.
/// </summary>
public static bool IsNewerVersion => Versions.Data.IsHigherVersion(VersionInfo.ProjectVersionNumber);


/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


/// <summary>
/// Gets if the entry is a higher version than the converted version.
/// </summary>
/// <param name="toCompare">The version string to compare.</param>
/// <returns>If the entry is greater on any (major/minor/patch) value.</returns>
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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
{
Expand All @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static class AssetVersionData
/// <summary>
/// The version number of the asset.
/// </summary>
public static string VersionNumber => "3.0.2";
public static string VersionNumber => "3.0.4";


/// <summary>
Expand All @@ -40,6 +40,6 @@ public static class AssetVersionData
/// <remarks>
/// Asset owner is in the UK, so its D/M/Y format.
/// </remarks>
public static string ReleaseDate => "27/12/2023";
public static string ReleaseDate => "11/01/2024";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/* ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -207,6 +210,16 @@ public static int LastLibraryGroupEntry
/// <summary>
/// The scroll rect pos of the group tab left GUI section.
/// </summary>
public static Vector2 GroupBtnScrollRectPos
{
get => (Vector2) GetOrCreateValue<Vector2>(GroupBtnScrollRectPosId, SettingType.EditorPref);
set => SetValue<Vector2>(GroupBtnScrollRectPosId, SettingType.EditorPref, value);
}


/// <summary>
/// The scroll rect pos of the group tab right GUI section.
/// </summary>
public static Vector2 GroupScrollRectPos
{
get => (Vector2) GetOrCreateValue<Vector2>(GroupScrollRectPosId, SettingType.EditorPref);
Expand All @@ -225,7 +238,17 @@ public static int LastLibMixerEntry


/// <summary>
/// The scroll rect pos of the group tab left GUI section.
/// The scroll rect pos of the mixer tab left GUI section.
/// </summary>
public static Vector2 MixerBtnScrollRectPos
{
get => (Vector2) GetOrCreateValue<Vector2>(MixerBtnScrollRectPosId, SettingType.EditorPref);
set => SetValue<Vector2>(MixerBtnScrollRectPosId, SettingType.EditorPref, value);
}


/// <summary>
/// The scroll rect pos of the group tab right GUI section.
/// </summary>
public static Vector2 MixerScrollRectPos
{
Expand All @@ -245,7 +268,17 @@ public static int LastLibMusicEntry


/// <summary>
/// The scroll rect pos of the music track list tab left GUI section.
/// The scroll rect pos of the music tab left GUI section.
/// </summary>
public static Vector2 MusicBtnScrollRectPos
{
get => (Vector2) GetOrCreateValue<Vector2>(MusicBtnScrollRectPosId, SettingType.EditorPref);
set => SetValue<Vector2>(MusicBtnScrollRectPosId, SettingType.EditorPref, value);
}


/// <summary>
/// The scroll rect pos of the music track list tab right GUI section.
/// </summary>
public static Vector2 MusicScrollRectPos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

using System;
using System.Collections.Generic;
using System.Linq;
using CarterGames.Common;
using UnityEngine;

Expand Down Expand Up @@ -81,6 +82,12 @@ public sealed class AudioPlayerSequence : MonoBehaviour
/// </summary>
private bool IsLoopCompleted => !LoopInfo.IsInfiniteLoop && LoopInfo.CurrentLoopCount.Equals(LoopInfo.LoopCount);


/// <summary>
/// Returns if any audio is currently being played from this sequence.
/// </summary>
public bool IsPlaying => Players.Any(t => t.IsPlaying);

/* ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
| Events
───────────────────────────────────────────────────────────────────────────────────────────────────────────── */
Expand Down

0 comments on commit 25ca75d

Please sign in to comment.