Example #1
0
 // Token: 0x06005936 RID: 22838 RVA: 0x001EF7B4 File Offset: 0x001EDBB4
 private void FetchWorldFromApiQuery(Action <ApiWorld, ApiWorld.WorldInstance> onSuccess = null)
 {
     ApiWorld.FetchList(delegate(List <ApiWorld> worlds)
     {
         if (this.isShutdown)
         {
             Debug.Log(this.name + " was shutdown, ignoring query.");
             return;
         }
         worlds = (from w in worlds
                   where w != null && w.releaseStatus == "public"
                   select w).ToList <ApiWorld>();
         if (worlds.Count > 0)
         {
             ApiWorld.WorldInstance arg = this.ConfigurePortal(worlds[0]);
             if (onSuccess != null)
             {
                 onSuccess(worlds[0], arg);
             }
         }
         else
         {
             Debug.LogError("No worlds found in query for " + this.name);
         }
     }, delegate(string msg)
     {
         this.isValidWorld = false;
         Debug.LogWarning(msg);
     }, this.SortHeading, ApiWorld.SortOwnership.Any, this.SortOrder, this.Offset, 1, this.SearchTerm, null, UiWorldList.BuildExcludedTags(this.SortHeading, ApiWorld.SortOwnership.Any), string.Empty, ApiWorld.ReleaseStatus.Public, true);
 }
    void FetchUploadedData()
    {
        if (!RemoteConfig.IsInitialized())
        {
            RemoteConfig.Init();
        }

        if (CheckLogin() == false)
        {
            return;
        }

        ApiModel.ClearReponseCache();

        ApiWorld.FetchList(
            delegate(List <ApiWorld> obj)
        {
            SetupWorldData(obj);
        },
            delegate(string obj)
        {
            Debug.LogError("Error fetching your uploaded worlds:\n" + obj);
            SetupWorldData(new List <ApiWorld>());
        },
            ApiWorld.SortHeading.Updated,
            ApiWorld.SortOwnership.Mine,
            ApiWorld.SortOrder.Descending,
            0,
            100,
            "",
            null,
            null,
            "",
            ApiWorld.ReleaseStatus.All,
            false
            );

        ApiAvatar.FetchList(
            delegate(List <ApiAvatar> obj)
        {
            SetupAvatarData(obj);
        },
            delegate(string obj)
        {
            Debug.LogError("Error fetching your uploaded avatars:\n" + obj);
            SetupAvatarData(new List <ApiAvatar>());
        },
            ApiAvatar.Owner.Mine,
            null,
            100,
            0,
            ApiAvatar.SortHeading.None,
            ApiAvatar.SortOrder.Descending,
            false
            );
    }
    static void FetchWorlds(int offset = 0)
    {
        ApiWorld.FetchList(
            delegate(IEnumerable <ApiWorld> obj)
        {
            Debug.LogFormat("<color=yellow>Fetching World Bucket {0}</color>", offset);
            if (obj.FirstOrDefault() != null)
            {
                fetchingWorlds = EditorCoroutine.Start(() =>
                {
                    var l     = obj.ToList();
                    int count = l.Count;
                    SetupWorldData(l);
                    FetchWorlds(offset + count);
                });
            }
            else
            {
                fetchingWorlds = null;

                foreach (ApiWorld w in uploadedWorlds)
                {
                    DownloadImage(w.id, w.thumbnailImageUrl);
                }
            }
        },
            delegate(string obj)
        {
            Debug.LogError("Error fetching your uploaded worlds:\n" + obj);
            fetchingWorlds = null;
        },
            ApiWorld.SortHeading.Updated,
            ApiWorld.SortOwnership.Mine,
            ApiWorld.SortOrder.Descending,
            offset,
            PageLimit,
            "",
            null,
            null,
            null,
            "",
            ApiWorld.ReleaseStatus.All,
            null,
            null,
            true,
            false);
    }
    void FetchWorldData()
    {
        if (!RemoteConfig.IsInitialized())
        {
            RemoteConfig.Init();
        }

        if (!APIUser.IsLoggedInWithCredentials && APIUser.IsCached)
        {
            APIUser.CachedLogin(null, null, false);
        }

        if (RemoteConfig.IsInitialized() && APIUser.IsLoggedInWithCredentials)
        {
            ApiWorld.FetchList(
                delegate(List <ApiWorld> obj) {
                SetupWorldData(obj);
            },
                delegate(string obj) {
                Debug.LogError("Error fetching your uploaded worlds");
            },
                ApiWorld.SortHeading.Updated,
                ApiWorld.SortOwnership.Mine,
                ApiWorld.SortOrder.Descending,
                0,
                100,
                "",
                null,
                "",
                ApiWorld.ReleaseStatus.All
                );

            ApiAvatar.FetchList(
                delegate(List <ApiAvatar> obj) {
                SetupAvatarData(obj);
            },
                delegate(string obj) {
                Debug.LogError("Error fetching your uploaded avatars");
            },
                ApiAvatar.Owner.Mine,
                null,
                100
                );
        }
    }
