Skip to content

Commit

Permalink
📦 Release 2.2.1
Browse files Browse the repository at this point in the history
🚧 2.2.1 Release bits
  • Loading branch information
JonathanMCarter authored May 16, 2024
2 parents 611b746 + bae7572 commit 181a461
Show file tree
Hide file tree
Showing 8 changed files with 726 additions and 382 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2024 Carter Games
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Expand Down Expand Up @@ -46,7 +46,13 @@ 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>
/// Gets the version data downloaded.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2024 Carter Games
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Expand Down 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
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2024 Carter Games
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Expand Down Expand Up @@ -43,10 +43,11 @@ public static void DrawCheckForUpdatesButton()
if (!GUILayout.Button("Check For Updates", GUILayout.MaxWidth(135))) return;

VersionChecker.GetLatestVersions();

VersionChecker.ResponseReceived.AddAnonymous("versionCheckManual", () => ShowResponseDialogue());
}


/// <summary>
/// Shows the response to a version check call as a dialogue box.
/// </summary>
Expand All @@ -55,9 +56,16 @@ public static void ShowResponseDialogue(bool showIfUptoDate = true)
{
VersionChecker.ResponseReceived.RemoveAnonymous("versionCheckManual");

if (!VersionChecker.IsLatestVersion)
if (VersionChecker.IsNewerVersion)
{
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($"{VersionInfo.Key} | Update Checker",
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 +75,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 => "2.2.0";
public static string VersionNumber => "2.2.1";


/// <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 => "31/03/2024";
public static string ReleaseDate => "16/05/2024";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ public LeaderboardEntryTime(string name, SerializableTime time)
/// <returns>The formatted string.</returns>
public string ValueFormatted(DisplayTimeFormat format)
{
Debug.Log(EntryValueAsTime.TotalSeconds);

switch (format)
{
case DisplayTimeFormat.SecondsOnly:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace CarterGames.Assets.LeaderboardManager.Serialization
/// Stored a time value in a readable format.
/// </summary>
[Serializable]
public struct SerializableTime
public struct SerializableTime : IComparable
{
/* ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
| Fields
Expand Down Expand Up @@ -277,7 +277,7 @@ public override string ToString()
return date.ToString(CultureInfo.InvariantCulture);
}


public string ToString(string format)
{
var date = new DateTime();
Expand All @@ -300,5 +300,14 @@ public string ToString(string format, IFormatProvider provider)
date = date.AddTicks(Ticks);
return date.ToString(format, provider);
}


public int CompareTo(object obj)
{
if (obj == null) return 1;

if (Ticks > ((SerializableTime) obj).Ticks) return 1;
return Ticks < ((SerializableTime) obj).Ticks ? -1 : 0;
}
}
}
Loading

0 comments on commit 181a461

Please sign in to comment.