diff --git a/Assets/PlayroomKit/modules/Interfaces/IPlayerBase.cs b/Assets/PlayroomKit/modules/Interfaces/IPlayerBase.cs index a25ca73..9488b27 100644 --- a/Assets/PlayroomKit/modules/Interfaces/IPlayerBase.cs +++ b/Assets/PlayroomKit/modules/Interfaces/IPlayerBase.cs @@ -17,7 +17,6 @@ public interface IPlayerBase public T GetState(string key); public Profile GetProfile(); public Action OnQuit(Action callback); - public void InvokePlayerOnQuitCallback(string id); public void Kick(Action onKickCallBack = null); public void WaitForState(string stateKey, Action onStateSetCallback = null); diff --git a/Assets/PlayroomKit/modules/MockMode/BrowserMode/BrowserMockPlayerService.cs b/Assets/PlayroomKit/modules/MockMode/BrowserMode/BrowserMockPlayerService.cs index c706018..37c8914 100644 --- a/Assets/PlayroomKit/modules/MockMode/BrowserMode/BrowserMockPlayerService.cs +++ b/Assets/PlayroomKit/modules/MockMode/BrowserMode/BrowserMockPlayerService.cs @@ -115,11 +115,6 @@ public Action OnQuit(Action callback) return default; } - public void InvokePlayerOnQuitCallback(string id) - { - throw new NotImplementedException(); - } - public void Kick(Action onKickCallBack = null) { _ubb.CallJs("Kick", null, null, true, _id); diff --git a/Assets/PlayroomKit/modules/Player/LocalPlayerService.cs b/Assets/PlayroomKit/modules/Player/LocalPlayerService.cs index a5c9aff..b1820b7 100644 --- a/Assets/PlayroomKit/modules/Player/LocalPlayerService.cs +++ b/Assets/PlayroomKit/modules/Player/LocalPlayerService.cs @@ -100,11 +100,7 @@ public Action OnQuit(Action callback) Debug.Log($"OnQuit is not implemented for local"); return null; } - - public void InvokePlayerOnQuitCallback(string id) - { - throw new NotImplementedException(); - } + public void Kick(Action onKickCallBack = null) { diff --git a/Assets/PlayroomKit/modules/Player/Player.cs b/Assets/PlayroomKit/modules/Player/Player.cs index fb431d3..9aff8a1 100644 --- a/Assets/PlayroomKit/modules/Player/Player.cs +++ b/Assets/PlayroomKit/modules/Player/Player.cs @@ -139,7 +139,18 @@ public void WaitForState(string StateKey, Action onStateSetCallback = nu public void InvokePlayerOnQuitCallback() { - _playerService.InvokePlayerOnQuitCallback(id); + // Attempt the cast and throw an exception if it fails + if ((_playerService is PlayerService playerService)) + { + playerService.InvokePlayerOnQuitCallback(id); + } + else + { + Debug.LogWarning("InvokePlayerOnQuitCallback is only supported o build"); + } + + // Invoke the method on the casted object + } //DI END diff --git a/Assets/PlayroomKit/modules/Player/PlayerService.cs b/Assets/PlayroomKit/modules/Player/PlayerService.cs index c511cd9..0c3acca 100644 --- a/Assets/PlayroomKit/modules/Player/PlayerService.cs +++ b/Assets/PlayroomKit/modules/Player/PlayerService.cs @@ -140,7 +140,7 @@ void Unsubscribe() return Unsubscribe; } - public void InvokePlayerOnQuitCallback(string id) + internal void InvokePlayerOnQuitCallback(string id) { OnQuitWrapperCallback(id); }