Пример #1
0
 public void LoadFromVRoidHub()
 {
     HubApi.GetAccountCharacterModels(
         count: PagerField.PerPageCount,
         onSuccess: (List <CharacterModel> characterModels) =>
     {
         for (int i = 0; i < characterModels.Count; ++i)
         {
             var item = Instantiate(VrmItemPrafab, ListParent);
             item.Init(characterModels[i]);
         }
     },
         onError: (error) =>
     {
         Debug.LogError(error.message);
     }
         );
     HubApi.GetHearts(
         count: PagerField.PerPageCount,
         onSuccess: (List <CharacterModel> characterModels) =>
     {
         Debug.Log(characterModels.Count);
         for (int i = 0; i < characterModels.Count; ++i)
         {
             var item = Instantiate(VrmItemPrafab, ListParent);
             item.Init(characterModels[i]);
         }
     },
         onError: (error) =>
     {
         Debug.LogError(error.message);
     }
         );
 }
Пример #2
0
        private void TabRequest(CharacterModelsModel.Tab tab, Action <IRenderer> onResponse)
        {
            switch (tab)
            {
            case CharacterModelsModel.Tab.YOURS:
                HubApi.GetAccountCharacterModels(10, GetCharacterModelsCallback(onResponse), GetOnErrorCallback(onResponse));
                break;

            case CharacterModelsModel.Tab.LIKE:
                HubApi.GetHearts(10, GetCharacterModelsCallback(onResponse), GetOnErrorCallback(onResponse));
                break;

            case CharacterModelsModel.Tab.PICKUP:
                HubApi.GetStaffPicks(10, (staffPicksCharacterModel, link) =>
                {
                    var characterModels = staffPicksCharacterModel.Select((x) => x.character_model);
                    GetCharacterModelsCallback(onResponse)(characterModels.ToList(), link);
                }, GetOnErrorCallback(onResponse));
                break;

            default:
                break;
            }
        }