123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using Excel2Json;
- using Fort23.Core;
- using Fort23.UTool;
- using UnityEngine;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "DivineSenceEventPreviewPanel")]
- public partial class DivineSenceEventPreviewPanel : UIPanel, IScrollListContent
- {
- private void Init()
- {
- }
- protected override void AddEvent()
- {
- EventManager.Instance.AddEventListener(CustomEventType.RemoveEvent, RemoveEvent);
- }
- protected override void DelEvent()
- {
- EventManager.Instance.RemoveEventListener(CustomEventType.RemoveEvent, RemoveEvent);
- }
- public override void AddButtonEvent()
- {
- Btn_Close.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(this); });
- }
- private void RemoveEvent(IEventData e)
- {
- UIManager.Instance.DormancyAllGComponent<ShengShiEventWidgetType2>();
- Content.Init(this, AccountFileInfo.Instance.playerData.eventList.Count);
- }
- public override CTask<bool> AsyncInit(object[] uiData)
- {
- Content.Init(this, AccountFileInfo.Instance.playerData.eventList.Count);
- return base.AsyncInit(uiData);
- }
- public async CTask<IScorllListWidget> GetIScorllListWidget(int index, RectTransform root)
- {
- if (index < 0 || index >= AccountFileInfo.Instance.playerData.eventList.Count)
- {
- return null;
- }
- EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(AccountFileInfo.Instance.playerData.eventList[index].eventID);
- if (eventConfig.EventType == 2)
- {
- ShengShiEventWidgetType3 shengShiEventWidgetType2 = await UIManager.Instance.CreateGComponent<ShengShiEventWidgetType3>(null, ContentRoot);
- shengShiEventWidgetType2.CustomInit(AccountFileInfo.Instance.playerData.eventList[index]);
- shengShiEventWidgetType2.onClick = ShengShiEventWidgetType3OnClick;
- return shengShiEventWidgetType2;
- }
- else
- {
- ShengShiEventWidgetType2 shengShiEventWidgetType2 = await UIManager.Instance.CreateGComponent<ShengShiEventWidgetType2>(null, ContentRoot);
- shengShiEventWidgetType2.CustomInit(AccountFileInfo.Instance.playerData.eventList[index]);
- shengShiEventWidgetType2.onClick = OnClick;
- return shengShiEventWidgetType2;
- }
- }
- private void ShengShiEventWidgetType3OnClick(ItemWidgetBasic obj)
- {
- ShengShiEventWidgetType3 shengShiEventWidgetType2 = obj as ShengShiEventWidgetType3;
- if (EventSystemManager.Instance.isTriggerEvent)
- return;
- this.GObjectPoolInterface.SetActive(false);
- EventSystemManager.Instance.isOpenUi = false;
- EventSystemManager.Instance.TriggerEvent(shengShiEventWidgetType2.eventList, () =>
- {
- Content.Init(this, AccountFileInfo.Instance.playerData.eventList.Count);
- this.GObjectPoolInterface.SetActive(true);
- EventSystemManager.Instance.isOpenUi = true;
- });
- }
- private void OnClick(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, AccountFileInfo.Instance.playerData.eventList.Count);
- this.GObjectPoolInterface.SetActive(true);
- EventSystemManager.Instance.isOpenUi = true;
- });
- }
- 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>();
- EventSystemManager.Instance.isOpenUi = false;
- base.Close();
- }
- }
- }
|