123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- using System.Collections.Generic;
- using System.Linq;
- using Core.Language;
- using Excel2Json;
- using Fort23.Core;
- using Fort23.UTool;
- using UnityEngine;
- using Utility;
- namespace Fort23.Mono
- {
- public class XianTuLogInfoData
- {
- /// <summary>
- /// 1.大标题 2.标题 3.描述
- /// </summary>
- public int type;
- public string message;
- }
- [UIBinding(prefab = "XianTuLogInfoPanel")]
- public partial class XianTuLogInfoPanel : UIPanel, IScrollListContent
- {
- private EventLogTitleWidget eventLogTitleWidget;
- private XianTuLogConfig _xianTuLogConfig;
- List<XianTuLogInfoData> showXianTuLogInfoData = new List<XianTuLogInfoData>();
- List<UIComponent> components = new List<UIComponent>();
- List<EventLogTitleWidget> titleWidgets = new List<EventLogTitleWidget>();
- private int type;
- private void Init()
- {
- }
- protected override void AddEvent()
- {
- }
- protected override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- Btn_Close.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(this); });
- }
- public async void CustomInit(int type, int id)
- {
- this.type = type;
- eventLogTitleWidget = await UIManager.Instance.CreateGComponentForObject<EventLogTitleWidget>(EventLogTitleWidget, null);
- Map<int, List<EventConfig>> eventConfigMap = new Map<int, List<EventConfig>>();
- showXianTuLogInfoData.Clear();
- _xianTuLogConfig = ConfigComponent.Instance.Get<XianTuLogConfig>(id);
- var configs = EventSystemManager.Instance.eventConfigsMap[_xianTuLogConfig.ID];
- foreach (var @c in configs)
- {
- EventConfig eventConfig = c;
- if (!eventConfigMap.ContainsKey(eventConfig.placeID))
- {
- eventConfigMap.Add(eventConfig.placeID, new List<EventConfig>());
- }
- eventConfigMap[eventConfig.placeID].Add(eventConfig);
- }
- foreach (var keyValuePair in eventConfigMap)
- {
- if (type == 1)
- {
- PlacesConfig placesConfig = ConfigComponent.Instance.Get<PlacesConfig>(keyValuePair.Key);
- XianTuLogInfoData xianTuLogInfoData3 = new XianTuLogInfoData();
- xianTuLogInfoData3.type = 1;
- xianTuLogInfoData3.message = LanguageManager.Instance.Text(placesConfig.placeName);
- showXianTuLogInfoData.Add(xianTuLogInfoData3);
- }
- foreach (var eventConfig in keyValuePair.Value)
- {
- AccountFileInfo.EventList eventList = AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(cl => cl.eventID == eventConfig.ID);
- if (eventList == null)
- {
- //主线没有做不显示问好
- if (_xianTuLogConfig.EventType == 2)
- {
- XianTuLogInfoData xianTuLogInfoData = new XianTuLogInfoData();
- xianTuLogInfoData.type = 2;
- xianTuLogInfoData.message = "????????";
- XianTuLogInfoData xianTuLogInfoData1 = new XianTuLogInfoData();
- xianTuLogInfoData1.type = 3;
- xianTuLogInfoData1.message = "?????????????????????????????????";
- showXianTuLogInfoData.Add(xianTuLogInfoData);
- showXianTuLogInfoData.Add(xianTuLogInfoData1);
- }
- }
- else
- {
- XianTuLogInfoData xianTuLogInfoData = new XianTuLogInfoData();
- xianTuLogInfoData.type = 2;
- xianTuLogInfoData.message = LanguageManager.Instance.Text(eventConfig.EventName);
- showXianTuLogInfoData.Add(xianTuLogInfoData);
- foreach (var eventListSelectEventLinkId in eventList.selectEventLinkIds)
- {
- EventLinkConfig eventLinkConfig = ConfigComponent.Instance.Get<EventLinkConfig>(eventListSelectEventLinkId);
- if (eventLinkConfig.LanID != null)
- {
- foreach (var i in eventLinkConfig.LanID)
- {
- XianTuLogInfoData xianTuLogInfoData1 = new XianTuLogInfoData();
- xianTuLogInfoData1.type = 3;
- if (eventLinkConfig.NPCID != 0)
- {
- xianTuLogInfoData1.message = $"<color=#A6A6A6>{LanguageManager.Instance.Text(i)}</color>";
- }
- else
- {
- xianTuLogInfoData1.message = $"<color=#867169>{LanguageManager.Instance.Text(i)}</color>";
- }
-
-
- showXianTuLogInfoData.Add(xianTuLogInfoData1);
- }
- }
- }
- }
- }
- }
- if (type == 1)
- {
- // eventLogTitleWidget.SetActive(true);
- Sv.SetParent(Marsk1,false);
- eventLogTitleWidget.CustomInit(showXianTuLogInfoData[0].message);
- eventLogTitleWidget.own.SetActive(true);
- }
- else if (type == 2)
- {
- Sv.SetParent(Marsk2,false);
- eventLogTitleWidget.own.SetActive(false);
- }
- Content.Init(this, showXianTuLogInfoData.Count);
- }
- public async CTask<IScorllListWidget> GetIScorllListWidget(int index, RectTransform root)
- {
- if (index < 0 || index >= showXianTuLogInfoData.Count)
- {
- return null;
- }
- XianTuLogInfoData xianTuLogInfoData = showXianTuLogInfoData[index];
- if (xianTuLogInfoData.type == 1)
- {
- EventLogTitleWidget eventLogTitleWidget = await UIManager.Instance.CreateGComponent<EventLogTitleWidget>(null, ContentRoot);
- eventLogTitleWidget.CustomInit(xianTuLogInfoData.message);
- titleWidgets.Add(eventLogTitleWidget);
- components.Add(eventLogTitleWidget);
- return eventLogTitleWidget;
- }
- else if (xianTuLogInfoData.type == 2)
- {
- EventLogInfoWidget eventLogInfoWidget = await UIManager.Instance.CreateGComponent<EventLogInfoWidget>(null, ContentRoot);
- eventLogInfoWidget.CustomInit(xianTuLogInfoData.message);
- components.Add(eventLogInfoWidget);
- return eventLogInfoWidget;
- }
- else if (xianTuLogInfoData.type == 3)
- {
- EventLogMessageWidget eventLogInfoWidget = await UIManager.Instance.CreateGComponent<EventLogMessageWidget>(null, ContentRoot);
- eventLogInfoWidget.CustomInit(xianTuLogInfoData.message);
- components.Add(eventLogInfoWidget);
- return eventLogInfoWidget;
- }
- return null;
- }
- public void HindIScorllListWidget(IScorllListWidget widget)
- {
- UIManager.Instance.DormancyGComponent(widget as UIComponent);
- if (components.Contains(widget as UIComponent))
- {
- components.Remove(widget as UIComponent);
- }
- if (titleWidgets.Contains(widget as EventLogTitleWidget))
- {
- titleWidgets.Remove(widget as EventLogTitleWidget);
- }
- }
- public override void Close()
- {
- showXianTuLogInfoData.Clear();
- foreach (var uiComponent in components)
- {
- UIManager.Instance.DormancyGComponent(uiComponent);
- }
- components.Clear();
- titleWidgets.Clear();
- base.Close();
- }
- [CustomMethod(CustomMethodType.Update)]
- public void Update()
- {
- if (type != 1)
- return;
- EventLogTitleWidget highestItem = null;
- float maxY = float.MinValue;
- foreach (var xianTuTitleWidget in titleWidgets)
- {
- float itemY = xianTuTitleWidget.own.transform.position.y; // 使用世界坐标的 Y 值
- if (itemY > maxY)
- {
- maxY = itemY;
- highestItem = xianTuTitleWidget;
- }
- }
- if (highestItem != null)
- {
- float outsideY = eventLogTitleWidget.own.transform.position.y;
- if (maxY > outsideY )
- {
- eventLogTitleWidget.CustomInit(highestItem.Text_Name.text);
- }
- }
- }
- public async static CTask OpenPanel(int type, int id)
- {
- XianTuLogInfoPanel xianTuLogInfoPanel = await UIManager.Instance.LoadAndOpenPanel<XianTuLogInfoPanel>(null);
- xianTuLogInfoPanel.CustomInit(type, id);
- }
- }
- }
|