Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed if else from invokeonquit #124

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Assets/PlayroomKit/modules/Interfaces/IPlayerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public interface IPlayerBase
public void WaitForState(string stateKey, Action<string> onStateSetCallback = null);

protected static Action onKickCallBack = null;

public void InvokePlayerOnQuitCallback(string id);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ void Unsubscribe()
return Unsubscribe;
}

public void OnQuitWrapperCallback(string id)
private void OnQuitWrapperCallback(string id)
{
if (OnQuitCallbacks != null)
foreach (var callback in OnQuitCallbacks)
callback?.Invoke(id);
}

internal void InvokePlayerOnQuitCallback(string id)
public void InvokePlayerOnQuitCallback(string id)
{
OnQuitWrapperCallback(id);
}
Expand Down
5 changes: 5 additions & 0 deletions Assets/PlayroomKit/modules/Player/LocalPlayerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public void WaitForState(string stateKey, Action<string> onStateSetCallback = nu
CallbackManager.RegisterCallback(onStateSetCallback, key);
DebugLogger.Log($"Callback registered, the key is: {key}");
}

public void InvokePlayerOnQuitCallback(string id)
{
Debug.LogWarning("InvokePlayerOnQuitCallback is only supported on build");
}
}
}
}
Expand Down
16 changes: 1 addition & 15 deletions Assets/PlayroomKit/modules/Player/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,7 @@ public void WaitForState(string StateKey, Action<string> onStateSetCallback = nu

public void InvokePlayerOnQuitCallback()
{
#if UNITY_WEBGL
if (_playerService is PlayerService playerService)
{
playerService.InvokePlayerOnQuitCallback(id);
}
#elif UNITY_EDITOR
else if (_playerService is BrowserMockPlayerService playerService2)
{
playerService2.InvokePlayerOnQuitCallback(id);
}
#endif
else
{
Debug.LogWarning("InvokePlayerOnQuitCallback is only supported on build");
}
_playerService.InvokePlayerOnQuitCallback(id);
}


Expand Down
2 changes: 1 addition & 1 deletion Assets/PlayroomKit/modules/Player/PlayerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void Unsubscribe()
return Unsubscribe;
}

internal void InvokePlayerOnQuitCallback(string id)
public void InvokePlayerOnQuitCallback(string id)
{
OnQuitWrapperCallback(id);
}
Expand Down
Loading