Example #1
0
    public void GetUserInventory()
    {
        ShowLoader();
        PlayerID playerIdentifier = lastPlayerIdentifier;

        PlayFabAdminAPI.GetUserInventory(new GetUserInventoryRequest {
            PlayFabId = playerIdentifier.playerID
        },
                                         result => {
            HideLoader();
            Debug.Log("GOT INVENTORY OK: " + result.ToJson());
            string items  = "";
            int itemCount = 0;
            foreach (var item in result.Inventory)
            {
                itemCount++;
                items += string.Format("\n{0}. {1}", itemCount, item.DisplayName);
            }
            Inform(string.Format("\"{0}'s\" inventory:\n{1}", lastPlayerIdentifier.displayName, items));
        },
                                         error => {
            HideLoader();
            Debug.LogError("GET INVENTORY FAILED: " + error.ToString());
            Inform("Unable to get inventory for \"" + playerIdentifier.displayName + "\"!\n\n" + error.ErrorMessage);
        });
    }