|
@@ -17,6 +17,8 @@ namespace Fort23.Mono
|
|
|
public int type;
|
|
|
|
|
|
public string message;
|
|
|
+
|
|
|
+ public int id;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -31,7 +33,7 @@ namespace Fort23.Mono
|
|
|
|
|
|
List<UIComponent> components = new List<UIComponent>();
|
|
|
|
|
|
- List<EventLogTitleWidget> titleWidgets = new List<EventLogTitleWidget>();
|
|
|
+ // List<EventLogTitleWidget> titleWidgets = new List<EventLogTitleWidget>();
|
|
|
|
|
|
private int type;
|
|
|
|
|
@@ -50,6 +52,12 @@ namespace Fort23.Mono
|
|
|
public override void AddButtonEvent()
|
|
|
{
|
|
|
Btn_Close.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(this); });
|
|
|
+ Sr.onValueChanged.AddListener(OnValueChanged);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnValueChanged(Vector2 arg0)
|
|
|
+ {
|
|
|
+ UpdateTitleWidget();
|
|
|
}
|
|
|
|
|
|
public async void CustomInit(int type, int id)
|
|
@@ -82,6 +90,7 @@ namespace Fort23.Mono
|
|
|
PlacesConfig placesConfig = ConfigComponent.Instance.Get<PlacesConfig>(keyValuePair.Key);
|
|
|
XianTuLogInfoData xianTuLogInfoData3 = new XianTuLogInfoData();
|
|
|
xianTuLogInfoData3.type = 1;
|
|
|
+ xianTuLogInfoData3.id = keyValuePair.Value[0].ID;
|
|
|
xianTuLogInfoData3.message = LanguageManager.Instance.Text(placesConfig.placeName);
|
|
|
showXianTuLogInfoData.Add(xianTuLogInfoData3);
|
|
|
}
|
|
@@ -96,10 +105,12 @@ namespace Fort23.Mono
|
|
|
{
|
|
|
XianTuLogInfoData xianTuLogInfoData = new XianTuLogInfoData();
|
|
|
xianTuLogInfoData.type = 2;
|
|
|
+ xianTuLogInfoData.id = eventConfig.ID;
|
|
|
xianTuLogInfoData.message = "????????";
|
|
|
|
|
|
XianTuLogInfoData xianTuLogInfoData1 = new XianTuLogInfoData();
|
|
|
xianTuLogInfoData1.type = 3;
|
|
|
+ xianTuLogInfoData1.id = eventConfig.ID;
|
|
|
xianTuLogInfoData1.message = "?????????????????????????????????";
|
|
|
|
|
|
showXianTuLogInfoData.Add(xianTuLogInfoData);
|
|
@@ -110,6 +121,7 @@ namespace Fort23.Mono
|
|
|
{
|
|
|
XianTuLogInfoData xianTuLogInfoData = new XianTuLogInfoData();
|
|
|
xianTuLogInfoData.type = 2;
|
|
|
+ xianTuLogInfoData.id = eventConfig.ID;
|
|
|
xianTuLogInfoData.message = LanguageManager.Instance.Text(eventConfig.EventName);
|
|
|
showXianTuLogInfoData.Add(xianTuLogInfoData);
|
|
|
foreach (var eventListSelectEventLinkId in eventList.selectEventLinkIds)
|
|
@@ -121,6 +133,7 @@ namespace Fort23.Mono
|
|
|
{
|
|
|
XianTuLogInfoData xianTuLogInfoData1 = new XianTuLogInfoData();
|
|
|
xianTuLogInfoData1.type = 3;
|
|
|
+ xianTuLogInfoData1.id = eventConfig.ID;
|
|
|
if (eventLinkConfig.NPCID != 0)
|
|
|
{
|
|
|
xianTuLogInfoData1.message = $"<color=#A6A6A6>{LanguageManager.Instance.Text(i)}</color>";
|
|
@@ -129,8 +142,8 @@ namespace Fort23.Mono
|
|
|
{
|
|
|
xianTuLogInfoData1.message = $"<color=#867169>{LanguageManager.Instance.Text(i)}</color>";
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
showXianTuLogInfoData.Add(xianTuLogInfoData1);
|
|
|
}
|
|
|
}
|
|
@@ -142,13 +155,13 @@ namespace Fort23.Mono
|
|
|
if (type == 1)
|
|
|
{
|
|
|
// eventLogTitleWidget.SetActive(true);
|
|
|
- Sv.SetParent(Marsk1,false);
|
|
|
+ Sv.SetParent(Marsk1, false);
|
|
|
eventLogTitleWidget.CustomInit(showXianTuLogInfoData[0].message);
|
|
|
eventLogTitleWidget.own.SetActive(true);
|
|
|
}
|
|
|
else if (type == 2)
|
|
|
{
|
|
|
- Sv.SetParent(Marsk2,false);
|
|
|
+ Sv.SetParent(Marsk2, false);
|
|
|
eventLogTitleWidget.own.SetActive(false);
|
|
|
}
|
|
|
|
|
@@ -167,22 +180,22 @@ namespace Fort23.Mono
|
|
|
if (xianTuLogInfoData.type == 1)
|
|
|
{
|
|
|
EventLogTitleWidget eventLogTitleWidget = await UIManager.Instance.CreateGComponent<EventLogTitleWidget>(null, ContentRoot);
|
|
|
- eventLogTitleWidget.CustomInit(xianTuLogInfoData.message);
|
|
|
- titleWidgets.Add(eventLogTitleWidget);
|
|
|
+ eventLogTitleWidget.CustomInit(xianTuLogInfoData);
|
|
|
+ // 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);
|
|
|
+ eventLogInfoWidget.CustomInit(xianTuLogInfoData);
|
|
|
components.Add(eventLogInfoWidget);
|
|
|
return eventLogInfoWidget;
|
|
|
}
|
|
|
else if (xianTuLogInfoData.type == 3)
|
|
|
{
|
|
|
EventLogMessageWidget eventLogInfoWidget = await UIManager.Instance.CreateGComponent<EventLogMessageWidget>(null, ContentRoot);
|
|
|
- eventLogInfoWidget.CustomInit(xianTuLogInfoData.message);
|
|
|
+ eventLogInfoWidget.CustomInit(xianTuLogInfoData);
|
|
|
components.Add(eventLogInfoWidget);
|
|
|
return eventLogInfoWidget;
|
|
|
}
|
|
@@ -198,10 +211,10 @@ namespace Fort23.Mono
|
|
|
components.Remove(widget as UIComponent);
|
|
|
}
|
|
|
|
|
|
- if (titleWidgets.Contains(widget as EventLogTitleWidget))
|
|
|
- {
|
|
|
- titleWidgets.Remove(widget as EventLogTitleWidget);
|
|
|
- }
|
|
|
+ // if (titleWidgets.Contains(widget as EventLogTitleWidget))
|
|
|
+ // {
|
|
|
+ // titleWidgets.Remove(widget as EventLogTitleWidget);
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
public override void Close()
|
|
@@ -213,36 +226,72 @@ namespace Fort23.Mono
|
|
|
}
|
|
|
|
|
|
components.Clear();
|
|
|
- titleWidgets.Clear();
|
|
|
+ // titleWidgets.Clear();
|
|
|
|
|
|
base.Close();
|
|
|
}
|
|
|
|
|
|
- [CustomMethod(CustomMethodType.Update)]
|
|
|
- public void Update()
|
|
|
+ List<UIComponent> _components = new List<UIComponent>();
|
|
|
+ private float maxY;
|
|
|
+ private float minY;
|
|
|
+
|
|
|
+
|
|
|
+ public void UpdateTitleWidget()
|
|
|
{
|
|
|
if (type != 1)
|
|
|
return;
|
|
|
- EventLogTitleWidget highestItem = null;
|
|
|
- float maxY = float.MinValue;
|
|
|
+ UIComponent highestItem = null;
|
|
|
+ maxY = float.MinValue;
|
|
|
+ minY = float.MaxValue;
|
|
|
+ _components.Clear();
|
|
|
|
|
|
|
|
|
- foreach (var xianTuTitleWidget in titleWidgets)
|
|
|
+ foreach (var xianTuTitleWidget in components)
|
|
|
{
|
|
|
float itemY = xianTuTitleWidget.own.transform.position.y; // 使用世界坐标的 Y 值
|
|
|
- if (itemY > maxY)
|
|
|
+ if (itemY > eventLogTitleWidget.own.transform.position.y)
|
|
|
{
|
|
|
maxY = itemY;
|
|
|
- highestItem = xianTuTitleWidget;
|
|
|
+ // highestItem = xianTuTitleWidget;
|
|
|
+ _components.Add(xianTuTitleWidget);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var uiComponent in _components)
|
|
|
+ {
|
|
|
+ float itemY = uiComponent.own.transform.position.y; // 使用世界坐标的 Y 值
|
|
|
+ if (itemY < minY)
|
|
|
+ {
|
|
|
+ minY = itemY;
|
|
|
+ highestItem = uiComponent;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
if (highestItem != null)
|
|
|
{
|
|
|
float outsideY = eventLogTitleWidget.own.transform.position.y;
|
|
|
- if (maxY > outsideY )
|
|
|
+ if (maxY > outsideY)
|
|
|
{
|
|
|
- eventLogTitleWidget.CustomInit(highestItem.Text_Name.text);
|
|
|
+ EventConfig eventConfig = default;
|
|
|
+ if (highestItem is EventLogTitleWidget)
|
|
|
+ {
|
|
|
+ EventLogTitleWidget eventLogTitleWidget = highestItem as EventLogTitleWidget;
|
|
|
+ eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventLogTitleWidget.data.id);
|
|
|
+ }
|
|
|
+ else if (highestItem is EventLogInfoWidget)
|
|
|
+ {
|
|
|
+ EventLogInfoWidget eventLogTitleWidget = highestItem as EventLogInfoWidget;
|
|
|
+ eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventLogTitleWidget.data.id);
|
|
|
+ }
|
|
|
+ else if (highestItem is EventLogMessageWidget)
|
|
|
+ {
|
|
|
+ EventLogMessageWidget eventLogTitleWidget = highestItem as EventLogMessageWidget;
|
|
|
+ eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventLogTitleWidget.data.id);
|
|
|
+ }
|
|
|
+
|
|
|
+ PlacesConfig placesConfig = ConfigComponent.Instance.Get<PlacesConfig>(eventConfig.placeID);
|
|
|
+ eventLogTitleWidget.CustomInit(LanguageManager.Instance.Text(placesConfig.placeName));
|
|
|
}
|
|
|
}
|
|
|
}
|