void OnGetStickerSetList(IList<Fresvii.AppSteroid.Models.StickerSet> stickerSets, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null)
            {
                return;
            }

            if (this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            if (this.listMeta == null || this.listMeta.CurrentPage != 0)
            {
                this.listMeta = meta;
            }

            foreach (var stickerSet in stickerSets)
            {
                UpdateStickerSet(stickerSet);
            }

            pullReflesh.PullRefleshCompleted();
        }
    void OnDeleteSnsAccount(Fresvii.AppSteroid.Models.Error error)
    {
        if (error != null)
        {
            logMessage = error.ToString(); ;
            Debug.LogError(logMessage);
            return;
        }

        logMessage = "Delete Success";
        Debug.Log(logMessage);
    }
    void OnGetSnsAccountList(IList<Fresvii.AppSteroid.Models.SnsAccount> snsAccountList, Fresvii.AppSteroid.Models.Error error)
    {
        if (error != null)
        {
            Debug.LogError(error.ToString());
            return;
        }

        logMessage = "";
        foreach (Fresvii.AppSteroid.Models.SnsAccount snsAccount in FAS.Instance.Client.User.SnsAccounts)
            logMessage += snsAccount.Id + ", " + snsAccount.Provider + ", " + snsAccount.Uid + ", " + snsAccount.CreatedAt + ", " + snsAccount.UpdatedAt + "\n";

        Debug.Log(logMessage);
    }
Пример #4
0
        void OnGetAppList(IList<Fresvii.AppSteroid.Models.App> apps, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            foreach (var app in apps)
            {
                if (string.IsNullOrEmpty(app.BannerImageUrl))
                    continue;

                var cell = cells.Find(x => x.App.Id == app.Id);

                if (cell != null)
                {
                    cell.SetApp(app, parentFrame);

                    continue;
                }

                var item = ((GameObject)Instantiate(prfbBannerCell)).GetComponent<RectTransform>();

                item.transform.SetParent(contents, false);

                item.transform.SetSiblingIndex(0);

                cell = item.GetComponent<AUIBannerCell>();

                cell.SetApp(app, parentFrame);

                cells.Add(cell);
            }

            if(this.gameObject.activeInHierarchy)
                StartCoroutine(BannerAnimation());
        }
        void OnGetEventList(IList<Fresvii.AppSteroid.Models.GameEvent> events, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            gameEventsLoadingSpinner.SetActive(false);

            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            gameEvents.SetActive(meta.TotalCount > 0);

            foreach (Fresvii.AppSteroid.Models.GameEvent gameEvent in events)
            {
                var cell = gameEventCells.Find(x => x.GameEvent.Id == gameEvent.Id);

                if (cell != null)
                {
                    cell.SetGameEvent(gameEvent, (ge) =>
                    {
                        GoToGameEvent(ge);
                    });
                }
                else
                {
                    var item = ((GameObject)Instantiate(prfbGameEventCell)).GetComponent<RectTransform>();

                    gameEventContents.AddItem(item);

                    cell = item.GetComponent<AUICommunityTopGameEventCell>();

                    cell.SetGameEvent(gameEvent, (ge) =>
                    {
                        GoToGameEvent(ge);
                    });

                    gameEventCells.Add(cell);
                }
            }

            SortEvnets();
        }
        void OnGetFriendshipRequestedUsersList(IList<Fresvii.AppSteroid.Models.Friend> friends, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            auiFriendRequest.StartCoroutine(SetRequestedUsersList(friends, meta, error));
        }
        void OnGetAppList(IList<Fresvii.AppSteroid.Models.App> apps, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            if (apps.Count > 0)
            {
                devAppTitle.text = FASText.Get("MoreAppsBy").Replace("%developer", apps[0].GameDeveloper.Name);
            }

            recommendedLoadingSpinner.SetActive(false);

            if (meta.TotalCount > 0)
            {
                foreach (var obj in recommendAppsObjects)
                {
                    obj.SetActive(true);
                }
            }

            foreach (var app in apps)
            {
                var cell = recommendedAppCells.Find(x => x.AddApp.Id == app.Id);

                if (cell != null)
                {
                    cell.SetApp(app);
                }
                else
                {
                    var item = ((GameObject)Instantiate(prfbRecommendedAppCell)).GetComponent<RectTransform>();

                    recommendedAppContents.AddItem(item);

                    cell = item.GetComponent<AUIRecommendedAppCell>();

                    cell.SetApp(app);

                    cell.OnClickAppCell += GoToAppDetail;

                    recommendedAppCells.Add(cell);
                }
            }
        }
        private void OnGetVideoList(IList<Fresvii.AppSteroid.Models.Video> videos, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            AUIManager.Instance.HideLoadingSpinner();

            if (this == null)
            {
                return;
            }

            if (this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            if (this.listMeta == null)
            {
                this.listMeta = meta;
            }
            else if (this.listMeta.CurrentPage != 0)
            {
                this.listMeta = meta;
            }

            noData.SetActive(meta.TotalCount == 0);

            mask.SetActive(meta.TotalCount == 0);

            scrollView.enabled = (meta.TotalCount > 0);

            scrollView.scrollVerticalHandle.enabled = (meta.TotalCount > 0);

            videoCount = this.listMeta.TotalCount;

            videosNum.text = FASText.Get("VideosUploadedNumber").Replace("0", videoCount.ToString());

            bool added = false;

            foreach (Fresvii.AppSteroid.Models.Video video in videos)
            {
                added |= UpdateVideo(video);
            }

            if (isPullRefleshProc)
            {
                pullReflesh.PullRefleshCompleted();

                isPullRefleshProc = false;
            }

            Sort();
        }
        void OnCompleteUploadVideo(Fresvii.AppSteroid.Models.Video video, Fresvii.AppSteroid.Models.Error error)
        {
            isUploading = false;

            if (error != null)
            {
                Fresvii.AppSteroid.Util.DialogManager.Instance.SetLabel(FresviiGUIText.Get("Yes"), FresviiGUIText.Get("No"), FresviiGUIText.Get("Cancel"));

                Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSelectDialog(FresviiGUIText.Get("VideoUploadErrorAndRetry"),

                    (del) =>
                    {
                        if (del)
                        {
                            OnClickShare();
                        }
                        else
                        {
                            if (System.IO.File.Exists(videoPath))
                            {
                                System.IO.File.Delete(videoPath);
                            }

                            FresviiGUIVideoSharing.Hide();

                            FASGesture.Resume();
                        }
                    });

                if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }
            }
            else
            {
                StartCoroutine(ShareCoroutine(video));
            }
        }