Example #5
0
 // Token: 0x060061D0 RID: 25040 RVA: 0x00228220 File Offset: 0x00226620
 protected override void FetchAndRenderElements(int page)
 {
     this.timeUntilUpdate = float.PositiveInfinity;
     ApiWorld.ReleaseStatus releaseStatus = ApiWorld.ReleaseStatus.Public;
     if (this.sortOwnership == ApiWorld.SortOwnership.Mine)
     {
         releaseStatus = ApiWorld.ReleaseStatus.All;
     }
     ApiWorld.FetchList(delegate(List <ApiWorld> worlds)
     {
         this.timeUntilUpdate      = UnityEngine.Random.Range(15f, 20f);
         this.paginatedLists[page] = worlds.Cast <ApiModel>().ToList <ApiModel>();
         List <ApiWorld> list      = this.paginatedLists.SelectMany((KeyValuePair <int, List <ApiModel> > w) => w.Value).Cast <ApiWorld>().ToList <ApiWorld>();
         this.RenderElements <ApiWorld>(list, page);
     }, delegate(string err)
     {
         this.timeUntilUpdate = UnityEngine.Random.Range(5f, 10f);
     }, this.sortHeading, this.sortOwnership, this.sortOrder, this.numElementsPerPage * page, this.numElementsPerPage, this.searchQuery, this.tags.ToArray(), UiWorldList.BuildExcludedTags(this.sortHeading, this.sortOwnership), this.ownerId, releaseStatus, true);
 }
 // Token: 0x0600611A RID: 24858 RVA: 0x00224150 File Offset: 0x00222550
 private void Reset(bool clear = true)
 {
     if (clear)
     {
         this.worlds.Clear();
         this.mTableView.ReloadData();
     }
     this.timeSinceUpdate     = 0f;
     this.currentSearchString = this.searchField.text;
     ApiWorld.SortOwnership owner = ApiWorld.SortOwnership.Any;
     if (this.myRoomsToggle.isOn)
     {
         owner = ApiWorld.SortOwnership.Mine;
     }
     ApiWorld.FetchList(delegate(List <ApiWorld> list)
     {
         this.worlds = list;
         this.mTableView.ReloadData();
     }, delegate(string msg)
     {
         Debug.LogWarning(msg);
     }, ApiWorld.SortHeading.Updated, owner, ApiWorld.SortOrder.Descending, 0, 100, this.currentSearchString, null, null, string.Empty, ApiWorld.ReleaseStatus.Public, true);
 }
Example #7
0
    IEnumerator FetchUploadedData()
    {
        if (!RemoteConfig.IsInitialized())
        {
            RemoteConfig.Init();
        }

        if (CheckLogin() == false)
        {
            yield break;
        }

        ApiModel.ClearReponseCache();

        int  indexPosition     = 0;
        int  lastResponseCount = 0;
        bool requestActive     = false;

        do
        {
            requestActive = true;
            ApiWorld.FetchList(
                delegate(List <ApiWorld> obj)
            {
                lastResponseCount = obj.Count;
                indexPosition    += obj.Count;
                requestActive     = false;
                SetupWorldData(obj);
            },
                delegate(string obj)
            {
                lastResponseCount = 0;
                requestActive     = false;
                Debug.LogError("Error fetching your uploaded worlds:\n" + obj);
                SetupWorldData(new List <ApiWorld>());
            },
                ApiWorld.SortHeading.Updated,
                ApiWorld.SortOwnership.Mine,
                ApiWorld.SortOrder.Descending,
                indexPosition,
                PageLimit,
                "",
                null,
                null,
                "",
                ApiWorld.ReleaseStatus.All,
                false,
                true
                );
            yield return(new WaitUntil(() => !requestActive));
        } while (lastResponseCount > 0);

        indexPosition = 0;

        do
        {
            requestActive = true;
            ApiAvatar.FetchList(
                delegate(List <ApiAvatar> obj)
            {
                lastResponseCount = obj.Count;
                indexPosition    += obj.Count;
                requestActive     = false;
                SetupAvatarData(obj);
            },
                delegate(string obj)
            {
                lastResponseCount = 0;
                requestActive     = false;
                Debug.LogError("Error fetching your uploaded avatars:\n" + obj);
                SetupAvatarData(new List <ApiAvatar>());
            },
                ApiAvatar.Owner.Mine,
                ApiAvatar.ReleaseStatus.All,
                null,
                PageLimit,
                indexPosition,
                ApiAvatar.SortHeading.None,
                ApiAvatar.SortOrder.Descending,
                false,
                true
                );
            yield return(new WaitUntil(() => !requestActive));
        } while (lastResponseCount > 0);
    }