| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 | using System.Collections.Generic;using Excel2Json;using Fort23.Core;using Fort23.UTool;using UnityEngine;namespace Fort23.Mono{    [UIBinding(prefab = "DivineSenceEventPreviewPanel")]    public partial class DivineSenceEventPreviewPanel : UIPanel, IScrollListContent    {        public List<AccountFileInfo.EventList> showEventList = new List<AccountFileInfo.EventList>();        List<ShengShiEventWidgetType2> shengShiEventWidgetTypeList = new List<ShengShiEventWidgetType2>();        private ShengShiEventWidgetType2 mainShengShiEventWidgetType2;        private int saixuanType = 1;        private void Init()        {            // isPopUi = true;            isAddStack = true;            IsShowAppBar = false;        }        protected override void AddEvent()        {            EventManager.Instance.AddEventListener(CustomEventType.RemoveEvent, RemoveEvent);        }        public override CTask GetFocus()        {            return base.GetFocus();        }        protected override void DelEvent()        {            EventManager.Instance.RemoveEventListener(CustomEventType.RemoveEvent, RemoveEvent);        }        public override void AddButtonEvent()        {            Btn_Log.onClick.AddListener(() => { XianTuLogPanel.OpenPanel(); });            Btn_Close.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(this); });            Btn_ShenShi.onClick.AddListener(async () =>            {                if (saixuanType == 1)                    return;                saixuanType = 1;                UpdateContent();            });            Btn_DaoYou.onClick.AddListener(async () =>            {                if (saixuanType == 2)                    return;                saixuanType = 2;                UpdateContent();            });        }        private void RemoveEvent(IEventData e)        {            // UIManager.Instance.DormancyAllGComponent<ShengShiEventWidgetType2>();            // Content.Init(this, showEventList.Count);            UpdateContent();        }        public async override CTask<bool> AsyncInit(object[] uiData)        {            await UpdateContent();            return await base.AsyncInit(uiData);        }        private async CTask UpdateContent()        {            foreach (var shengShiEventWidgetType2 in shengShiEventWidgetTypeList)            {                UIManager.Instance.DormancyGComponent(shengShiEventWidgetType2);            }            if (mainShengShiEventWidgetType2 == null)                mainShengShiEventWidgetType2 = await UIManager.Instance.CreateGComponent<ShengShiEventWidgetType2>(null, ShengShiEventWidgetType2Root);            AccountFileInfo.EventList eventList = EventSystemManager.Instance.GetMainEventDta();            mainShengShiEventWidgetType2.CustomInit(eventList, GoOnClick);            mainShengShiEventWidgetType2.OnClick = OnClick;            shengShiEventWidgetTypeList.Clear();            int maxCount = PlayerManager.Instance.myHero.powerUpConfig.ShenshiMax / PlayerManager.Instance.gameConstantConfig.DetectEventCount;            Text_ShenShiCount.text = $"神识{EventSystemManager.Instance.GetShenShiCount()}/{maxCount}";            SaiXuan(saixuanType);            await Content.Init(this, showEventList.Count);        }        public void SaiXuan(int type)        {            showEventList.Clear();            if (type == 1)            {                foreach (var eventList in AccountFileInfo.Instance.playerData.eventList)                {                    EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventList.eventID);                    if (eventConfig.EventTriggerType != 5 && eventConfig.EventTriggerType != 4)                    {                        showEventList.Add(eventList);                    }                }            }            else            {                foreach (var eventList in AccountFileInfo.Instance.playerData.eventList)                {                    EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventList.eventID);                    if (eventConfig.EventTriggerType == 5 && eventConfig.EventTriggerType != 4)                    {                        showEventList.Add(eventList);                    }                }            }        }        public async CTask<IScorllListWidget> GetIScorllListWidget(int index, RectTransform root)        {            if (index < 0 || index >= showEventList.Count)            {                return null;            }            ShengShiEventWidgetType2 shengShiEventWidgetType2 = await UIManager.Instance.CreateGComponent<ShengShiEventWidgetType2>(null, ContentRoot);            shengShiEventWidgetType2.CustomInit(showEventList[index], GoOnClick);            shengShiEventWidgetType2.OnClick = OnClick;            shengShiEventWidgetTypeList.Add(shengShiEventWidgetType2);            return shengShiEventWidgetType2;        }        private void GoOnClick(ItemWidgetBasic obj)        {            ShengShiEventWidgetType2 shengShiEventWidgetType2 = obj as ShengShiEventWidgetType2;            EventSystemManager.Instance.CancelEvent();            if (EventSystemManager.Instance.isTriggerEvent)                return;            this.GObjectPoolInterface.SetActive(false);            EventSystemManager.Instance.isOpenUi = false;            EventSystemManager.Instance.TriggerEvent(shengShiEventWidgetType2.eventList, () =>            {                this.GObjectPoolInterface.SetActive(true);                UpdateContent();            });        }        private void OnClick(ItemWidgetBasic obj)        {            ShengShiEventWidgetType2 shengShiEventWidgetType2 = obj as ShengShiEventWidgetType2;            TaskInfoPanel.OpenPanel(shengShiEventWidgetType2.eventList);        }        public void HindIScorllListWidget(IScorllListWidget widget)        {            UIManager.Instance.DormancyGComponent(widget as UIComponent);        }        public async static CTask<DivineSenceEventPreviewPanel> OpenPanel()        {            DivineSenceEventPreviewPanel divineSenceEventPreviewPanel = await UIManager.Instance.LoadAndOpenPanel<DivineSenceEventPreviewPanel>(null);            return divineSenceEventPreviewPanel;        }        public override void Close()        {            UIManager.Instance.DormancyAllGComponent<ShengShiEventWidgetType2>();            shengShiEventWidgetTypeList.Clear();            EventSystemManager.Instance.isOpenUi = false;            saixuanType = 1;            mainShengShiEventWidgetType2 = null;            base.Close();        }    }}
 |