Пример #10
0
        private void OnGetThreadComments(IList<Fresvii.AppSteroid.Models.Comment> comments, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            AUIManager.Instance.HideLoadingSpinner();

            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            this.listMeta = meta;

            currentPage = meta.CurrentPage;

            if (minPage > currentPage)
            {
                minPage = currentPage;
            }

            if (maxPage < currentPage)
            {
                maxPage = currentPage;
            }

            bool added = false;

            foreach (Fresvii.AppSteroid.Models.Comment comment in comments)
            {
                added |= UpdateComment(comment);
            }

            if (pullRefleshing)
            {
                pullReflesh.PullRefleshCompleted();

                pullRefleshing = false;
            }

            if (isPullDown)
            {
                isPullDown = false;

                scrollView.Pinned();
            }

            // Sort
            commentCells.Sort(SortCondition);

            foreach (var obj in commentCells)
            {
                obj.transform.SetSiblingIndex(contents.transform.childCount - 1);
            }

            contents.ReLayout();

            if (showComment != null)
            {
                StartCoroutine(ShowComment());
            }
        }
        void OnGetHiddenFriendshipRequestedUsersList(IList<Fresvii.AppSteroid.Models.Friend> requestedList, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (loadingSpinner != null)
            {
                loadingSpinner.Hide();
            }

            loading = false;

            if (pullRefleshing)
            {
                if (isPullUp)
                {

                }
                else
                {
                    OnCompletePullReflesh(scrollViewRect, baseRect);
                }
            }

            pullRefleshing = false;

            isPullUp = false;

            if (error == null)
            {
                if (hiddenMeta == null)
                {
                    hiddenMeta = meta;
                }
                else if (hiddenMeta.CurrentPage != 1)
                {
                    hiddenMeta = meta;
                }

                foreach (Fresvii.AppSteroid.Models.Friend friend in requestedList)
                {
                    bool exists = false;

                    foreach (FresviiGUIFriendRequestCard card in hiddenCards)
                    {
                        if (card.User.Id == friend.Id)
                        {
                            exists = true;

                            break;
                        }
                    }

                    if (!exists)
                    {
                        CreateCard(friend, true, (card) =>
                        {
                            hiddenCards.Add(card);
                        });
                    }
                }
            }
            else
            {
                if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }
            }
        }
