using System.Collections.Generic; using ET; using FairyGUI; using UI.Poem; using UnityEngine; namespace GFGGame { public class PoemGalleryView : BaseWindow { private UI_PoemGalleryUI _ui; private List _galleryInfos = new List(); private int _infoType = 0;//0推荐1好友2收藏3我的 public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_PoemGalleryUI.PACKAGE_NAME; _ui = UI_PoemGalleryUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("gzs_bjbj"); _ui.m_btnback.onClick.Add(OnBtnBackClick); _ui.m_btnRecover.onClick.Add(OnBtnRecoverClick); _ui.m_btnJoin.onClick.Add(OnBtnJoinClick); _ui.m_btnFavorites.onClick.Add(OnBtnFavoritesClick); _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.header.onSizeChanged.Add(OnSizeChanged); _ui.m_comNormal.m_listFriend.itemRenderer = RenderListItem; _ui.m_comNormal.m_listFriend.SetVirtual(); _ui.m_comNormal.m_listRank.itemRenderer = RenderListRankItem; _ui.m_comNormal.m_listRank.SetVirtual(); _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_btnReward.onClick.Add(OnBtnRewardClick); _ui.m_comNormal.m_c1.onChanged.Add(OnNormalTabChange); _ui.m_comFavorites.m_c1.onChanged.Add(OnFavoritesTabChange); } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); } protected override void OnHide() { base.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void OnBtnBackClick() { 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 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 OnBtnShopClick() { ViewManager.Show(new object[] { ConstStoreId.GALLERY_STORE_ID }, new object[] { typeof(PoemGalleryView).FullName, this.viewData }, true); } /// /// 推荐 /// private void OnBtnRecommendClick() { } /// /// 最新 /// private void OnBtnNewestClick() { ViewManager.Show(null, new object[] { typeof(PoemGalleryView).FullName, this.viewData }, true); } /// /// 排行榜奖励 /// private void OnBtnRewardClick() { } private void RenderListItem(int index, GObject obj) { } private void RenderListRankItem(int index, GObject obj) { } private void onPullDownRelease() { 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); }); } private void OnSizeChanged() { GComponent header = _ui.m_comNormal.m_listRecommend.scrollPane.header; Controller controller = _ui.m_comNormal.m_listRecommend.scrollPane.header.GetController("c1"); if (header.height <= 1) { controller.selectedIndex = 0; } } } }