|
@@ -6,6 +6,34 @@ using UnityEngine;
|
|
|
|
|
|
namespace GFGGame
|
|
namespace GFGGame
|
|
{
|
|
{
|
|
|
|
+ class RecommendType
|
|
|
|
+ {
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 推荐
|
|
|
|
+ /// </summary>
|
|
|
|
+ public static int RECOMMEND = 0;
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 好友
|
|
|
|
+ /// </summary>
|
|
|
|
+ public static int FRIEND = 1;
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 排行榜
|
|
|
|
+ /// </summary>
|
|
|
|
+ public static int RANK = 2;
|
|
|
|
+ }
|
|
|
|
+ class FavoritesType
|
|
|
|
+ {
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 我的收藏
|
|
|
|
+ /// </summary>
|
|
|
|
+ public static int FAVORITE = 0;
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 我的作品
|
|
|
|
+ /// </summary>
|
|
|
|
+ public static int MY_SELF = 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
public class PoemGalleryView : BaseWindow
|
|
public class PoemGalleryView : BaseWindow
|
|
{
|
|
{
|
|
private UI_PoemGalleryUI _ui;
|
|
private UI_PoemGalleryUI _ui;
|
|
@@ -83,27 +111,44 @@ namespace GFGGame
|
|
{
|
|
{
|
|
base.OnShown();
|
|
base.OnShown();
|
|
|
|
|
|
- _tabIndex = 0;
|
|
|
|
- _subtabIndex = 0;
|
|
|
|
|
|
+
|
|
if (this.viewData != null)
|
|
if (this.viewData != null)
|
|
{
|
|
{
|
|
_tabIndex = (int)(this.viewData as object[])[0];
|
|
_tabIndex = (int)(this.viewData as object[])[0];
|
|
_subtabIndex = (int)(this.viewData as object[])[1];
|
|
_subtabIndex = (int)(this.viewData as object[])[1];
|
|
- }
|
|
|
|
- _ui.m_c1.selectedIndex = _tabIndex;
|
|
|
|
-
|
|
|
|
- if (_tabIndex == 0)
|
|
|
|
- {
|
|
|
|
|
|
+ _ui.m_comNormal.m_comBoBox.selectedIndex = (int)(this.viewData as object[])[2];
|
|
_ui.m_comNormal.m_c1.selectedIndex = _subtabIndex;
|
|
_ui.m_comNormal.m_c1.selectedIndex = _subtabIndex;
|
|
- OnNormalTabChange();
|
|
|
|
|
|
+ _ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
|
|
|
|
+ _list.RefreshVirtualList();
|
|
}
|
|
}
|
|
- else if (_tabIndex == 2)
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
|
|
+ _tabIndex = 0;
|
|
|
|
+ _subtabIndex = 0;
|
|
|
|
+ _ui.m_comNormal.m_comBoBox.selectedIndex = 0;
|
|
|
|
+ _ui.m_comNormal.m_c1.selectedIndex = _subtabIndex;
|
|
_ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
|
|
_ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
|
|
- OnFavoritesTabChange();
|
|
|
|
|
|
+ if (_ui.m_comNormal.m_listRecommend.numItems > 0) _ui.m_comNormal.m_listRecommend.ScrollToView(0);
|
|
|
|
+ if (_ui.m_comNormal.m_listFriend.numItems > 0) _ui.m_comNormal.m_listFriend.ScrollToView(0);
|
|
|
|
+ if (_ui.m_comNormal.m_listRank.numItems > 0) _ui.m_comNormal.m_listRank.ScrollToView(0);
|
|
|
|
+ if (_ui.m_comFavorites.m_listFavorite.numItems > 0) _ui.m_comFavorites.m_listFavorite.ScrollToView(0);
|
|
|
|
+ if (_ui.m_comFavorites.m_listMySelf.numItems > 0) _ui.m_comFavorites.m_listMySelf.ScrollToView(0);
|
|
|
|
+ OnNormalTabChange();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ _ui.m_c1.selectedIndex = _tabIndex;
|
|
|
|
+
|
|
|
|
+ _ui.m_comNormal.m_listRecommend.numItems = 15;
|
|
|
|
+ _ui.m_comNormal.m_listFriend.numItems = 15;
|
|
|
|
+ _ui.m_comNormal.m_listRank.numItems = 15;
|
|
|
|
+ _ui.m_comFavorites.m_listFavorite.numItems = 15;
|
|
|
|
+ _ui.m_comFavorites.m_listMySelf.numItems = 15;
|
|
|
|
+
|
|
_list = _ui.m_comNormal.m_listRecommend;
|
|
_list = _ui.m_comNormal.m_listRecommend;
|
|
_list.numItems = 10;
|
|
_list.numItems = 10;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // _list.RefreshVirtualList();
|
|
UpdateView();
|
|
UpdateView();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -133,16 +178,18 @@ namespace GFGGame
|
|
/// </summary>
|
|
/// </summary>
|
|
private void OnBtnRecoverClick()
|
|
private void OnBtnRecoverClick()
|
|
{
|
|
{
|
|
- _tabIndex = _ui.m_c1.selectedIndex;
|
|
|
|
- if (_ui.m_comNormal.m_c1.selectedIndex == 0)
|
|
|
|
|
|
+
|
|
|
|
+ if (_tabIndex == 0 && _ui.m_comNormal.m_c1.selectedIndex == RecommendType.RECOMMEND)//当前在推荐页要刷新
|
|
{
|
|
{
|
|
|
|
+ PullDown();
|
|
onPullDownRelease();
|
|
onPullDownRelease();
|
|
- // OnNormalTabChange();//每次点首页都要刷新
|
|
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else//当前不在推荐页只把页签切回到推荐页,不刷新
|
|
{
|
|
{
|
|
- _ui.m_comNormal.m_c1.selectedIndex = 0;
|
|
|
|
|
|
+ _ui.m_comNormal.m_c1.selectedIndex = RecommendType.RECOMMEND;
|
|
}
|
|
}
|
|
|
|
+ _tabIndex = _ui.m_c1.selectedIndex;
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -152,7 +199,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
// int tabIndex = _ui.m_c1.selectedIndex;
|
|
// int tabIndex = _ui.m_c1.selectedIndex;
|
|
// int subType = _ui.m_c1.selectedIndex
|
|
// int subType = _ui.m_c1.selectedIndex
|
|
- object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex };
|
|
|
|
|
|
+ object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex, _ui.m_comNormal.m_comBoBox.selectedIndex };
|
|
ViewManager.Show<DressUpView>(1, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas }, true);
|
|
ViewManager.Show<DressUpView>(1, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas }, true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -162,42 +209,13 @@ namespace GFGGame
|
|
private void OnBtnFavoritesClick()
|
|
private void OnBtnFavoritesClick()
|
|
{
|
|
{
|
|
_tabIndex = _ui.m_c1.selectedIndex;
|
|
_tabIndex = _ui.m_c1.selectedIndex;
|
|
- if (_ui.m_comFavorites.m_c1.selectedIndex != 0)
|
|
|
|
|
|
+ if (_ui.m_comFavorites.m_c1.selectedIndex != FavoritesType.FAVORITE)
|
|
{
|
|
{
|
|
- _ui.m_comFavorites.m_c1.selectedIndex = 0;
|
|
|
|
|
|
+ _ui.m_comFavorites.m_c1.selectedIndex = FavoritesType.FAVORITE;
|
|
}
|
|
}
|
|
ResetPullDownRelease();
|
|
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>
|
|
/// 切换首页页签
|
|
/// 切换首页页签
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -206,13 +224,13 @@ namespace GFGGame
|
|
ResetPullDownRelease();
|
|
ResetPullDownRelease();
|
|
|
|
|
|
_subtabIndex = _ui.m_comNormal.m_c1.selectedIndex;
|
|
_subtabIndex = _ui.m_comNormal.m_c1.selectedIndex;
|
|
- if (_ui.m_comNormal.m_c1.selectedIndex == 2)//排行榜
|
|
|
|
|
|
+ if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RANK)//排行榜
|
|
{
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- if (_ui.m_comNormal.m_c1.selectedIndex == 0)//首页
|
|
|
|
|
|
+ if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RECOMMEND)//首页
|
|
{
|
|
{
|
|
// _infoType = GalleryType.Recommend;
|
|
// _infoType = GalleryType.Recommend;
|
|
if (_ui.m_comNormal.m_comBoBox.selectedIndex == 0)//推荐
|
|
if (_ui.m_comNormal.m_comBoBox.selectedIndex == 0)//推荐
|
|
@@ -227,7 +245,7 @@ namespace GFGGame
|
|
}
|
|
}
|
|
_list = _ui.m_comNormal.m_listRecommend;
|
|
_list = _ui.m_comNormal.m_listRecommend;
|
|
}
|
|
}
|
|
- else if (_ui.m_comNormal.m_c1.selectedIndex == 1)//好友
|
|
|
|
|
|
+ else if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.FRIEND)//好友
|
|
{
|
|
{
|
|
_sortType = (int)GallerySortType.Friend;
|
|
_sortType = (int)GallerySortType.Friend;
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
@@ -246,13 +264,13 @@ namespace GFGGame
|
|
private void OnFavoritesTabChange()
|
|
private void OnFavoritesTabChange()
|
|
{
|
|
{
|
|
_subtabIndex = _ui.m_comFavorites.m_c1.selectedIndex;
|
|
_subtabIndex = _ui.m_comFavorites.m_c1.selectedIndex;
|
|
- if (_ui.m_comFavorites.m_c1.selectedIndex == 0)//我的收藏
|
|
|
|
|
|
+ if (_ui.m_comFavorites.m_c1.selectedIndex == FavoritesType.FAVORITE)//我的收藏
|
|
{
|
|
{
|
|
_sortType = (int)GallerySortType.MyCollect;
|
|
_sortType = (int)GallerySortType.MyCollect;
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
_list = _ui.m_comFavorites.m_listFavorite;
|
|
_list = _ui.m_comFavorites.m_listFavorite;
|
|
}
|
|
}
|
|
- else if (_ui.m_comFavorites.m_c1.selectedIndex == 1)//我的作品
|
|
|
|
|
|
+ else if (_ui.m_comFavorites.m_c1.selectedIndex == FavoritesType.MY_SELF)//我的作品
|
|
{
|
|
{
|
|
_sortType = (int)GallerySortType.MyWorks;
|
|
_sortType = (int)GallerySortType.MyWorks;
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
@@ -298,7 +316,7 @@ namespace GFGGame
|
|
/// </summary>
|
|
/// </summary>
|
|
private void OnBtnShopClick()
|
|
private void OnBtnShopClick()
|
|
{
|
|
{
|
|
- object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex };
|
|
|
|
|
|
+ object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex, _ui.m_comNormal.m_comBoBox.selectedIndex };
|
|
ViewManager.Show<ClothingShopView>(new object[] { ConstStoreId.GALLERY_STORE_ID }, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas }, true);
|
|
ViewManager.Show<ClothingShopView>(new object[] { ConstStoreId.GALLERY_STORE_ID }, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas }, true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -316,22 +334,6 @@ namespace GFGGame
|
|
_ui.m_comNormal.m_txtTheme.text = string.Format("本期主题:{0}", themeCfg.theme);
|
|
_ui.m_comNormal.m_txtTheme.text = string.Format("本期主题:{0}", themeCfg.theme);
|
|
_ui.m_comNormal.m_txtRank.text = string.Format("我的排名:{0}", PoemGalleryDataManager.Instance.MyRank);
|
|
_ui.m_comNormal.m_txtRank.text = string.Format("我的排名:{0}", PoemGalleryDataManager.Instance.MyRank);
|
|
_ui.m_comNormal.m_txtRewardCount.text = string.Format("奖励次数:{0}/{1}", PoemGalleryDataManager.Instance.VoteCount, GalleryRewardCfgArray.Instance.dataArray.Length);
|
|
_ui.m_comNormal.m_txtRewardCount.text = string.Format("奖励次数:{0}/{1}", PoemGalleryDataManager.Instance.VoteCount, GalleryRewardCfgArray.Instance.dataArray.Length);
|
|
- // long monday = TimeUtil.GetCurWeekMondayTime(GlobalCfgArray.globalCfg.refreshTime);//本周一5点
|
|
|
|
- // long startTime = 0;
|
|
|
|
- // long endTime = 0;
|
|
|
|
- // if ((TimeInfo.Instance.ServerNow() / 1000) < monday)//本周一5点之前显示上周
|
|
|
|
- // {
|
|
|
|
- // startTime = TimeUtil.GetLastWeekMondayTime(GlobalCfgArray.globalCfg.refreshTime);
|
|
|
|
- // endTime = TimeUtil.GetLastWeekSundayTime("23:59:59");
|
|
|
|
- // }
|
|
|
|
- // else
|
|
|
|
- // {
|
|
|
|
- // startTime = monday * 1000;
|
|
|
|
- // endTime = TimeUtil.GetCurWeekSundayTime("23:59:59") * 1000; ;
|
|
|
|
- // }
|
|
|
|
- // string strStartTime = TimeUtil.FormattingTime3(startTime);
|
|
|
|
- // string strEndTime = TimeUtil.FormattingTime3(endTime); ;
|
|
|
|
-
|
|
|
|
_ui.m_comNormal.m_txtTime.text = PoemGalleryDataManager.Instance.GetThemeTime();
|
|
_ui.m_comNormal.m_txtTime.text = PoemGalleryDataManager.Instance.GetThemeTime();
|
|
}
|
|
}
|
|
private void RenderListItem(int index, GObject obj)
|
|
private void RenderListItem(int index, GObject obj)
|
|
@@ -381,15 +383,50 @@ namespace GFGGame
|
|
{
|
|
{
|
|
GObject obj = context.data as GObject;
|
|
GObject obj = context.data as GObject;
|
|
PoemGalleryData data = obj.data as PoemGalleryData;
|
|
PoemGalleryData data = obj.data as PoemGalleryData;
|
|
- object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex };
|
|
|
|
|
|
+ object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex, _ui.m_comNormal.m_comBoBox.selectedIndex };
|
|
ViewManager.Show<PoemGalleryPreviewView>(new object[] { _sortType, data }, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas });
|
|
ViewManager.Show<PoemGalleryPreviewView>(new object[] { _sortType, data }, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas });
|
|
}
|
|
}
|
|
|
|
|
|
- private void OnBtnCollectClick(EventContext context)
|
|
|
|
|
|
+ private async void OnBtnCollectClick(EventContext context)
|
|
{
|
|
{
|
|
GObject obj = context.data as GObject;
|
|
GObject obj = context.data as GObject;
|
|
- PoemGalleryData data = obj.data as PoemGalleryData;
|
|
|
|
-
|
|
|
|
|
|
+ PoemGalleryData galleryData = obj.data as PoemGalleryData;
|
|
|
|
+ if (galleryData.CollectOrNot)
|
|
|
|
+ {
|
|
|
|
+ bool result = await PoemGallerySProxy.ReqCancelCollecteGalleryWorks(galleryData.WorkId);
|
|
|
|
+ if (result)
|
|
|
|
+ {
|
|
|
|
+ galleryData.CollectOrNot = false;
|
|
|
|
+ galleryData.CollectCount = galleryData.CollectCount - 1;
|
|
|
|
+ UpdateView();
|
|
|
|
+ if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RANK)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_comNormal.m_listRank.RefreshVirtualList();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ _list.RefreshVirtualList();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ bool result = await PoemGallerySProxy.ReqCollecteGalleryWorks(galleryData.WorkId);
|
|
|
|
+ if (result)
|
|
|
|
+ {
|
|
|
|
+ galleryData.CollectOrNot = true;
|
|
|
|
+ galleryData.CollectCount = galleryData.CollectCount + 1;
|
|
|
|
+ UpdateView();
|
|
|
|
+ if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RANK)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_comNormal.m_listRank.RefreshVirtualList();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ _list.RefreshVirtualList();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private void OnBtnVoteClick(EventContext context)
|
|
private void OnBtnVoteClick(EventContext context)
|
|
@@ -399,7 +436,12 @@ namespace GFGGame
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ private void PullDown()
|
|
|
|
+ {
|
|
|
|
+ if (_ui.m_comNormal.m_listRecommend.numItems > 0) _ui.m_comNormal.m_listRecommend.ScrollToView(0);
|
|
|
|
+ GComponent header = _ui.m_comNormal.m_listRecommend.scrollPane.header;
|
|
|
|
+ header.height = header.sourceHeight;
|
|
|
|
+ }
|
|
|
|
|
|
//下拉刷新
|
|
//下拉刷新
|
|
private void onPullDownRelease()
|
|
private void onPullDownRelease()
|