Пример #12
0
        void OnGetThreadList(IList<Fresvii.AppSteroid.Models.Thread> threads, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null)
            {
                return;
            }

            if (this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    if (error.Code == (int)Fresvii.AppSteroid.Models.Error.ErrorCode.CacheNotExists)
                    {
                        Debug.LogWarning(error.ToString());
                    }
                    else
                    {
                        Debug.LogError(error.ToString());
                    }
                }

                return;
            }

            if (meta.TotalCount > 0)
            {
                communities.SetActive(true);
            }
            else
            {
                return;
            }

            int index = 0;

            foreach (var thread in threads)
            {
                if (string.IsNullOrEmpty(thread.Comment.Text))
                    continue;

                thread.Comment.App = thread.App;

                commentCells[index].gameObject.SetActive(true);

                commentCells[index].SetThread(thread, true, OnClickCell);

                index++;

                if (index == commentCells.Length) break;
            }

            for (int i = index; i < commentCells.Length; i++)
            {
                commentCells[i].gameObject.SetActive(false);
            }
        }
Пример #13
0
        void OnGetVideoList(IList<Fresvii.AppSteroid.Models.Video> videos, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            this.previewListMeta = meta;

            this.previewVideos = videos;

            if (meta.TotalCount > 0)
            {
                previews.SetActive(true);
            }
            else
            {
                return;
            }

            foreach (var video in videos)
            {
                var cell = previewCells.Find(x => x.Video.Id == video.Id);

                if (cell != null)
                {
                    cell.SetPreview(video);

                    continue;
                }

                var item = ((GameObject)Instantiate(prfbPreviewCell)).GetComponent<RectTransform>();

                previewContents.AddItem(item);

                cell = item.GetComponent<AUIAppsPreviewCell>();

                cell.OnTapAppButtonAtVideoUI += GoToAppDetail;

                cell.SetPreview(video);

                previewCells.Add(cell);
            }

            previewContents.ReLayout();
        }
Пример #14
0
        void OnGetAppList(IList<Fresvii.AppSteroid.Models.App> apps, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            if (meta.TotalCount > 0)
            {
                recommendApps.SetActive(true);
            }
            else
            {
                return;
            }

            foreach (var app in apps)
            {
                var cell = recommendedAppCells.Find(x => x.AddApp.Id == app.Id);

                if (cell != null)
                {
                    cell.SetApp(app);
                }
                else
                {
                    var item = ((GameObject)Instantiate(prfbRecommendedAppCell)).GetComponent<RectTransform>();

                    recommendedAppContents.AddItem(item);

                    cell = item.GetComponent<AUIRecommendedAppCell>();

                    cell.SetApp(app);

                    cell.OnClickAppCell += GoToAppDetail;

                    recommendedAppCells.Add(cell);
                }
            }

            recommendedAppCells = recommendedAppCells.OrderBy(c => System.Guid.NewGuid()).ToList();

            recommendedAppContents.ReLayout();

            recommendedAppContents.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, recommendedAppContents.GetComponent<RectTransform>().anchoredPosition.y);

            if (fadeRecommendedApps.gameObject.activeSelf && this.gameObject.activeInHierarchy)
            {
                StartCoroutine(FadeOutMask(fadeRecommendedApps));
            }
        }
