From 9aa5f121d569c3efcbc08d0ffbef32fe5b0b723c Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:12:08 +0500 Subject: [PATCH 01/16] feat: multiple callbacks per event RPC --- .../scripts/GameManagerDemo.cs | 1 - .../modules/Helpers/CallbackManager.cs | 45 +++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs b/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs index bcc79ea..a99fc5f 100644 --- a/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs +++ b/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs @@ -93,7 +93,6 @@ private void AddPlayer(PlayroomKit.Player player) } - [MonoPInvokeCallback(typeof(Action))] private void RemovePlayer(string playerID) { if (PlayerDict.TryGetValue(playerID, out var player)) diff --git a/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs b/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs index 019fa9d..0caa2e1 100644 --- a/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs +++ b/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs @@ -8,7 +8,46 @@ namespace Playroom public static class CallbackManager { private static Dictionary callbacks = new(); - + + private static Dictionary>> RpcCallBacks = new(); + + public static string RegisterRpcCallback(Action callback, string key = null) + { + if (string.IsNullOrEmpty(key)) + key = GenerateKey(); + + if (RpcCallBacks.ContainsKey(key)) + { + RpcCallBacks[key].Add(callback); + } + else + { + RpcCallBacks.Add(key, new List> { callback }); + } + + Debug.Log($"{key} and number of callbacks {RpcCallBacks[key].Count}"); + return key; + } + + public static void InvokeRpcRegisterCallBack(string name, string data, string sender) + { + if (RpcCallBacks.TryGetValue(name, out List> callbacks)) + { + for (var i = 0; i < callbacks.Count; i++) + { + var callback = callbacks[i]; + Debug.Log("Looping in InvokeRPCRegisterCallback"); + callback?.Invoke(data, sender); + } + } + else + { + Debug.LogWarning( + $"Callback with key {name} not found!, maybe register the callback or call the correct playroom function?"); + } + } + + public static string RegisterCallback(Delegate callback, string key = null) { if (string.IsNullOrEmpty(key)) @@ -44,12 +83,12 @@ public static void InvokeCallback(string key, params string[] args) $"Callback with key {key} not found!, maybe register the callback or call the correct playroom function?"); } } - + public static bool CheckCallback(string key) { return callbacks.TryGetValue(key, out Delegate callback); } - + private static string GenerateKey() { From 68b07994fe8ee9ffd12d4853f4a295f374cd5c15 Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:42:31 +0500 Subject: [PATCH 02/16] fix: same rpc event tested --- .../scripts/GameManagerIsometric.cs | 5 +- .../scripts/GameManagerDemo.cs | 5 ++ Assets/PlayroomKit/modules/RPC/RPC.cs | 60 +++++++++---------- Assets/Scripts/GameManager.cs | 23 ++++--- ProjectSettings/EditorBuildSettings.asset | 6 -- 5 files changed, 49 insertions(+), 50 deletions(-) diff --git a/Assets/PlayroomKit/Examples/discord-activity/scripts/GameManagerIsometric.cs b/Assets/PlayroomKit/Examples/discord-activity/scripts/GameManagerIsometric.cs index bd60052..8d901a7 100644 --- a/Assets/PlayroomKit/Examples/discord-activity/scripts/GameManagerIsometric.cs +++ b/Assets/PlayroomKit/Examples/discord-activity/scripts/GameManagerIsometric.cs @@ -54,7 +54,7 @@ private void Update() { Debug.Log("Space Down"); _playroomKit.RpcCall("one", "69420", PlayroomKit.RpcMode.ALL); - _playroomKit.RpcCall("two", "2", PlayroomKit.RpcMode.ALL); + // _playroomKit.RpcCall("two", "2", PlayroomKit.RpcMode.ALL); } var myPlayer = _playroomKit.MyPlayer(); @@ -77,7 +77,6 @@ private void Update() if (playerGameObjects[i] != null) { playerGameObjects[i].GetComponent().SetPositionAndRotation(pos, rotate); - playerGameObjects[i].GetComponent().material.color = color; } } @@ -103,8 +102,6 @@ private void AddPlayer(PlayroomKit.Player player) player.OnQuit(RemovePlayer); } - // FIX: - [MonoPInvokeCallback(typeof(Action))] private static void RemovePlayer(string playerID) { Debug.Log("Here?"); diff --git a/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs b/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs index a99fc5f..936cdc8 100644 --- a/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs +++ b/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs @@ -239,6 +239,11 @@ public void HandleValueChange(int index) public void RegisterRpcShoot() { _playroomKit.RpcRegister("ShootLaser", HandleScoreUpdate, "You shot a bullet!"); + _playroomKit.RpcRegister("ShootLaser", (aS, aS1) => + { + Debug.Log("Shoot RPC called again"); + }); + Debug.Log("Shoot function registered"); logsText.text = "ShootLaser RPC registered"; } diff --git a/Assets/PlayroomKit/modules/RPC/RPC.cs b/Assets/PlayroomKit/modules/RPC/RPC.cs index 051d43a..b9dc76e 100644 --- a/Assets/PlayroomKit/modules/RPC/RPC.cs +++ b/Assets/PlayroomKit/modules/RPC/RPC.cs @@ -36,49 +36,42 @@ public RPC(PlayroomKit playroomKit, IInterop interop) public void RpcRegister(string name, Action rpcRegisterCallback, string onResponseReturn = null) { - CallbackManager.RegisterCallback(rpcRegisterCallback, name); + CallbackManager.RegisterRpcCallback(rpcRegisterCallback, name); _interop.RpcRegisterWrapper(name, InvokeRpcRegisterCallBack, onResponseReturn); } public void RpcCall(string name, object data, RpcMode mode, Action callbackOnResponse = null) { - if (CallbackManager.CheckCallback(name)) - { - string jsonData = ConvertToJson(data); + string jsonData = ConvertToJson(data); - if (OnResponseCallbacks.ContainsKey(name)) - { - OnResponseCallbacks[name].Add(callbackOnResponse); - } - else + if (OnResponseCallbacks.ContainsKey(name)) + { + OnResponseCallbacks[name].Add(callbackOnResponse); + } + else + { + OnResponseCallbacks.Add(name, new List { callbackOnResponse }); + if (!RpcCalledEvents.Contains(name)) { - OnResponseCallbacks.Add(name, new List { callbackOnResponse }); - if (!RpcCalledEvents.Contains(name)) - { - RpcCalledEvents.Add(name); - } + RpcCalledEvents.Add(name); } + } - JSONArray jsonArray = new JSONArray(); - foreach (string item in RpcCalledEvents) - { - jsonArray.Add(item); - } + JSONArray jsonArray = new JSONArray(); + foreach (string item in RpcCalledEvents) + { + jsonArray.Add(item); + } - string jsonString = jsonArray.ToString(); + string jsonString = jsonArray.ToString(); /* This is required to sync the rpc events between all players, without this players won't know which event has been called. Update: This fix works fine for now, but there might be a better way. this is a temporary fix, RPCs need to be handled within JSLIB for better control. */ - _playroomKit.SetState("rpcCalledEventName", jsonString, reliable: true); - _interop.RpcCallWrapper(name, jsonData, mode, InvokeOnResponseCallback); - } - else - { - Debug.LogError("RPC is not registered!, register RPC first."); - } + _playroomKit.SetState("rpcCalledEventName", jsonString, reliable: true); + _interop.RpcCallWrapper(name, jsonData, mode, InvokeOnResponseCallback); } public void RpcCall(string name, object data, Action callbackOnResponse = null) @@ -136,7 +129,6 @@ protected static void InvokeRpcRegisterCallBack(string dataJson, string senderJs Debug.LogError(ex.Message); } - List updatedRpcCalledEvents = new(); // This state is required to update the called rpc events list, (Temp fix see RpcCall for more) string nameJson = _playroomKit.GetState("rpcCalledEventName"); @@ -150,12 +142,18 @@ protected static void InvokeRpcRegisterCallBack(string dataJson, string senderJs updatedRpcCalledEvents.Add(item); } - foreach (string name in updatedRpcCalledEvents) + Debug.Log(updatedRpcCalledEvents.Count); + + for (var i = 0; i < updatedRpcCalledEvents.Count; i++) { - CallbackManager.InvokeCallback(name, dataJson, senderJson); + string name = updatedRpcCalledEvents[i]; + + Debug.Log("i " + i + " name " + name); + + CallbackManager.InvokeRpcRegisterCallBack(name, dataJson, senderJson); } } - + #endregion #region Helpers diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index b12f361..57c333e 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -13,18 +13,23 @@ public class GameManager : MonoBehaviour /// /// List of players and their gameObjects. /// - [SerializeField] private List players = new(); + [SerializeField] + private List players = new(); private static readonly List playerGameObjects = new(); private static readonly Dictionary PlayerDict = new(); - [SerializeField] private GameObject playerPrefab; + [SerializeField] + private GameObject playerPrefab; - [SerializeField] private TextMeshProUGUI playerIDText; - [SerializeField] private TextMeshProUGUI score; + [SerializeField] + private TextMeshProUGUI playerIDText; + [SerializeField] + private TextMeshProUGUI score; - [SerializeField] private string playerID; + [SerializeField] + private string playerID; private PlayroomKit _playroomKit = new PlayroomKit(); @@ -37,12 +42,12 @@ void Start() }, () => { _playroomKit.OnPlayerJoin(AddPlayer); - _playroomKit.RpcRegister("score", (data, caller) => print($"{data} by {_playroomKit.GetPlayer(caller).GetProfile().name}")); + _playroomKit.RpcRegister("score", + (data, caller) => print($"{data} by {_playroomKit.GetPlayer(caller).GetProfile().name}")); }, () => { Debug.Log("OnDisconnect callback"); }); } - - - + + /// /// Update the player position and sync. /// diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index ab0bf7e..0273124 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -5,18 +5,12 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_Scenes: - - enabled: 0 - path: Assets/Scenes/Lobby.unity - guid: 27215d4ccddeb6d49af03911dd97f9b1 - enabled: 0 path: Assets/PlayroomKit/Examples/2d-platformer/2d-platformer.unity guid: cf82eec4c654cf44b89cec2a91afebd5 - enabled: 0 path: Assets/PlayroomKit/Examples/discord-activity/discord-activity.unity guid: bb7ef8e4a67f3fb46b78e5d95a6858a7 - - enabled: 0 - path: Assets/Scenes/topdown.unity - guid: 490247da3cf48784ab657a183ba059d1 - enabled: 1 path: Assets/PlayroomKit/Examples/package-showcase/showcase.unity guid: 85c9af77ae006408ab24500b953a9035 From 866a65f8a02a3cfdd50ac4ca6bd6e3b1f61cdb55 Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:57:20 +0500 Subject: [PATCH 03/16] feat: same event 2 different callbacks --- .../package-showcase/scripts/GameManagerDemo.cs | 13 +++++-------- .../Examples/package-showcase/showcase.unity | 2 +- .../PlayroomKit/modules/Helpers/CallbackManager.cs | 1 + 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs b/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs index 936cdc8..638f437 100644 --- a/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs +++ b/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs @@ -238,20 +238,16 @@ public void HandleValueChange(int index) public void RegisterRpcShoot() { - _playroomKit.RpcRegister("ShootLaser", HandleScoreUpdate, "You shot a bullet!"); - _playroomKit.RpcRegister("ShootLaser", (aS, aS1) => - { - Debug.Log("Shoot RPC called again"); - }); - + _playroomKit.RpcRegister("ShootLaser", HandleScoreUpdate); + _playroomKit.RpcRegister("ShootLaser", (aS, aS1) => { Debug.LogWarning("Shoot RPC called again"); }); + Debug.Log("Shoot function registered"); logsText.text = "ShootLaser RPC registered"; } private void HandleScoreUpdate(string data, string caller) { - var player = _playroomKit.GetPlayer(caller); - Debug.Log($"Caller: {caller}, Player Name: {player?.GetProfile().name}, Data: {data}"); + Debug.LogWarning("Handle Score Called"); if (PlayerDict.TryGetValue(caller, out var playerObj)) { @@ -278,6 +274,7 @@ public void ShootLaser() var myPlayer = _playroomKit.MyPlayer(); var index = players.IndexOf(myPlayer); score = playerGameObjects[index].GetComponent().ShootLaser(score); + _playroomKit.RpcCall("ShootLaser", score, PlayroomKit.RpcMode.ALL, () => { logsText.text = "ShootLaser RPC Called"; }); } diff --git a/Assets/PlayroomKit/Examples/package-showcase/showcase.unity b/Assets/PlayroomKit/Examples/package-showcase/showcase.unity index c377cf5..8ce687e 100644 --- a/Assets/PlayroomKit/Examples/package-showcase/showcase.unity +++ b/Assets/PlayroomKit/Examples/package-showcase/showcase.unity @@ -7773,7 +7773,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} propertyPath: mockMode - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} propertyPath: insertCoinCaller diff --git a/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs b/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs index 0caa2e1..45d59b1 100644 --- a/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs +++ b/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs @@ -37,6 +37,7 @@ public static void InvokeRpcRegisterCallBack(string name, string data, string se { var callback = callbacks[i]; Debug.Log("Looping in InvokeRPCRegisterCallback"); + callback?.Invoke(data, sender); } } From fa3b75537532a0c7a62c8458d2917c3362390da5 Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Fri, 22 Nov 2024 11:40:06 +0500 Subject: [PATCH 04/16] chore: removed logs --- .../Examples/package-showcase/scripts/GameManagerDemo.cs | 1 - Assets/PlayroomKit/modules/Helpers/CallbackManager.cs | 3 --- Assets/PlayroomKit/modules/RPC/RPC.cs | 3 --- ProjectSettings/ProjectSettings.asset | 2 +- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs b/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs index 638f437..e555ae1 100644 --- a/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs +++ b/Assets/PlayroomKit/Examples/package-showcase/scripts/GameManagerDemo.cs @@ -239,7 +239,6 @@ public void HandleValueChange(int index) public void RegisterRpcShoot() { _playroomKit.RpcRegister("ShootLaser", HandleScoreUpdate); - _playroomKit.RpcRegister("ShootLaser", (aS, aS1) => { Debug.LogWarning("Shoot RPC called again"); }); Debug.Log("Shoot function registered"); logsText.text = "ShootLaser RPC registered"; diff --git a/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs b/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs index 45d59b1..041fd1d 100644 --- a/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs +++ b/Assets/PlayroomKit/modules/Helpers/CallbackManager.cs @@ -25,7 +25,6 @@ public static string RegisterRpcCallback(Action callback, string RpcCallBacks.Add(key, new List> { callback }); } - Debug.Log($"{key} and number of callbacks {RpcCallBacks[key].Count}"); return key; } @@ -36,8 +35,6 @@ public static void InvokeRpcRegisterCallBack(string name, string data, string se for (var i = 0; i < callbacks.Count; i++) { var callback = callbacks[i]; - Debug.Log("Looping in InvokeRPCRegisterCallback"); - callback?.Invoke(data, sender); } } diff --git a/Assets/PlayroomKit/modules/RPC/RPC.cs b/Assets/PlayroomKit/modules/RPC/RPC.cs index b9dc76e..5741543 100644 --- a/Assets/PlayroomKit/modules/RPC/RPC.cs +++ b/Assets/PlayroomKit/modules/RPC/RPC.cs @@ -147,9 +147,6 @@ protected static void InvokeRpcRegisterCallBack(string dataJson, string senderJs for (var i = 0; i < updatedRpcCalledEvents.Count; i++) { string name = updatedRpcCalledEvents[i]; - - Debug.Log("i " + i + " name " + name); - CallbackManager.InvokeRpcRegisterCallBack(name, dataJson, senderJson); } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 2f81a5e..71d6a92 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -675,7 +675,7 @@ PlayerSettings: webGLDebugSymbols: 0 webGLEmscriptenArgs: webGLModulesDirectory: - webGLTemplate: PROJECT:DiscordTemplate + webGLTemplate: APPLICATION:Default webGLAnalyzeBuildSize: 0 webGLUseEmbeddedResources: 0 webGLCompressionFormat: 2 From ddccef04b56c01481ff2852e1933e727a5261ee3 Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:02:21 +0500 Subject: [PATCH 05/16] chore: removed debug logs --- Assets/PlayroomKit/modules/RPC/RPC.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Assets/PlayroomKit/modules/RPC/RPC.cs b/Assets/PlayroomKit/modules/RPC/RPC.cs index 5741543..3a9923b 100644 --- a/Assets/PlayroomKit/modules/RPC/RPC.cs +++ b/Assets/PlayroomKit/modules/RPC/RPC.cs @@ -133,17 +133,13 @@ protected static void InvokeRpcRegisterCallBack(string dataJson, string senderJs // This state is required to update the called rpc events list, (Temp fix see RpcCall for more) string nameJson = _playroomKit.GetState("rpcCalledEventName"); - Debug.Log($"rpcCalledEventName {nameJson}: {dataJson}"); - JSONArray jsonArray = JSON.Parse(nameJson).AsArray; foreach (JSONNode node in jsonArray) { string item = node.Value; updatedRpcCalledEvents.Add(item); } - - Debug.Log(updatedRpcCalledEvents.Count); - + for (var i = 0; i < updatedRpcCalledEvents.Count; i++) { string name = updatedRpcCalledEvents[i]; From 522b61b4b94f9b1facb50a496640d1c91e06791c Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:51:09 +0500 Subject: [PATCH 06/16] feat: scene saved --- Assets/PlayroomKit/Examples/package-showcase/showcase.unity | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Assets/PlayroomKit/Examples/package-showcase/showcase.unity b/Assets/PlayroomKit/Examples/package-showcase/showcase.unity index c377cf5..8d67717 100644 --- a/Assets/PlayroomKit/Examples/package-showcase/showcase.unity +++ b/Assets/PlayroomKit/Examples/package-showcase/showcase.unity @@ -7767,6 +7767,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 8899696337967424923, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: httpServerPort + value: 6510 + objectReference: {fileID: 0} - target: {fileID: 8899696337967424923, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} propertyPath: webDriverDirectory value: Assets\ From 77aa121bf744d6f6d8a22ba81198d22f89a093c5 Mon Sep 17 00:00:00 2001 From: aarijimam <35100854+aarijimam@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:23:02 +0500 Subject: [PATCH 07/16] feat: add debug toggle to dev manager --- .../PlayroomKit/Editor/PlayroomDevEditor.cs | 48 +++++++++++++++++++ .../Editor/PlayroomkitDevManagerEditor.uss | 8 ++++ .../discord-activity/discord-activity.unity | 6 ++- .../modules/Helpers/DebugToggle.cs | 17 ------- .../modules/Helpers/DebugToggle.cs.meta | 11 ----- .../modules/PlayroomkitDevManager.cs | 4 ++ 6 files changed, 65 insertions(+), 29 deletions(-) delete mode 100644 Assets/PlayroomKit/modules/Helpers/DebugToggle.cs delete mode 100644 Assets/PlayroomKit/modules/Helpers/DebugToggle.cs.meta diff --git a/Assets/PlayroomKit/Editor/PlayroomDevEditor.cs b/Assets/PlayroomKit/Editor/PlayroomDevEditor.cs index 070c290..7467626 100644 --- a/Assets/PlayroomKit/Editor/PlayroomDevEditor.cs +++ b/Assets/PlayroomKit/Editor/PlayroomDevEditor.cs @@ -41,10 +41,12 @@ public override VisualElement CreateInspectorGUI() VisualElement insertCoinContainer = InsertCoinContainerCreator(); Button launchPlayerButton = LaunchPlayerButtonCreator(); VisualElement docsLink = DocumentationLinkCreator(); + VisualElement enableLogsToggle = EnableLogsToggleCreator(); // Add elements to root root.Add(mockModeContainer); root.Add(insertCoinContainer); + root.Add(enableLogsToggle); root.Add(launchPlayerButton); root.Add(docsLink); @@ -170,6 +172,52 @@ private static VisualElement DocumentationLinkCreator() return docLink; } + + private VisualElement EnableLogsToggleCreator() + { + // Create a horizontal container + VisualElement enableLogsContainer = new VisualElement(); + enableLogsContainer.style.flexDirection = FlexDirection.Row; // Arrange items horizontally + + // Create the label for Enable Logs + var enableLogsLabel = new Label("Enable Logs"); + enableLogsLabel.AddToClassList("label"); // Add consistent styling + + // Create the tooltip button + var debugToggleToolTip = new Button(() => { }) + { + text = "?", + tooltip = "Enable or disable logging for debugging purposes." + }; + debugToggleToolTip.AddToClassList("tooltip-button"); + + // Create the toggle + var enableLogsToggle = new Toggle(); + enableLogsToggle.AddToClassList("toggle"); // Apply consistent styling to the toggle + + // Manually bind the property if BindProperty isn't supported + var enableLogsProperty = serializedObject.FindProperty("enableLogs"); + + // Set the initial value + enableLogsToggle.value = enableLogsProperty.boolValue; + + // Register value changed callback + enableLogsToggle.RegisterValueChangedCallback(evt => + { + enableLogsProperty.boolValue = evt.newValue; + serializedObject.ApplyModifiedProperties(); + }); + + // Add the elements to the container in the desired order + enableLogsContainer.Add(enableLogsLabel); // Add label first + enableLogsContainer.Add(debugToggleToolTip); // Add tooltip button next + enableLogsContainer.Add(enableLogsToggle); // Add toggle last + + return enableLogsContainer; + } + + + } } #endif \ No newline at end of file diff --git a/Assets/PlayroomKit/Editor/PlayroomkitDevManagerEditor.uss b/Assets/PlayroomKit/Editor/PlayroomkitDevManagerEditor.uss index 2f48198..e39718d 100644 --- a/Assets/PlayroomKit/Editor/PlayroomkitDevManagerEditor.uss +++ b/Assets/PlayroomKit/Editor/PlayroomkitDevManagerEditor.uss @@ -88,4 +88,12 @@ align-self: center; color: aqua; +} + +.toggle { + height: 25px; + font-size: 14px; + -unity-text-align: middle-center; + margin-left: 32px; + margin-bottom: 32px; } \ No newline at end of file diff --git a/Assets/PlayroomKit/Examples/discord-activity/discord-activity.unity b/Assets/PlayroomKit/Examples/discord-activity/discord-activity.unity index 53d0edb..e96b03e 100644 --- a/Assets/PlayroomKit/Examples/discord-activity/discord-activity.unity +++ b/Assets/PlayroomKit/Examples/discord-activity/discord-activity.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 1429187865} - m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481694, a: 1} + m_IndirectSpecularColor: {r: 0.44657815, g: 0.49641192, b: 0.5748165, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -218,6 +218,10 @@ PrefabInstance: propertyPath: mockMode value: 0 objectReference: {fileID: 0} + - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: enableLogs + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} propertyPath: insertCoinCaller value: diff --git a/Assets/PlayroomKit/modules/Helpers/DebugToggle.cs b/Assets/PlayroomKit/modules/Helpers/DebugToggle.cs deleted file mode 100644 index 5f27d62..0000000 --- a/Assets/PlayroomKit/modules/Helpers/DebugToggle.cs +++ /dev/null @@ -1,17 +0,0 @@ -using UnityEngine; - -public class DebugToggle : MonoBehaviour -{ - [SerializeField] private bool enableLogs = false; - - private void Start() - { - DebugLogger.enableLogs = enableLogs; - } - - private void ToggleLogs(bool isEnabled) - { - DebugLogger.enableLogs = isEnabled; - } -} - diff --git a/Assets/PlayroomKit/modules/Helpers/DebugToggle.cs.meta b/Assets/PlayroomKit/modules/Helpers/DebugToggle.cs.meta deleted file mode 100644 index 21f27e9..0000000 --- a/Assets/PlayroomKit/modules/Helpers/DebugToggle.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 37df37ffbaed24d5f858db19670affdf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/PlayroomKit/modules/PlayroomkitDevManager.cs b/Assets/PlayroomKit/modules/PlayroomkitDevManager.cs index 4750ae5..84f30d9 100644 --- a/Assets/PlayroomKit/modules/PlayroomkitDevManager.cs +++ b/Assets/PlayroomKit/modules/PlayroomkitDevManager.cs @@ -18,6 +18,8 @@ public class PlayroomkitDevManager : MonoBehaviour "InsertCoin() must be called in order to connect PlayroomKit server.\n\nChoose the gameObject (with the script) which calls InsertCoin.\n\nRead More in the docs")] [SerializeField] private GameObject insertCoinCaller; + + [SerializeField] private bool enableLogs = false; private static PlayroomkitDevManager Instance { get; set; } @@ -37,6 +39,8 @@ private void Awake() UpdateMockMode(); UnityBrowserBridge.Instance.RegisterGameObject("InsertCoin", insertCoinCaller); UnityBrowserBridge.Instance.RegisterGameObject("devManager", gameObject); + + DebugLogger.enableLogs = enableLogs; } private void OnValidate() From 39e5c03b1a87acc7a8ea337f627507ce949e075c Mon Sep 17 00:00:00 2001 From: aarijimam <35100854+aarijimam@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:25:09 +0500 Subject: [PATCH 08/16] fix: update dev manager prefab --- .../Prefabs/PlayroomMockManager.prefab | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/Assets/PlayroomKit/Prefabs/PlayroomMockManager.prefab b/Assets/PlayroomKit/Prefabs/PlayroomMockManager.prefab index 2c4876b..1478b30 100644 --- a/Assets/PlayroomKit/Prefabs/PlayroomMockManager.prefab +++ b/Assets/PlayroomKit/Prefabs/PlayroomMockManager.prefab @@ -10,7 +10,6 @@ GameObject: m_Component: - component: {fileID: 4611920177403363027} - component: {fileID: 8987662522597341863} - - component: {fileID: 7325353642485059119} m_Layer: 0 m_Name: PlayroomMockManager m_TagString: EditorOnly @@ -49,19 +48,7 @@ MonoBehaviour: m_EditorClassIdentifier: mockMode: 1 insertCoinCaller: {fileID: 0} ---- !u!114 &7325353642485059119 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1824217503633254899} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 37df37ffbaed24d5f858db19670affdf, type: 3} - m_Name: - m_EditorClassIdentifier: - logToggle: {fileID: 0} + enableLogs: 0 --- !u!1 &5935941862803782869 GameObject: m_ObjectHideFlags: 0 From 3b25dc96ef8437fbdb84d9dc12fb91b9d66c925e Mon Sep 17 00:00:00 2001 From: "Saad A. Bazaz" Date: Mon, 25 Nov 2024 11:44:22 +0500 Subject: [PATCH 09/16] docs: add download badge in readme --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 790ba21..f32b982 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@

PlayroomKit SDK for Unity

The easiest multiplayer infrastructure for the web

- + From b524d3b40d4ec8f7b04c244dfd1bb1f567ea4000 Mon Sep 17 00:00:00 2001 From: "Saad A. Bazaz" Date: Mon, 25 Nov 2024 11:56:03 +0500 Subject: [PATCH 10/16] docs: add beta latest release as well --- readme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index f32b982..336b9a6 100644 --- a/readme.md +++ b/readme.md @@ -2,8 +2,11 @@

PlayroomKit SDK for Unity

The easiest multiplayer infrastructure for the web

+ +
+ +
- From dc836ecfccbcc5ce699a93f45fdee1d856adb9cd Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:52:06 +0500 Subject: [PATCH 11/16] chore: scene saved --- .../PlayroomKit/Examples/2d-platformer/2d-platformer.unity | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/PlayroomKit/Examples/2d-platformer/2d-platformer.unity b/Assets/PlayroomKit/Examples/2d-platformer/2d-platformer.unity index 160525e..620863a 100644 --- a/Assets/PlayroomKit/Examples/2d-platformer/2d-platformer.unity +++ b/Assets/PlayroomKit/Examples/2d-platformer/2d-platformer.unity @@ -307,13 +307,17 @@ PrefabInstance: propertyPath: insertCoinCaller value: objectReference: {fileID: 330732768} + - target: {fileID: 8899696337967424923, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: browser + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8899696337967424923, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} propertyPath: webDriverDirectory value: Assets\ objectReference: {fileID: 0} - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} propertyPath: mockMode - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} propertyPath: insertCoinCaller From bdb42024ce0285d41d164f26033c505a0bd2a407 Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:54:04 +0500 Subject: [PATCH 12/16] fix: updated logger initialization --- Assets/PlayroomKit/modules/Player/LocalPlayerService.cs | 2 +- Assets/PlayroomKit/modules/PlayroomkitDevManager.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/PlayroomKit/modules/Player/LocalPlayerService.cs b/Assets/PlayroomKit/modules/Player/LocalPlayerService.cs index 3c43c9e..8e9e4c6 100644 --- a/Assets/PlayroomKit/modules/Player/LocalPlayerService.cs +++ b/Assets/PlayroomKit/modules/Player/LocalPlayerService.cs @@ -97,7 +97,7 @@ public Profile GetProfile() public Action OnQuit(Action callback) { - Debug.Log($"OnQuit is not supported in Local Mock Mode."); + DebugLogger.Log($"OnQuit is not supported in Local Mock Mode."); return null; } diff --git a/Assets/PlayroomKit/modules/PlayroomkitDevManager.cs b/Assets/PlayroomKit/modules/PlayroomkitDevManager.cs index d7be185..05c9e23 100644 --- a/Assets/PlayroomKit/modules/PlayroomkitDevManager.cs +++ b/Assets/PlayroomKit/modules/PlayroomkitDevManager.cs @@ -36,16 +36,18 @@ private void Awake() Destroy(gameObject); } + DebugLogger.enableLogs = enableLogs; + UpdateMockMode(); UnityBrowserBridge.Instance.RegisterGameObject("InsertCoin", insertCoinCaller); UnityBrowserBridge.Instance.RegisterGameObject("devManager", gameObject); - - DebugLogger.enableLogs = enableLogs; } private void OnValidate() { + DebugLogger.enableLogs = enableLogs; UpdateMockMode(); + DebugLogger.Log("Setting Current Mode to: " + PlayroomKit.CurrentMockMode); } private void UpdateMockMode() From 12dc13c849992fb78f6a21966d57353f316c759b Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:12:49 +0500 Subject: [PATCH 13/16] fix: updated platform conditionals --- .../PlayroomKit/modules/Interfaces/IPlayroomBase.cs | 2 +- Assets/PlayroomKit/modules/Player/Player.cs | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Assets/PlayroomKit/modules/Interfaces/IPlayroomBase.cs b/Assets/PlayroomKit/modules/Interfaces/IPlayroomBase.cs index 5b438d8..a3a7dfd 100644 --- a/Assets/PlayroomKit/modules/Interfaces/IPlayroomBase.cs +++ b/Assets/PlayroomKit/modules/Interfaces/IPlayroomBase.cs @@ -58,7 +58,7 @@ protected static void __OnPlayerJoinCallbackHandler(string id) protected static void OnPlayerJoinWrapperCallback(string id) { var player = GetPlayerById(id); - foreach (var callback in IPlayroomBase.OnPlayerJoinCallbacks) + foreach (var callback in OnPlayerJoinCallbacks) { callback?.Invoke(player); } diff --git a/Assets/PlayroomKit/modules/Player/Player.cs b/Assets/PlayroomKit/modules/Player/Player.cs index 4f28c6d..42ae492 100644 --- a/Assets/PlayroomKit/modules/Player/Player.cs +++ b/Assets/PlayroomKit/modules/Player/Player.cs @@ -136,29 +136,26 @@ public void WaitForState(string StateKey, Action onStateSetCallback = nu _playerService.WaitForState(StateKey, onStateSetCallback); } - + public void InvokePlayerOnQuitCallback() { +#if UNITY_WEBGL if (_playerService is PlayerService playerService) { playerService.InvokePlayerOnQuitCallback(id); } - #if UNITY_EDITOR || DEBUG +#elif UNITY_EDITOR else if (_playerService is BrowserMockPlayerService playerService2) { playerService2.InvokePlayerOnQuitCallback(id); } - #endif +#endif else { Debug.LogWarning("InvokePlayerOnQuitCallback is only supported on build"); } - - } - //DI END - [Serializable] public class Profile From a0c11d406ed0bd105a028e8e62a2ec898a36b2ba Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:13:19 +0500 Subject: [PATCH 14/16] chore: saved scene --- .../Examples/package-showcase/showcase.unity | 148 +++++++++--------- Assets/PlayroomKit/PlayroomKit.cs | 3 - 2 files changed, 74 insertions(+), 77 deletions(-) diff --git a/Assets/PlayroomKit/Examples/package-showcase/showcase.unity b/Assets/PlayroomKit/Examples/package-showcase/showcase.unity index d552504..bf989b0 100644 --- a/Assets/PlayroomKit/Examples/package-showcase/showcase.unity +++ b/Assets/PlayroomKit/Examples/package-showcase/showcase.unity @@ -6771,6 +6771,79 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1826344565} m_CullTransparentMesh: 1 +--- !u!1001 &1855243287 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1824217503633254899, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_Name + value: PlayroomMockManager + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalPosition.x + value: -0.3 + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8899696337967424923, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: webDriverDirectory + value: Assets\ + objectReference: {fileID: 0} + - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: mockMode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: enableLogs + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} + propertyPath: insertCoinCaller + value: + objectReference: {fileID: 893908560} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} --- !u!1 &1883683081 GameObject: m_ObjectHideFlags: 0 @@ -7715,79 +7788,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2143370850} m_CullTransparentMesh: 1 ---- !u!1001 &2854658873105489201 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1824217503633254899, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_Name - value: PlayroomMockManager - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalPosition.x - value: -0.3 - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4611920177403363027, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8899696337967424923, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: httpServerPort - value: 6510 - objectReference: {fileID: 0} - - target: {fileID: 8899696337967424923, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: webDriverDirectory - value: Assets\ - objectReference: {fileID: 0} - - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: mockMode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8987662522597341863, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} - propertyPath: insertCoinCaller - value: - objectReference: {fileID: 893908560} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 1b30fa3a265114a45a7e23165a20aecc, type: 3} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 @@ -7799,4 +7799,4 @@ SceneRoots: - {fileID: 417229588} - {fileID: 1643951926} - {fileID: 181053975} - - {fileID: 2854658873105489201} + - {fileID: 1855243287} diff --git a/Assets/PlayroomKit/PlayroomKit.cs b/Assets/PlayroomKit/PlayroomKit.cs index a4c0cf5..83324af 100644 --- a/Assets/PlayroomKit/PlayroomKit.cs +++ b/Assets/PlayroomKit/PlayroomKit.cs @@ -31,17 +31,14 @@ public PlayroomKit() _rpc = new RPC(this); #elif UNITY_EDITOR - switch (CurrentMockMode) { case MockModeSelector.Local: - Debug.Log("Starting playroom in Local Mock Mode"); _playroomService = new LocalMockPlayroomService(); _rpc = new RPCLocal(); break; case MockModeSelector.Browser: - Debug.Log("Starting playroom in Browser Mock Mode"); _playroomService = new BrowserMockService(); _rpc = new BrowserMockRPC(); break; From 88525c99e936bd7b112a5cd7d447dd6cd16539c3 Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:19:42 +0500 Subject: [PATCH 15/16] chore: removed commented file --- Assets/PlayroomKit/modules/Player/Player.cs | 3 +- .../modules/Player/PlayerHelpers.cs | 30 ------------------- .../modules/Player/PlayerHelpers.cs.meta | 3 -- 3 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 Assets/PlayroomKit/modules/Player/PlayerHelpers.cs delete mode 100644 Assets/PlayroomKit/modules/Player/PlayerHelpers.cs.meta diff --git a/Assets/PlayroomKit/modules/Player/Player.cs b/Assets/PlayroomKit/modules/Player/Player.cs index 42ae492..2edd7a9 100644 --- a/Assets/PlayroomKit/modules/Player/Player.cs +++ b/Assets/PlayroomKit/modules/Player/Player.cs @@ -162,8 +162,7 @@ public class Profile { [NonSerialized] public UnityEngine.Color color; - - [FormerlySerializedAs("jsonColor")] + public PlayerProfileColor playerProfileColor; public string name; public string photo; diff --git a/Assets/PlayroomKit/modules/Player/PlayerHelpers.cs b/Assets/PlayroomKit/modules/Player/PlayerHelpers.cs deleted file mode 100644 index 7744550..0000000 --- a/Assets/PlayroomKit/modules/Player/PlayerHelpers.cs +++ /dev/null @@ -1,30 +0,0 @@ -// using System; -// using UnityEngine.Serialization; -// -// namespace Playroom -// { -// public partial class PlayroomKit -// { -// -// [Serializable] -// public class Profile -// { -// [NonSerialized] public UnityEngine.Color color; -// -// [FormerlySerializedAs("jsonColor")] public PlayerProfileColor playerProfileColor; -// public string name; -// public string photo; -// -// [Serializable] -// public class PlayerProfileColor -// { -// public int r; -// public int g; -// public int b; -// public string hexString; -// public int hex; -// } -// } -// } -// } -// diff --git a/Assets/PlayroomKit/modules/Player/PlayerHelpers.cs.meta b/Assets/PlayroomKit/modules/Player/PlayerHelpers.cs.meta deleted file mode 100644 index b17a6cf..0000000 --- a/Assets/PlayroomKit/modules/Player/PlayerHelpers.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 12dfc03fda994408822f84014a0a6478 -timeCreated: 1730208351 \ No newline at end of file From b2077232fcbf7cd5358d8e8020b9c66344312d21 Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:23:51 +0500 Subject: [PATCH 16/16] chore: removed duplicate, unused function --- Assets/PlayroomKit/modules/Player/PlayerService.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Assets/PlayroomKit/modules/Player/PlayerService.cs b/Assets/PlayroomKit/modules/Player/PlayerService.cs index 1dddc4b..70cfb5e 100644 --- a/Assets/PlayroomKit/modules/Player/PlayerService.cs +++ b/Assets/PlayroomKit/modules/Player/PlayerService.cs @@ -154,11 +154,12 @@ public void Kick(Action onKickCallBack = null) private static Action onSetState; + public void WaitForState(string stateKey, Action onStateSetCallback = null) { onSetState = onStateSetCallback; } - + [MonoPInvokeCallback(typeof(Action))] private static void InvokeKickCallBack(string data) { @@ -179,11 +180,6 @@ public void OnQuitWrapperCallback(string id) callback?.Invoke(id); } - public void InvokeOnQuitWrapperCallback(string id) - { - OnQuitWrapperCallback(id); - } - private bool GetPlayerStateBoolById(string key) { var stateValue = _interop.GetPlayerStateIntWrapper(_id, key); @@ -191,8 +187,6 @@ private bool GetPlayerStateBoolById(string key) stateValue == 0 ? false : throw new InvalidOperationException($"GetStateBool: {key} is not a bool"); } - - } } }