| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 | using ET;using FairyGUI;using UI.Studio;using UnityEngine;namespace GFGGame{    public class StudioFilingNpcView : BaseWindow    {        private UI_StudioFilingNpcUI _ui;        private GComponent _comSelect;        public override void Dispose()        {            if (_comSelect != null)            {                _comSelect.RemoveFromParent();                _comSelect.Dispose();            }            if (_ui != null)            {                _ui.Dispose();                _ui = null;            }            base.Dispose();        }        protected override void OnInit()        {            base.OnInit();            packageName = UI_StudioFilingNpcUI.PACKAGE_NAME;            _ui = UI_StudioFilingNpcUI.Create();            this.viewCom = _ui.target;            isfullScreen = true;            //isReturnView = true;            // this.viewCom.Center();            // this.modal = true;            viewAnimationType = EnumViewAnimationType.None;            this.clickBlankToClose = true;            _comSelect = new GComponent();            _comSelect = UIPackage.CreateObject(UI_StudioFilingNpcUI.PACKAGE_NAME, "ComNpcItemSelect").asCom;            _comSelect.touchable = false;            _ui.m_list.itemRenderer = RenderListItem;            _ui.m_list.onClickItem.Add(OnListItemClick);            _ui.m_btnback.onClick.Add(this.Hide);            _ui.m_loaBg.onClick.Add(this.Hide);        }        protected override void AddEventListener()        {            base.AddEventListener();        }        protected override void OnShown()        {            base.OnShown();            _ui.m_list.numItems = StudioDataManager.Instance.FilingDatas.Count;        }        protected override void OnHide()        {            base.OnHide();        }        protected override void RemoveEventListener()        {            base.RemoveEventListener();        }        private void RenderListItem(int index, GObject obj)        {            StudioCfg cfg = StudioDataManager.Instance.FilingDatas[index];            UI_ListNpcItem item = UI_ListNpcItem.Proxy(obj);            bool isPass = InstanceZonesDataManager.CheckLevelPass(cfg.storyLevelId);            item.m_ComIcon.m_loaIcon.url = ResPathUtil.GetNpcPicSPath(cfg.res);// isPass ? ResPathUtil.GetNpcPicSPath(cfg.res) : ResPathUtil.GetNpcPicSPath(cfg.inRes);            item.m_ComIcon.m_loaIcon.url = ResPathUtil.GetStudioChapterPicPath(cfg.res);            item.m_imgLock.visible = !isPass;            item.m_txtName.text = cfg.name;            item.m_grpName.visible = isPass;            item.m_txtNone.visible = false;            item.target.data = cfg;            if (cfg.id == StudioDataManager.Instance.filingChapterId)            {                item.target.AddChild(_comSelect);            }            RedDotController.Instance.SetComRedDot(item.target, StudioDataManager.Instance.GetFilingRewardState(cfg.id), "", -38, 116);            UI_ListNpcItem.ProxyEnd();        }        private void OnListItemClick(EventContext context)        {            GObject obj = context.data as GObject;            StudioCfg cfg = obj.data as StudioCfg;            bool isPass = InstanceZonesDataManager.CheckLevelPass(cfg.storyLevelId);            if (!isPass)            {                StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(cfg.storyLevelId);                string showId = StoryUtil.GetChapterOrder(storyLevelCfg.chapterId) + "_" + storyLevelCfg.order;                PromptController.Instance.ShowFloatTextPrompt(string.Format("通关主线{0}解锁", showId));                return;            }            StudioDataManager.Instance.npcFilingChapterId = cfg.id;            StudioDataManager.Instance.filingChapterId = cfg.id;            StorageSProxy.ReqSetClientValue(ConstStorageId.STUDIO_FILING_CHAPTERID, cfg.id).Coroutine();            EventAgent.DispatchEvent(ConstMessage.FILLING_CHANGE_CHAPTER);            this.Hide();            // UI_ListNpcItem item = UI_ListNpcItem.Proxy(obj);            // item.target.AddChild(_comSelect);            // UI_ListNpcItem.ProxyEnd();        }    }}
 |