|
@@ -1,5 +1,6 @@
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
|
+using Core.Language;
|
|
using Excel2Json;
|
|
using Excel2Json;
|
|
using Fort23.Core;
|
|
using Fort23.Core;
|
|
using Fort23.UTool;
|
|
using Fort23.UTool;
|
|
@@ -13,6 +14,8 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
|
|
|
|
List<AccountFileInfo.EventData> eventDatas = new List<AccountFileInfo.EventData>();
|
|
List<AccountFileInfo.EventData> eventDatas = new List<AccountFileInfo.EventData>();
|
|
|
|
|
|
|
|
+ public AccountFileInfo.EventList CurrentEventList;
|
|
|
|
+
|
|
public void CustomInit()
|
|
public void CustomInit()
|
|
{
|
|
{
|
|
eventConfigs = ConfigComponent.Instance.GetAll<EventConfig>().ToList();
|
|
eventConfigs = ConfigComponent.Instance.GetAll<EventConfig>().ToList();
|
|
@@ -34,7 +37,7 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public List<EventConfig> UseDivinesense(int bigMapId)
|
|
|
|
|
|
+ public List<AccountFileInfo.EventList> UseDivinesense(int bigMapId)
|
|
{
|
|
{
|
|
DivineSenseConfig divineSenseConfig = ConfigComponent.Instance.Get<DivineSenseConfig>(AccountFileInfo.Instance.playerData.divineSenseLevel);
|
|
DivineSenseConfig divineSenseConfig = ConfigComponent.Instance.Get<DivineSenseConfig>(AccountFileInfo.Instance.playerData.divineSenseLevel);
|
|
int count = AccountFileInfo.Instance.playerData.divineSensePoint / PlayerManager.Instance.gameConstantConfig.DetectEventCount;
|
|
int count = AccountFileInfo.Instance.playerData.divineSensePoint / PlayerManager.Instance.gameConstantConfig.DetectEventCount;
|
|
@@ -50,7 +53,19 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
//todo 神识升级逻辑
|
|
//todo 神识升级逻辑
|
|
AccountFileInfo.Instance.SavePlayerData();
|
|
AccountFileInfo.Instance.SavePlayerData();
|
|
|
|
|
|
- return DetectEvents(bigMapId, count);
|
|
|
|
|
|
+ var eventConfigs = DetectEvents(bigMapId, count);
|
|
|
|
+ if (eventConfigs == null || eventConfigs.Count == 0)
|
|
|
|
+ return default;
|
|
|
|
+
|
|
|
|
+ List<AccountFileInfo.EventList> eventLists = new List<AccountFileInfo.EventList>();
|
|
|
|
+ for (var i = 0; i < eventConfigs.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ AccountFileInfo.EventList eventList = new AccountFileInfo.EventList();
|
|
|
|
+ eventList.eventID = eventConfigs[i].ID;
|
|
|
|
+ eventLists.Add(eventList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return eventLists;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -140,6 +155,27 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
DialogueManager.Instance.StartDialogue(evt.EventType, evt.ID, () => { CompleteEvent(evt.ID); });
|
|
DialogueManager.Instance.StartDialogue(evt.EventType, evt.ID, () => { CompleteEvent(evt.ID); });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 触发事件
|
|
|
|
+ /// </summary>
|
|
|
|
+ public void TriggerEvent(AccountFileInfo.EventList evt)
|
|
|
|
+ {
|
|
|
|
+ EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(evt.eventID);
|
|
|
|
+ LogTool.Log($"触发事件: {LanguageManager.Instance.Text(eventConfig.Description)} (ID: {eventConfig.ID}, 品质: {eventConfig.EventQuality})");
|
|
|
|
+
|
|
|
|
+ int dialogueID = 0;
|
|
|
|
+ if (evt.curStep == 0)
|
|
|
|
+ {
|
|
|
|
+ dialogueID = eventConfig.EventType;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ dialogueID = evt.curStep;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DialogueManager.Instance.StartDialogue(dialogueID, eventConfig.ID, () => { CompleteEvent(); });
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 检查事件是否满足触发条件。
|
|
/// 检查事件是否满足触发条件。
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -200,6 +236,37 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
|
|
|
|
if (AccountFileInfo.Instance.playerData.senceExplorationProgress < 100)
|
|
if (AccountFileInfo.Instance.playerData.senceExplorationProgress < 100)
|
|
AccountFileInfo.Instance.playerData.senceExplorationProgress += 5;
|
|
AccountFileInfo.Instance.playerData.senceExplorationProgress += 5;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ AccountFileInfo.Instance.SavePlayerData();
|
|
|
|
+
|
|
|
|
+ EventManager.Instance.Dispatch(CustomEventType.CompleteEvent, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 完成事件
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="eventID">事件ID</param>
|
|
|
|
+ public void CompleteEvent()
|
|
|
|
+ {
|
|
|
|
+ LogTool.Log($"完成事件{CurrentEventList.eventID}");
|
|
|
|
+ AccountFileInfo.EventData eventData = AccountFileInfo.Instance.playerData.events.FirstOrDefault((e) => e.eventID == CurrentEventList.eventID);
|
|
|
|
+ if (eventData == null)
|
|
|
|
+ {
|
|
|
|
+ eventData = new AccountFileInfo.EventData();
|
|
|
|
+ eventData.eventID = CurrentEventList.eventID;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ eventData.completeCount++;
|
|
|
|
+ AccountFileInfo.Instance.playerData.events.Add(eventData);
|
|
|
|
+
|
|
|
|
+ if (AccountFileInfo.Instance.playerData.senceExplorationProgress < 100)
|
|
|
|
+ AccountFileInfo.Instance.playerData.senceExplorationProgress += 5;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ AccountFileInfo.Instance.playerData.eventList.RemoveAll(el => el.eventID == CurrentEventList.eventID);
|
|
AccountFileInfo.Instance.SavePlayerData();
|
|
AccountFileInfo.Instance.SavePlayerData();
|
|
|
|
+
|
|
|
|
+ EventManager.Instance.Dispatch(CustomEventType.CompleteEvent, null);
|
|
}
|
|
}
|
|
}
|
|
}
|