|
@@ -11,7 +11,8 @@ namespace GFGGame
|
|
|
private UI_PoemGalleryUI _ui;
|
|
|
private GList _list;
|
|
|
private List<PoemGalleryData> _galleryDatas = new List<PoemGalleryData>();
|
|
|
- private int _infoType = 0;//0推荐1好友2收藏3我的
|
|
|
+ private int _sortType = 0;//由GallerySortType定义
|
|
|
+ private int _pageCount = 10;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -42,16 +43,30 @@ namespace GFGGame
|
|
|
_ui.m_comNormal.m_listRecommend.SetVirtual();
|
|
|
_ui.m_comNormal.m_listRecommend.scrollPane.onPullDownRelease.Add(onPullDownRelease);
|
|
|
_ui.m_comNormal.m_listRecommend.scrollPane.header.onSizeChanged.Add(OnSizeChanged);
|
|
|
+ _ui.m_comNormal.m_listRecommend.scrollPane.onScroll.Add(onScroll);
|
|
|
+
|
|
|
_ui.m_comNormal.m_listFriend.itemRenderer = RenderListItem;
|
|
|
_ui.m_comNormal.m_listFriend.SetVirtual();
|
|
|
+ _ui.m_comNormal.m_listFriend.scrollPane.onScroll.Add(onScroll);
|
|
|
+
|
|
|
_ui.m_comNormal.m_listRank.itemRenderer = RenderListRankItem;
|
|
|
_ui.m_comNormal.m_listRank.SetVirtual();
|
|
|
+ _ui.m_comNormal.m_listRank.scrollPane.onScroll.Add(onScroll);
|
|
|
+
|
|
|
+ _ui.m_comFavorites.m_listFavorite.itemRenderer = RenderListItem;
|
|
|
+ _ui.m_comFavorites.m_listFavorite.SetVirtual();
|
|
|
+ _ui.m_comFavorites.m_listFavorite.scrollPane.onScroll.Add(onScroll);
|
|
|
+
|
|
|
+ _ui.m_comFavorites.m_listMySelf.itemRenderer = RenderListItem;
|
|
|
+ _ui.m_comFavorites.m_listMySelf.SetVirtual();
|
|
|
+ _ui.m_comFavorites.m_listMySelf.scrollPane.onScroll.Add(onScroll);
|
|
|
+
|
|
|
|
|
|
_ui.m_comNormal.m_btnShop.onClick.Add(OnBtnShopClick);
|
|
|
_ui.m_comNormal.m_btnReward.onClick.Add(OnBtnRewardClick);
|
|
|
- _ui.m_comNormal.m_c1.onChanged.Add(OnNormalTabChange);
|
|
|
-
|
|
|
|
|
|
+ // _ui.m_c1.onChanged.Add(OnTabChange);
|
|
|
+ _ui.m_comNormal.m_c1.onChanged.Add(OnNormalTabChange);
|
|
|
_ui.m_comFavorites.m_c1.onChanged.Add(OnFavoritesTabChange);
|
|
|
|
|
|
|
|
@@ -68,12 +83,13 @@ namespace GFGGame
|
|
|
base.OnShown();
|
|
|
|
|
|
_list = _ui.m_comNormal.m_listRecommend;
|
|
|
+ _list.numItems = 4;
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
base.OnHide();
|
|
|
-
|
|
|
+ ResetPullDownRelease();
|
|
|
}
|
|
|
|
|
|
protected override void RemoveEventListener()
|
|
@@ -100,7 +116,16 @@ namespace GFGGame
|
|
|
/// </summary>
|
|
|
private void OnBtnRecoverClick()
|
|
|
{
|
|
|
- _ui.m_comNormal.m_c1.selectedIndex = 0;
|
|
|
+
|
|
|
+ if (_ui.m_comNormal.m_c1.selectedIndex == 0)
|
|
|
+ {
|
|
|
+ onPullDownRelease();
|
|
|
+ // OnNormalTabChange();//每次点首页都要刷新
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _ui.m_comNormal.m_c1.selectedIndex = 0;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -108,14 +133,49 @@ namespace GFGGame
|
|
|
/// </summary>
|
|
|
private void OnBtnFavoritesClick()
|
|
|
{
|
|
|
- _ui.m_comFavorites.m_c1.selectedIndex = 0;
|
|
|
+ if (_ui.m_comFavorites.m_c1.selectedIndex != 0)
|
|
|
+ {
|
|
|
+ _ui.m_comFavorites.m_c1.selectedIndex = 0;
|
|
|
+ }
|
|
|
+ ResetPullDownRelease();
|
|
|
}
|
|
|
|
|
|
+ // /// <summary>
|
|
|
+ // /// 切换ui页签:首页,投稿,收藏
|
|
|
+ // /// </summary>
|
|
|
+ // private void OnTabChange()
|
|
|
+ // {
|
|
|
+ // if (_ui.m_c1.selectedIndex == 0)//刷新首页
|
|
|
+ // {
|
|
|
+ // if (_ui.m_comNormal.m_c1.selectedIndex == 0)
|
|
|
+ // {
|
|
|
+ // OnNormalTabChange();
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // _ui.m_comNormal.m_c1.selectedIndex = 0;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else if (_ui.m_c1.selectedIndex == 2)//刷新收藏页
|
|
|
+ // {
|
|
|
+ // if (_ui.m_comFavorites.m_c1.selectedIndex == 0)
|
|
|
+ // {
|
|
|
+ // OnFavoritesTabChange();
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // _ui.m_comFavorites.m_c1.selectedIndex = 0;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 切换首页页签
|
|
|
/// </summary>
|
|
|
private void OnNormalTabChange()
|
|
|
{
|
|
|
+ ResetPullDownRelease();
|
|
|
+
|
|
|
if (_ui.m_comNormal.m_c1.selectedIndex == 2)//排行榜
|
|
|
{
|
|
|
|
|
@@ -127,22 +187,26 @@ namespace GFGGame
|
|
|
// _infoType = GalleryType.Recommend;
|
|
|
if (_ui.m_comNormal.m_comBoBox.selectedIndex == 0)//推荐
|
|
|
{
|
|
|
- _infoType = (int)GallerySortType.Recommend;
|
|
|
+ _sortType = (int)GallerySortType.Recommend;
|
|
|
_galleryDatas = PoemGalleryDataManager.Instance.RecommendDatas;
|
|
|
}
|
|
|
else//最新
|
|
|
{
|
|
|
- _infoType = (int)GallerySortType.Newest;
|
|
|
+ _sortType = (int)GallerySortType.Newest;
|
|
|
_galleryDatas = PoemGalleryDataManager.Instance.NewestDatas;
|
|
|
}
|
|
|
_list = _ui.m_comNormal.m_listRecommend;
|
|
|
}
|
|
|
else if (_ui.m_comNormal.m_c1.selectedIndex == 1)//好友
|
|
|
{
|
|
|
- _infoType = (int)GallerySortType.Friend;
|
|
|
+ _sortType = (int)GallerySortType.Friend;
|
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
|
_list = _ui.m_comNormal.m_listFriend;
|
|
|
}
|
|
|
+
|
|
|
+ if (_list.numItems > 0) _list.ScrollToView(0);
|
|
|
+
|
|
|
+ ReqGalleryList(0);
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -150,16 +214,37 @@ namespace GFGGame
|
|
|
/// </summary>
|
|
|
private void OnFavoritesTabChange()
|
|
|
{
|
|
|
- if (_ui.m_comFavorites.m_c1.selectedIndex == 0)
|
|
|
+ if (_ui.m_comFavorites.m_c1.selectedIndex == 0)//我的收藏
|
|
|
{
|
|
|
- // _infoType = GalleryType.Favorite;
|
|
|
- // _galleryIds = PoemGalleryDataManager.Instance.FavoriteInfos;
|
|
|
+ _sortType = (int)GallerySortType.MyCollect;
|
|
|
+ _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
|
+ _list = _ui.m_comFavorites.m_listFavorite;
|
|
|
}
|
|
|
- else if (_ui.m_comFavorites.m_c1.selectedIndex == 1)
|
|
|
+ else if (_ui.m_comFavorites.m_c1.selectedIndex == 1)//我的作品
|
|
|
{
|
|
|
- // _infoType = GalleryType.MySelf;
|
|
|
- // _galleryIds = PoemGalleryDataManager.Instance.MySelfInfos;
|
|
|
+ _sortType = (int)GallerySortType.MyWorks;
|
|
|
+ _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
|
+ _list = _ui.m_comFavorites.m_listMySelf;
|
|
|
}
|
|
|
+ if (_list.numItems > 0) _list.ScrollToView(0);
|
|
|
+ ReqGalleryList(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //分页刷新
|
|
|
+ private void onScroll()
|
|
|
+ {
|
|
|
+ int itemIndex = _list.ChildIndexToItemIndex(0);
|
|
|
+ int startIndex = itemIndex + 1;
|
|
|
+ if (startIndex >= _list.numItems && startIndex % _pageCount == 0)
|
|
|
+ {
|
|
|
+ ReqGalleryList(startIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //请求刷新
|
|
|
+ private void ReqGalleryList(int startIndex)
|
|
|
+ {
|
|
|
+ PoemGallerySProxy.ReqGalleryList(_sortType, startIndex, _pageCount).Coroutine();
|
|
|
}
|
|
|
|
|
|
private void UpdateGalleryList()
|
|
@@ -170,7 +255,6 @@ namespace GFGGame
|
|
|
private void UpdateGalleryRankList()
|
|
|
{
|
|
|
_ui.m_comNormal.m_listRank.numItems = _galleryDatas.Count;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -182,53 +266,37 @@ namespace GFGGame
|
|
|
ViewManager.Show<ClothingShopView>(new object[] { ConstStoreId.GALLERY_STORE_ID }, new object[] { typeof(PoemGalleryView).FullName, this.viewData }, true);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 推荐
|
|
|
- /// </summary>
|
|
|
- private void OnBtnRecommendClick()
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 最新
|
|
|
- /// </summary>
|
|
|
- private void OnBtnNewestClick()
|
|
|
- {
|
|
|
- ViewManager.Show<PoemGalleryRewardView>(null, new object[] { typeof(PoemGalleryView).FullName, this.viewData }, true);
|
|
|
- }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 排行榜奖励
|
|
|
/// </summary>
|
|
|
private void OnBtnRewardClick()
|
|
|
{
|
|
|
-
|
|
|
+ ViewManager.Show<PoemGalleryRewardView>(null, new object[] { typeof(PoemGalleryView).FullName, this.viewData });
|
|
|
}
|
|
|
|
|
|
private void RenderListItem(int index, GObject obj)
|
|
|
{
|
|
|
- // PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(_galleryIds[index]);
|
|
|
- PoemGalleryData data = _galleryDatas[index];
|
|
|
- UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
-
|
|
|
-
|
|
|
- if (item.m_loaIcon.data == null)
|
|
|
- {
|
|
|
- item.m_loaIcon.onClick.Add(OnLoaIconClick);
|
|
|
- }
|
|
|
- item.m_loaIcon.data = data;
|
|
|
- if (item.m_btnCollect.data == null)
|
|
|
- {
|
|
|
- item.m_btnCollect.onClick.Add(OnBtnCollectClick);
|
|
|
- }
|
|
|
- item.m_btnCollect.data = data;
|
|
|
- if (item.m_btnVote.data == null)
|
|
|
- {
|
|
|
- item.m_btnVote.onClick.Add(OnBtnVoteClick);
|
|
|
- }
|
|
|
- item.m_btnVote.data = data;
|
|
|
- UI_ListItem.ProxyEnd();
|
|
|
+ // PoemGalleryData data = _galleryDatas[index];
|
|
|
+ // UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
+
|
|
|
+
|
|
|
+ // if (item.m_loaIcon.data == null)
|
|
|
+ // {
|
|
|
+ // item.m_loaIcon.onClick.Add(OnLoaIconClick);
|
|
|
+ // }
|
|
|
+ // item.m_loaIcon.data = data;
|
|
|
+ // if (item.m_btnCollect.data == null)
|
|
|
+ // {
|
|
|
+ // item.m_btnCollect.onClick.Add(OnBtnCollectClick);
|
|
|
+ // }
|
|
|
+ // item.m_btnCollect.data = data;
|
|
|
+ // if (item.m_btnVote.data == null)
|
|
|
+ // {
|
|
|
+ // item.m_btnVote.onClick.Add(OnBtnVoteClick);
|
|
|
+ // }
|
|
|
+ // item.m_btnVote.data = data;
|
|
|
+ // UI_ListItem.ProxyEnd();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -262,18 +330,23 @@ namespace GFGGame
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+ //下拉刷新
|
|
|
private void onPullDownRelease()
|
|
|
{
|
|
|
+ // ReqGalleryList(0);
|
|
|
+
|
|
|
GComponent header = _ui.m_comNormal.m_listRecommend.scrollPane.header;
|
|
|
Controller controller = header.GetController("c1");
|
|
|
controller.selectedIndex = 1;
|
|
|
_ui.m_comNormal.m_listRecommend.scrollPane.LockHeader(header.sourceHeight);
|
|
|
- Timers.inst.Add(2, 1, (object param) =>
|
|
|
- {
|
|
|
- controller.selectedIndex = 2;
|
|
|
- _ui.m_comNormal.m_listRecommend.scrollPane.LockHeader(0);
|
|
|
- });
|
|
|
+ Timers.inst.Add(2, 1, OnTimeComplete);
|
|
|
+ }
|
|
|
+ private void OnTimeComplete(object param)
|
|
|
+ {
|
|
|
+ GComponent header = _ui.m_comNormal.m_listRecommend.scrollPane.header;
|
|
|
+ // Controller controller = header.GetController("c1");
|
|
|
+ header.GetController("c1").selectedIndex = 2;
|
|
|
+ _ui.m_comNormal.m_listRecommend.scrollPane.LockHeader(0);
|
|
|
}
|
|
|
private void OnSizeChanged()
|
|
|
{
|
|
@@ -285,5 +358,14 @@ namespace GFGGame
|
|
|
controller.selectedIndex = 0;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 重置下拉刷新状态
|
|
|
+ /// </summary>
|
|
|
+ private void ResetPullDownRelease()
|
|
|
+ {
|
|
|
+ Timers.inst.Remove(OnTimeComplete);
|
|
|
+ OnTimeComplete(null);
|
|
|
+ }
|
|
|
}
|
|
|
}
|