Пример #1
0
        static UserList ExtractUserListFromUnityWebRequest(UnityWebRequest unityWebRequest)
        {
            if (UnityWebRequestHelper.IsUnityWebRequestReadyForTextExtract(unityWebRequest, out var jsonContent))
            {
                UserList userList = null;
                if (JsonHelper.TryJsonDeserialize(jsonContent, ref userList))
                {
                    return(userList);
                }
            }

            return(null);
        }
Пример #2
0
        static IServiceFlags ExtractServiceFlagsFromUnityWebRequest(UnityWebRequest unityWebRequest)
        {
            IDictionary <string, object> flags = null;

            if (UnityWebRequestHelper.IsUnityWebRequestReadyForTextExtract(unityWebRequest, out var jsonContent))
            {
                try
                {
                    var jsonEntries = (IDictionary <string, object>)MiniJson.Deserialize(jsonContent);
                    flags = (IDictionary <string, object>)jsonEntries[k_ServiceFlagsKey];
                }
                catch (Exception ex)
                {
                    Debug.LogError($"Exception occurred when fetching service flags:\n{ex.Message}");
                    flags = new Dictionary <string, object>();
                }
            }

            return(new ServiceFlags(flags));
        }