|
@@ -131,8 +131,8 @@ namespace GFGGame
|
|
|
_ui.m_comNormal.m_comBoBox.selectedIndex = (int)(this.viewData as object[])[2];
|
|
|
_ui.m_comNormal.m_c1.selectedIndex = _subtabIndex;
|
|
|
_ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
|
|
|
- _list.RefreshVirtualList();
|
|
|
- _list1.RefreshVirtualList();
|
|
|
+
|
|
|
+ UpdateGalleryList();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -155,13 +155,7 @@ namespace GFGGame
|
|
|
|
|
|
_ui.m_c1.selectedIndex = _tabIndex;
|
|
|
|
|
|
-
|
|
|
- // _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();
|
|
|
-
|
|
|
+ // UpdateGalleryList();
|
|
|
UpdateView();
|
|
|
}
|
|
|
|
|
@@ -227,8 +221,6 @@ namespace GFGGame
|
|
|
/// </summary>
|
|
|
private void OnBtnJoinClick()
|
|
|
{
|
|
|
- // int tabIndex = _ui.m_c1.selectedIndex;
|
|
|
- // int subType = _ui.m_c1.selectedIndex
|
|
|
object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex, _ui.m_comNormal.m_comBoBox.selectedIndex };
|
|
|
ViewManager.Show<DressUpView>(1, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas }, true);
|
|
|
}
|
|
@@ -263,7 +255,6 @@ namespace GFGGame
|
|
|
{
|
|
|
if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RECOMMEND)//首页
|
|
|
{
|
|
|
- // _infoType = GalleryType.Recommend;
|
|
|
if (_ui.m_comNormal.m_comBoBox.selectedIndex == 0)//推荐
|
|
|
{
|
|
|
_sortType = (int)GallerySortType.Recommend;
|
|
@@ -274,13 +265,11 @@ namespace GFGGame
|
|
|
_sortType = (int)GallerySortType.Newest;
|
|
|
_galleryDatas = PoemGalleryDataManager.Instance.NewestDatas;
|
|
|
}
|
|
|
- // _list = _ui.m_comNormal.m_listRecommend;
|
|
|
}
|
|
|
else if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.FRIEND)//好友
|
|
|
{
|
|
|
_sortType = (int)GallerySortType.Friend;
|
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
|
- // _list = _ui.m_comNormal.m_listFriend;
|
|
|
}
|
|
|
_list = _ui.m_comNormal.m_comScroll.m_listRecommend;
|
|
|
_list1 = _ui.m_comNormal.m_comScroll.m_listRecommend1;
|
|
@@ -301,13 +290,11 @@ namespace GFGGame
|
|
|
{
|
|
|
_sortType = (int)GallerySortType.MyCollect;
|
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
|
- // _list = _ui.m_comFavorites.m_listFavorite;
|
|
|
}
|
|
|
else if (_ui.m_comFavorites.m_c1.selectedIndex == FavoritesType.MY_SELF)//我的作品
|
|
|
{
|
|
|
_sortType = (int)GallerySortType.MyWorks;
|
|
|
_galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
|
|
|
- // _list = _ui.m_comFavorites.m_listMySelf;
|
|
|
}
|
|
|
_list = _ui.m_comNormal.m_comScroll.m_listRecommend;
|
|
|
_list1 = _ui.m_comNormal.m_comScroll.m_listRecommend1;
|
|
@@ -319,31 +306,12 @@ namespace GFGGame
|
|
|
|
|
|
/********************************************************请求更新列表*************************************************/
|
|
|
|
|
|
- //分页刷新
|
|
|
- // private void onScroll()
|
|
|
- // {
|
|
|
- // if (_list == null) return;
|
|
|
- // int index = _list.ItemIndexToChildIndex(_list.numItems);
|
|
|
- // int itemIndex = _list.ChildIndexToItemIndex(0);
|
|
|
- // int startIndex = itemIndex + 1;
|
|
|
- // if (startIndex >= _list.numItems && startIndex % _pageCount == 0)
|
|
|
- // {
|
|
|
- // ReqGalleryList(startIndex);
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
private void onScrollEnd()
|
|
|
{
|
|
|
- // int index = _list.ItemIndexToChildIndex(_list.numItems);
|
|
|
- // if (index <= _list.numChildren)
|
|
|
- // {
|
|
|
-
|
|
|
- // }
|
|
|
if (_comScroll.scrollPane.percY == 1)
|
|
|
{
|
|
|
ReqGalleryList(_list.numItems);
|
|
|
}
|
|
|
- // GObject obj = _list.GetChildAt(index);
|
|
|
}
|
|
|
//请求刷新
|
|
|
private async void ReqGalleryList(int startIndex)
|
|
@@ -356,30 +324,21 @@ namespace GFGGame
|
|
|
}
|
|
|
private void UpdateGalleryList()
|
|
|
{
|
|
|
- // 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 = count / 2;
|
|
|
- _list1.numItems = count / 2;
|
|
|
+ _list.numItems = _galleryDatas.Count / 2;
|
|
|
+ _list1.numItems = _galleryDatas.Count / 2;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- _list.numItems = (count + 1) / 2;
|
|
|
- _list1.numItems = (count - 1) / 2;
|
|
|
+ _list.numItems = (_galleryDatas.Count + 1) / 2;
|
|
|
+ _list1.numItems = (_galleryDatas.Count - 1) / 2;
|
|
|
}
|
|
|
+
|
|
|
_list.ResizeToFit();
|
|
|
_list1.ResizeToFit();
|
|
|
+
|
|
|
+ UpdateView();
|
|
|
}
|
|
|
|
|
|
//请求排行榜刷新
|
|
@@ -422,70 +381,63 @@ namespace GFGGame
|
|
|
|
|
|
private void RenderListItem(int index, GObject obj)
|
|
|
{
|
|
|
- int dataIndex = index * 2;
|
|
|
- long workId = PoemPhotoDataManager.Instance.PersonalPhotoInfos[index * 2].PictureId;// _galleryDatas[index * 2];
|
|
|
-
|
|
|
- UpdateListItem(workId, obj, dataIndex);
|
|
|
+ long workId = _galleryDatas[index * 2];
|
|
|
+ UpdateListItem(workId, obj);
|
|
|
}
|
|
|
+
|
|
|
private void RenderListItem1(int index, GObject obj)
|
|
|
{
|
|
|
- int dataIndex = index * 2 + 1;
|
|
|
- long workId = PoemPhotoDataManager.Instance.PersonalPhotoInfos[index * 2 + 1].PictureId;// _galleryDatas[index * 2 + 1];
|
|
|
-
|
|
|
- UpdateListItem(workId, obj, dataIndex);
|
|
|
+ long workId = _galleryDatas[index * 2 + 1];
|
|
|
+ UpdateListItem(workId, obj);
|
|
|
}
|
|
|
|
|
|
- private void UpdateListItem(long workId, GObject obj, int dataIndex)
|
|
|
+ private void UpdateListItem(long workId, GObject obj)
|
|
|
{
|
|
|
+ PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
|
|
|
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);
|
|
|
|
|
|
- // 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;
|
|
|
- // item.m_btnCollect.title = data.CollectCount.ToString();
|
|
|
- // item.m_btnCollect.selected = data.CollectOrNot;
|
|
|
- // item.m_btnVote.title = data.VoteCount.ToString();
|
|
|
- // item.m_btnVote.selected = data.VoteOrNot;
|
|
|
+ if (data.Ntexture == null)
|
|
|
+ {
|
|
|
+ Timers.inst.StartCoroutine(PictureStorageHelper.DownloadFile(data.PictureTempUrl, (Texture2D texture) =>
|
|
|
+ {
|
|
|
+ data.Ntexture = new NTexture(texture);
|
|
|
+ item.m_loaIcon.texture = data.Ntexture;
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ item.m_loaIcon.texture = data.Ntexture;
|
|
|
+ }
|
|
|
+ item.m_loaIcon.height = item.m_loaIcon.width * item.m_loaIcon.texture.height / item.m_loaIcon.texture.width;
|
|
|
+ item.m_txtName.text = data.AuthorName;
|
|
|
+ item.m_btnCollect.title = data.CollectCount.ToString();
|
|
|
+ item.m_btnCollect.selected = data.CollectOrNot;
|
|
|
+ item.m_btnVote.title = data.VoteCount.ToString();
|
|
|
+ item.m_btnVote.selected = data.VoteOrNot;
|
|
|
|
|
|
- // if (item.m_loaIcon.data == null)
|
|
|
- // {
|
|
|
- // item.m_loaIcon.onClick.Add(OnLoaIconClick);
|
|
|
- // }
|
|
|
- // item.m_loaIcon.data = workId;
|
|
|
- // if (item.m_btnCollect.data == null)
|
|
|
- // {
|
|
|
- // item.m_btnCollect.onClick.Add(OnBtnCollectClick);
|
|
|
- // }
|
|
|
- // item.m_btnCollect.data = workId;
|
|
|
- // if (item.m_btnVote.data == null)
|
|
|
- // {
|
|
|
- // item.m_btnVote.onClick.Add(OnBtnVoteClick);
|
|
|
- // }
|
|
|
- // item.m_btnVote.data = workId;
|
|
|
- // UI_ListItem.ProxyEnd();
|
|
|
+ if (item.m_loaIcon.data == null)
|
|
|
+ {
|
|
|
+ item.m_loaIcon.onClick.Add(OnLoaIconClick);
|
|
|
+ }
|
|
|
+ item.m_loaIcon.data = workId;
|
|
|
+ if (item.m_btnCollect.data == null)
|
|
|
+ {
|
|
|
+ item.m_btnCollect.onClick.Add(OnBtnCollectClick);
|
|
|
+ }
|
|
|
+ item.m_btnCollect.data = workId;
|
|
|
+ if (item.m_btnVote.data == null)
|
|
|
+ {
|
|
|
+ item.m_btnVote.onClick.Add(OnBtnVoteClick);
|
|
|
+ }
|
|
|
+ item.m_btnVote.data = workId;
|
|
|
+ UI_ListItem.ProxyEnd();
|
|
|
}
|
|
|
|
|
|
private void RenderListRankItem(int index, GObject obj)
|
|
|
{
|
|
|
- // long workId = _galleryDatas[index];
|
|
|
- // PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
|
|
|
+ long workId = _galleryDatas[index];
|
|
|
+ PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
|
|
|
UI_ListRankItem item = UI_ListRankItem.Proxy(obj);
|
|
|
- // item.m_loaIcon.height = 550 + Random.Range(40, 100);
|
|
|
|
|
|
// item.target.height = item.m_loaIcon.height + 80;
|
|
|
// item.m_loaIcon.texture = data.Ntexture;
|
|
@@ -590,12 +542,9 @@ namespace GFGGame
|
|
|
//自动下拉
|
|
|
private void PullDown()
|
|
|
{
|
|
|
- // if (_ui.m_comNormal.m_listRecommend.numItems > 0) _ui.m_comNormal.m_listRecommend.ScrollToView(0);
|
|
|
_list.ScrollToView(0);
|
|
|
- // _comScroll.scrollPane.posY = 0;
|
|
|
GComponent header = _comScroll.scrollPane.header;
|
|
|
header.height = header.sourceHeight;
|
|
|
- // _comScroll.scrollPane.LockHeader(header.sourceHeight);
|
|
|
}
|
|
|
|
|
|
//下拉刷新
|