|
@@ -1,3 +1,4 @@
|
|
|
+using System.Collections.Generic;
|
|
|
using ET;
|
|
|
using FairyGUI;
|
|
|
using UI.Poem;
|
|
@@ -8,6 +9,8 @@ namespace GFGGame
|
|
|
public class PoemGalleryView : BaseWindow
|
|
|
{
|
|
|
private UI_PoemGalleryUI _ui;
|
|
|
+ private List<PoemGalleryData> _galleryInfos = new List<PoemGalleryData>();
|
|
|
+ private int _infoType = 0;//0推荐1好友2收藏3我的
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -36,6 +39,18 @@ namespace GFGGame
|
|
|
_ui.m_comNormal.m_btnShop.onClick.Add(OnBtnShopClick);
|
|
|
_ui.m_comNormal.m_btnRecommend.onClick.Add(OnBtnRecommendClick);
|
|
|
_ui.m_comNormal.m_btnNewest.onClick.Add(OnBtnNewestClick);
|
|
|
+ _ui.m_comNormal.m_c1.onChanged.Add(OnNormalTabChange);
|
|
|
+ _ui.m_comFavorites.m_c1.onChanged.Add(OnFavoritesTabChange);
|
|
|
+
|
|
|
+ _ui.m_comNormal.m_listRecommend.itemRenderer = RenderListItem;
|
|
|
+ _ui.m_comNormal.m_listRecommend.SetVirtual();
|
|
|
+ _ui.m_comNormal.m_listRecommend.scrollPane.onPullDownRelease.Add(onPullDownRelease);
|
|
|
+ _ui.m_comNormal.m_listRecommend.scrollPane.onScroll.Add(onScroll);
|
|
|
+ _ui.m_comNormal.m_listRecommend.scrollPane.onScrollEnd.Add(OnScrollEnd);
|
|
|
+ // SwipeGesture swipeGesture;
|
|
|
+ // swipeGesture = new SwipeGesture(_ui.m_comNormal.m_listRecommend);
|
|
|
+ // swipeGesture.onMove.Add(OnMove);
|
|
|
+
|
|
|
}
|
|
|
protected override void AddEventListener()
|
|
|
{
|
|
@@ -65,22 +80,109 @@ namespace GFGGame
|
|
|
ViewManager.GoBackFrom(typeof(PoemGalleryView).FullName);
|
|
|
}
|
|
|
|
|
|
+ //投稿
|
|
|
+ private void OnBtnJoinClick()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//首页
|
|
|
private void OnBtnRecoverClick()
|
|
|
{
|
|
|
+ _ui.m_comNormal.m_c1.selectedIndex = 0;
|
|
|
+ }
|
|
|
|
|
|
+ //收藏夹
|
|
|
+ private void OnBtnFavoritesClick()
|
|
|
+ {
|
|
|
+ _ui.m_comFavorites.m_c1.selectedIndex = 0;
|
|
|
}
|
|
|
|
|
|
- //投稿
|
|
|
- private void OnBtnJoinClick()
|
|
|
+ //切换首页页签
|
|
|
+ private void OnNormalTabChange()
|
|
|
{
|
|
|
+ if (_ui.m_comNormal.m_c1.selectedIndex == 2)
|
|
|
+ {
|
|
|
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (_ui.m_comNormal.m_c1.selectedIndex == 0)
|
|
|
+ {
|
|
|
+ _infoType = 0;
|
|
|
+ _galleryInfos = PoemGalleryDataManager.Instance.RecommendInfos;
|
|
|
+ _ui.m_comNormal.m_listRecommend.numItems = 5;
|
|
|
+ }
|
|
|
+ else if (_ui.m_comNormal.m_c1.selectedIndex == 1)
|
|
|
+ {
|
|
|
+ _infoType = 1;
|
|
|
+ _galleryInfos = PoemGalleryDataManager.Instance.FrinedInfos;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //切换收藏页签
|
|
|
+ private void OnFavoritesTabChange()
|
|
|
+ {
|
|
|
+ if (_ui.m_comFavorites.m_c1.selectedIndex == 0)
|
|
|
+ {
|
|
|
+ _infoType = 2;
|
|
|
+ _galleryInfos = PoemGalleryDataManager.Instance.FavoriteInfos;
|
|
|
+ }
|
|
|
+ else if (_ui.m_comFavorites.m_c1.selectedIndex == 1)
|
|
|
+ {
|
|
|
+ _infoType = 3;
|
|
|
+ _galleryInfos = PoemGalleryDataManager.Instance.MySelfInfos;
|
|
|
+ }
|
|
|
}
|
|
|
+ private void onPullDownRelease()
|
|
|
+ {
|
|
|
+ UI_ComHead header = UI_ComHead.Proxy(_ui.m_comNormal.m_listRecommend.scrollPane.header);
|
|
|
+ // ScrollPaneHeader header = (ScrollPaneHeader)_ui.m_comNormal.m_listRecommend.scrollPane.header;
|
|
|
+ // if (header.ReadyToRefresh)
|
|
|
+ // {
|
|
|
+ // header.SetRefreshStatus(2);
|
|
|
+ header.m_c1.selectedIndex = 1;
|
|
|
+ _ui.m_comNormal.m_listRecommend.scrollPane.LockHeader(header.target.sourceHeight);
|
|
|
+
|
|
|
+ //Simulate a async resquest
|
|
|
+ Timers.inst.Add(2, 1, (object param) =>
|
|
|
+ {
|
|
|
+ header.m_c1.selectedIndex = 2;
|
|
|
+ // _ui.m_comNormal.m_listRecommend.numItems += 5;
|
|
|
+
|
|
|
+ // //Refresh completed
|
|
|
+ // header.SetRefreshStatus(3);
|
|
|
+ // _ui.m_comNormal.m_listRecommend.scrollPane.LockHeader(35);
|
|
|
+
|
|
|
+ // Timers.inst.Add(2, 1, (object param2) =>
|
|
|
+ // {
|
|
|
+ // header.SetRefreshStatus(0);
|
|
|
+ _ui.m_comNormal.m_listRecommend.scrollPane.LockHeader(0);
|
|
|
+ header.m_c1.selectedIndex = 0;
|
|
|
+ // });
|
|
|
+ });
|
|
|
+ // }
|
|
|
|
|
|
- //收藏夹
|
|
|
- private void OnBtnFavoritesClick()
|
|
|
+ }
|
|
|
+ private void OnMove(EventContext context)
|
|
|
+ {
|
|
|
+ SwipeGesture swipeture = (SwipeGesture)context.sender;
|
|
|
+ ScrollPane scrollPane = _ui.m_comNormal.m_listRecommend.scrollPane;
|
|
|
+ ET.Log.Debug("posY:" + scrollPane.header.position.y + " swipetureY:" + swipeture.position.y + " " + (-scrollPane.header.height + swipeture.position.y));
|
|
|
+ scrollPane.header.SetXY(scrollPane.header.position.x, -scrollPane.header.height + swipeture.position.y);
|
|
|
+ }
|
|
|
+ private void onScroll()
|
|
|
{
|
|
|
+ ScrollPane scrollPane = _ui.m_comNormal.m_listRecommend.scrollPane;
|
|
|
+ // scrollPane.
|
|
|
|
|
|
+ // ET.Log.Debug("posY:" + scrollPane.posY + " scrollingPosY:" + scrollPane.scrollingPosY);
|
|
|
+ }
|
|
|
+ private void OnScrollEnd()
|
|
|
+ {
|
|
|
+ // ScrollPane scrollPane = _ui.m_comNormal.m_listRecommend.scrollPane;
|
|
|
+ // scrollPane.header.SetXY();
|
|
|
+ // _ui.m_comNormal.m_listRecommend.scrollPane.header.y = -_ui.m_comNormal.m_listRecommend.scrollPane.header.height;
|
|
|
}
|
|
|
|
|
|
//积分商店
|
|
@@ -100,5 +202,10 @@ namespace GFGGame
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ private void RenderListItem(int index, GObject obj)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|