123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System.Collections.Generic;
- using System.Linq;
- using Excel2Json;
- using Fort23.Core;
- using Fort23.UTool;
- using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
- using UnityEngine;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "XianTuLogPanel")]
- public partial class XianTuLogPanel : UIPanel, IScrollListContent
- {
- private int type = 1;
- List<XianTuLogConfig> xianTuLogConfigs = new List<XianTuLogConfig>();
- List<XianTuLogConfig> shoeXianTuLogConfigs = new List<XianTuLogConfig>();
- private void Init()
- {
- isAddStack = true;
- IsShowAppBar = false;
- }
- protected override void AddEvent()
- {
- }
- protected override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- Btn_Close.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(this); });
- Btn_Main.onClick.AddListener(() =>
- {
- if(this.type == 1)
- return;
- UIManager.Instance.DormancyAllGComponent<MainEventLogWidget>();
- UIManager.Instance.DormancyAllGComponent<EventLogWidget>();
- type = 1;
- shoeXianTuLogConfigs = GetTypeXiantuLogConfigs(type);
- Content.Init(this, shoeXianTuLogConfigs.Count);
- });
- Btn_Event.onClick.AddListener(() =>
- {
- if(this.type == 2)
- return;
- UIManager.Instance.DormancyAllGComponent<MainEventLogWidget>();
- UIManager.Instance.DormancyAllGComponent<EventLogWidget>();
- type = 2;
- shoeXianTuLogConfigs = GetTypeXiantuLogConfigs(type);
- Content.Init(this, shoeXianTuLogConfigs.Count);
- });
- }
- public override CTask<bool> AsyncInit(object[] uiData)
- {
- xianTuLogConfigs = ConfigComponent.Instance.GetAll<XianTuLogConfig>().ToList();
- shoeXianTuLogConfigs = GetTypeXiantuLogConfigs(type);
- Content.Init(this, shoeXianTuLogConfigs.Count);
- return base.AsyncInit(uiData);
- }
- private List<XianTuLogConfig> GetTypeXiantuLogConfigs(int type)
- {
- List<XianTuLogConfig> xiaNTYULogConfigs = new List<XianTuLogConfig>();
- foreach (var xianTuLogConfig in xianTuLogConfigs)
- {
- if (xianTuLogConfig.EventType == type)
- {
- xiaNTYULogConfigs.Add(xianTuLogConfig);
- }
- }
- return xiaNTYULogConfigs;
- }
- public async CTask<IScorllListWidget> GetIScorllListWidget(int index, RectTransform root)
- {
- if (index < 0 || index >= shoeXianTuLogConfigs.Count)
- {
- return null;
- }
- if (type == 1)
- {
- MainEventLogWidget mainEventLogWidget = await UIManager.Instance.CreateGComponent<MainEventLogWidget>(null, Content.GetComponent<RectTransform>());
- mainEventLogWidget.CustomInit(shoeXianTuLogConfigs[index]);
- return mainEventLogWidget;
- }
- else
- {
- EventLogWidget EventLogWidget = await UIManager.Instance.CreateGComponent<EventLogWidget>(null, Content.GetComponent<RectTransform>());
- await EventLogWidget.CustomInit(shoeXianTuLogConfigs[index]);
- return EventLogWidget;
- }
- }
- public void HindIScorllListWidget(IScorllListWidget widget)
- {
- UIManager.Instance.DormancyGComponent(widget as UIComponent);
- }
- public async static CTask OpenPanel()
- {
- XianTuLogPanel xianTuLogPanel = await UIManager.Instance.LoadAndOpenPanel<XianTuLogPanel>(null);
- }
- public override void Close()
- {
- UIManager.Instance.DormancyAllGComponent<MainEventLogWidget>();
- UIManager.Instance.DormancyAllGComponent<EventLogWidget>();
- type = 2;
- base.Close();
- }
- }
- }
|