| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 | 
							- using FairyGUI;
 
- using UI.FieldGuide;
 
- using System.Collections.Generic;
 
- using System;
 
- namespace GFGGame
 
- {
 
-     public class FieldGuideView : BaseWindow
 
-     {
 
-         private delegate bool GetRedCall();
 
-         private UI_FieldGuideUI _ui;
 
-         private int[] _listBannerDatas = new int[3] { ConstBannerId.ZHAI_XING, ConstBannerId.ZHAI_XING, ConstBannerId.ZHAI_XING };
 
-         private int[] _listGuideDatas = new int[3] { ConstFieldGuideId.SUIT_GUIDE, ConstFieldGuideId.CHAPTER_ITEM, ConstFieldGuideId.TRAVEL_GUIDE };
 
-         GetRedCall[] actions = new GetRedCall[] { RedDotDataManager.Instance.GetFieldGuideRed, null, RedDotDataManager.Instance.GetTravelGuideRed };
 
-         public override void Dispose()
 
-         {
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-                 _ui = null;
 
-             }
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             packageName = UI_FieldGuideUI.PACKAGE_NAME;
 
-             _ui = UI_FieldGuideUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             _ui.m_compBanner.m_listTab.itemRenderer = ListBannerItemRenderer;
 
-             _ui.m_compBanner.m_listTab.numItems = _listBannerDatas.Length;
 
-             _ui.m_listGuide.itemRenderer = ListGuideItemRenderer;
 
-             // _ui.m_listGuide.numItems = _listGuideDatas.Length;
 
-             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
 
-             _ui.m_listGuide.onClickItem.Add(OnClickListGuideItem);
 
-             _ui.m_compBanner.m_listTab.onClickItem.Add(OnClickListBannerItem);
 
-             // _ui.m_compBanner.m_loaderPic.onClick.Add(OnClickBannerPic);
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             EventAgent.AddEventListener(ConstMessage.SUIT_GUIDE_BOX_BONUS, UpdateList);
 
-             EventAgent.AddEventListener(ConstMessage.JUMP_TO_SOURCE, this.Hide);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("fuben_bjbj");
 
-             _ui.m_listGuide.numItems = _listGuideDatas.Length;
 
-             UpdatePrgress();
 
-             _ui.m_compBanner.m_listTab.selectedIndex = 0;
 
-             UpdateBanner(_ui.m_compBanner.m_listTab.GetChildAt(_ui.m_compBanner.m_listTab.selectedIndex));
 
-             Timers.inst.Add(3, 0, SwitchBannerPic);
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-             Timers.inst.Remove(SwitchBannerPic);
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.SUIT_GUIDE_BOX_BONUS, UpdateList);
 
-             EventAgent.RemoveEventListener(ConstMessage.JUMP_TO_SOURCE, this.Hide);
 
-         }
 
-         private void OnClickBtnBack()
 
-         {
 
-             // this.Hide();
 
-             ViewManager.GoBackFrom(ViewName.FIELD_GUIDE_VIEW);
 
-         }
 
-         private void UpdateList()
 
-         {
 
-             _ui.m_listGuide.numItems = _listGuideDatas.Length;
 
-         }
 
-         private void ListBannerItemRenderer(int index, GObject item)
 
-         {
 
-             UI_ButtonBannerPage listItem = UI_ButtonBannerPage.Proxy(item);
 
-             int id = _listBannerDatas[index];
 
-             listItem.target.data = id;
 
-             UI_ButtonBannerPage.ProxyEnd();
 
-         }
 
-         private void OnClickBannerPic()
 
-         {
 
-             int id = _listBannerDatas[_ui.m_compBanner.m_listTab.selectedIndex];
 
-             switch (id)
 
-             {
 
-                 case ConstBannerId.ZHAI_XING:
 
-                     ViewManager.Show<LuckyBoxView>(null, new object[] { ViewName.FIELD_GUIDE_VIEW, this.viewData });
 
-                     this.Hide();
 
-                     break;
 
-             }
 
-         }
 
-         private void ListGuideItemRenderer(int index, GObject item)
 
-         {
 
-             UI_CompGuideItem listItem = UI_CompGuideItem.Proxy(item);
 
-             int id = _listGuideDatas[index];
 
-             listItem.m_loaderTitle.url = "ui://FieldGuide/tujian_taoz_" + id;
 
-             listItem.m_loaderPic.url = "ui://FieldGuide/tujian_tup_" + id;
 
-             listItem.target.data = id;
 
-             bool red = actions[index] == null ? false : actions[index]();
 
-             RedDotController.Instance.SetComRedDot(listItem.target, red, "", -20);
 
-             UI_CompGuideItem.ProxyEnd();
 
-         }
 
