diff --git a/Assets/Rivet/Dockerfile b/Assets/Rivet/Dockerfile index 7165280..d7e395d 100644 --- a/Assets/Rivet/Dockerfile +++ b/Assets/Rivet/Dockerfile @@ -1,5 +1,5 @@ # MARK: Runner -FROM ubuntu:22.04 +FROM debian:12 WORKDIR /app # Install necessary libraries for Unity @@ -10,10 +10,8 @@ RUN apt-get update && apt-get install -y \ && useradd -ms /bin/bash rivet # Copy the precompiled Unity server files -COPY ./Builds/Game /app/Game -# COPY ./Builds/Game_BurstDebugInformation_DoNotShip /app/Game_BurstDebugInformation_DoNotShip -# COPY ./Builds/Game_Data /app/Game_Data -# COPY ./Builds/UnityPlayer.so /app/UnityPlayer.so +COPY builds/LinuxServer/ /app +RUN ls /app && chmod +x /app/LinuxServer.x86_64 # Change to user rivet USER rivet @@ -21,4 +19,4 @@ USER rivet ENV UNITY_SERVER=1 # Run the server -ENTRYPOINT ["./Game", "-batchmode", "-nographics"] +ENTRYPOINT ["/app/LinuxServer.x86_64", "-batchmode", "-nographics"] diff --git a/Assets/Rivet/Editor/CoroutineUtility.cs b/Assets/Rivet/Editor/CoroutineUtility.cs deleted file mode 100644 index f1c854c..0000000 --- a/Assets/Rivet/Editor/CoroutineUtility.cs +++ /dev/null @@ -1,25 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class CoroutineUtility : MonoBehaviour -{ - public static CoroutineUtility instance; - - private void Awake() - { - if (instance == null) - { - instance = this; - DontDestroyOnLoad(gameObject); - } - else - { - Destroy(gameObject); - } - } - - public Coroutine StartGlobalCoroutine(IEnumerator coroutine) - { - return StartCoroutine(coroutine); - } -} \ No newline at end of file diff --git a/Assets/Rivet/Editor/CoroutineUtility.cs.meta b/Assets/Rivet/Editor/CoroutineUtility.cs.meta deleted file mode 100644 index 0a4d63a..0000000 --- a/Assets/Rivet/Editor/CoroutineUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2b601aa65406b41a490ceafaf4bd7764 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Rivet/Editor/EditorCoroutine.cs b/Assets/Rivet/Editor/EditorCoroutine.cs deleted file mode 100644 index 47a7c17..0000000 --- a/Assets/Rivet/Editor/EditorCoroutine.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections; -using UnityEditor; - -public class EditorCoroutine -{ - public static EditorCoroutine Start(IEnumerator routine) - { - EditorCoroutine coroutine = new EditorCoroutine(routine); - coroutine.Start(); - return coroutine; - } - - readonly IEnumerator routine; - EditorCoroutine(IEnumerator routine) - { - this.routine = routine; - } - - void Start() - { - EditorApplication.update += Update; - } - public void Stop() - { - EditorApplication.update -= Update; - } - - void Update() - { - if (!routine.MoveNext()) - { - Stop(); - } - } -} \ No newline at end of file diff --git a/Assets/Rivet/Editor/EditorCoroutine.cs.meta b/Assets/Rivet/Editor/EditorCoroutine.cs.meta deleted file mode 100644 index 289ef3e..0000000 --- a/Assets/Rivet/Editor/EditorCoroutine.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 95c9da3192d364b37b715ecacfdbc85a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Rivet/Editor/Images.meta b/Assets/Rivet/Editor/Images.meta new file mode 100644 index 0000000..c3303eb --- /dev/null +++ b/Assets/Rivet/Editor/Images.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 05e473322652c4d059fa03b7d47a12fb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Rivet/Editor/Images/icon-text-black.svg.meta b/Assets/Rivet/Editor/Images/icon-text-black.svg.meta new file mode 100644 index 0000000..fbe69cd --- /dev/null +++ b/Assets/Rivet/Editor/Images/icon-text-black.svg.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bf9ac639395fa4e11b86c43c257eb82e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Rivet/Editor/Images/icon-text-white.svg.meta b/Assets/Rivet/Editor/Images/icon-text-white.svg.meta new file mode 100644 index 0000000..8facdd4 --- /dev/null +++ b/Assets/Rivet/Editor/Images/icon-text-white.svg.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a479d38aa7a054ac89ad1f120d299577 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Rivet/Editor/RivetCLI.cs b/Assets/Rivet/Editor/RivetCLI.cs index 4fee3c3..8d190f8 100644 --- a/Assets/Rivet/Editor/RivetCLI.cs +++ b/Assets/Rivet/Editor/RivetCLI.cs @@ -1,13 +1,5 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Data.Common; -using System.Diagnostics; using System.IO; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; using Newtonsoft.Json.Linq; -using UnityEngine; public static class RivetCLI { @@ -38,10 +30,7 @@ public static bool CLIInstalled() return false; } return true; - case ErrorResult _: - return false; default: - UnityEngine.Debug.Log("Got different result type"); return false; } } @@ -53,33 +42,28 @@ public static Result RunCommand(params string[] args) public static string GetBinDir() { - string homePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + string homePath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile); return Path.Combine(homePath, ".rivet", REQUIRED_RIVET_CLI_VERSION, "bin"); } public static string GetRivetCLIPath() { - // // Assuming _RivetEditorSettings is a static class with a method GetSetting - // string cliPath = _RivetEditorSettings.GetSetting(RIVET_CLI_PATH_SETTING); - // if (!string.IsNullOrEmpty(cliPath)) - // { - // return cliPath; - // } - return Path.Combine(GetBinDir(), "rivet"); } public static Result RunRivetCLI(params string[] args) { - UnityEngine.Debug.Log($"Running Rivet CLI: {GetRivetCLIPath()} {string.Join(" ", args)}"); + // TODO: Turn this on if debug is enabled + // UnityEngine.Debug.Log($"Running Rivet CLI: {GetRivetCLIPath()} {string.Join(" ", args)}"); if (!File.Exists(GetRivetCLIPath())) { - UnityEngine.Debug.LogError("File does not exist: " + GetRivetCLIPath()); + // TODO: Turn this on if debug is enabled + // UnityEngine.Debug.LogError("File does not exist: " + GetRivetCLIPath()); return new ErrorResult("File does not exist: " + GetRivetCLIPath()); } - var startInfo = new ProcessStartInfo + var startInfo = new System.Diagnostics.ProcessStartInfo { FileName = GetRivetCLIPath(), Arguments = string.Join(" ", args), @@ -90,21 +74,19 @@ public static Result RunRivetCLI(params string[] args) try { - using (var process = Process.Start(startInfo)) - { - var output = process.StandardOutput.ReadToEnd(); - process.WaitForExit(); + using var process = System.Diagnostics.Process.Start(startInfo); + var output = process.StandardOutput.ReadToEnd(); + process.WaitForExit(); - return new SuccessResult(JObject.Parse(output)); - } + return new SuccessResult(JObject.Parse(output)); } - catch (Exception ex) + catch (System.Exception ex) { return new ErrorResult("Failed to start process: " + ex.Message); } } - public static Result _install() + public static Result Install() { string bin_dir = GetBinDir(); diff --git a/Assets/Rivet/Editor/RivetPlugin.cs b/Assets/Rivet/Editor/RivetPlugin.cs index dc2eab7..25e0516 100644 --- a/Assets/Rivet/Editor/RivetPlugin.cs +++ b/Assets/Rivet/Editor/RivetPlugin.cs @@ -1,10 +1,5 @@ -#define IN_EDITOR - using UnityEngine; using UnityEditor; -using System.Diagnostics; -using System.IO; -using Newtonsoft.Json.Linq; public static class ExtensionData { @@ -59,6 +54,15 @@ public void TransitionToState(IState newState) void OnGUI() { + // Draw the global Rivet buttons + + // Links + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Hub")) Application.OpenURL("https://hub.rivet.gg/"); + if (GUILayout.Button("Docs")) Application.OpenURL("https://rivet.gg/docs"); + if (GUILayout.Button("Discord")) Application.OpenURL("https://rivet.gg/discord"); + GUILayout.EndHorizontal(); + // Call the OnGUI method of the current state currentState.OnGUI(); } diff --git a/Assets/Rivet/Editor/RivetThread.cs b/Assets/Rivet/Editor/RivetThread.cs deleted file mode 100644 index 5e907e9..0000000 --- a/Assets/Rivet/Editor/RivetThread.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Threading; - -public class RivetThread -{ - public object _lock = new object(); - public Thread _thread; - public object _output; - - public object Output - { - get - { - lock (_lock) - { - return _output; - } - } - private set - { - lock (_lock) - { - _output = value; - } - } - } - - public RivetThread(Action action) - { - _thread = new Thread(() => - { - // var result = action(); - // Output = result; - }); - _thread.Start(); - } - - public void WaitToFinish() - { - _thread.Join(); - } -} \ No newline at end of file diff --git a/Assets/Rivet/Editor/RivetThread.cs.meta b/Assets/Rivet/Editor/RivetThread.cs.meta deleted file mode 100644 index 8d7b8d8..0000000 --- a/Assets/Rivet/Editor/RivetThread.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8639b3eea24644577853dc347ca5030e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Rivet/Editor/Windows/Installer.cs b/Assets/Rivet/Editor/Windows/Installer.cs index 442e394..bf9695c 100644 --- a/Assets/Rivet/Editor/Windows/Installer.cs +++ b/Assets/Rivet/Editor/Windows/Installer.cs @@ -1,10 +1,5 @@ using UnityEngine; using UnityEditor; -using System.Diagnostics; -using System.IO; -using System.Threading.Tasks; -using System.Collections; -using Newtonsoft.Json.Linq; namespace Rivet { @@ -20,36 +15,8 @@ public Installer() public void OnEnter(RivetPluginWindow pluginWindow) { - new System.Threading.Thread(() => - { - - // var api_address = apiEndpointLineEdit.Text; // replace with your actual control - var api_address = "https://api.rivet.gg"; - - var getLinkResult = RivetCLI.RunCommand( - "--api-endpoint", - api_address, - "sidekick", - "get-namespace-development-token", - "--namespace", - "staging" - ); - - switch (getLinkResult) - { - case SuccessResult successResult: - var token = successResult.Data["Ok"]["token"].ToString(); - break; - case ErrorResult errorResult: - UnityEngine.Debug.LogError(errorResult.Message); - break; - } - - }).Start(); - this.window = pluginWindow; - // Prepare the installer installLabelText = ReplacePlaceholders("%%version%% %%bin_dir%%"); installButtonEnabled = false; @@ -79,9 +46,7 @@ public void OnGUI() // Handle the Install button click new System.Threading.Thread(() => { - // window.TransitionToState(new LoginState(window)); - // return; - var result = RivetCLI._install(); + var result = RivetCLI.Install(); switch (result) { diff --git a/Assets/Rivet/Editor/Windows/Loading.cs b/Assets/Rivet/Editor/Windows/Loading.cs deleted file mode 100644 index e69de29..0000000 diff --git a/Assets/Rivet/Editor/Windows/Loading.cs.meta b/Assets/Rivet/Editor/Windows/Loading.cs.meta deleted file mode 100644 index 96faf30..0000000 --- a/Assets/Rivet/Editor/Windows/Loading.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 69340115a29fc4adb84e12ca0ae1398c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Rivet/Editor/Windows/Login.cs b/Assets/Rivet/Editor/Windows/Login.cs index b8b3b35..8d4648f 100644 --- a/Assets/Rivet/Editor/Windows/Login.cs +++ b/Assets/Rivet/Editor/Windows/Login.cs @@ -1,6 +1,5 @@ using UnityEngine; using UnityEditor; -using System.Collections; using Newtonsoft.Json.Linq; namespace Rivet diff --git a/Assets/Rivet/Editor/Windows/Plugin.cs b/Assets/Rivet/Editor/Windows/Plugin.cs index e074731..8a6e0a6 100644 --- a/Assets/Rivet/Editor/Windows/Plugin.cs +++ b/Assets/Rivet/Editor/Windows/Plugin.cs @@ -17,7 +17,7 @@ public string ApiEndpoint } [JsonProperty("game_id")] public string GameId; - [JsonProperty("token")] public string Token; + [JsonProperty("token")] public string CloudToken; } public class Region @@ -88,65 +88,62 @@ public class Plugin : RivetPluginWindow.IState public RivetPluginWindow window; public BootstrapData bootstrapData; private bool thisMachineSelected = false; - private string rivetEditorToken = ""; public void OnEnter(RivetPluginWindow pluginWindow) { this.window = pluginWindow; - GetBootstrapData(); + new System.Threading.Thread(() => + { + GetBootstrapData(); + }).Start(); } private void GetBootstrapData() { - new System.Threading.Thread(() => - { - var getBootstrapResult = RivetCLI.RunCommand( - "sidekick", - "get-bootstrap-data" - ); - - switch (getBootstrapResult) - { - case SuccessResult successResult: - var data = successResult.Data["Ok"]; - // TODO: Deserialize this better - bootstrapData = new BootstrapData - { - ApiEndpoint = data["api_endpoint"].ToString(), - GameId = data["game_id"].ToString(), - Token = data["token"].ToString() - }; + var getBootstrapResult = RivetCLI.RunCommand( + "sidekick", + "get-bootstrap-data" + ); - Debug.Log("Bootstrap data: " + bootstrapData.ApiEndpoint + " " + bootstrapData.GameId + " " + bootstrapData.Token); + switch (getBootstrapResult) + { + case SuccessResult successResult: + var data = successResult.Data["Ok"]; + // TODO: Deserialize this better + bootstrapData = new BootstrapData + { + ApiEndpoint = data["api_endpoint"].ToString(), + GameId = data["game_id"].ToString(), + CloudToken = data["token"].ToString() + }; - // Fetch plugin data - gameData = FetchPluginData(); + // Update namespaces + FetchPluginData(); - break; - case ErrorResult errorResult: - UnityEngine.Debug.LogError(errorResult.Message); - break; - } - }).Start(); + break; + case ErrorResult errorResult: + UnityEngine.Debug.LogError(errorResult.Message); + break; + } } - public GameData FetchPluginData() + public void FetchPluginData() { using var httpClient = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, $"{bootstrapData.ApiEndpoint}/cloud/games/{bootstrapData.GameId}"); - request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", bootstrapData.Token); + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", bootstrapData.CloudToken); var response = httpClient.SendAsync(request).Result; if (response.StatusCode != HttpStatusCode.OK) { Debug.LogError("Failed to fetch plugin data"); - return null; + return; } var responseBody = response.Content.ReadAsStringAsync().Result; var root = JsonConvert.DeserializeObject(responseBody); - var gameData = new GameData + var newGameData = new GameData { namespaces = new List<(Namespace, Version)>() }; @@ -157,83 +154,57 @@ public GameData FetchPluginData() if (version != null) { - gameData.namespaces.Add((ns, version)); + newGameData.namespaces.Add((ns, version)); } } // Return the data to the main thread - return gameData; + gameData = newGameData; } public void OnGUI() { - // if (GUILayout.Button("Build and Deploy")) - // { - // // Check if Linux build support is installed - // if (!BuildPipeline.IsBuildTargetSupported(BuildTargetGroup.Standalone, BuildTarget.StandaloneLinux64)) - // { - // Debug.LogError("Linux build support is not installed"); - // // return; - // } - - // // Set the build settings - // BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions - // { - // scenes = EditorBuildSettings.scenes.Select(scene => scene.path).ToArray(), - // locationPathName = "build/LinuxServer/LinuxServer.x86_64", // Output path - // target = BuildTarget.StandaloneLinux64, // Target platform - // subtarget = (int)StandaloneBuildSubtarget.Server // Headless mode for server build - // }; - - // // Build the player - // BuildPipeline.BuildPlayer(buildPlayerOptions); - - // // Run deploy with CLI - // new System.Threading.Thread(() => - // { - // var result = RivetCLI.RunCommand( - // "sidekick", - // "--show-terminal", - // "deploy", - // "--namespace", - // gameData.namespaces[selectedIndex].Item1.name_id - // ); - // }).Start(); - // } - // return; - - // The existing GUI code goes here - // Debug.LogError("Start 1"); GUILayout.BeginVertical(); try { - // Logo GUILayout.Label(logoTexture, GUILayout.Width(200), GUILayout.Height(200)); // Horizontal line GUILayout.Label("", GUI.skin.horizontalSlider); - // Links - GUILayout.BeginHorizontal(); - if (GUILayout.Button("Hub")) Application.OpenURL("https://hub.rivet.gg/"); - if (GUILayout.Button("Docs")) Application.OpenURL("https://rivet.gg/docs"); - if (GUILayout.Button("Discord")) Application.OpenURL("https://rivet.gg/discord"); - GUILayout.EndHorizontal(); - // Buttons - if (GUILayout.Button("Playtest")) { showPlaytestOptions = true; showDeployOptions = false; showSettingsOptions = false; } - if (GUILayout.Button("Deploy")) { showDeployOptions = true; showPlaytestOptions = false; showSettingsOptions = false; } + if (GUILayout.Button("Playtest")) + { + showPlaytestOptions = true; + showDeployOptions = false; + showSettingsOptions = false; + new System.Threading.Thread(() => + { + FetchPluginData(); + }).Start(); + } + + if (GUILayout.Button("Deploy")) + { + showDeployOptions = true; + showPlaytestOptions = false; + showSettingsOptions = false; + new System.Threading.Thread(() => + { + FetchPluginData(); + }).Start(); + } + if (GUILayout.Button("Settings")) { showSettingsOptions = true; showDeployOptions = false; showPlaytestOptions = false; } // Playtest options if (showPlaytestOptions) { GUILayout.Label("Server"); - GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); - GUIStyle toggleButtonStyle = new GUIStyle(GUI.skin.button) { normal = GUI.skin.button.active }; - + GUIStyle buttonStyle = new(GUI.skin.button); + GUIStyle toggleButtonStyle = new(GUI.skin.button) { normal = GUI.skin.button.active }; GUILayout.BeginHorizontal(); bool thisMachineClicked = GUILayout.Button("This machine", thisMachineSelected ? toggleButtonStyle : buttonStyle); @@ -260,7 +231,10 @@ public void OnGUI() if (thisMachineClicked || rivetServersClicked || oldSelectedIndex != selectedIndex) { - GetNamespaceToken(); + new System.Threading.Thread(() => + { + GetNamespaceToken(); + }).Start(); } } } @@ -285,11 +259,14 @@ public void OnGUI() if (GUILayout.Button("Build and Deploy")) { + // Update the game token + GetNamespaceToken(); + // Check if Linux build support is installed if (!BuildPipeline.IsBuildTargetSupported(BuildTargetGroup.Standalone, BuildTarget.StandaloneLinux64)) { Debug.LogError("Linux build support is not installed"); - // return; + return; } // Set the build settings @@ -303,7 +280,6 @@ public void OnGUI() // Build the player var result = BuildPipeline.BuildPlayer(buildPlayerOptions); - Debug.Log("Build result: " + result); // Run deploy with CLI new System.Threading.Thread(() => @@ -337,7 +313,6 @@ public void OnGUI() case SuccessResult getLinkSuccessResult: if (getLinkSuccessResult.Data["Ok"] == null) { - // RivetPluginBridge.DisplayCliError(result); TODO: UnityEngine.Debug.LogError("Error: " + result.Data); return; } diff --git a/Assets/Rivet/Runtime/RivetAPI.cs b/Assets/Rivet/Runtime/RivetAPI.cs deleted file mode 100644 index e69de29..0000000 diff --git a/Assets/Rivet/Runtime/RivetAPI.cs.meta b/Assets/Rivet/Runtime/RivetAPI.cs.meta deleted file mode 100644 index 9c1c807..0000000 --- a/Assets/Rivet/Runtime/RivetAPI.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f459b84dae7b743ce84f68aed1f2b191 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Rivet/Runtime/RivetHelper.cs b/Assets/Rivet/Runtime/RivetHelper.cs deleted file mode 100644 index df1f195..0000000 --- a/Assets/Rivet/Runtime/RivetHelper.cs +++ /dev/null @@ -1,69 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; - -namespace Rivet -{ - public class RivetHelper : MonoBehaviour - { - public delegate void StartServer(); - public static event StartServer OnStartServer; - - public delegate void StartClient(); - public static event StartClient OnStartClient; - - private bool multiplayerSetup = false; - private Dictionary playerTokens = new Dictionary(); - private string playerToken = null; - - // Singleton instance - public static RivetHelper Instance { get; private set; } - - private void Awake() - { - // Singleton setup - if (Instance == null) - { - Instance = this; - DontDestroyOnLoad(gameObject); - } - else - { - Destroy(gameObject); - } - } - - public bool IsDedicatedServer() - { - // Check if the environment variable UNITY_SERVER is set - return System.Environment.GetEnvironmentVariable("UNITY_SERVER") == "1"; - } - - public void SetupMultiplayer() - { - Debug.Assert(!multiplayerSetup, "RivetHelper.SetupMultiplayer already called"); - multiplayerSetup = true; - - // Setup SceneMultiplayer here - - if (IsDedicatedServer()) - { - Debug.Log("Starting server"); - OnStartServer?.Invoke(); - } - else - { - Debug.Log("Starting client"); - OnStartClient?.Invoke(); - } - } - - public void SetPlayerToken(string _playerToken) - { - Debug.Assert(multiplayerSetup, "RivetHelper.SetupMultiplayer has not been called"); - Debug.Assert(!IsDedicatedServer(), "Cannot call RivetHelper.SetPlayerToken on server"); - playerToken = _playerToken; - } - - // Implement other methods here - } -} \ No newline at end of file diff --git a/Assets/Rivet/Runtime/RivetHelper.cs.meta b/Assets/Rivet/Runtime/RivetHelper.cs.meta deleted file mode 100644 index 334da80..0000000 --- a/Assets/Rivet/Runtime/RivetHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6522624065039444bb1273c3b1abb08c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Rivet/Runtime/RivetManager.cs b/Assets/Rivet/Runtime/RivetManager.cs index e3b93e2..b0bb327 100644 --- a/Assets/Rivet/Runtime/RivetManager.cs +++ b/Assets/Rivet/Runtime/RivetManager.cs @@ -8,7 +8,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; -using UnityEngine.Serialization; [JsonConverter(typeof(StringEnumConverter))] public enum CreateLobbyRequestPublicity @@ -89,15 +88,12 @@ public class RivetManager : MonoBehaviour private void Start() { // Try to load Rivet runtime settings - var rivetSettings = Resources.Load("RivetSettings"); - if (rivetSettings != null) - { - Debug.Log("RivetSettings: " + rivetSettings.RivetToken); - RivetToken = rivetSettings.RivetToken; - - Debug.Log("RivetSettings: " + rivetSettings.ApiEndpoint); - ApiEndpoint = rivetSettings.ApiEndpoint; - } + var rivetSettings = Resources.Load("RivetSettings"); + if (rivetSettings != null) + { + RivetToken = rivetSettings.RivetToken; + ApiEndpoint = rivetSettings.ApiEndpoint; + } } #region API: Matchmaker.Lobbies @@ -118,9 +114,6 @@ public IEnumerator FindLobby(FindLobbyRequest request, Action { // Save response FindLobbyResponse = res; - - - success(res); }, fail); } @@ -141,12 +134,6 @@ public IEnumerator JoinLobby(JoinLobbyRequest request, Action { // Save response FindLobbyResponse = res; - - // // Connect to server - // var port = res.Ports["default"]; - // Debug.Log("Connecting to " + port.Hostname + ":" + port.Port); - // _networkManager.ClientManager.StartConnection(port.Hostname, port.Port); - success(res); }, fail); } @@ -167,12 +154,6 @@ public IEnumerator CreateLobby(CreateLobbyRequest request, Action 0) { return token; } -#endif // Try loading from PlayerPrefs string value = PlayerPrefs.GetString("RIVET_EDITOR_TOKEN"); @@ -261,6 +230,7 @@ private string GetToken() return value; } + // Try loading from RivetSettings if (RivetToken != null && RivetToken.Length > 0) { return RivetToken; @@ -271,7 +241,6 @@ private string GetToken() public IEnumerator PostRequest(string url, TReq requestBody, Action success, Action fail, string token = "") { - Debug.Log("PostRequest: " + url); if (token.Length == 0) { token = GetToken(); @@ -281,7 +250,6 @@ public IEnumerator PostRequest(string url, TReq requestBody, Action< var requestBodyStr = JsonConvert.SerializeObject(requestBody, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); - Debug.Log(debugRequestDescription + " Request: " + requestBodyStr + "\n" + Environment.StackTrace); var www = UnityWebRequest.Post(url, requestBodyStr, "application/json"); www.SetRequestHeader("Authorization", "Bearer " + token); @@ -291,12 +259,10 @@ public IEnumerator PostRequest(string url, TReq requestBody, Action< switch (www.result) { case UnityWebRequest.Result.InProgress: - Debug.Log("In progress"); break; case UnityWebRequest.Result.Success: if (www.responseCode == 200) { - Debug.Log(debugRequestDescription + " Success: " + www.downloadHandler.text); var responseBody = JsonConvert.DeserializeObject(www.downloadHandler.text); success(responseBody!); } @@ -336,7 +302,6 @@ public IEnumerator GetRequest(string url, Action success, Action(string url, Action success, Action(www.downloadHandler.text); success(responseBody!); } diff --git a/Assets/Rivet/Runtime/RivetRuntime.cs b/Assets/Rivet/Runtime/RivetRuntime.cs deleted file mode 100644 index e69de29..0000000 diff --git a/Assets/Rivet/Runtime/RivetRuntime.cs.meta b/Assets/Rivet/Runtime/RivetRuntime.cs.meta deleted file mode 100644 index 326af3e..0000000 --- a/Assets/Rivet/Runtime/RivetRuntime.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5e6c4d24fa99541398fd4eeb6cd6f707 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 866c11f..bf15286 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,16 +1,24 @@ { "dependencies": { + "com.unity.2d.sprite": "1.0.0", + "com.unity.2d.tilemap": "1.0.0", + "com.unity.ads": "4.4.2", + "com.unity.ai.navigation": "1.1.5", + "com.unity.analytics": "3.8.1", "com.unity.collab-proxy": "2.3.1", "com.unity.feature.2d": "2.0.0", "com.unity.ide.rider": "3.0.27", "com.unity.ide.visualstudio": "2.0.22", + "com.unity.ide.vscode": "1.2.5", "com.unity.nuget.newtonsoft-json": "3.2.1", + "com.unity.purchasing": "4.9.3", "com.unity.test-framework": "1.1.33", "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.7.6", "com.unity.toolchain.macos-arm64-linux-x86_64": "2.0.0", "com.unity.ugui": "1.0.0", "com.unity.visualscripting": "1.9.1", + "com.unity.xr.legacyinputhelpers": "2.1.10", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 2eacf77..193bf41 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -58,7 +58,7 @@ }, "com.unity.2d.sprite": { "version": "1.0.0", - "depth": 1, + "depth": 0, "source": "builtin", "dependencies": {} }, @@ -75,7 +75,7 @@ }, "com.unity.2d.tilemap": { "version": "1.0.0", - "depth": 1, + "depth": 0, "source": "builtin", "dependencies": { "com.unity.modules.tilemap": "1.0.0", @@ -94,6 +94,34 @@ }, "url": "https://packages.unity.com" }, + "com.unity.ads": { + "version": "4.4.2", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ai.navigation": { + "version": "1.1.5", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.ai": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.analytics": { + "version": "3.8.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.services.analytics": "1.0.4", + "com.unity.ugui": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.burst": { "version": "1.8.12", "depth": 3, @@ -161,6 +189,13 @@ }, "url": "https://packages.unity.com" }, + "com.unity.ide.vscode": { + "version": "1.2.5", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, "com.unity.mathematics": { "version": "1.2.6", "depth": 2, @@ -175,6 +210,42 @@ "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.purchasing": { + "version": "4.9.3", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0", + "com.unity.modules.unityanalytics": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", + "com.unity.services.core": "1.8.1" + }, + "url": "https://packages.unity.com" + }, + "com.unity.services.analytics": { + "version": "5.0.0", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.services.core": "1.10.1" + }, + "url": "https://packages.unity.com" + }, + "com.unity.services.core": { + "version": "1.12.2", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.nuget.newtonsoft-json": "3.2.1", + "com.unity.modules.androidjni": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.sysroot": { "version": "2.0.7", "depth": 1, @@ -252,6 +323,16 @@ }, "url": "https://packages.unity.com" }, + "com.unity.xr.legacyinputhelpers": { + "version": "2.1.10", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.vr": "1.0.0", + "com.unity.modules.xr": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.modules.ai": { "version": "1.0.0", "depth": 0,