Skip to content
Merged
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: 1 addition & 1 deletion Assets/PlayroomKit/PlayroomKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public void OpenDiscordInviteDialog(Action callback = null)
_playroomService.OpenDiscordInviteDialog(callback);
}

public void StartDiscordPurchase(string skuId, Action<List<Entitlement>> responseCallback = null)
public void StartDiscordPurchase(string skuId, Action<string> responseCallback = null)
{
CheckPlayRoomInitialized();
_playroomService.StartDiscordPurchase(skuId, responseCallback);
Expand Down
2 changes: 1 addition & 1 deletion Assets/PlayroomKit/modules/Interfaces/IPlayroomBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void InsertCoin(InitOptions options = null, Action onLaunchCallBack = nul

#region Discord
public void OpenDiscordInviteDialog(Action callback = null);
public void StartDiscordPurchase(string skuId, Action<List<Entitlement>> callback = null);
public void StartDiscordPurchase(string skuId, Action<string> callback = null);
#endregion


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,9 @@ public void OpenDiscordInviteDialog(Action callback = null)
callback?.Invoke();
}

public void StartDiscordPurchase(string skuId, Action<List<Entitlement>> callback = null)
public void StartDiscordPurchase(string skuId, Action<string> callback = null)
{
DebugLogger.LogWarning("[MockMode] Discord purchase is currently not supported in browser mock mode!");
callback?.Invoke(new List<Entitlement>());
}
#endregion
}
Expand Down
3 changes: 1 addition & 2 deletions Assets/PlayroomKit/modules/MockMode/LocalPlayroomService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,9 @@ public void OpenDiscordInviteDialog(Action callback = null)
callback?.Invoke();
}

public void StartDiscordPurchase(string skuId, Action<List<Entitlement>> callback = null)
public void StartDiscordPurchase(string skuId, Action<string> callback = null)
{
DebugLogger.LogWarning("[MockMode] Discord purchase is currently not supported in local mode!");
callback?.Invoke(new List<Entitlement>());
}
#endregion
}
Expand Down
17 changes: 2 additions & 15 deletions Assets/PlayroomKit/modules/PlayroomBuildService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,23 +442,10 @@ public void OpenDiscordInviteDialog(Action callback = null)
[MonoPInvokeCallback(typeof(Action<string, string>))]
private static void DiscordPurchaseCallback(string skuId, string result)
{
JSONNode root = JSON.Parse(result);

List<Entitlement> entitlements = new List<Entitlement>();

if (root != null && root.IsArray)
{
foreach (JSONNode item in root.AsArray)
{
Entitlement e = Entitlement.FromJSON(item);
entitlements.Add(e);
}
}

CallbackManager.InvokeCallback(skuId, entitlements);
CallbackManager.InvokeCallback(skuId, result);
}

public void StartDiscordPurchase(string skuId, Action<List<Entitlement>> callback = null)
public void StartDiscordPurchase(string skuId, Action<string> callback = null)
{
CheckPlayRoomInitialized();
CallbackManager.RegisterCallback(callback, skuId);
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class GameManager : MonoBehaviour

bool coinInserted = false;

string skuId = "123456789";
string skuId = "1371921246031319121";

private void Awake()
{
Expand All @@ -23,7 +23,7 @@ private void Start()
{
playroomKit.InsertCoin(new InitOptions()
{
gameId = "cW0r8UJ1aXnZ8v5TPYmv",
gameId = "FmOBeUfQO2AOLNIrJNSJ",
maxPlayersPerRoom = 2,
discord = true,
}, OnLaunchCallBack);
Expand Down