-         private void OnClickListBannerItem(EventContext context)
 
-         {
 
-             UpdateBanner(context.data as GObject);
 
-         }
 
-         private void OnClickListGuideItem(EventContext context)
 
-         {
 
-             GObject listItem = context.data as GObject;
 
-             int id = (int)listItem.data;
 
-             switch (id)
 
-             {
 
-                 case ConstFieldGuideId.SUIT_GUIDE:
 
-                     ViewManager.Show<SuitGuideView>(null, new object[] { ViewName.FIELD_GUIDE_VIEW, this.viewData });
 
-                     break;
 
-                 case ConstFieldGuideId.CHAPTER_ITEM:
 
-                     ViewManager.Show<ChapterItemGuideView>(null, new object[] { ViewName.FIELD_GUIDE_VIEW, this.viewData });
 
-                     break;
 
-                 case ConstFieldGuideId.TRAVEL_GUIDE:
 
-                     ViewManager.Show<TravelGuideView>(null, new object[] { ViewName.FIELD_GUIDE_VIEW, this.viewData });
 
-                     break;
 
-             }
 
-         }
 
-         private void GetGuideProgress(int id, out int haveCount, out int totalCount)
 
-         {
 
-             switch (id)
 
-             {
 
-                 case ConstFieldGuideId.SUIT_GUIDE:
 
-                     DressUpMenuSuitDataManager.GetTotalProgress(out haveCount, out totalCount);
 
-                     break;
 
-                 case ConstFieldGuideId.CHAPTER_ITEM:
 
-                     InstanceZonesDataManager.GetTotalProgress(out haveCount, out totalCount);
 
-                     break;
 
-                 case ConstFieldGuideId.TRAVEL_GUIDE:
 
-                     TravelDataManager.Instance.GetTotalTravelProgress(out haveCount, out totalCount);
 
-                     break;
 
-                 default:
 
-                     haveCount = 0;
 
-                     totalCount = 1;
 
-                     break;
 
-             }
 
-             if (totalCount == 0) totalCount = 1;
 
-         }
 
-         private void UpdatePrgress()
 
-         {
 
-             int num = _ui.m_listGuide.numChildren;
 
-             for (int i = 0; i < num; i++)
 
-             {
 
-                 UI_CompGuideItem listItem = UI_CompGuideItem.Proxy(_ui.m_listGuide.GetChildAt(i));
 
-                 int id = (int)listItem.target.data;
 
-                 int haveCount = 0;
 
-                 int totalCount = 1;
 
-                 GetGuideProgress(id, out haveCount, out totalCount);
 
-                 decimal value = Math.Floor((decimal)100 * haveCount / totalCount);
 
-                 listItem.m_txtProgress.text = value + "%";
 
-                 UI_CompGuideItem.ProxyEnd();
 
-             }
 
-         }
 
-         private void UpdateBanner(GObject listItem)
 
-         {
 
-             string resName = "tujian_huodtu_1";
 
-             int id = (int)listItem.data;
 
-             switch (id)
 
-             {
 
-                 case ConstBannerId.ZHAI_XING:
 
-                     resName = "tujian_huodtu_1";
 
-                     break;
 
-             }
 
-             _ui.m_compBanner.m_loaderPic.url = "ui://FieldGuide/" + resName;
 
-             UpdateListBannerItems();
 
-         }
 
-         private void UpdateListBannerItems()
 
-         {
 
-             int num = _ui.m_compBanner.m_listTab.numChildren;
 
-             // for (int i = 0; i < num; i++)
 
-             // {
 
-             //     UI_ButtonBannerPage listItem = UI_ButtonBannerPage.Proxy(_ui.m_compBanner.m_listTab.GetChildAt(i));
 
-             //     if (listItem.target.selected)
 
-             //     {
 
-             //         listItem.target.width = 47;
 
-             //     }
 
-             //     else
 
-             //     {
 
-             //         listItem.target.width = 15;
 
-             //     }
 
-             // }
 
-             // _ui.m_compBanner.m_listTab.ResizeToFit();
 
-         }
 
-         private void SwitchBannerPic(object param)
 
-         {
 
-             int index = _ui.m_compBanner.m_listTab.selectedIndex;
 
-             index++;
 
-             if (index >= _listBannerDatas.Length)
 
-             {
 
-                 index = 0;
 
-             }
 
-             _ui.m_compBanner.m_listTab.selectedIndex = index;
 
-             UpdateBanner(_ui.m_compBanner.m_listTab.GetChildAt(_ui.m_compBanner.m_listTab.selectedIndex));
 
-         }
 
-     }
 
- }
 
 
  |