Пример #15
0
        void OnGetEventList(IList<Fresvii.AppSteroid.Models.GameEvent> events, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            if (meta.TotalCount > 0)
            {
                gameEventsObj.SetActive(true);
            }

            foreach (Fresvii.AppSteroid.Models.GameEvent gameEvent in events)
            {
                var cell = gameEventCells.Find(x => x.GameEvent.Id == gameEvent.Id);

                if (cell != null)
                {
                    cell.SetGameEvent(gameEvent, (ge) =>
                    {
                        GoToAppDetail(ge.App);
                    });

                    continue;
                }

                var item = ((GameObject)Instantiate(prfbGameEventCell)).GetComponent<RectTransform>();

                gameEventContents.AddItem(item);

                cell = item.GetComponent<AUIHotGameEventCell>();

                cell.SetGameEvent(gameEvent, (ge) =>
                {
                    GoToAppDetail(ge.App);
                });

                gameEventCells.Add(cell);
            }

            // Sort
            gameEventCells.Sort(SortEventsCondition);

            foreach (var obj in gameEventCells)
            {
                obj.transform.SetSiblingIndex(gameEventContents.transform.childCount - 1);
            }

            gameEventContents.ReLayout();
        }
        private void OnGetForumThreads(IList<Fresvii.AppSteroid.Models.Thread> threads, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null)
            {
                return;
            }

            if (this.enabled == false)
            {
                return;
            }

            loadingSpinner.Hide();

            if (error != null)
            {
                if (error.Code == (int)Fresvii.AppSteroid.Models.Error.ErrorCode.CacheNotExists && FASConfig.Instance.logLevel <= FAS.LogLevels.Warning)
                {
                    Debug.LogWarning(error.Detail);
                }
                else if(FASConfig.Instance.logLevel <= FAS.LogLevels.Error)
                {
                        Debug.LogError(error.ToString());
                }

                return;
            }

            foreach (Fresvii.AppSteroid.Models.Thread thread in threads)
            {
                UpdateThread(thread);
            }

            SortCards();

            scrollViewRect.y = 0.0f;
        }
Пример #17
0
        void OnGetGroupMessageList(IList<Fresvii.AppSteroid.Models.GroupMessage> groupMessages, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            AUIManager.Instance.HideLoadingSpinner();

            if (this == null)
            {
                return;
            }

            if (this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (error.Code == (int)Fresvii.AppSteroid.Models.Error.ErrorCode.NotFound || (Application.platform == RuntimePlatform.Android && error.Detail.IndexOf("FileNotFound") >= 0))
                {
                    if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error)
                    {
                        Debug.LogError(error.ToString());
                    }

                    Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FASText.Get("GroupNone"), (del) => { });

                    BackPage();
                }

                return;
            }

            if (this.listMeta == null || this.listMeta.CurrentPage != 0)
            {
                this.listMeta = meta;
            }

            foreach (Fresvii.AppSteroid.Models.GroupMessage groupMessage in groupMessages)
            {
                UpdateGroupMessage(groupMessage);
            }

            if (pullRefleshing)
            {
                pullReflesh.PullRefleshCompleted(true);

                pullRefleshing = false;
            }

            Sort();
        }
