| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 | using System.Collections.Generic;using Core.Language;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>();        public ShengShiEventWidgetType2 mainShengShiEventWidgetType2;        private int saixuanType = 1;        bool isTriggerEvent = false;        private void Init()        {            // isPopUi = true;            isAddStack = true;        }        public override CTask GetFocus()        {            if (PlayerGuideManager.Instance.GuideIsCanDo(2, 2))            {                PlayerGuideManager.Instance.NextGuide();            }            if (PlayerGuideManager.Instance.GuideIsCanDo(3, 1))            {                PlayerGuideManager.Instance.NextGuide();            }            if (isTriggerEvent)                GObjectPoolInterface.SetActive(false);            AppBarPanel.OpenPanel(this);            return base.GetFocus();        }        protected override void AddEvent()        {            EventManager.Instance.AddEventListener(CustomEventType.RemoveEvent, RemoveEvent);        }        public override CTask Show()        {            return base.Show();        }        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);            }            shengShiEventWidgetTypeList.Clear();            //神识            if (saixuanType == 1)            {                toggleList.ShowTargetIndex(0);                TitleRoot.SetActive(true);                Rect_Sv.SetParent(Sv1root);                Rect_Sv.offsetMax =Vector2.zero;                Rect_Sv.offsetMin =Vector2.zero;                // Rect_Sv.sizeDelta = new Vector2(718.82f, 844.7f);                // Rect_Sv.anchoredPosition = new Vector2(2.61f, -190.52f);                Text_Tips.gameObject.SetActive(false);                AccountFileInfo.EventList eventList = EventSystemManager.Instance.GetMainEventDta();                if (eventList != null)                {                    if (mainShengShiEventWidgetType2 == null)                        mainShengShiEventWidgetType2 =                            await UIManager.Instance.CreateGComponentForObject<ShengShiEventWidgetType2>(                                ShengShiEventWidgetType2Game, null, ShengShiEventWidgetType2Root);                    mainShengShiEventWidgetType2.own.SetActive(true);                    mainShengShiEventWidgetType2.CustomInit(eventList, GoOnClick);                    mainShengShiEventWidgetType2.OnClick = OnClick;                }            }            //道友            else            {                toggleList.ShowTargetIndex(1);                mainShengShiEventWidgetType2?.own.SetActive(false);                // UIManager.Instance.DormancyGComponent(mainShengShiEventWidgetType2);                // mainShengShiEventWidgetType2 = null;                TitleRoot.SetActive(false);                Rect_Sv.SetParent(Sv2root);                Rect_Sv.offsetMax =Vector2.zero;                Rect_Sv.offsetMin =Vector2.zero;                Text_Tips.gameObject.SetActive(showEventList.Count > 0);            }            var divineSenseConfig =                ConfigComponent.Instance.Get<DivineSenseConfig>(AccountFileInfo.Instance.playerData.divineSenseLevel);            int maxCount = PlayerManager.Instance.myHero.powerUpConfig.ShenshiMax /                           PlayerManager.Instance.gameConstantConfig.DetectEventCount;            maxCount = maxCount > divineSenseConfig.MaxNum ? divineSenseConfig.MaxNum : maxCount;            Text_ShenShiCount.text =                LanguageManager.Instance.Text(10239, EventSystemManager.Instance.GetShenShiCount(), maxCount);            SaiXuan(saixuanType);            showEventList.Sort(Sort);            await Content.Init(this, showEventList.Count);        }        public int Sort(AccountFileInfo.EventList a, AccountFileInfo.EventList b)        {            if (a.isCompleted && !b.isCompleted)                return 1;            if (!a.isCompleted && b.isCompleted)                return -1;            return 0;        }        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;            if (shengShiEventWidgetType2.eventList.isCompleted)            {                return;            }            EventConfig eventConfig =                ConfigComponent.Instance.Get<EventConfig>(shengShiEventWidgetType2.eventList.eventID);            if (eventConfig.EventTriggerType == 4)            {                if (shengShiEventWidgetType2.eventList.isCompleted1)                {                    EventSystemManager.Instance.CompleteEvent(shengShiEventWidgetType2.eventList);                    UpdateContent();                    return;                }            }            isTriggerEvent = true;            EventSystemManager.Instance.TriggerEvent(shengShiEventWidgetType2.eventList, () =>            {                isTriggerEvent = false;                UpdateContent();            });        }        private void OnClick(ItemWidgetBasic obj)        {            ShengShiEventWidgetType2 shengShiEventWidgetType2 = obj as ShengShiEventWidgetType2;            //条件完成 任务没有完成 是最后一步就直接开始任务            if (shengShiEventWidgetType2.isComplete && !shengShiEventWidgetType2.eventList.isCompleted)            {                if (shengShiEventWidgetType2.evenkConfig.ResultType == 0 ||                    shengShiEventWidgetType2.evenkConfig.ResultType == 3)                {                    GoOnClick(shengShiEventWidgetType2);                    return;                }            }            TaskInfoPanel.OpenPanel(shengShiEventWidgetType2.eventList, 1);        }        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, UILayer.Middle);            return divineSenceEventPreviewPanel;        }        public async override CTask Close()        {            UIManager.Instance.DormancyAllGComponent<ShengShiEventWidgetType2>();            shengShiEventWidgetTypeList.Clear();            EventSystemManager.Instance.isOpenUi = false;            saixuanType = 1;            mainShengShiEventWidgetType2?.DormancyObj();            mainShengShiEventWidgetType2 = null;            isTriggerEvent = false;            await base.Close();        }    }}
 |