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(); Content.Init(this, AccountFileInfo.Instance.playerData.eventList.Count); } public override CTask AsyncInit(object[] uiData) { Content.Init(this, AccountFileInfo.Instance.playerData.eventList.Count); return base.AsyncInit(uiData); } public async CTask GetIScorllListWidget(int index, RectTransform root) { if (index < 0 || index >=AccountFileInfo.Instance.playerData.eventList.Count) { return null; } ShengShiEventWidgetType2 shengShiEventWidgetType2 = await UIManager.Instance.CreateGComponent(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(); EventSystemManager.Instance.TriggerEvent(shengShiEventWidgetType2.eventList); } public void HindIScorllListWidget(IScorllListWidget widget) { UIManager.Instance.DormancyGComponent(widget as UIComponent); } public async static CTask OpenPanel() { DivineSenceEventPreviewPanel divineSenceEventPreviewPanel = await UIManager.Instance.LoadAndOpenPanel(null); return divineSenceEventPreviewPanel; } public override void Close() { UIManager.Instance.DormancyAllGComponent(); EventSystemManager.Instance.isOpenUi = false; base.Close(); } } }