|
@@ -31,11 +31,18 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
|
|
|
|
Action onCompleteCallback;
|
|
Action onCompleteCallback;
|
|
|
|
|
|
|
|
+ // public Map<int, AccountFileInfo.EventConditionData> EventConditionDataMap = new Map<int, AccountFileInfo.EventConditionData>();
|
|
|
|
+
|
|
public void CustomInit()
|
|
public void CustomInit()
|
|
{
|
|
{
|
|
eventConfigs = ConfigComponent.Instance.GetAll<EventConfig>().ToList();
|
|
eventConfigs = ConfigComponent.Instance.GetAll<EventConfig>().ToList();
|
|
divineSenseConfigs = ConfigComponent.Instance.GetAll<DivineSenseConfig>().ToList();
|
|
divineSenseConfigs = ConfigComponent.Instance.GetAll<DivineSenseConfig>().ToList();
|
|
|
|
|
|
|
|
+ // foreach (var playerDataEventConditionData in AccountFileInfo.Instance.playerData.eventConditionDatas)
|
|
|
|
+ // {
|
|
|
|
+ // EventConditionDataMap.Add(playerDataEventConditionData.guid, playerDataEventConditionData);
|
|
|
|
+ // }
|
|
|
|
+
|
|
StaticUpdater.Instance.AddRenderUpdateCallBack(Update);
|
|
StaticUpdater.Instance.AddRenderUpdateCallBack(Update);
|
|
EventManager.Instance.AddEventListener(CustomEventType.DetectRandomEvent, RenfenceRandomEvent);
|
|
EventManager.Instance.AddEventListener(CustomEventType.DetectRandomEvent, RenfenceRandomEvent);
|
|
EventManager.Instance.AddEventListener(CustomEventType.AddItem, ItemUpdate);
|
|
EventManager.Instance.AddEventListener(CustomEventType.AddItem, ItemUpdate);
|
|
@@ -90,7 +97,7 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
int maxCount = heroPowerUpConfig.ShenshiMax / PlayerManager.Instance.gameConstantConfig.DetectEventCount;
|
|
int maxCount = heroPowerUpConfig.ShenshiMax / PlayerManager.Instance.gameConstantConfig.DetectEventCount;
|
|
count = count + AccountFileInfo.Instance.playerData.eventList.Count > maxCount ? maxCount - AccountFileInfo.Instance.playerData.eventList.Count : count;
|
|
count = count + AccountFileInfo.Instance.playerData.eventList.Count > maxCount ? maxCount - AccountFileInfo.Instance.playerData.eventList.Count : count;
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
EventManager.Instance.Dispatch(CustomEventType.DivineSensePointChange, null);
|
|
EventManager.Instance.Dispatch(CustomEventType.DivineSensePointChange, null);
|
|
// 神识升级逻辑
|
|
// 神识升级逻辑
|
|
UpDivinesense();
|
|
UpDivinesense();
|
|
@@ -100,10 +107,10 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
return default;
|
|
return default;
|
|
|
|
|
|
//扣除神识值 增加神识经验
|
|
//扣除神识值 增加神识经验
|
|
- int xiaoHao = eventConfigs.Count * PlayerManager.Instance.gameConstantConfig.DetectEventCount;
|
|
|
|
|
|
+ int xiaoHao = eventConfigs.Count * PlayerManager.Instance.gameConstantConfig.DetectEventCount;
|
|
AccountFileInfo.Instance.playerData.divineSenseexp += xiaoHao;
|
|
AccountFileInfo.Instance.playerData.divineSenseexp += xiaoHao;
|
|
AccountFileInfo.Instance.playerData.divineSensePoint -= xiaoHao;
|
|
AccountFileInfo.Instance.playerData.divineSensePoint -= xiaoHao;
|
|
-
|
|
|
|
|
|
+
|
|
AccountFileInfo.Instance.playerData.eventList.AddRange(eventConfigs);
|
|
AccountFileInfo.Instance.playerData.eventList.AddRange(eventConfigs);
|
|
AccountFileInfo.Instance.SavePlayerData();
|
|
AccountFileInfo.Instance.SavePlayerData();
|
|
return eventConfigs;
|
|
return eventConfigs;
|
|
@@ -268,20 +275,28 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
{
|
|
{
|
|
foreach (var i in eventConfig.EventLinksId)
|
|
foreach (var i in eventConfig.EventLinksId)
|
|
{
|
|
{
|
|
- AccountFileInfo.EventLinkData eventLinkData = AccountFileInfo.Instance.playerData.eventLinkDatas.FirstOrDefault(el => el.eventLinkId == i);
|
|
|
|
|
|
+ EventLinkConfig eventLinkConfig = ConfigComponent.Instance.Get<EventLinkConfig>(i);
|
|
|
|
|
|
- if (eventLinkData == null)
|
|
|
|
|
|
+ AccountFileInfo.EventLinkData eventLinkData = new AccountFileInfo.EventLinkData();
|
|
|
|
+ eventLinkData.eventId = eventID;
|
|
|
|
+ eventLinkData.eventLinkId = i;
|
|
|
|
+ if (eventLinkConfig.ConditionId != null)
|
|
{
|
|
{
|
|
- eventLinkData = new AccountFileInfo.EventLinkData();
|
|
|
|
- eventLinkData.eventId = eventList.eventID;
|
|
|
|
- eventLinkData.eventLinkId = i;
|
|
|
|
- AccountFileInfo.Instance.playerData.eventLinkDatas.Add(eventLinkData);
|
|
|
|
|
|
+ foreach (var i1 in eventLinkConfig.ConditionId)
|
|
|
|
+ {
|
|
|
|
+ AccountFileInfo.EventConditionData eventConditionData = new AccountFileInfo.EventConditionData();
|
|
|
|
+ eventConditionData.eventId = eventList.eventID;
|
|
|
|
+ eventConditionData.eventCondition = i1;
|
|
|
|
+ // AccountFileInfo.Instance.playerData.eventConditionDatas.Add(eventConditionData);
|
|
|
|
+ eventLinkData.eventConditions.Add(eventConditionData);
|
|
|
|
+
|
|
|
|
+ //初始化先检测一些条件
|
|
|
|
+ CeekTaskComplete(eventConditionData, 1, null);
|
|
|
|
+ CeekTaskComplete(eventConditionData, 3, null);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- eventLinkData.fishCount = 0;
|
|
|
|
- //初始化先检测一些条件
|
|
|
|
- CeekTaskComplete(eventLinkData.eventLinkId, 1, null);
|
|
|
|
- CeekTaskComplete(eventLinkData.eventLinkId, 3, null);
|
|
|
|
|
|
+ eventList.eventLinks.Add(eventLinkData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -326,7 +341,7 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
LogTool.Log($"触发事件: {evt.EventName} (ID: {evt.ID}, 品质: {evt.EventQuality})");
|
|
LogTool.Log($"触发事件: {evt.EventName} (ID: {evt.ID}, 品质: {evt.EventQuality})");
|
|
CombatDrive.Instance.CombatController.ChangeState(CombatController.idle);
|
|
CombatDrive.Instance.CombatController.ChangeState(CombatController.idle);
|
|
|
|
|
|
- DialogueManager.Instance.StartDialogue(evt.EventLinksId[0], evt.ID, () => { CompleteEvent(evt.ID); });
|
|
|
|
|
|
+ DialogueManager.Instance.StartDialogue(null, evt.EventLinksId[0], evt.ID, () => { CompleteEvent(evt.ID); });
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -355,7 +370,7 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
|
|
|
|
CurrentEventList = evt;
|
|
CurrentEventList = evt;
|
|
CombatDrive.Instance.CombatController.ChangeState(CombatController.idle);
|
|
CombatDrive.Instance.CombatController.ChangeState(CombatController.idle);
|
|
- DialogueManager.Instance.StartDialogue(dialogueID, eventConfig.ID, () =>
|
|
|
|
|
|
+ DialogueManager.Instance.StartDialogue(CurrentEventList, dialogueID, eventConfig.ID, () =>
|
|
{
|
|
{
|
|
CompleteEvent(CurrentEventList);
|
|
CompleteEvent(CurrentEventList);
|
|
cTask.SetResult();
|
|
cTask.SetResult();
|
|
@@ -369,97 +384,138 @@ public class EventSystemManager : Singleton<EventSystemManager>
|
|
|
|
|
|
|
|
|
|
//任务是否完成
|
|
//任务是否完成
|
|
- public bool IsEvenkLinkComplete(int eventLinkId)
|
|
|
|
|
|
+ public bool IsEvenkLinkComplete(AccountFileInfo.EventConditionData eventCondition)
|
|
{
|
|
{
|
|
- EventLinkConfig eventLinkConfig = ConfigComponent.Instance.Get<EventLinkConfig>(eventLinkId);
|
|
|
|
- // if (eventLinkConfig.ConditionType == 0)
|
|
|
|
- // return true;
|
|
|
|
- //
|
|
|
|
- // AccountFileInfo.EventLinkData eventLinkData = AccountFileInfo.Instance.playerData.eventLinkDatas.FirstOrDefault(el => el.eventLinkId == eventLinkId);
|
|
|
|
- //
|
|
|
|
- // if (eventLinkData != null)
|
|
|
|
- // {
|
|
|
|
- // return eventLinkData.fishCount >= eventLinkConfig.finishCount;
|
|
|
|
- // }
|
|
|
|
|
|
+ EventConditionConfig eventConditionConfig = ConfigComponent.Instance.Get<EventConditionConfig>(eventCondition.eventCondition);
|
|
|
|
+
|
|
|
|
+ if (eventCondition != null)
|
|
|
|
+ {
|
|
|
|
+ return eventCondition.fishCount >= eventConditionConfig.finishCount;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public bool CeekEventGroupComplete(List<AccountFileInfo.EventConditionData> eventConditions)
|
|
|
|
+ {
|
|
|
|
+ Map<int, List<AccountFileInfo.EventConditionData>> eventConditionDataGroup = new Map<int, List<AccountFileInfo.EventConditionData>>();
|
|
|
|
+
|
|
|
|
+ foreach (var eventConditionData in eventConditions)
|
|
|
|
+ {
|
|
|
|
+ EventConditionConfig eventConditionConfig = ConfigComponent.Instance.Get<EventConditionConfig>(eventConditionData.eventCondition);
|
|
|
|
+ if (!eventConditionDataGroup.ContainsKey(eventConditionConfig.Operation))
|
|
|
|
+ {
|
|
|
|
+ eventConditionDataGroup.Add(eventConditionConfig.Operation, new List<AccountFileInfo.EventConditionData>());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ eventConditionDataGroup[eventConditionConfig.Operation].Add(eventConditionData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ bool isUlock = true;
|
|
|
|
+ foreach (var keyValuePair in eventConditionDataGroup)
|
|
|
|
+ {
|
|
|
|
+ isUlock = true;
|
|
|
|
+ foreach (var eventConditionData in keyValuePair.Value)
|
|
|
|
+ {
|
|
|
|
+ if (!IsEvenkLinkComplete(eventConditionData))
|
|
|
|
+ {
|
|
|
|
+ isUlock = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (isUlock)
|
|
|
|
+ {
|
|
|
|
+ return isUlock;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
public void CeekEventCompletes(int type, int[] value)
|
|
public void CeekEventCompletes(int type, int[] value)
|
|
{
|
|
{
|
|
- foreach (var playerDataEventLinkData in AccountFileInfo.Instance.playerData.eventLinkDatas)
|
|
|
|
|
|
+ foreach (var playerDataEventLinkData in AccountFileInfo.Instance.playerData.eventList)
|
|
{
|
|
{
|
|
- CeekTaskComplete(playerDataEventLinkData.eventLinkId, type, value);
|
|
|
|
|
|
+ foreach (var eventLinkData in playerDataEventLinkData.eventLinks)
|
|
|
|
+ {
|
|
|
|
+ foreach (var eventConditionData in eventLinkData.eventConditions)
|
|
|
|
+ {
|
|
|
|
+ CeekTaskComplete(eventConditionData, type, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
EventManager.Instance.Dispatch(CustomEventType.RemoveEvent, null);
|
|
EventManager.Instance.Dispatch(CustomEventType.RemoveEvent, null);
|
|
}
|
|
}
|
|
|
|
|
|
- public void CeekTaskComplete(int eventLiknId, int type, int[] value)
|
|
|
|
|
|
+ public void CeekTaskComplete(AccountFileInfo.EventConditionData conditionData, int type, int[] value)
|
|
{
|
|
{
|
|
- //任务完成了跳过检测
|
|
|
|
- if (IsEvenkLinkComplete(eventLiknId))
|
|
|
|
|
|
+ EventConditionConfig eventConditionConfig = ConfigComponent.Instance.Get<EventConditionConfig>(conditionData.eventCondition);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (IsEvenkLinkComplete(conditionData))
|
|
return;
|
|
return;
|
|
- AccountFileInfo.EventLinkData eventLinkData = AccountFileInfo.Instance.playerData.eventLinkDatas.FirstOrDefault(el => el.eventLinkId == eventLiknId);
|
|
|
|
|
|
|
|
- EventLinkConfig eventLinkConfig = ConfigComponent.Instance.Get<EventLinkConfig>(eventLiknId);
|
|
|
|
switch (type)
|
|
switch (type)
|
|
{
|
|
{
|
|
- // //检测背包道具
|
|
|
|
- // case 1:
|
|
|
|
- // if (eventLinkConfig.ConditionType == 1)
|
|
|
|
- // {
|
|
|
|
- // eventLinkData.fishCount += (int)PlayerManager.Instance.BagController.GetItemCount(eventLinkConfig.ConditionPara[0]);
|
|
|
|
- //
|
|
|
|
- // if (IsEvenkLinkComplete(eventLiknId))
|
|
|
|
- // {
|
|
|
|
- // CompleteTask(eventLiknId);
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //
|
|
|
|
- // break;
|
|
|
|
- //
|
|
|
|
- // //境界检测
|
|
|
|
- // case 3:
|
|
|
|
- // if (eventLinkConfig.ConditionType == 3 && PlayerManager.Instance.myHero.powerUpConfig.ID >= eventLinkConfig.ConditionPara[0])
|
|
|
|
- // {
|
|
|
|
- // eventLinkData.fishCount++;
|
|
|
|
- //
|
|
|
|
- // if (IsEvenkLinkComplete(eventLiknId))
|
|
|
|
- // {
|
|
|
|
- // CompleteTask(eventLiknId);
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //
|
|
|
|
- // break;
|
|
|
|
- //
|
|
|
|
- // //战斗胜利
|
|
|
|
- // case 5:
|
|
|
|
- // if (eventLinkConfig.ConditionType == 5 && eventLinkConfig.ConditionPara[0] == value[0])
|
|
|
|
- // {
|
|
|
|
- // eventLinkData.fishCount++;
|
|
|
|
- //
|
|
|
|
- // if (IsEvenkLinkComplete(eventLiknId))
|
|
|
|
- // {
|
|
|
|
- // CompleteEvent(eventLiknId);
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //
|
|
|
|
- // break;
|
|
|
|
- //
|
|
|
|
- // //获得道具
|
|
|
|
- // case 6:
|
|
|
|
- // if (eventLinkConfig.ConditionType == 6 && eventLinkConfig.ConditionPara[0] == value[0])
|
|
|
|
- // {
|
|
|
|
- // eventLinkData.fishCount += value[1];
|
|
|
|
- //
|
|
|
|
- // if (IsEvenkLinkComplete(eventLiknId))
|
|
|
|
- // {
|
|
|
|
- // CompleteEvent(eventLinkData);
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //
|
|
|
|
- // break;
|
|
|
|
|
|
+ //检测背包道具
|
|
|
|
+ case 1:
|
|
|
|
+ if (eventConditionConfig.ConditionType == 1)
|
|
|
|
+ {
|
|
|
|
+ conditionData.fishCount += (int)PlayerManager.Instance.BagController.GetItemCount(eventConditionConfig.ConditionPara[0]);
|
|
|
|
+
|
|
|
|
+ if (IsEvenkLinkComplete(conditionData))
|
|
|
|
+ {
|
|
|
|
+ // CompleteTask(conditionData.guid);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ //境界检测
|
|
|
|
+ case 3:
|
|
|
|
+ if (eventConditionConfig.ConditionType == 3 && PlayerManager.Instance.myHero.powerUpConfig.ID >= eventConditionConfig.ConditionPara[0])
|
|
|
|
+ {
|
|
|
|
+ conditionData.fishCount++;
|
|
|
|
+
|
|
|
|
+ if (IsEvenkLinkComplete(conditionData))
|
|
|
|
+ {
|
|
|
|
+ // CompleteTask(conditionData.guid);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ //战斗胜利
|
|
|
|
+ case 5:
|
|
|
|
+ if (eventConditionConfig.ConditionType == 5 && eventConditionConfig.ConditionPara[0] == value[0])
|
|
|
|
+ {
|
|
|
|
+ conditionData.fishCount++;
|
|
|
|
+
|
|
|
|
+ if (IsEvenkLinkComplete(conditionData))
|
|
|
|
+ {
|
|
|
|
+ // CompleteEvent(conditionData.guid);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ //获得道具
|
|
|
|
+ case 6:
|
|
|
|
+ if (eventConditionConfig.ConditionType == 6 && eventConditionConfig.ConditionPara[0] == value[0])
|
|
|
|
+ {
|
|
|
|
+ conditionData.fishCount += value[1];
|
|
|
|
+
|
|
|
|
+ if (IsEvenkLinkComplete(conditionData))
|
|
|
|
+ {
|
|
|
|
+ // CompleteEvent(conditionData.guid);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|