Skip to content

Commit

Permalink
refactor: replacing version enum with assembly version (MirageNet#663)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Version.Current is no longer an enum and now returns Mirage's assembly version
  • Loading branch information
James-Frowen committed Mar 6, 2021
1 parent ab730a0 commit d8facb7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
9 changes: 2 additions & 7 deletions Assets/Mirage/Editor/WelcomeWindow/WelcomeWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ public class WelcomeWindow : EditorWindow
private static string firstStartUpKey = string.Empty;
private const string firstTimeMirageKey = "MirageWelcome";

private static string GetVersion()
{
return typeof(NetworkIdentity).Assembly.GetName().Version.ToString();
}

#region Handle visibility

private static bool ShowChangeLog
Expand Down Expand Up @@ -92,7 +87,7 @@ static WelcomeWindow()
private static void ShowWindowOnFirstStart()
{
EditorApplication.update -= ShowWindowOnFirstStart;
firstStartUpKey = GetVersion();
firstStartUpKey = Version.Current;

if ((!EditorPrefs.GetBool(firstTimeMirageKey, false) || !EditorPrefs.GetBool(firstStartUpKey, false)) && firstStartUpKey != "MirageUnknown")
{
Expand Down Expand Up @@ -139,7 +134,7 @@ private void OnEnable()

//set the version text
Label versionText = root.Q<Label>("VersionText");
versionText.text = "v" + GetVersion();
versionText.text = "v" + Version.Current;

#region Page buttons

Expand Down
3 changes: 2 additions & 1 deletion Assets/Mirage/Runtime/NetworkServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ void Initialize()
initialized = true;

Application.quitting += Disconnect;
if (logger.LogEnabled()) logger.Log("NetworkServer Created version " + Version.Current);
if (logger.LogEnabled()) logger.Log($"NetworkServer Created, Mirage version: {Version.Current}");


//Make sure connections are cleared in case any old connections references exist from previous sessions
connections.Clear();
Expand Down
4 changes: 2 additions & 2 deletions Assets/Mirage/Runtime/UNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public enum MirageInvokeType
ClientRpc
}

public enum Version
public static class Version
{
Current = 1
public static readonly string Current = typeof(NetworkIdentity).Assembly.GetName().Version.ToString();
}

/// <summary>
Expand Down

0 comments on commit d8facb7

Please sign in to comment.