question

Swifter avatar image
Swifter asked

How would I put this in as a cloud script?

        public static string GetUserInventory(string playFabId)
        {
            string result = "";
            if (!PlayFabClientAPI.IsClientLoggedIn())
            {
                return result;
            }
            try
            {
                string name = PhotonNetwork.PlayerListOthers.ToList<Player>().Find((Player plyer) => plyer.UserId == playFabId).NickName;
                GorillaLocalLogs.logger.Log(LogLevel.Info, "Getting items for " + name);
                PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
                {
                    FunctionName = "GetPlayFabUserInventory",
                    FunctionParameter = new
                    {
                        PlayFabId = playFabId
                    }
                }, delegate(ExecuteCloudScriptResult resultObject)
                {
                    try
                    {
                        string text = (string)resultObject.FunctionResult;
                        result = text;
                        GorillaLocalLogs.logger.Log(LogLevel.Info, name + "'s items: " + text);
                    }
                    catch (Exception ex2)
                    {
                        GorillaLocalLogs.logger.Log(LogLevel.Error, "Failed to get items: " + ex2.ToString());
                    }
                }, delegate(PlayFabError error)
                {
                    GorillaLocalLogs.logger.Log(LogLevel.Error, string.Concat(new string[]
                    {
                        "Failed to get items for " + name + ": " + error.GenerateErrorReport()
                    }));
                }, null, null);
            }
            catch (Exception ex)
            {
                GorillaLocalLogs.logger.Log(LogLevel.Error, "Failed to get items: " + ex.ToString());
            }
            return result;
        }
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Gosen Gao avatar image Gosen Gao commented ·

Can you clearly explain your needs, do you want to implement the function of obtaining the inventory of other users in Cloud Script?

0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.