public void OnPullUpReflesh() { if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Bottom; loadingSpinnerPosition = new Rect(baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, baseRect.y + baseRect.height - reloadHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, FASGui.GuiDepthBase); loadedPage++; pullRefleshing = true; FASForum.GetThreadComments(Thread.Id, loadedPage, delegate(IList<Fresvii.AppSteroid.Models.Comment> _comments, Fresvii.AppSteroid.Models.Error _error) { bool added = false; pullRefleshing = false; loadingSpinner.Hide(); OnCompletePullReflesh(scrollViewRect, baseRect, threadTopMenu.height, threadBottomMenu.height); if (_error == null) { 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); comments.Add(_comment); commentIds.Add(_comment.Id); 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[0]; cards.RemoveAt(0); Destroy(card.gameObject); } } } else { loadedPage--; } if (!added) loadedPage--; loading = false; if (!FASGesture.IsTouching && !added) { iTween.ValueTo(this.gameObject, iTween.Hash("from", scrollViewRect.y, "to", - scrollViewRect.height + baseRect.height - threadBottomMenu.height, "time", tweenTime, "easetype", tweenEaseType, "onupdatetarget", this.gameObject, "onupdate", "OnUpdateScrollPosition")); } }); }
void OnPullUpReflesh() { uint loadPage = 2; Fresvii.AppSteroid.Models.ListMeta selectedMeta = (selectedIndex == 0 ) ? requestedMeta : hiddenMeta; if (selectedMeta != null) { if (selectedMeta.NextPage.HasValue) { loadPage = (uint)selectedMeta.NextPage; } else { loadPage = selectedMeta.TotalCount / selectedMeta.PerPage + 1; } } if (loading || loadBlock) return; 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 - pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position, this.GuiDepth - 1); pullRefleshing = true; isPullUp = true; if (selectedIndex == 0) { FASFriendship.GetFriendshipRequestedUsersList(FAS.CurrentUser.Id, loadPage, false, OnGetFriendshipRequestedUsersList); } else { FASFriendship.GetHiddenFriendshipRequestedUsersList(loadPage, OnGetHiddenFriendshipRequestedUsersList); } }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); threadTopMenu = GetComponent<FresviiGUIThreadTopMenu>(); threadBottomMenu = GetComponent<FresviiGUIThreadBottomMenu>(); this.postFix = postFix; threadTopMenu.Init(appIcon, postFix, scaleFactor); threadBottomMenu.Init(postFix, scaleFactor, this); this.scaleFactor = scaleFactor; this.sideMargin *= scaleFactor; this.verticalMargin = verticalMargin * scaleFactor; this.loadingSpinnerSize *= scaleFactor; this.reloadHeight *= scaleFactor; TexForumLikeM = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeMTextureName + postFix, false); TexForumLikeMH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeMHTextureName + postFix, false); TexForumLikeL = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeLTextureName + postFix, false); TexForumLikeLH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeLHTextureName + postFix, false); this.baseRect = new Rect(Position.x, Position.y + threadTopMenu.height, Screen.width, Screen.height - threadTopMenu.height - threadBottomMenu.height); if (Application.internetReachability == NetworkReachability.NotReachable) { Fresvii.AppSteroid.Util.DialogManager.Instance.ShowSubmitDialog(FresviiGUIText.Get("Offline"), delegate(bool del) { }); return; } else { if (cards == null) { cards = new List<FresviiGUICommentCard>(); } else { foreach (FresviiGUICommentCard card in cards) { Destroy(card.gameObject); } cards.Clear(); } pageLoaded = 0; int pageNum = (int)(Thread.CommentCount / 25 + 1); for (uint i = 1; i <= pageNum; i++) { FASForum.GetThreadComments(this.Thread.Id, i, OnGetThreadComments); } } Initialized = true; loadingSpinnerPlace = LoadingSpinnerPlace.Center; loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, FASGui.GuiDepthBase); threadTopMenu.GuiDepth = GuiDepth - 1; threadBottomMenu.GuiDepth = GuiDepth - 1; SetScrollSlider(scaleFactor * 2.0f); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); friendRequestTopMenu = GetComponent<FresviiGUIFriendRequestsTopMenu>(); friendRequestTopMenu.Init(appIcon, postFix, scaleFactor, this.GuiDepth - 10, this); tabBar = GetComponent<FresviiGUITabBar>(); tabBar.Init(postFix, scaleFactor, this.GuiDepth - 1); tabBar.GuiDepth = GuiDepth - 1; this.scaleFactor = scaleFactor; sideMargin *= scaleFactor; verticalMargin *= scaleFactor; miniMargin *= scaleFactor; topMargin *= scaleFactor; loadingSpinnerSize *= scaleFactor; segmentedCtrlHeight *= scaleFactor; pullRefleshHeight *= scaleFactor; TexButtonAdd = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.Button02TextureName + postFix, false); TexButtonAddH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.Button02HTextureName + postFix, false); TexButtonHide = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.Button03TextureName + postFix, false); TexButtonHideH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.Button03HTextureName + postFix, false); Initialized = true; SetScrollSlider(scaleFactor * 2.0f); FASFriendship.GetFriendshipRequestedUsersList(FAS.CurrentUser.Id, OnGetFriendshipRequestedUsersList); FASFriendship.GetHiddenFriendshipRequestedUsersList(OnGetHiddenFriendshipRequestedUsersList); loadingSpinnerPlace = LoadingSpinnerPlace.Center; loadingSpinnerPosition = new Rect(Position.x + Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition); labels = new List<string>(); labels.Add(FresviiGUIText.Get("Requested")); labels.Add(FresviiGUIText.Get("NotNow")); selectedCards = requestedCards; segmentedCtrl.Init(scaleFactor, postFix, labels, OnTapSegmentedControl); }
void OnPullDownReflesh() { if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Top; loadingSpinner.Position = new Rect(baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, baseRect.y + segmentedCtrlBgPosition.height + pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position, this.GuiDepth - 1); pullRefleshing = true; if (selectedIndex == 0) { FASFriendship.GetFriendshipRequestedUsersList(FAS.CurrentUser.Id, OnGetFriendshipRequestedUsersList); } else { FASFriendship.GetHiddenFriendshipRequestedUsersList(OnGetHiddenFriendshipRequestedUsersList); } }
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); } }); }
public void OnPullDownReflesh() { if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Top; loadingSpinner.Position = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + reloadHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position); pullRefleshing = true; FASForum.GetForumThreads(delegate(IList<Fresvii.AppSteroid.Models.Thread> _threads, Fresvii.AppSteroid.Models.Error error) { pullRefleshing = false; loading = false; OnCompletePullReflesh(scrollViewRect, baseRect); loadingSpinner.Hide(); if (error == null) { foreach (Fresvii.AppSteroid.Models.Thread thread in _threads) { UpdateThread(thread); } SortCards(); } }); }
public override void Init(Texture2D appIcon, string postFix, float scaleFactor, int guiDepth) { this.GuiDepth = guiDepth; textureCoordsBackground = FresviiGUIColorPalette.GetTextureCoods(FresviiGUIColorPalette.MainBackground); loadingSpinnerPlace = LoadingSpinnerPlace.Center; loadingSpinnerPosition = new Rect(Screen.width * 0.5f - loadingSpinnerSize.x * 0.5f, Screen.height * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinnerPosition, FASGui.GuiDepthBase); forumTopMenu = GetComponent<FresviiGUIForumTopMenu>(); tabBar = GetComponent<FresviiGUITabBar>(); forumTopMenu.Init(appIcon, postFix, scaleFactor, FresviiGUIText.Get("Forum")); tabBar.Init(postFix, scaleFactor, this.GuiDepth - 1); this.scaleFactor = scaleFactor; this.verticalMargin = verticalMargin * scaleFactor; this.reloadHeight *= scaleFactor; this.sideMargin *= scaleFactor; this.loadingSpinnerSize *= scaleFactor; this.postFix = postFix; TexForumCommentS = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumCommentSTextureName + postFix, false); TexForumCommentSH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumCommentSHTextureName + postFix, false); TexForumLikeS = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeSTextureName + postFix, false); TexForumLikeSH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeSHTextureName + postFix, false); TexForumCommentL = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumCommentLTextureName + postFix, false); TexForumCommentLH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumCommentLHTextureName + postFix, false); TexForumLikeL = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeLTextureName + postFix, false); TexForumLikeLH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeLHTextureName + postFix, false); TexForumLikeM = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeMTextureName + postFix, false); TexForumLikeMH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumLikeMHTextureName + postFix, false); TexForumMenu = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumMenuTextureName + postFix, false); TexForumMenuH = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.ForumMenuHTextureName + postFix, false); TexVideoPlaybackIcon = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.VideoPlaybackIconTextureName, false); TexVideoIcon = FresviiGUIManager.Instance.resourceManager.LoadTextureFromResource(FresviiGUIConstants.ResouceTextureFolderName + "/" + FresviiGUIConstants.VideoIconTextureName, false); FASForum.GetForumThreadsFromCache(OnGetForumThreads); GetForumThreads(); Initialized = true; frameCreateThread = ((GameObject)Instantiate(prfbGUIFrameCreateThread)).GetComponent<FresviiGUIFrame>(); frameCreateThread.transform.parent = this.transform; frameCreateThread.Init(appIcon, postFix, scaleFactor, this.GuiDepth - 10); frameCreateThread.PostFrame = this; frameCreateThread.SetDraw(false); tabBar.GuiDepth = this.GuiDepth - 1; SetScrollSlider(scaleFactor * 2.0f); }
void OnPullUpReflesh() { uint loadPage = 2; if (groupListMeta != null) { if (groupListMeta.NextPage.HasValue) { loadPage = (uint)groupListMeta.NextPage; } else { loadPage = groupListMeta.TotalCount / groupListMeta.PerPage + 1; } } if (loading || loadBlock) return; 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 - pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position, this.GuiDepth - 1); pullRefleshing = true; isPullUp = true; FASGroup.GetGroupMessageGroupList(loadPage, OnGetGroups); }
void OnPullDownReflesh() { if (loading || loadBlock) return; loading = true; loadBlock = true; loadingSpinnerPlace = LoadingSpinnerPlace.Top; loadingSpinner.Position = new Rect(Position.x + baseRect.x + baseRect.width * 0.5f - loadingSpinnerSize.x * 0.5f, Position.y + baseRect.y + pullRefleshHeight * 0.5f - loadingSpinnerSize.y * 0.5f, loadingSpinnerSize.x, loadingSpinnerSize.y); loadingSpinner = Fresvii.AppSteroid.Gui.LoadingSpinner.Show(loadingSpinner.Position, this.GuiDepth - 1); pullRefleshing = true; FASGroup.GetGroupMessageGroupList(OnGetGroups); }