// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) VRMADA, All rights reserved.
//
// --------------------------------------------------------------------------------------------------------------------
using System;
using UltimateXR.Core;
using UnityEditor;
using UnityEngine;
namespace UltimateXR.Editor.Sdks.Networking
{
///
/// SDK Locator for the FishNet SDK.
///
public sealed class UxrSdkLocatorFishNet : UxrSdkLocator
{
#region Public Overrides UxrSdkLocator
///
public override SupportType Support => SupportType.Networking;
///
public override string Name => UxrConstants.SdkFishNet;
///
public override string MinimumUnityVersion => "2020.3";
///
public override string[] AvailableSymbols
{
get
{
if (CurrentState == State.Available)
{
if (CurrentVersion == 0)
{
return new[] { "ULTIMATEXR_USE_FISHNET_SDK" };
}
}
return Array.Empty();
}
}
///
public override string[] AllSymbols
{
get { return new[] { "ULTIMATEXR_USE_FISHNET_SDK" }; }
}
///
public override bool CanBeUpdated => true;
///
public override void TryLocate()
{
CurrentState = State.NotInstalled;
if (IsTypeInAssemblies("FishNet.Managing.NetworkManager"))
{
CurrentVersion = 0;
CurrentState = State.Available;
}
}
///
public override void TryGet()
{
Application.OpenURL("https://assetstore.unity.com/packages/tools/network/fish-net-networking-evolved-207815");
}
///
public override void TryUpdate()
{
TryGet();
}
#endregion
#region Public Methods
///
/// Auto-registers the locator each time Unity is launched or the project folder is updated.
///
[InitializeOnLoadMethod]
public static void RegisterLocator()
{
UxrSdkManager.RegisterLocator(new UxrSdkLocatorFishNet());
}
#endregion
#region Private Methods
///
/// Allows to remove dependencies from the project in case the user removed SDK folders manually.
///
[MenuItem(UxrConstants.Editor.MenuPathSdksNetworking + "Remove Symbols for FishNet", priority = UxrConstants.Editor.PriorityMenuPathSdksNetworking)]
private static void RemoveSymbols()
{
UxrSdkManager.RemoveSymbols(new UxrSdkLocatorFishNet());
}
#endregion
}
}