12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using Fort23.Core;
- 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;
- }
- ShengShiEventWidgetType2 shengShiEventWidgetType2 = await UIManager.Instance.CreateGComponent<ShengShiEventWidgetType2>(null, ContentRoot);
- shengShiEventWidgetType2.CustomInit(AccountFileInfo.Instance.playerData.eventList[index]);
- shengShiEventWidgetType2.onClick = OnClick;
- return shengShiEventWidgetType2;
- }
- private void OnClick(ItemWidgetBasic obj)
- {
- ShengShiEventWidgetType2 shengShiEventWidgetType2 = obj as ShengShiEventWidgetType2;
-
- if (EventSystemManager.Instance.isTriggerEvent)
- return;
- UIManager.Instance.HideUIUIPanel(this);
- UIManager.Instance.DormancyAllGComponent<ShengShiEventWidget>();
- EventSystemManager.Instance.TriggerEvent(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>();
- EventSystemManager.Instance.isOpenUi = false;
- base.Close();
- }
- }
- }
|