|
@@ -54,7 +54,11 @@ namespace GFGGame
|
|
|
private UI_PoemGalleryUI _ui;
|
|
|
private GList _list;
|
|
|
private GList _list1;
|
|
|
- private GComponent _comScroll;
|
|
|
+ private GList _scrollList;
|
|
|
+
|
|
|
+ private UI_ComScroll _comScroll;
|
|
|
+ private ScrollPane _curScrollPane;
|
|
|
+ private GComponent _curFooter;
|
|
|
// private List<PoemGalleryData> _galleryDatas = new List<PoemGalleryData>();
|
|
|
private List<long> _galleryDatas = new List<long>();
|
|
|
private int _sortType = 0;//由GallerySortType定义
|
|
@@ -95,15 +99,37 @@ namespace GFGGame
|
|
|
_ui.m_btnJoin.onClick.Add(OnBtnJoinClick);
|
|
|
_ui.m_btnFavorites.onClick.Add(OnBtnFavoritesClick);
|
|
|
|
|
|
- _ui.m_comNormal.m_comScroll.target.scrollPane.onPullDownRelease.Add(onPullDownRelease);
|
|
|
- _ui.m_comNormal.m_comScroll.target.scrollPane.onPullUpRelease.Add(OnPullUpToRefresh);
|
|
|
- _ui.m_comFavorites.m_comScroll.target.scrollPane.onPullDownRelease.Add(onPullDownRelease);
|
|
|
- _ui.m_comFavorites.m_comScroll.target.scrollPane.onPullUpRelease.Add(OnPullUpToRefresh);
|
|
|
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend.scrollPane.onPullDownRelease.Add(SetPullDownParent0);
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend1.scrollPane.onPullDownRelease.Add(SetPullDownParent1);
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend.scrollPane.onPullUpRelease.Add(OnPullUpToRefresh);
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend1.scrollPane.onPullUpRelease.Add(OnPullUpToRefresh);
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend.scrollPane.onScroll.Add(SetScrollCom0);
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend1.scrollPane.onScroll.Add(SetScrollCom1);
|
|
|
+
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend.SetVirtual();
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend1.SetVirtual();
|
|
|
_ui.m_comNormal.m_comScroll.m_listRecommend.itemRenderer = RenderListItem;
|
|
|
_ui.m_comNormal.m_comScroll.m_listRecommend1.itemRenderer = RenderListItem1;
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend.scrollPane.twinsScrollPane = _ui.m_comNormal.m_comScroll.m_listRecommend1.scrollPane;
|
|
|
+ _ui.m_comNormal.m_comScroll.m_listRecommend1.scrollPane.twinsScrollPane = _ui.m_comNormal.m_comScroll.m_listRecommend.scrollPane;
|
|
|
+
|
|
|
+
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend.scrollPane.onPullDownRelease.Add(OnPullDownRelease);
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend1.scrollPane.onPullDownRelease.Add(OnPullDownRelease);
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend.scrollPane.onPullUpRelease.Add(OnPullUpToRefresh);
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend1.scrollPane.onPullUpRelease.Add(OnPullUpToRefresh);
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend.scrollPane.onScroll.Add(SetScrollCom2);
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend1.scrollPane.onScroll.Add(SetScrollCom3);
|
|
|
+
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend.SetVirtual();
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend1.SetVirtual();
|
|
|
_ui.m_comFavorites.m_comScroll.m_listRecommend.itemRenderer = RenderListItem;
|
|
|
_ui.m_comFavorites.m_comScroll.m_listRecommend1.itemRenderer = RenderListItem1;
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend.scrollPane.twinsScrollPane = _ui.m_comFavorites.m_comScroll.m_listRecommend1.scrollPane;
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_listRecommend1.scrollPane.twinsScrollPane = _ui.m_comFavorites.m_comScroll.m_listRecommend.scrollPane;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
_ui.m_comNormal.m_listRank.itemRenderer = RenderListRankItem;
|
|
|
// _ui.m_comNormal.m_listRank.SetVirtual();
|
|
@@ -155,7 +181,7 @@ namespace GFGGame
|
|
|
_ui.m_comNormal.m_comBoBox.selectedIndex = 0;
|
|
|
_ui.m_comNormal.m_c1.selectedIndex = _subtabIndex;
|
|
|
_ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
|
|
|
- _comScroll = _ui.m_comNormal.m_comScroll.target;
|
|
|
+ // _comScroll = _ui.m_comNormal.m_comScroll.target;
|
|
|
|
|
|
|
|
|
if (_ui.m_comNormal.m_comScroll.m_listRecommend.numItems > 0) _ui.m_comNormal.m_comScroll.m_listRecommend.ScrollToView(0);
|
|
@@ -169,16 +195,23 @@ namespace GFGGame
|
|
|
_ui.m_comFavorites.m_comScroll.m_listRecommend.numItems = 0;
|
|
|
_ui.m_comFavorites.m_comScroll.m_listRecommend1.numItems = 0;
|
|
|
|
|
|
- // OnFavoritesTabChange();
|
|
|
- // OnNormalTabChange();
|
|
|
- // _ui.m_comNormal.m_comOpenLoad.target.visible = true;
|
|
|
+ _scrollList = _ui.m_comNormal.m_comScroll.m_listRecommend;
|
|
|
+
|
|
|
ViewManager.Show<ModalStatusView>();
|
|
|
UpdateList();
|
|
|
PullDown();
|
|
|
- onPullDownRelease();
|
|
|
+ OnPullDownRelease();
|
|
|
}
|
|
|
|
|
|
_ui.m_c1.selectedIndex = _tabIndex;
|
|
|
+ // _ui.m_comNormal.m_comScroll.m_comHeader.target.y = -_ui.m_comNormal.m_comScroll.m_comHeader.target.height;
|
|
|
+ // _ui.m_comNormal.m_comScroll.m_comFooter.target.y = _ui.m_comNormal.m_comScroll.target.height;
|
|
|
+ // _ui.m_comFavorites.m_comScroll.m_comHeader.target.y = -_ui.m_comFavorites.m_comScroll.m_comHeader.target.height;
|
|
|
+ // _ui.m_comFavorites.m_comScroll.m_comFooter.target.y = _ui.m_comFavorites.m_comScroll.target.height;
|
|
|
+ _ui.m_comNormal.m_comScroll.m_comHeader.m_grpLoad.visible = true;
|
|
|
+ _ui.m_comNormal.m_comScroll.m_comFooter.m_grpLoad.visible = true;
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_comHeader.target.visible = false;
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_comFooter.m_grpLoad.visible = true;
|
|
|
|
|
|
UpdateView();
|
|
|
if (PoemGalleryDataManager.Instance.HasBonus)
|
|
@@ -245,7 +278,7 @@ namespace GFGGame
|
|
|
if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RECOMMEND)//重新拉取数据
|
|
|
{
|
|
|
PullDown();
|
|
|
- onPullDownRelease();
|
|
|
+ OnPullDownRelease();
|
|
|
}
|
|
|
else//切页签并重新拉取数据
|
|
|
{
|
|
@@ -289,7 +322,7 @@ namespace GFGGame
|
|
|
private void OnNormalTabChange()
|
|
|
{
|
|
|
ResetPullRelease();
|
|
|
- _ui.m_comNormal.m_comScroll.target.scrollPane.header.visible = false;
|
|
|
+ // _ui.m_comNormal.m_comScroll.target.scrollPane.header.visible = false;
|
|
|
_subtabIndex = _ui.m_comNormal.m_c1.selectedIndex;
|
|
|
if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RANK)//排行榜
|
|
|
{
|
|
@@ -301,21 +334,36 @@ namespace GFGGame
|
|
|
{
|
|
|
UpdateList();
|
|
|
|
|
|
- if (_list.numItems > 0) _list.ScrollToView(0);
|
|
|
- if (_list1.numItems > 0) _list.ScrollToView(0);
|
|
|
_list.numItems = 0;
|
|
|
_list1.numItems = 0;
|
|
|
+ if (_list.numItems > 0) _list.ScrollToView(0);
|
|
|
+ if (_list1.numItems > 0) _list.ScrollToView(0);
|
|
|
ReqGalleryList(0);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 切换收藏页签
|
|
|
+ /// </summary>
|
|
|
+ private void OnFavoritesTabChange()
|
|
|
+ {
|
|
|
+ _subtabIndex = _ui.m_comFavorites.m_c1.selectedIndex;
|
|
|
+ UpdateList();
|
|
|
+ _list.numItems = 0;
|
|
|
+ _list1.numItems = 0;
|
|
|
+ ReqGalleryList(0);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void UpdateList()
|
|
|
{
|
|
|
if (_tabIndex == TabType.RECOVER)
|
|
|
{
|
|
|
+ _ui.m_comNormal.m_comScroll.m_comHeader.target.visible = true;
|
|
|
if (_subtabIndex == RecommendType.RECOMMEND)//首页
|
|
|
{
|
|
|
- _ui.m_comNormal.m_comScroll.target.scrollPane.header.visible = true;
|
|
|
+ // _ui.m_comNormal.m_comScroll.target.scrollPane.header.visible = true;
|
|
|
if (_ui.m_comNormal.m_comBoBox.selectedIndex == 0)//推荐
|
|
|
{
|
|
|
_sortType = (int)GallerySortType.Recommend;
|
|
@@ -331,6 +379,7 @@ namespace GFGGame
|
|
|
{
|
|
|
_sortType = (int)GallerySortType.Friend;
|
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
|
+ _ui.m_comNormal.m_comScroll.m_comHeader.target.visible = false;
|
|
|
}
|
|
|
else if (_subtabIndex == RecommendType.RANK)
|
|
|
{
|
|
@@ -338,7 +387,8 @@ namespace GFGGame
|
|
|
}
|
|
|
_list = _ui.m_comNormal.m_comScroll.m_listRecommend;
|
|
|
_list1 = _ui.m_comNormal.m_comScroll.m_listRecommend1;
|
|
|
- _comScroll = _ui.m_comNormal.m_comScroll.target;
|
|
|
+ _comScroll = _ui.m_comNormal.m_comScroll;
|
|
|
+ // _curScrollPane = _ui.m_comNormal.m_comScroll.m_listRecommend.scrollPane;
|
|
|
}
|
|
|
else if (_tabIndex == TabType.FAVORITES)
|
|
|
{
|
|
@@ -354,38 +404,14 @@ namespace GFGGame
|
|
|
}
|
|
|
_list = _ui.m_comFavorites.m_comScroll.m_listRecommend;
|
|
|
_list1 = _ui.m_comFavorites.m_comScroll.m_listRecommend1;
|
|
|
- _comScroll = _ui.m_comFavorites.m_comScroll.target;
|
|
|
+ _comScroll = _ui.m_comFavorites.m_comScroll;
|
|
|
+ // _curScrollPane = _ui.m_comFavorites.m_comScroll.m_listRecommend.scrollPane;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 切换收藏页签
|
|
|
- /// </summary>
|
|
|
- private void OnFavoritesTabChange()
|
|
|
- {
|
|
|
- _ui.m_comFavorites.m_comScroll.target.scrollPane.header.visible = false;
|
|
|
- _subtabIndex = _ui.m_comFavorites.m_c1.selectedIndex;
|
|
|
- UpdateList();
|
|
|
- if (_list.numItems > 0) _list.ScrollToView(0);
|
|
|
- if (_list1.numItems > 0) _list.ScrollToView(0);
|
|
|
- ReqGalleryList(0);
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
/********************************************************请求更新列表*************************************************/
|
|
|
|
|
|
- private void onScrollEnd()
|
|
|
- {
|
|
|
- GComponent header = _comScroll.scrollPane.header;
|
|
|
- if (!header.visible || header.height >= header.sourceHeight || isPullDown) return;
|
|
|
-
|
|
|
- if (_comScroll.scrollPane.percY == 1)
|
|
|
- {
|
|
|
- ReqGalleryList(_galleryDatas.Count);
|
|
|
- // PullUp();
|
|
|
- // OnPullUpToRefresh();
|
|
|
- }
|
|
|
- }
|
|
|
//请求刷新
|
|
|
private async void ReqGalleryList(int startIndex)
|
|
|
{
|
|
@@ -421,8 +447,6 @@ namespace GFGGame
|
|
|
_list.numItems = (_galleryDatas.Count + 1) / 2;
|
|
|
_list1.numItems = (_galleryDatas.Count - 1) / 2;
|
|
|
}
|
|
|
- _list.ResizeToFit();
|
|
|
- _list1.ResizeToFit();
|
|
|
}
|
|
|
|
|
|
UpdateView();
|
|
@@ -456,7 +480,7 @@ namespace GFGGame
|
|
|
{
|
|
|
bool isResulting = PoemGalleryDataManager.Instance.IsResulting();
|
|
|
_ui.m_comNormal.m_grpResult.visible = isResulting;
|
|
|
- _ui.m_comNormal.m_comScroll.target.visible = !isResulting;
|
|
|
+ // _ui.m_comNormal.m_comScroll.target.visible = !isResulting;
|
|
|
_ui.m_comNormal.m_listRank.visible = !isResulting;
|
|
|
|
|
|
GalleryThemeCfg themeCfg = GalleryThemeCfgArray.Instance.GetCfg((int)PoemGalleryDataManager.Instance.ThemeId);
|
|
@@ -640,18 +664,62 @@ namespace GFGGame
|
|
|
private void PullDown()
|
|
|
{
|
|
|
if (_list.numItems > 0) _list.ScrollToView(0);
|
|
|
- GComponent header = _comScroll.scrollPane.header;
|
|
|
- header.height = header.sourceHeight;
|
|
|
+ _curScrollPane = _list.scrollPane;
|
|
|
+ _curScrollPane.header.height = _curScrollPane.header.sourceHeight;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetScrollCom0()
|
|
|
+ {
|
|
|
+ _scrollList = _ui.m_comNormal.m_comScroll.m_listRecommend;
|
|
|
+ UpdateHeaderPos(_ui.m_comNormal.m_comScroll.m_comHeader.target, _ui.m_comNormal.m_comScroll.m_comFooter.target, _ui.m_comNormal.m_comScroll.m_listRecommend);
|
|
|
+ }
|
|
|
+ private void SetScrollCom1()
|
|
|
+ {
|
|
|
+ _scrollList = _ui.m_comNormal.m_comScroll.m_listRecommend1;
|
|
|
+ UpdateHeaderPos(_ui.m_comNormal.m_comScroll.m_comHeader.target, _ui.m_comNormal.m_comScroll.m_comFooter.target, _ui.m_comNormal.m_comScroll.m_listRecommend1);
|
|
|
}
|
|
|
+ private void SetScrollCom2()
|
|
|
+ {
|
|
|
+ _scrollList = _ui.m_comFavorites.m_comScroll.m_listRecommend;
|
|
|
+ UpdateHeaderPos(null, _ui.m_comFavorites.m_comScroll.m_comFooter.target, _ui.m_comFavorites.m_comScroll.m_listRecommend);
|
|
|
+ }
|
|
|
+ private void SetScrollCom3()
|
|
|
+ {
|
|
|
+ _scrollList = _ui.m_comFavorites.m_comScroll.m_listRecommend1;
|
|
|
+ UpdateHeaderPos(null, _ui.m_comFavorites.m_comScroll.m_comFooter.target, _ui.m_comFavorites.m_comScroll.m_listRecommend1);
|
|
|
+ }
|
|
|
+ private void UpdateHeaderPos(GComponent header, GComponent footer, GList list)
|
|
|
+ {
|
|
|
+ if (header != null && list.scrollPane.container.y > 0)
|
|
|
+ {
|
|
|
+ header.height = list.scrollPane.header.height;
|
|
|
+ }
|
|
|
+ else if (footer != null && list.scrollPane.container.y < -list.scrollPane.posY)
|
|
|
+ {
|
|
|
+ footer.height = list.scrollPane.footer.height;
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void SetPullDownParent0()
|
|
|
+ {
|
|
|
+ _curScrollPane = _ui.m_comNormal.m_comScroll.m_listRecommend.scrollPane;
|
|
|
+ OnPullDownRelease();
|
|
|
+ }
|
|
|
+ private void SetPullDownParent1()
|
|
|
+ {
|
|
|
+ _curScrollPane = _ui.m_comNormal.m_comScroll.m_listRecommend1.scrollPane;
|
|
|
+ OnPullDownRelease();
|
|
|
+ }
|
|
|
//下拉刷新
|
|
|
- private async void onPullDownRelease()
|
|
|
+ private async void OnPullDownRelease()
|
|
|
{
|
|
|
- GComponent header = _comScroll.scrollPane.header;
|
|
|
- if (!header.visible || header.height < header.sourceHeight || isPullDown) return;
|
|
|
+ if (!_comScroll.m_comHeader.target.visible || _scrollList.scrollPane.header.height < _scrollList.scrollPane.header.sourceHeight || isPullDown) return;
|
|
|
|
|
|
isPullDown = true;
|
|
|
- _comScroll.scrollPane.LockHeader(header.sourceHeight);
|
|
|
+ _scrollList.scrollPane.LockHeader(_scrollList.scrollPane.header.sourceHeight);
|
|
|
|
|
|
bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, 0, PoemGalleryDataManager.pageCount);
|
|
|
// OnPullDownTimeComplete();
|
|
@@ -663,38 +731,29 @@ namespace GFGGame
|
|
|
}
|
|
|
private void OnPullDownTimeComplete()
|
|
|
{
|
|
|
- if (_comScroll == null) return;
|
|
|
- GComponent header = _comScroll.scrollPane.header;
|
|
|
+ if (_scrollList == null) return;
|
|
|
+ GComponent header = _scrollList.scrollPane.header;
|
|
|
Transition transition = header.GetTransition("t0");
|
|
|
transition.Stop();
|
|
|
- header.height = 1;
|
|
|
- _comScroll.scrollPane.LockHeader(0);
|
|
|
+ _scrollList.scrollPane.LockHeader(0);
|
|
|
isPullDown = false;
|
|
|
- }
|
|
|
- //自动上拉
|
|
|
- private void PullUp()
|
|
|
- {
|
|
|
- GComponent header = _comScroll.scrollPane.footer;
|
|
|
- header.height = header.sourceHeight;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//上拉刷新
|
|
|
private async void OnPullUpToRefresh()
|
|
|
{
|
|
|
- GComponent header = _comScroll.scrollPane.header;
|
|
|
- if (!header.visible || header.height >= header.sourceHeight || isPullDown) return;
|
|
|
+ GComponent header = _scrollList.scrollPane.header;
|
|
|
+ if (!header.visible || header.height > header.sourceHeight || isPullDown) return;
|
|
|
|
|
|
- GComponent footer = _comScroll.scrollPane.footer;
|
|
|
- if (footer.height < footer.sourceHeight || isPullUp) return;
|
|
|
- // _lastListCount = _list.numItems;
|
|
|
- // _lastList1Count = _list1.numItems;
|
|
|
- _lastGalleryDatasCount = _galleryDatas.Count;
|
|
|
+ GComponent footer = _scrollList.scrollPane.footer;
|
|
|
+ if (footer.height <= footer.sourceHeight || isPullUp) return;
|
|
|
|
|
|
+ _lastGalleryDatasCount = _galleryDatas.Count;
|
|
|
isPullUp = true;
|
|
|
- _comScroll.scrollPane.LockFooter(footer.sourceHeight + 10);
|
|
|
+ _scrollList.scrollPane.LockFooter(footer.sourceHeight + 10);
|
|
|
|
|
|
bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, _galleryDatas.Count, PoemGalleryDataManager.pageCount);
|
|
|
- // OnPullUpTimeComplete();
|
|
|
if (result)
|
|
|
{
|
|
|
Timers.inst.StartCoroutine(PictureStorageHelper.Download(_galleryDatas, _lastGalleryDatasCount, UpdateGalleryList));
|
|
@@ -704,23 +763,25 @@ namespace GFGGame
|
|
|
|
|
|
private void OnPullUpTimeComplete()
|
|
|
{
|
|
|
- if (_comScroll == null) return;
|
|
|
- GComponent footer = _comScroll.scrollPane.footer;
|
|
|
+
|
|
|
+ if (_scrollList == null) return;
|
|
|
+
|
|
|
+ GComponent footer = _scrollList.scrollPane.footer;
|
|
|
Transition transition = footer.GetTransition("t0");
|
|
|
transition.Stop();
|
|
|
- // header.GetController("c1").selectedIndex = 2;
|
|
|
- _comScroll.scrollPane.LockFooter(0);
|
|
|
+ _scrollList.scrollPane.LockFooter(0);
|
|
|
isPullUp = false;
|
|
|
+
|
|
|
+
|
|
|
+ _ui.m_comNormal.m_comScroll.m_comFooter.target.height = footer.initHeight;
|
|
|
+ _ui.m_comFavorites.m_comScroll.m_comFooter.target.height = footer.initHeight;
|
|
|
}
|
|
|
|
|
|
//重置上拉/下拉刷新状态
|
|
|
private void ResetPullRelease()
|
|
|
{
|
|
|
- // Timers.inst.Remove(OnPullDownTimeComplete);
|
|
|
OnPullDownTimeComplete();
|
|
|
- // Timers.inst.Remove(OnPullUpTimeComplete);
|
|
|
OnPullUpTimeComplete();
|
|
|
- // _ui.m_comNormal.m_comOpenLoad.target.visible = false;
|
|
|
ViewManager.Hide<ModalStatusView>();
|
|
|
}
|
|
|
}
|