如何将此 Unity 代码转换为 MonoGame 代码?

How can I convert this Unity code to MonoGame code?

我不知道如何在 MonoGame 项目中使用 PlayFab。我已经阅读了一些 PlayFab 教程,但它们都是针对 Unity 的,我认为不可能将 Unity 代码示例与 MonoGame 一起使用,因为我总是收到错误消息。

来自这行代码。

PlayFabClientAPI.GetUserInventoryAsync(new GetUserInventoryRequest(), OnGetUserInventoryRequest, OnPlayFabInventoryError);

我在这里收到错误消息:

Error CS1503: Argument 2: cannot convert from 'method group' to 'object'

Error CS1503: Argument 3: cannot convert from 'method group' to 'Dictionary'

"OnGetUserInventoryRequest, OnPlayFabInventoryError" 出了点问题,但我不知道可以更改什么。

我可以更改什么以使此代码适用于 MonoGame?

https://api.playfab.com/documentation/client/method/GetUserInventory

示例代码

public void GetInventoryList()
{
    PlayFabClientAPI.GetUserInventoryAsync(new GetUserInventoryRequest(), OnGetUserInventoryRequest, OnPlayFabInventoryError);
}
public void OnGetUserInventoryRequest(GetUserInventoryResult result)
{
    Console.WriteLine(result.VirtualCurrency);
}

public void OnPlayFabInventoryError(PlayFabError result)
{
    Console.WriteLine("Error");
}

编辑:

如果我想使用 VirtualCurrency 的值,我会收到一条新的错误消息。我不知道如何获取 VirtualCurrency 的值,我做错了什么?

private async Task GetInventoryList()
{
    var result = await PlayFabClientAPI.GetUserInventoryAsync(new GetUserInventoryRequest());

    int CurrentAmount = result.Result.VirtualCurrency;
}

Error CS0029: Cannot implicitly convert type 'System.Collections.Generic.Dictionary' to 'int'

如果你看一下方法签名就很明显了:

GetUserInventoryAsync(GetUserInventoryRequest request, object customData = null, Dictionary<string,string> extraHeaders = null)

最后2个参数是可选的,不是回调方法