|
@@ -62,6 +62,8 @@ namespace GFGGame
|
|
|
private int _tabIndex = 0;//当前选中大页签下标,首页0投稿1收藏2
|
|
|
private int _subtabIndex = 0;//当前选中小页签下标,推荐0好友1排行榜2;我的收藏0我的作品1
|
|
|
|
|
|
+ private bool isPullDown = false;//是否下拉刷新中,刷新中再次下拉不会重新请求更新数据
|
|
|
+ private bool isPullUp = false;//是否上拉刷新中,刷新中再次下拉不会重新请求更新数据
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
if (_ui != null)
|
|
@@ -82,6 +84,7 @@ namespace GFGGame
|
|
|
_ui.m_loaBg.url = ResPathUtil.GetBgImgPath("hc_bj_1");
|
|
|
|
|
|
_ui.m_comNormal.m_comBoBox.items = new string[] { "推荐", "最新" };
|
|
|
+ _ui.m_comNormal.m_comBoBox.icons = new string[] { "ui://Poem/hl_pxpx", "ui://Poem/hl_zxzx" };
|
|
|
_ui.m_btnback.onClick.Add(OnBtnBackClick);
|
|
|
_ui.m_btnRecover.onClick.Add(OnBtnRecoverClick);
|
|
|
_ui.m_btnJoin.onClick.Add(OnBtnJoinClick);
|
|
@@ -113,8 +116,8 @@ namespace GFGGame
|
|
|
{
|
|
|
base.AddEventListener();
|
|
|
|
|
|
- EventAgent.AddEventListener(ConstMessage.GALLERY_DATA_CHANGE, UpdateGalleryList);
|
|
|
- EventAgent.AddEventListener(ConstMessage.GALLERY_RANK_DATA_CHANGE, UpdateGalleryRankList);
|
|
|
+ // EventAgent.AddEventListener(ConstMessage.GALLERY_DATA_CHANGE, UpdateGalleryList);
|
|
|
+ // EventAgent.AddEventListener(ConstMessage.GALLERY_RANK_DATA_CHANGE, UpdateGalleryRankList);
|
|
|
}
|
|
|
protected override void OnShown()
|
|
|
{
|
|
@@ -140,11 +143,6 @@ namespace GFGGame
|
|
|
_ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
|
|
|
_comScroll = _ui.m_comNormal.m_comScroll.target;
|
|
|
|
|
|
- // 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);
|
|
|
|
|
|
if (_ui.m_comNormal.m_comScroll.m_listRecommend.numItems > 0) _ui.m_comNormal.m_comScroll.m_listRecommend.ScrollToView(0);
|
|
|
if (_ui.m_comNormal.m_comScroll.m_listRecommend1.numItems > 0) _ui.m_comNormal.m_comScroll.m_listRecommend1.ScrollToView(0);
|
|
@@ -157,21 +155,12 @@ namespace GFGGame
|
|
|
|
|
|
_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.numItems = 10;
|
|
|
- // _list.ResizeToFit();
|
|
|
-
|
|
|
- // _list.RefreshVirtualList();
|
|
|
- _ui.m_comNormal.m_comScroll.m_listRecommend.numItems = 7;
|
|
|
- _ui.m_comNormal.m_comScroll.m_listRecommend.ResizeToFit();
|
|
|
- _ui.m_comNormal.m_comScroll.m_listRecommend1.numItems = 6;
|
|
|
- _ui.m_comNormal.m_comScroll.m_listRecommend1.ResizeToFit();
|
|
|
+ // _ui.m_comNormal.m_comScroll.m_listRecommend.numItems = 7;
|
|
|
+ // _ui.m_comNormal.m_comScroll.m_listRecommend.ResizeToFit();
|
|
|
+ // _ui.m_comNormal.m_comScroll.m_listRecommend1.numItems = 6;
|
|
|
+ // _ui.m_comNormal.m_comScroll.m_listRecommend1.ResizeToFit();
|
|
|
+ UpdateGalleryList();
|
|
|
|
|
|
UpdateView();
|
|
|
}
|
|
@@ -179,16 +168,15 @@ namespace GFGGame
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
base.OnHide();
|
|
|
- ResetPullDownRelease();
|
|
|
- ResetPullUpRelease();
|
|
|
+ ResetPullRelease();
|
|
|
_ui.m_comNormal.m_comBoBox.selectedIndex = 0;
|
|
|
}
|
|
|
|
|
|
protected override void RemoveEventListener()
|
|
|
{
|
|
|
base.RemoveEventListener();
|
|
|
- EventAgent.RemoveEventListener(ConstMessage.GALLERY_DATA_CHANGE, UpdateGalleryList);
|
|
|
- EventAgent.RemoveEventListener(ConstMessage.GALLERY_RANK_DATA_CHANGE, UpdateGalleryRankList);
|
|
|
+ // EventAgent.RemoveEventListener(ConstMessage.GALLERY_DATA_CHANGE, UpdateGalleryList);
|
|
|
+ // EventAgent.RemoveEventListener(ConstMessage.GALLERY_RANK_DATA_CHANGE, UpdateGalleryRankList);
|
|
|
}
|
|
|
|
|
|
private void OnBtnBackClick()
|
|
@@ -256,8 +244,7 @@ namespace GFGGame
|
|
|
{
|
|
|
_ui.m_comFavorites.m_c1.selectedIndex = FavoritesType.FAVORITE;
|
|
|
}
|
|
|
- ResetPullDownRelease();
|
|
|
- ResetPullUpRelease();
|
|
|
+ ResetPullRelease();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -265,8 +252,7 @@ namespace GFGGame
|
|
|
/// </summary>
|
|
|
private void OnNormalTabChange()
|
|
|
{
|
|
|
- ResetPullDownRelease();
|
|
|
- ResetPullUpRelease();
|
|
|
+ ResetPullRelease();
|
|
|
_subtabIndex = _ui.m_comNormal.m_c1.selectedIndex;
|
|
|
if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RANK)//排行榜
|
|
|
{
|
|
@@ -360,24 +346,40 @@ namespace GFGGame
|
|
|
// GObject obj = _list.GetChildAt(index);
|
|
|
}
|
|
|
//请求刷新
|
|
|
- private void ReqGalleryList(int startIndex)
|
|
|
+ private async void ReqGalleryList(int startIndex)
|
|
|
{
|
|
|
- PoemGallerySProxy.ReqGalleryList(_sortType, startIndex, _pageCount).Coroutine();
|
|
|
+ bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, startIndex, _pageCount);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ UpdateGalleryList();
|
|
|
+ }
|
|
|
}
|
|
|
private void UpdateGalleryList()
|
|
|
{
|
|
|
- _list.numItems = _galleryDatas.Count;
|
|
|
+ // if (_galleryDatas.Count % 2 == 0)
|
|
|
+ // {
|
|
|
+ // _list.numItems = _galleryDatas.Count / 2;
|
|
|
+ // _list1.numItems = _galleryDatas.Count / 2;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // _list.numItems = (_galleryDatas.Count + 1) / 2;
|
|
|
+ // _list1.numItems = (_galleryDatas.Count - 1) / 2;
|
|
|
+ // }
|
|
|
+ UpdateView();
|
|
|
+ int count = PoemPhotoDataManager.Instance.PersonalPhotoInfos.Count;
|
|
|
if (_galleryDatas.Count % 2 == 0)
|
|
|
{
|
|
|
- _list.numItems = _galleryDatas.Count / 2;
|
|
|
- _list1.numItems = _galleryDatas.Count / 2;
|
|
|
+ _list.numItems = count / 2;
|
|
|
+ _list1.numItems = count / 2;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- _list.numItems = (_galleryDatas.Count + 1) / 2;
|
|
|
- _list1.numItems = (_galleryDatas.Count - 1) / 2;
|
|
|
+ _list.numItems = (count + 1) / 2;
|
|
|
+ _list1.numItems = (count - 1) / 2;
|
|
|
}
|
|
|
- UpdateView();
|
|
|
+ _list.ResizeToFit();
|
|
|
+ _list1.ResizeToFit();
|
|
|
}
|
|
|
|
|
|
//请求排行榜刷新
|
|
@@ -416,35 +418,42 @@ namespace GFGGame
|
|
|
_ui.m_comNormal.m_txtTime.text = PoemGalleryDataManager.Instance.GetThemeTime();
|
|
|
_ui.m_comNormal.m_grpResult.visible = PoemGalleryDataManager.Instance.IsResulting();
|
|
|
}
|
|
|
- string GetListItemResource(int index)
|
|
|
- {
|
|
|
|
|
|
- if (index % 2 == 0)
|
|
|
- return "ui://Poem/ListItem";
|
|
|
- else
|
|
|
- return "ui://Poem/ListItem1";
|
|
|
- }
|
|
|
|
|
|
private void RenderListItem(int index, GObject obj)
|
|
|
{
|
|
|
- // long workId = _galleryDatas[index * 2];
|
|
|
- // PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
|
|
|
- // UpdateListItem(data, obj);
|
|
|
- UpdateListItem(null, obj);
|
|
|
+ int dataIndex = index * 2;
|
|
|
+ long workId = PoemPhotoDataManager.Instance.PersonalPhotoInfos[index * 2].PictureId;// _galleryDatas[index * 2];
|
|
|
+
|
|
|
+ UpdateListItem(workId, obj, dataIndex);
|
|
|
}
|
|
|
private void RenderListItem1(int index, GObject obj)
|
|
|
{
|
|
|
- // long workId = _galleryDatas[index * 1];
|
|
|
- // PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
|
|
|
- // UpdateListItem(data, obj);
|
|
|
- UpdateListItem(null, obj);
|
|
|
+ int dataIndex = index * 2 + 1;
|
|
|
+ long workId = PoemPhotoDataManager.Instance.PersonalPhotoInfos[index * 2 + 1].PictureId;// _galleryDatas[index * 2 + 1];
|
|
|
+
|
|
|
+ UpdateListItem(workId, obj, dataIndex);
|
|
|
}
|
|
|
|
|
|
- private void UpdateListItem(PoemGalleryData data, GObject obj)
|
|
|
+ private void UpdateListItem(long workId, GObject obj, int dataIndex)
|
|
|
{
|
|
|
UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
+ NTexture nTexture = PoemPhotoDataManager.Instance.PersonalPhotoInfos[dataIndex].Ntexture;
|
|
|
+ item.m_loaIcon.texture = nTexture;
|
|
|
+ item.m_loaIcon.height = item.m_loaIcon.width * item.m_loaIcon.texture.height / item.m_loaIcon.texture.width;
|
|
|
+ UI_ListItem.ProxyEnd();
|
|
|
+ // PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
|
|
|
+ // UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
|
|
|
- item.m_loaIcon.SetSize(item.m_loaIcon.width, 550 + Random.Range(1, 5) * 30);
|
|
|
+ // if (data.Ntexture == null)
|
|
|
+ // {
|
|
|
+ // Timers.inst.StartCoroutine(PictureStorageHelper.DownloadFile(data.PictureTempUrl, (Texture2D texture) =>
|
|
|
+ // {
|
|
|
+ // data.Ntexture = new NTexture(texture);
|
|
|
+ // item.m_loaIcon.texture = data.Ntexture;
|
|
|
+ // }));
|
|
|
+ // }
|
|
|
+ // item.m_loaIcon.SetSize(item.m_loaIcon.width, 550 + Random.Range(1, 5) * 30);
|
|
|
|
|
|
// item.m_loaIcon.texture = data.Ntexture;
|
|
|
// item.m_txtName.text = data.AuthorName;
|
|
@@ -468,7 +477,7 @@ namespace GFGGame
|
|
|
// item.m_btnVote.onClick.Add(OnBtnVoteClick);
|
|
|
// }
|
|
|
// item.m_btnVote.data = workId;
|
|
|
- UI_ListItem.ProxyEnd();
|
|
|
+ // UI_ListItem.ProxyEnd();
|
|
|
}
|
|
|
|
|
|
private void RenderListRankItem(int index, GObject obj)
|
|
@@ -510,7 +519,6 @@ namespace GFGGame
|
|
|
private void OnLoaIconClick(EventContext context)
|
|
|
{
|
|
|
GObject obj = context.data as GObject;
|
|
|
- // PoemGalleryData data = obj.data as PoemGalleryData;
|
|
|
long workId = (long)obj.data;
|
|
|
object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex, _ui.m_comNormal.m_comBoBox.selectedIndex };
|
|
|
ViewManager.Show<PoemGalleryPreviewView>(new object[] { _sortType, workId }, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas });
|
|
@@ -527,9 +535,6 @@ namespace GFGGame
|
|
|
bool result = await PoemGallerySProxy.ReqCancelCollecteGalleryWorks(workId);
|
|
|
if (result)
|
|
|
{
|
|
|
- // galleryData.CollectOrNot = false;
|
|
|
- // galleryData.CollectCount = galleryData.CollectCount - 1;
|
|
|
-
|
|
|
if (_tabIndex == TabType.FAVORITES && _subtabIndex == FavoritesType.FAVORITE)
|
|
|
{
|
|
|
ReqGalleryList(0);//当前为收藏页要重新拉取数据
|
|
@@ -545,8 +550,6 @@ namespace GFGGame
|
|
|
bool result = await PoemGallerySProxy.ReqCollecteGalleryWorks(workId);
|
|
|
if (result)
|
|
|
{
|
|
|
- // galleryData.CollectOrNot = true;
|
|
|
- // galleryData.CollectCount = galleryData.CollectCount + 1;
|
|
|
if (_tabIndex == TabType.FAVORITES && _subtabIndex == FavoritesType.FAVORITE)
|
|
|
{
|
|
|
ReqGalleryList(0);//当前为收藏页要重新拉取数据
|
|
@@ -562,7 +565,6 @@ namespace GFGGame
|
|
|
private async void OnBtnVoteClick(EventContext context)
|
|
|
{
|
|
|
GObject obj = context.data as GObject;
|
|
|
- // PoemGalleryData galleryData = obj.data as PoemGalleryData;
|
|
|
long workId = (long)obj.data;
|
|
|
PoemGalleryData galleryData = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
|
|
|
|
|
@@ -570,8 +572,7 @@ namespace GFGGame
|
|
|
bool result = await PoemGallerySProxy.ReqVoteGalleryWorks(workId);
|
|
|
if (result)
|
|
|
{
|
|
|
- // galleryData.VoteOrNot = true;
|
|
|
- // galleryData.CollectCount = galleryData.CollectCount + 1;
|
|
|
+
|
|
|
RefreshList();
|
|
|
|
|
|
int Count = GameGlobal.myNumericComponent.GetAsInt(NumericType.LikeGalleryWorksCountDaily);
|
|
@@ -598,65 +599,66 @@ namespace GFGGame
|
|
|
}
|
|
|
|
|
|
//下拉刷新
|
|
|
- private void onPullDownRelease()
|
|
|
+ private async void onPullDownRelease()
|
|
|
{
|
|
|
- // ReqGalleryList(0);
|
|
|
-
|
|
|
GComponent header = _comScroll.scrollPane.header;
|
|
|
- if (header.height < header.sourceHeight) return;
|
|
|
+ if (header.height < header.sourceHeight || isPullDown) return;
|
|
|
|
|
|
+ isPullDown = true;
|
|
|
_comScroll.scrollPane.LockHeader(header.sourceHeight);
|
|
|
- Timers.inst.Add(2, 1, OnPullDownTimeComplete);
|
|
|
+
|
|
|
+ bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, 0, _pageCount);
|
|
|
+ OnPullDownTimeComplete();
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ UpdateGalleryList();
|
|
|
+ }
|
|
|
}
|
|
|
- private void OnPullDownTimeComplete(object param)
|
|
|
+ private void OnPullDownTimeComplete()
|
|
|
{
|
|
|
GComponent header = _comScroll.scrollPane.header;
|
|
|
Transition transition = header.GetTransition("t0");
|
|
|
transition.Stop();
|
|
|
- // header.GetController("c1").selectedIndex = 2;
|
|
|
_comScroll.scrollPane.LockHeader(0);
|
|
|
+ isPullDown = false;
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 重置下拉刷新状态
|
|
|
- /// </summary>
|
|
|
- private void ResetPullDownRelease()
|
|
|
- {
|
|
|
- Timers.inst.Remove(OnPullDownTimeComplete);
|
|
|
- OnPullDownTimeComplete(null);
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
//上拉刷新
|
|
|
- private void OnPullUpToRefresh()
|
|
|
+ private async void OnPullUpToRefresh()
|
|
|
{
|
|
|
GComponent footer = _comScroll.scrollPane.footer;
|
|
|
- if (footer.height < footer.sourceHeight) return;
|
|
|
+ if (footer.height < footer.sourceHeight || isPullUp) return;
|
|
|
|
|
|
+ isPullUp = true;
|
|
|
_comScroll.scrollPane.LockFooter(footer.sourceHeight + 10);
|
|
|
- Timers.inst.Add(2, 1, OnPullUpTimeComplete);
|
|
|
+
|
|
|
+ bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, _galleryDatas.Count, _pageCount);
|
|
|
+ OnPullUpTimeComplete();
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ UpdateGalleryList();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private void OnPullUpTimeComplete(object param)
|
|
|
+ private void OnPullUpTimeComplete()
|
|
|
{
|
|
|
GComponent footer = _comScroll.scrollPane.footer;
|
|
|
Transition transition = footer.GetTransition("t0");
|
|
|
transition.Stop();
|
|
|
// header.GetController("c1").selectedIndex = 2;
|
|
|
_comScroll.scrollPane.LockFooter(0);
|
|
|
+ isPullUp = false;
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 重置上拉刷新状态
|
|
|
- /// </summary>
|
|
|
- private void ResetPullUpRelease()
|
|
|
+ //重置上拉/下拉刷新状态
|
|
|
+ private void ResetPullRelease()
|
|
|
{
|
|
|
- Timers.inst.Remove(OnPullUpTimeComplete);
|
|
|
- OnPullUpTimeComplete(null);
|
|
|
+ // Timers.inst.Remove(OnPullDownTimeComplete);
|
|
|
+ OnPullDownTimeComplete();
|
|
|
+ // Timers.inst.Remove(OnPullUpTimeComplete);
|
|
|
+ OnPullUpTimeComplete();
|
|
|
}
|
|
|
|
|
|
- /********************************************************滚动容器*************************************************/
|
|
|
-
|
|
|
-
|
|
|
|
|
|
}
|
|
|
}
|