123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using System.Collections.Generic;
- using FairyGUI;
- using UI.FieldGuide;
- namespace GFGGame
- {
- public class ChapterItemGuideView : BaseWindow
- {
- private UI_ChapterItemGuideUI _ui;
- private CulturalRelicCfg[] culturalRelicCfg;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_ChapterItemGuideUI.PACKAGE_NAME;
- _ui = UI_ChapterItemGuideUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- _ui.m_btnBack.onClick.Add(OnClickBtnBack);
- _ui.m_list.itemRenderer = RenderListItem;
- _ui.m_list.onClickItem.Add(OnListItemClick);
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("hc_bj_1");
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void OnShown()
- {
- base.OnShown();
- culturalRelicCfg = CulturalRelicCfgArray.Instance.dataArray;
- _ui.m_list.numItems = culturalRelicCfg.Length;
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- }
- private void OnClickBtnBack()
- {
- ViewManager.GoBackFrom(typeof(ChapterItemGuideView).FullName);
- _ui.m_list.scrollPane.ScrollTop();
- }
- private void RenderListItem(int index, GObject obj)
- {
- CulturalRelicCfg cfg = culturalRelicCfg[index];
- StoryChapterCfg storyChapterCfg = StoryChapterCfgArray.Instance.GetCfg(cfg.chapterId);
- UI_ChapterGuideItem item = UI_ChapterGuideItem.Proxy(obj);
- item.m_loaIcon.url = ResPathUtil.GetChapterGuideIconPath(cfg.bgRes);// string.Format("ui://FieldGuide/{0}", cfg.iconRes);
- bool isPass = InstanceZonesDataManager.CheckChapterPass(storyChapterCfg.type, storyChapterCfg.subType, storyChapterCfg.id, storyChapterCfg.levelCount);
- item.m_grpLock.visible = !isPass;
- item.m_txtDesc.text = string.Format("通关主线第{0}章解锁", NumberUtil.GetChiniseNumberText(storyChapterCfg.order));
- item.target.data = cfg;
- }
- private void OnListItemClick(EventContext context)
- {
- CulturalRelicCfg cfg = (context.data as GObject).data as CulturalRelicCfg;
- StoryChapterCfg storyChapterCfg = StoryChapterCfgArray.Instance.GetCfg(cfg.chapterId);
- bool isPass = InstanceZonesDataManager.CheckChapterPass(storyChapterCfg.type, storyChapterCfg.subType, storyChapterCfg.id, storyChapterCfg.levelCount);
- if (!isPass)
- {
- PromptController.Instance.ShowFloatTextPrompt("暂未解锁");
- return;
- }
- ViewManager.Show<ChapterItemShowView>(cfg, new object[] { typeof(ChapterItemGuideView).FullName, this.viewData });
- }
- }
- }
|