123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- 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 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)
- {
- AccountFileInfo.EventList eventList = EventSystemManager.Instance.GetMainEventDta();
- ShengShiEventWidgetType2 shengShiEventWidgetType2 = await UIManager.Instance.CreateGComponent<ShengShiEventWidgetType2>(null, ShengShiEventWidgetType2Root);
- shengShiEventWidgetType2.CustomInit(eventList, GoOnClick);
- shengShiEventWidgetType2.OnClick = OnClick;
- await UpdateContent();
- return await base.AsyncInit(uiData);
- }
- private async CTask UpdateContent()
- {
- foreach (var shengShiEventWidgetType2 in shengShiEventWidgetTypeList)
- {
- UIManager.Instance.DormancyGComponent(shengShiEventWidgetType2);
- }
- 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;
- if (EventSystemManager.Instance.isTriggerEvent)
- return;
- this.GObjectPoolInterface.SetActive(false);
- EventSystemManager.Instance.isOpenUi = false;
- EventSystemManager.Instance.TriggerEvent(shengShiEventWidgetType2.eventList, () =>
- {
- // Content.Init(this, showEventList.Count);
- this.GObjectPoolInterface.SetActive(true);
- UpdateContent();
- // EventSystemManager.Instance.isOpenUi = true;
- });
- }
- 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;
- base.Close();
- }
- }
- }
|