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(); }
IEnumerator Init() { while (!AUIManager.Instance.Initialized) { yield return 1; } FASDirectMessage.GetDirectMessageList(1, false, (directMessages, meta, error) => { if (this.gameObject == null || !this.gameObject.activeInHierarchy) { return; } if (error == null) { this.directMessages = directMessages; this.listMeta = meta; if (directMessages.Count > 0) { this.directMessage = directMessages[0]; SetDirectMessage(this.directMessage); } } }); while (FAS.OfficialUser == null) { yield return 1; } userIcon.Set(FAS.OfficialUser.ProfileImageUrl); }
void OnGetUserFriendList(IList<Fresvii.AppSteroid.Models.Friend> friends, 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.CurrentPage != 0) { this.listMeta = meta; } noData.SetActive(meta.TotalCount == 0); noDataUserFindButton.SetActive(meta.TotalCount == 0 && (User.Id == FAS.CurrentUser.Id)); noFriendsText.text = (User.Id == FAS.CurrentUser.Id) ? FASText.Get("YouHaveNoFriends") : FASText.Get("NoFriends"); title.text = this.listMeta.TotalCount.ToString() + " " + FASText.Get("Friends"); bool added = false; foreach (Fresvii.AppSteroid.Models.Friend friend in friends) { friend.FriendStatus = Models.User.FriendStatuses.Friend; added |= UpdateFriend(friend); } if (pullRefleshing) { pullReflesh.PullRefleshCompleted(); pullRefleshing = false; } contents.ReLayout(); }
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 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()); } } }
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 GetDirectMessageList() { FAS.Instance.Client.DirectMessageService.GetDirectMessageList(1, true, (directMessages, meta, error) => { if (error == null) { DirectMessagesMeta = meta; FresviiGUIManager.Instance.UnreadDirectMessageCount = meta.TotalCount; directMessageListLabelContent = new GUIContent(FresviiGUIText.Get("DirectMessages") + ((meta.TotalCount > 0) ? (" (" + DirectMessagesMeta.TotalCount + ")") : "")); } else { if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error) { Debug.LogError(error.ToString()); } } }); }
void GetAccountFriendList() { FASFriendship.GetAccountFriendList(delegate(IList<Fresvii.AppSteroid.Models.Friend> friends, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error) { if (loadingSpinner != null) loadingSpinner.Hide(); if (error == null) { FriendsMeta = meta; friendCountLabelContent = new GUIContent(((meta.TotalCount > 0) ? (FriendsMeta.TotalCount.ToString()) + " " : "") + FresviiGUIText.Get("Friends")); } else { if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error) { Debug.LogError(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(); } }
void GetUserVideoList() { string query = "{\"where\":[{\"collection\":\"users\", \"column\":\"id\", \"value\":\"" + user.Id + "\"}]}"; FASVideo.GetVideoList( query, (videos, meta, error) => { if (loadingSpinner != null) loadingSpinner.Hide(); if (error == null) { VideosMeta = meta; videoListLabelContent = new GUIContent(((meta.TotalCount > 0) ? (VideosMeta.TotalCount.ToString()) + " " : "") + FresviiGUIText.Get("Videos")); } else { if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error) { Debug.LogError(error.ToString()); } } }); }
void GetUserFriendList(){ FASFriendship.GetUserFriendList(user.Id, delegate(IList<Fresvii.AppSteroid.Models.Friend> friends, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error) { #if GROUP_CONFERENCE if (loadingSpinner != null) loadingSpinner.Hide(); #endif if (error != null) { Fresvii.AppSteroid.Util.DialogManager.Instance.SetLabel(FresviiGUIText.Get("OK"), FresviiGUIText.Get("Cancel"), FresviiGUIText.Get("Close")); Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("UnknownError"), delegate(bool del) { }); return; } else { this.friendsMeta = meta; friendCountLabelContent = new GUIContent(friendsMeta.TotalCount + " " + FresviiGUIText.Get("Friends")); } }); }
void OnGetVideoList(IList<Fresvii.AppSteroid.Models.Video> _videos, Fresvii.AppSteroid.Models.ListMeta _meta, Fresvii.AppSteroid.Models.Error _error) { if (loadingSpinner != null) { loadingSpinner.Hide(); } if (bottomLoadingSpinner != null) { bottomLoadingSpinner.Hide(); } videoListLoading = false; if(_error == null) { foreach (Fresvii.AppSteroid.Models.Video video in _videos) { AddVideo(video); } this.videoListMeta = _meta; contentUploaded = new GUIContent(_meta.TotalCount.ToString() + FresviiGUIText.Get("VideosUploaded")); } }
private void OnGetImageAndVideoComments(IList<Fresvii.AppSteroid.Models.Comment> comments, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error) { AUIManager.Instance.HideLoadingSpinner(); if (isPullUpRefleshProc) { isPullDownRefleshProc = isPullUpRefleshProc = false; pullReflesh.PullRefleshCompleted(); } if (isPullDownRefleshProc) { isPullDownRefleshProc = isPullUpRefleshProc = false; pullReflesh.PullRefleshCompleted(); if (pullReflesh2 != null) { pullReflesh2.PullRefleshCompleted(); } } 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; noData.SetActive(listMeta != null && listMeta.TotalCount == 0); if (this.gameObject.activeInHierarchy) { StartCoroutine(LoadImages(comments)); } }
private void OnGetForumThreads(IList<Fresvii.AppSteroid.Models.Thread> threads, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error) { AUIManager.Instance.HideLoadingSpinner(); if (this == null) { return; } if (this.enabled == false) { return; } if (isPullDownRefleshProc || isPullUpRefleshProc) { pullReflesh.PullRefleshCompleted(); isPullUpRefleshProc = isPullDownRefleshProc = false; } if (error != null) { if (FASSettings.Instance.logLevel <= FAS.LogLevels.Error) { Debug.LogError(error.ToString()); } return; } loaded = true; if (this.listMeta == null || this.listMeta.CurrentPage != 1) { this.listMeta = meta; } noData.SetActive(listMeta != null && listMeta.TotalCount == 0); bool added = false; foreach (Fresvii.AppSteroid.Models.Thread thread in threads) { added |= UpdateThread(thread); } Sort(); }
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(); }
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 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 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 GetAccountVideoList() { FASVideo.GetCurrentUserVideoList((videos, meta, error) => { if (loadingSpinner != null) loadingSpinner.Hide(); if (error == null) { VideosMeta = meta; videoListLabelContent = new GUIContent(((meta.TotalCount > 0) ? (VideosMeta.TotalCount.ToString()) + " " : "") + FresviiGUIText.Get("Videos")); } else { if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error) { Debug.LogError(error.ToString()); } } }); }
void GetUserFriendList(uint page) { friendListLoading = true; FASFriendship.GetUserFriendList(user.Id, delegate(IList<Fresvii.AppSteroid.Models.Friend> friends, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error) { friendListLoading = false; if (bottomLoadingSpinner != null) { bottomLoadingSpinner.Hide(); } if (error != null && this.gameObject != null) { if (this.gameObject.activeInHierarchy) { Fresvii.AppSteroid.Util.DialogManager.Instance.SetLabel(FresviiGUIText.Get("OK"), FresviiGUIText.Get("Cancel"), FresviiGUIText.Get("Close")); if (error.Code == (int)Fresvii.AppSteroid.Models.Error.ErrorCode.NetworkNotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); } else { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(error.Detail, delegate(bool del) { }); } } return; } else { this.friendsMeta = meta; foreach (Fresvii.AppSteroid.Models.Friend friend in friends) { AddFriend(friend); } if (page == 1) { friendListTop.SetTitle(this.user, this.friendsMeta); if (loadingSpinner != null) loadingSpinner.Hide(); } } }); }
IEnumerator SetRequestedUsersList(IList<Fresvii.AppSteroid.Models.Friend> friends, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error) { while (this != null && !this.gameObject.activeInHierarchy) { yield return 1; } if (this == null) { yield break; } this.listMeta = meta; foreach (Fresvii.AppSteroid.Models.Friend friend in friends) { UpdateFriend(friend); } if (isPullRefleshProc) { pullReflesh.PullRefleshCompleted(); isPullRefleshProc = false; } contents.ReLayout(); }
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); } }
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 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(); }
IEnumerator SetRanking(IList<Fresvii.AppSteroid.Models.Score> scores, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error) { while (this != null && !this.gameObject.activeInHierarchy) { yield return 1; } if (this == null || !this.gameObject.activeInHierarchy) { yield break; } foreach (AUIScrollViewItemLayout item in allPlayerCellItems) { item.ignore = false; } this.listMeta = meta; noData.SetActive(meta.TotalCount == 0); foreach (Fresvii.AppSteroid.Models.Score score in scores) { UpdateScore(score); } Sort(); }
public void OnPullUpReflesh() { if (loading || loadBlock) return; uint loadPage = 2; if (pullUpListMeta != null) { if (pullUpListMeta.NextPage.HasValue) { loadPage = (uint)pullUpListMeta.NextPage; } else { loadPage = pullUpListMeta.TotalCount / pullUpListMeta.PerPage + 1; } } loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Bottom; loadingSpinner.Position = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + baseRect.height - reloadHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position); pullRefleshing = true; FASForum.GetForumThreads(loadPage, delegate(IList<Fresvii.AppSteroid.Models.Thread> _threads, Fresvii.AppSteroid.Models.ListMeta _meta, Fresvii.AppSteroid.Models.Error _error) { pullUpListMeta = _meta; pullRefleshing = false; loading = false; loadingSpinner.Hide(); if (_error == null) { float addedHeight = 0.0f; foreach (Fresvii.AppSteroid.Models.Thread thread in _threads) { addedHeight += UpdateThread(thread); } SortCards(); if (addedHeight > 0.0f) { //scrollViewRect.y -= addedHeight; } else { OnCompletePullReflesh(scrollViewRect, baseRect, forumTopMenu.height, tabBar.height); } } else { OnCompletePullReflesh(scrollViewRect, baseRect, forumTopMenu.height, tabBar.height); } }); }
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(); }
public void SetTitle(Fresvii.AppSteroid.Models.User user, Fresvii.AppSteroid.Models.ListMeta meta) { this.user = user; this.friendsListMeta = meta; LayoutTitle(); }
public void OnPullDownReflesh() { if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Top; loadingSpinnerPosition = new Rect(baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, baseRect.y + reloadHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, FASGui.GuiDepthBase); pullRefleshing = true; uint loadPage = 2; if (pullUpListMeta != null) { if (pullUpListMeta.NextPage.HasValue) { loadPage = (uint)pullUpListMeta.NextPage; } else { loadPage = pullUpListMeta.TotalCount / pullUpListMeta.PerPage + 1; } } FASForum.GetThreadComments(Thread.Id, loadPage, delegate(IList<Fresvii.AppSteroid.Models.Comment> _comments, Fresvii.AppSteroid.Models.ListMeta _meta, Fresvii.AppSteroid.Models.Error _error) { pullUpListMeta = _meta; pullRefleshing = false; bool added = false; loadingSpinner.Hide(); OnCompletePullReflesh(scrollViewRect, baseRect); if (_error == null) { loading = false; int insertIndex = 0; foreach (Fresvii.AppSteroid.Models.Comment _comment in _comments) { if (!commentIds.Contains(_comment.Id)) { FresviiGUICommentCard card = ((GameObject)Instantiate(Resources.Load("GuiPrefabs/CommentCard"))).GetComponent<FresviiGUICommentCard>(); card.transform.parent = this.transform; card.Init(_comment, scaleFactor, Thread, Screen.width - 2f * sideMargin, this); cards.Add(card); //scrollPosition.y -= card.GetHeight(); comments.Add(_comment); commentIds.Add(_comment.Id); insertIndex++; added = true; } else { foreach (FresviiGUICommentCard card in cards) { if (card.Comment.Id == _comment.Id) { card.Comment = _comment; break; } } } } } cards.Sort((a, b) => System.DateTime.Compare(a.Comment.CreatedAt, b.Comment.CreatedAt)); if (cards.Count > cardMaxNum) { for (int i = 0; i < cardMaxNum - cards.Count; i++) { FresviiGUICommentCard card = cards[cards.Count - 1]; cards.RemoveAt(cards.Count - 1); Destroy(card.gameObject); } } if (!FASGesture.IsTouching && !added) { iTween.ValueTo(this.gameObject, iTween.Hash("from", scrollViewRect.y, "to", 0.0f, "time", tweenTime, "easetype", tweenEaseType, "onupdatetarget", this.gameObject, "onupdate", "OnUpdateScrollPosition")); } }); }
void OnGetGroupMessagesWithoutScroll(IList<Fresvii.AppSteroid.Models.GroupMessage> groupMessages, Fresvii.AppSteroid.Models.ListMeta meta, Fresvii.AppSteroid.Models.Error error) { if (this == null) return; if (loadingSpinnerTop != null) loadingSpinnerTop.Hide(); if (error == null) { this.groupMessages = groupMessages; if (groupMessagesMeta == null || meta.CurrentPage != GroupService.DefaultPageNumber) groupMessagesMeta = meta; foreach (Fresvii.AppSteroid.Models.GroupMessage groupMessage in groupMessages) { bool exists = false; for (int i = 0; i < chatBalloons.Count; i++) { if (chatBalloons[i].GroupMessage.Id == groupMessage.Id) { exists = true; break; } } if (!exists) { FresviiGUIChatBalloon chatBalloon = ((GameObject)Instantiate(prfbChatBalloon)).GetComponent<FresviiGUIChatBalloon>(); chatBalloon.Init(groupMessage, scaleFactor, Screen.width, this); scrollViewRect.y -= chatBalloon.GetHeight() + balloonMargin; chatBalloons.Add(chatBalloon); Sort(); } } } else { if (FASConfig.Instance.logLevel <= FAS.LogLevels.Error) Debug.LogError(error.ToString()); } loading = false; pullRefleshing = false; if (scrollViewRect.y < - baseRect.y) { OnCompletePullReflesh(scrollViewRect, baseRect); } }