Пример #18
0
        void OnGetEventboardList(IList<Fresvii.AppSteroid.Models.Eventboard> eventboards, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            initialized = true;

            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            if (this.eventboardListMeta == null || this.eventboardListMeta.CurrentPage != 0)
            {
                this.eventboardListMeta = meta;
            }

            if (meta.TotalCount > 0)
            {
                eventBoardPanel.SetActive(true);
            }

            foreach (var eventboard in eventboards)
            {
                var cell = eventboardCells.Find(x => x.Eventboard.Id == eventboard.Id);

                if (cell != null)
                {
                    cell.SetEventboard(eventboard, this);

                    return;
                }

                var item = ((GameObject)Instantiate(prfbAUIEventboardListCell)).GetComponent<RectTransform>();

                eventboardContents.AddItem(item);

                cell = item.GetComponent<AUIGameEventboardCell>();

                cell.SetEventboard(eventboard, this);

                eventboardCells.Add(cell);
            }
        }
        private void OnGetForumThreads(IList<Fresvii.AppSteroid.Models.Thread> threads, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null)
            {
                return;
            }

            if (this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    if (error.Code == (int)Fresvii.AppSteroid.Models.Error.ErrorCode.CacheNotExists)
                    {
                        //Debug.LogWarning(error.ToString());
                    }
                    else
                    {
                        Debug.LogError(error.ToString());
                    }
                }

                return;
            }

            commentsLayoutFade.targetHeight = Mathf.Min(5f, meta.TotalCount) * commentCellHeight;

            comments.SetActive(meta.TotalCount > 0);

            commentsNoData.SetActive(meta.TotalCount == 0);

            int index = 0;

            foreach (Fresvii.AppSteroid.Models.Thread thread in threads)
            {
                if (string.IsNullOrEmpty(thread.Comment.Text) && string.IsNullOrEmpty(thread.Title))
                    continue;

                commentCells[index].gameObject.SetActive(true);

                commentCells[index].SetThread(thread, false, (_thread) =>
                {
                    GoToThread(_thread.Id, _thread.Comment, true);
                });

                index++;

                if (index == commentCells.Length) break;
            }

            for (int i = index; i < commentCells.Length; i++)
            {
                commentCells[i].gameObject.SetActive(false);
            }
        }
        void OnGetFriends(IList<Fresvii.AppSteroid.Models.Friend> _friends, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null) return;

            loadingSpinner.Hide();

            if (error == null)
            {
                foreach (Fresvii.AppSteroid.Models.Friend friend in _friends)
                {
                    this.friends.Add(friend);

                    FresviiGUIGroupMessageCreateFriendCell friendCell = ((GameObject)Instantiate(prfbGroupMessageFriendCell)).GetComponent<FresviiGUIGroupMessageCreateFriendCell>();

                    friendCell.transform.parent = this.transform;

                    friendCell.Init(friend, scaleFactor, this, textureCheckMark, AddSelectedFriend, RemoveSelectedFriend);

                    friendCells.Add(friendCell);

                    if (meta.NextPage.HasValue)
                    {
                        FASFriendship.GetAccountFriendList((uint)meta.NextPage, OnGetFriends);
                    }

                    Fresvii.AppSteroid.Models.User addedUser = null;

                    foreach (Fresvii.AppSteroid.Models.User _user in initSelectedUsers)
                    {
                        if (_user.Id == friend.Id)
                        {
                            friendCell.IsSelected = true;

                            addedUser = _user;

                            break;
                        }
                    }

                    if (addedUser != null)
                    {
                        initSelectedUsers.Remove(addedUser);
                    }

                }
            }
            else
            {
                if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }
            }
        }
        private void OnGetImageAndVideoComments(IList<Fresvii.AppSteroid.Models.Comment> comments, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            foreach (var obj in imageAndVideosObjects)
                obj.SetActive(meta.TotalCount > 0);

            foreach (var comment in comments)
            {
                AUICommunityTopImagessAndVideosCell cell = imagesAndVideosCells.Find(x => x.Comment.Id == comment.Id);

                if (cell != null)
                {
                    if (comment.VideoState == Models.Comment.VideoStatus.Removed)
                    {
                        imagesAndVideosContents.RemoveItem(cell.GetComponent<RectTransform>());

                        imagesAndVideosCells.Remove(cell);

                        Destroy(cell.gameObject);
                    }
                    else
                    {
                        cell.SetComment(comment, this);
                    }
                }
                else
                {
                    if (comment.VideoState == Models.Comment.VideoStatus.Removed) continue;

                    var item = ((GameObject)Instantiate(prfbAUICommunityTopImagesAndVideosCell)).GetComponent<RectTransform>();

                    imagesAndVideosContents.AddItem(item);

                    cell = item.GetComponent<AUICommunityTopImagessAndVideosCell>();

                    cell.SetComment(comment, this);

                    imagesAndVideosCells.Add(cell);
                }
            }

            SortImages();
        }
        void OnGetUserFriendList(IList<Fresvii.AppSteroid.Models.Friend> friends, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            bool added = false;

            foreach (Fresvii.AppSteroid.Models.Friend friend in friends)
            {
                List<Fresvii.AppSteroid.Models.Member> members = (List<Fresvii.AppSteroid.Models.Member>) Group.Members;

                if (members.Find(x => x.Id == friend.Id) == null)
                {
                    added |= UpdateFriend(friend);
                }
            }

            if (isPullRefleshProc)
            {
                pullReflesh.PullRefleshCompleted();

                isPullRefleshProc = false;
            }

            contents.ReLayout();
        }
        void OnGetVideoList(IList<Fresvii.AppSteroid.Models.Video> videos, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            AUIManager.Instance.HideLoadingSpinner();

            if (this == null)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            if (this.PreviewListMeta == null)
            {
                this.PreviewListMeta = meta;
            }
            else if (this.PreviewListMeta.CurrentPage != 0)
            {
                this.PreviewListMeta = meta;
            }

            foreach (Fresvii.AppSteroid.Models.Video video in videos)
            {
                if (mode == Mode.Apps)
                {
                    video.App = App;
                }

                UpdateVideo(video);
            }

            if (isPullRefleshProc)
            {
                pullReflesh.PullRefleshCompleted();

                isPullRefleshProc = false;
            }
        }
        void OnGetFriends(IList<Fresvii.AppSteroid.Models.Friend> friends, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null) return;

            loadingSpinner.Hide();

            if (error == null)
            {
                this.friends = friends;

                if (initCheckedUser != null)
                {
                    bool isExist = false;

                    foreach (Fresvii.AppSteroid.Models.Friend friend in this.friends)
                    {
                        if (friend.Id == initCheckedUser.Id)
                        {
                            isExist = true;

                            break;
                        }
                    }

                    if (!isExist)
                    {
                        this.friends.Insert(0, initCheckedUser.ToFriend());
                    }
                }

                foreach (Fresvii.AppSteroid.Models.Friend friend in this.friends)
                {
                    FresviiGUIGroupMessageCreateFriendCell friendCell = ((GameObject)Instantiate(prfbGroupMessageFriendCell)).GetComponent<FresviiGUIGroupMessageCreateFriendCell>();

                    friendCell.transform.parent = this.transform;

                    friendCell.Init(friend, scaleFactor, this, textureCheckMark, AddFriendToGroup, RemoveFriendToGroup);

                    if(initCheckedUser != null)
                        friendCell.IsSelected = (friend.Id == initCheckedUser.Id);

                    friendCells.Add(friendCell);
                }
            }
            else
            {
                if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error)
                    Debug.LogError(error.ToString());
            }
        }
        void OnGetRanking(IList<Fresvii.AppSteroid.Models.Score> scores, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null || !this.gameObject.activeInHierarchy)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            if (isVpullDownReflesh)
            {
                isVpullDownReflesh = false;

                isPullRefleshProc = false;

                noDataPullReflesh.PullRefleshCompleted();
            }
            else if (isPullRefleshProc)
            {
                pullReflesh.PullRefleshCompleted();

                isPullRefleshProc = false;
            }

            auiLeaderboard.StartCoroutine(SetRanking(scores, meta, error));
        }
        void OnGetGroupList(IList<Fresvii.AppSteroid.Models.Group> groups, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null || this.enabled == false || !this.gameObject.activeInHierarchy)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            this.listMeta = meta;

            bool added = false;

            foreach (Fresvii.AppSteroid.Models.Group group in groups)
            {
                if (group.Hidden)
                {
                    continue;
                }

                added |= UpdateGroup(group);
            }

            if (isPullRefleshProc)
            {
                pullReflesh.PullRefleshCompleted();

                isPullRefleshProc = false;
            }

            Sort();
        }
        void OnGetEventList(IList<Fresvii.AppSteroid.Models.GameEvent> events, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            initialized = true;

            AUIManager.Instance.HideLoadingSpinner();

            if(fade.gameObject.activeSelf)
                StartCoroutine(FadeOutMask(fade));

            if (this == null || this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            listMeta = meta;

            noData.SetActive(listMeta != null && listMeta.TotalCount == 0);

            foreach (Fresvii.AppSteroid.Models.GameEvent gameEvent in events)
            {
                var cell = cells.Find(x => x.GameEvent.Id == gameEvent.Id);

                if (cell != null)
                {
                    cell.SetGameEvent(gameEvent, this.auiEvents, this.contents, () => { });

                    continue;
                }

                var item = ((GameObject)Instantiate(prfbEventCell)).GetComponent<RectTransform>();

                cell = item.GetComponent<AUIEventCell>();

                cell.SetGameEvent(gameEvent, this.auiEvents, this.contents, () =>
                {

                });

                contents.AddItem(item);

                cells.Add(cell);

            }

            if (mode == Models.GameEvent.Status.Upcoming)
            {
                cells.Sort((a, b) => System.DateTime.Compare(a.GameEvent.StartAt, b.GameEvent.StartAt));
            }
            else if (mode == Models.GameEvent.Status.Past)
            {
                cells.Sort(SortEventsCondition);
            }
            else
            {
                cells.Sort(SortEventsCondition);
            }

            foreach (var obj in cells)
            {
                obj.transform.SetSiblingIndex(contents.transform.childCount - 1);
            }

            if (isVpullDownReflesh)
            {
                isVpullDownReflesh = false;

                isPullRefleshProc = false;

                noDataPullReflesh.PullRefleshCompleted();
            }
            else if (isPullRefleshProc)
            {
                pullReflesh.PullRefleshCompleted();

                isPullRefleshProc = false;
            }

            contents.ReLayout();
        }
        void OnGetFriendList(IList<Fresvii.AppSteroid.Models.Friend> friends, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if (this == null)
            {
                return;
            }

            if (this.enabled == false)
            {
                return;
            }

            if (error != null)
            {
                if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }

                return;
            }

            if (this.listMeta == null || this.listMeta.CurrentPage != 0)
            {
                this.listMeta = meta;
            }

            foreach (Fresvii.AppSteroid.Models.Friend friend in friends)
            {
                UpdateFriend(friend);
            }

            if (isPullRefleshProc)
            {
                pullReflesh.PullRefleshCompleted();

                isPullRefleshProc = false;
            }

            contents.ReLayout();

            buttonSubmit.interactable = (selectedUsers.Count > 0);
        }
        void OnGetFriendshipRequestedUsersList(IList<Fresvii.AppSteroid.Models.Friend> _requestedList, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error _error)
        {
            if (_error == null)
            {
                RequestedFriendsListMeta = meta;

                if (RequestedFriendsListMeta.TotalCount > 0)
                {
                    requestLabelContent = new GUIContent(FresviiGUIText.Get("FriendRequests") + ((meta.TotalCount > 0) ? (" (" + RequestedFriendsListMeta.TotalCount + ")") : ""));
                }
                else
                {
                    requestLabelContent = new GUIContent(FresviiGUIText.Get("FriendRequests"));
                }

                FresviiGUIManager.Instance.FriendRequestCount = meta.TotalCount;

                foreach (Fresvii.AppSteroid.Models.Friend friend in _requestedList)
                {
                    AddFriendshipRequest(friend);
                }
            }
            else
            {
                if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError("GetFriendshipRequestedList Error : " + _error.ToString());
                }
            }
        }
        void OnGetGroups(IList<Fresvii.AppSteroid.Models.Group> groups, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error)
        {
            if(loadingSpinner != null && !initialized)
                loadingSpinner.Hide();

            if(loadingSpinner != null && loading)
                loadingSpinner.Hide();

            float addedHeight = 0.0f;

            if (error == null)
            {
                if (groupListMeta == null)
                {
                    groupListMeta = meta;
                }
                else if (groupListMeta.CurrentPage != 1)
                {
                    groupListMeta = meta;
                }

                foreach (Fresvii.AppSteroid.Models.Group group in groups)
                {
                   addedHeight += AddGroup(group);
                }

                if (!initialized)
                {
                    initialized = true;

                    loadingSpinner.Hide();
                }
            }
            else
            {
                if (error.Code == (int)Fresvii.AppSteroid.Models.Error.ErrorCode.CacheNotExists && FASConfig.Instance.logLevel <= FAS.LogLevels.Warning)
                {
                    Debug.LogWarning(error.Detail);
                }
                else if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error)
                {
                    Debug.LogError(error.ToString());
                }
            }

            loading = false;

            if (pullRefleshing)
            {
                if (isPullUp && addedHeight > 0.0f)
                {

                }
                else
                {
                    OnCompletePullReflesh(scrollViewRect, baseRect);
                }
            }

            pullRefleshing = false;

            isPullUp = false;

            Sort();

            if (initialGroupMessage != null)
            {
                foreach (FresviiGUIGroupCard card in groupCards)
                {
                    if (initialGroupMessage.GroupId == card.Group.Id)
                    {
                        this.SetDraw(false);

                        this.Position = new Vector2(-Screen.width, 0.0f);

                        card.GoToGroupChat(false);

                        break;
                    }
                }
            }

            initialGroupMessage = null;

            uint unreadMessageCount = 0;

            foreach (FresviiGUIGroupCard card in groupCards)
            {
                if (card.Group.LatestMessage != null)
                {
                    if (card.Group.LatestMessage.Id != card.Group.LastReadMessageId && card.Group.LatestMessage.User.Id != FAS.CurrentUser.Id)
                    {
                        FresviiGUIManager.Instance.AddUnreadGroupMessageGroupId(card.Group.Id);

                        unreadMessageCount++;
                    }
                }
            }

            if (unreadMessageCount == 0)
            {
                FresviiGUIManager.Instance.ClearUnreadGroupMessageGroupId();
            }
        }