EventSystemManager.cs 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Common.Utility.CombatEvent;
  5. using Core.Language;
  6. using Excel2Json;
  7. using Fort23.Core;
  8. using Fort23.Mono;
  9. using Fort23.UTool;
  10. using GameLogic.Bag;
  11. using GameLogic.Combat;
  12. using GameLogic.Combat.CombatTool;
  13. using GameLogic.Player;
  14. using UnityEngine;
  15. using Utility;
  16. using EventConfig = Excel2Json.EventConfig;
  17. using Random = UnityEngine.Random;
  18. public class EventSystemManager : Singleton<EventSystemManager>
  19. {
  20. List<EventConfig> eventConfigs = new List<EventConfig>();
  21. public AccountFileInfo.EventList CurrentEventList;
  22. public bool isTriggerEvent;
  23. List<DivineSenseConfig> divineSenseConfigs = new List<DivineSenseConfig>();
  24. List<int> qualitys = new List<int>() { 1, 2, 3, 4, 5, 6 };
  25. public bool isOpenUi;
  26. Action onCompleteCallback;
  27. public Map<int, List<EventConfig>> eventConfigsMap = new Map<int, List<EventConfig>>();
  28. // public Map<int, AccountFileInfo.EventConditionData> EventConditionDataMap = new Map<int, AccountFileInfo.EventConditionData>();
  29. public void CustomInit()
  30. {
  31. eventConfigs = ConfigComponent.Instance.GetAll<EventConfig>().ToList();
  32. divineSenseConfigs = ConfigComponent.Instance.GetAll<DivineSenseConfig>().ToList();
  33. foreach (var eventConfig in eventConfigs)
  34. {
  35. if (eventConfig.XiantuID != 0)
  36. {
  37. if (eventConfigsMap.ContainsKey(eventConfig.XiantuID))
  38. {
  39. eventConfigsMap[eventConfig.XiantuID].Add(eventConfig);
  40. }
  41. else
  42. {
  43. eventConfigsMap.Add(eventConfig.XiantuID, new List<EventConfig>() { eventConfig });
  44. }
  45. }
  46. }
  47. //进入游戏全部检测一次
  48. foreach (var playerDataEventLinkData in AccountFileInfo.Instance.playerData.eventList)
  49. {
  50. foreach (var eventLinkData in playerDataEventLinkData.eventLinks)
  51. {
  52. CeekEventGroupComplete(eventLinkData.eventConditions);
  53. }
  54. }
  55. StaticUpdater.Instance.AddRenderUpdateCallBack(Update);
  56. EventManager.Instance.AddEventListener(CustomEventType.DetectRandomEvent, RenfenceRandomEvent);
  57. EventManager.Instance.AddEventListener(CustomEventType.AddItem, ItemUpdate);
  58. EventManager.Instance.AddEventListener(CustomEventType.JingJieUpgrade, JingJieUpgrade);
  59. EventManager.Instance.AddEventListener(CustomEventType.CancelEvent, Cancel);
  60. }
  61. private void Cancel(IEventData e)
  62. {
  63. CancelEvent();
  64. }
  65. private void JingJieUpgrade(IEventData e)
  66. {
  67. CeekEventCompletes(3, null);
  68. }
  69. private void ItemUpdate(IEventData e)
  70. {
  71. ItemUpdateData data = e as ItemUpdateData;
  72. CeekEventCompletes(1, new[] { data.ItemInfo.itemID });
  73. CeekEventCompletes(6, new[] { data.ItemInfo.itemID, data.Count });
  74. }
  75. private void RenfenceRandomEvent(IEventData e)
  76. {
  77. DetectRandomEvents();
  78. }
  79. private float timer = 0;
  80. private void Update()
  81. {
  82. timer += Time.deltaTime;
  83. if (timer > 1)
  84. {
  85. timer = 0;
  86. HeroPowerUpConfig heroPowerUpConfig = PlayerManager.Instance.myHero.powerUpConfig;
  87. if (AccountFileInfo.Instance.playerData.divineSensePoint < heroPowerUpConfig.ShenshiMax)
  88. {
  89. if (AccountFileInfo.Instance.playerData.todayDivineSensePoint <
  90. PlayerManager.Instance.gameConstantConfig.shenshiPointRecSPD[0])
  91. {
  92. AccountFileInfo.Instance.playerData.todayDivineSensePoint +=
  93. PlayerManager.Instance.gameConstantConfig.shenshiPointRecSPD[1];
  94. AccountFileInfo.Instance.playerData.divineSensePoint +=
  95. PlayerManager.Instance.gameConstantConfig.shenshiPointRecSPD[1];
  96. }
  97. else
  98. {
  99. AccountFileInfo.Instance.playerData.divineSensePoint +=
  100. PlayerManager.Instance.gameConstantConfig.shenshiPointRecSPD[2];
  101. }
  102. EventManager.Instance.Dispatch(CustomEventType.DivineSensePointChange, null);
  103. AccountFileInfo.Instance.SavePlayerData();
  104. }
  105. }
  106. }
  107. public List<AccountFileInfo.EventList> UseDivinesense(int useCount, List<ItemInfo> useItems)
  108. {
  109. //使用神识先移除完成的事件
  110. List<AccountFileInfo.EventList> removeEvents = new List<AccountFileInfo.EventList>();
  111. foreach (var eventList in AccountFileInfo.Instance.playerData.eventList)
  112. {
  113. if (eventList.isCompleted)
  114. {
  115. removeEvents.Add(eventList);
  116. }
  117. }
  118. foreach (var removeEvent in removeEvents)
  119. {
  120. AccountFileInfo.Instance.playerData.completeEvents.Add(removeEvent);
  121. AccountFileInfo.Instance.playerData.eventList.Remove(removeEvent);
  122. }
  123. AccountFileInfo.Instance.SavePlayerData();
  124. HeroPowerUpConfig heroPowerUpConfig = PlayerManager.Instance.myHero.powerUpConfig;
  125. int count = (int)(AccountFileInfo.Instance.playerData.divineSensePoint /
  126. PlayerManager.Instance.gameConstantConfig.DetectEventCount);
  127. if (count <= 0)
  128. {
  129. //神识值不够
  130. return null;
  131. }
  132. int maxCount = heroPowerUpConfig.ShenshiMax / PlayerManager.Instance.gameConstantConfig.DetectEventCount;
  133. count = count + GetShenShiCount() > maxCount ? maxCount - GetShenShiCount() : count;
  134. if (useCount > count)
  135. {
  136. LogTool.Error("神识值不够");
  137. return null;
  138. }
  139. CeekEventCompletes(8, new[] { 1 });
  140. EventManager.Instance.Dispatch(CustomEventType.DivineSensePointChange, null);
  141. var eventConfigs = DetectEvents(useCount, useItems);
  142. if (eventConfigs == null || eventConfigs.Count == 0)
  143. {
  144. TipMessagePanel.OpenTipMessagePanel("没有可以触发的事件");
  145. return default;
  146. }
  147. //扣除神识值 增加神识经验
  148. int xiaoHao = eventConfigs.Count * PlayerManager.Instance.gameConstantConfig.DetectEventCount;
  149. AccountFileInfo.Instance.playerData.divineSenseexp += xiaoHao;
  150. AccountFileInfo.Instance.playerData.divineSensePoint -= xiaoHao;
  151. // 神识升级逻辑
  152. UpDivinesense();
  153. AccountFileInfo.Instance.playerData.eventList.AddRange(eventConfigs);
  154. UpdateZuizhongEventData();
  155. AccountFileInfo.Instance.SavePlayerData();
  156. return eventConfigs;
  157. }
  158. public void UpdateZuizhongEventData()
  159. {
  160. AccountFileInfo.EventList eventList = AccountFileInfo.Instance.playerData.eventList.FirstOrDefault(e =>
  161. e.guid == AccountFileInfo.Instance.playerData.CurrentZuiZhongEventListId);
  162. if (eventList == null || eventList.guid == 0)
  163. {
  164. var mainEventData = GetMainEventDta();
  165. if (mainEventData != null)
  166. {
  167. AccountFileInfo.Instance.playerData.CurrentZuiZhongEventListId = mainEventData.guid;
  168. }
  169. else if (AccountFileInfo.Instance.playerData.eventList.Count > 0)
  170. {
  171. AccountFileInfo.Instance.playerData.CurrentZuiZhongEventListId =
  172. AccountFileInfo.Instance.playerData.eventList[0].guid;
  173. }
  174. }
  175. }
  176. private void UpDivinesense()
  177. {
  178. if (AccountFileInfo.Instance.playerData.divineSenseLevel >= divineSenseConfigs.Count)
  179. {
  180. return;
  181. }
  182. for (var i = AccountFileInfo.Instance.playerData.divineSenseLevel - 1; i < divineSenseConfigs.Count; i++)
  183. {
  184. if (AccountFileInfo.Instance.playerData.divineSenseexp >= divineSenseConfigs[i].exp)
  185. {
  186. AccountFileInfo.Instance.playerData.divineSenseexp -= divineSenseConfigs[i].exp;
  187. AccountFileInfo.Instance.playerData.divineSenseLevel = divineSenseConfigs[i + 1].ID;
  188. }
  189. }
  190. AccountFileInfo.Instance.SavePlayerData();
  191. }
  192. public int GetShenShiCount()
  193. {
  194. int count = 0;
  195. foreach (var eventList in AccountFileInfo.Instance.playerData.eventList)
  196. {
  197. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventList.eventID);
  198. if (eventList == null || eventList.eventID == 0 || eventList.isCompleted ||
  199. eventConfig.EventTriggerType == 4)
  200. continue;
  201. if (eventConfig.EventTriggerType != 5)
  202. {
  203. count++;
  204. }
  205. }
  206. return count;
  207. }
  208. public bool BagIsEvent(int eventID)
  209. {
  210. foreach (var eventList in AccountFileInfo.Instance.playerData.eventList)
  211. {
  212. if (eventList.eventID == eventID)
  213. {
  214. return true;
  215. }
  216. }
  217. return false;
  218. }
  219. public int GetBagEventCount(int eventID)
  220. {
  221. int count = 0;
  222. foreach (var eventList in AccountFileInfo.Instance.playerData.eventList)
  223. {
  224. if (eventList.eventID == eventID)
  225. {
  226. count++;
  227. }
  228. }
  229. return count;
  230. }
  231. // public bool IsRefenceEvent(int eventID)
  232. // {
  233. // EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventID);
  234. // }
  235. public bool IsEventTrigger(int eventID)
  236. {
  237. foreach (var eventList in AccountFileInfo.Instance.playerData.completeEvents)
  238. {
  239. if (eventList.eventID == eventID)
  240. {
  241. return true;
  242. }
  243. }
  244. return false;
  245. }
  246. private List<AccountFileInfo.EventList> DetectEvents(int eventCount, List<ItemInfo> useItems)
  247. {
  248. SmallPlacesConfig smallPlacesConfig =
  249. ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);
  250. PlacesConfig bigMap = ConfigComponent.Instance.Get<PlacesConfig>(smallPlacesConfig.PlacesId);
  251. DivineSenseConfig divineSenseConfig =
  252. ConfigComponent.Instance.Get<DivineSenseConfig>(AccountFileInfo.Instance.playerData.divineSenseLevel);
  253. LogTool.Log($"使用神识,神识等级:{AccountFileInfo.Instance.playerData.divineSenseLevel}");
  254. List<AccountFileInfo.EventList> eventLists = new List<AccountFileInfo.EventList>();
  255. //取消根据主线进度刷新啊支线任务
  256. //现在改成优先刷新满足条件的支线任务然后判断概率是否刷新
  257. //找出可以刷新的支线任务
  258. // if (bigMap.ZhixianActivatedPercentage != null)
  259. // {
  260. // List<EventConfig> zhiXianEvents = new List<EventConfig>();
  261. // for (var i = 0; i < bigMap.ZhixianActivatedPercentage.Length; i++)
  262. // {
  263. // if (PlayerManager.Instance.PlacesBl >= bigMap.ZhixianActivatedPercentage[i])
  264. // {
  265. // if (!BagIsEvent(bigMap.ZhixianID[i]) && !IsEventTrigger(bigMap.ZhixianID[i]) &&
  266. // CanTriggerEvent(bigMap.ZhixianID[i]))
  267. // {
  268. // zhiXianEvents.Add(ConfigComponent.Instance.Get<EventConfig>(bigMap.ZhixianID[i]));
  269. // }
  270. // }
  271. // }
  272. //
  273. // foreach (var c in zhiXianEvents)
  274. // {
  275. // AccountFileInfo.EventList eventList = AddEvent(c.ID);
  276. // if (eventList != null)
  277. // {
  278. // eventLists.Add(eventList);
  279. // eventCount--;
  280. //
  281. // if (eventCount == 0)
  282. // {
  283. // return eventLists;
  284. // }
  285. // }
  286. // }
  287. // }
  288. for (int i = 0; i < eventCount; i++)
  289. {
  290. //刷新支线任务
  291. List<EventConfig> zhiXianEvents = eventConfigs.Where(e =>
  292. e.EventTriggerType == 6 && !BagIsEvent(e.ID) && !IsEventTrigger(e.ID) &&
  293. e.SmallPlacesId == smallPlacesConfig.ID &&
  294. eventLists.FirstOrDefault(el => el.eventID == e.ID) == null && CanTriggerEvent(e.ID)).ToList();
  295. if (zhiXianEvents.Count > 0)
  296. {
  297. var zhixianEvnetConfig = zhiXianEvents[0];
  298. int randomValueZhiXian = Random.Range(0, 101);
  299. if (randomValueZhiXian <= zhixianEvnetConfig.RefreshProbability)
  300. {
  301. AccountFileInfo.EventList eventList = AddEvent(zhixianEvnetConfig.ID);
  302. if (eventList != null)
  303. {
  304. eventLists.Add(eventList);
  305. LogTool.Log("刷新支线任务:id:" + zhixianEvnetConfig.ID);
  306. continue;
  307. }
  308. }
  309. }
  310. int randomValue3 = Random.Range(0, 101);
  311. //先刷事件关联的事件
  312. if (randomValue3 <= PlayerManager.Instance.gameConstantConfig.RefreshRelevanceEventProbability)
  313. {
  314. bool isRefence = false;
  315. foreach (var eventList in AccountFileInfo.Instance.playerData.eventList)
  316. {
  317. foreach (var eventListEventLink in eventList.eventLinks)
  318. {
  319. foreach (var eventConditionData in eventListEventLink.eventConditions)
  320. {
  321. if (IsEvenkLinkComplete(eventConditionData))
  322. continue;
  323. EventConditionConfig eventConditionConfig =
  324. ConfigComponent.Instance.Get<EventConditionConfig>(eventConditionData.eventCondition);
  325. for (var i1 = 0; i1 < eventConditionConfig.RelatedEvents?.Length; i1++)
  326. {
  327. EventConfig eventConfig1 =
  328. ConfigComponent.Instance.Get<EventConfig>(eventConditionConfig.RelatedEvents[i1]);
  329. int count = 0;
  330. foreach (var list in eventLists)
  331. {
  332. if (list.eventID == eventConfig1.ID)
  333. {
  334. count++;
  335. }
  336. }
  337. if (GetBagEventCount(eventConfig1.ID) + count >= eventConfig1.RefreshCount)
  338. {
  339. continue;
  340. }
  341. int randomValue4 = Random.Range(0, 101);
  342. if (randomValue4 <= eventConfig1.RefreshProbability)
  343. {
  344. var eventList1 = AddEvent(eventConfig1.ID);
  345. if (eventList1 != null)
  346. {
  347. eventLists.Add(AddEvent(eventConfig1.ID));
  348. isRefence = true;
  349. }
  350. else
  351. {
  352. LogTool.Error("管理事件没有刷新出来 id:" + eventConfig1.ID);
  353. }
  354. break;
  355. }
  356. }
  357. }
  358. }
  359. }
  360. if (isRefence)
  361. continue;
  362. }
  363. //概率
  364. ItemInfo itemInfoType1 = null;
  365. //类型
  366. ItemInfo itemInfoType2 = null;
  367. foreach (var itemInfo in useItems)
  368. {
  369. if (itemInfo.config.associateID == 6)
  370. {
  371. itemInfoType1 = itemInfo;
  372. }
  373. else if (itemInfo.config.associateID == 7)
  374. {
  375. itemInfoType2 = itemInfo;
  376. }
  377. }
  378. float[] QualityBonusChance = divineSenseConfig.QualityBonusChance.ToArray();
  379. if (itemInfoType1 != null)
  380. {
  381. QualityBonusChance[itemInfoType1.config.associateVlaue[0] - 1] *=
  382. itemInfoType1.config.associateVlaue[1];
  383. }
  384. //先掉落出品质
  385. int quality = UtilTools.GetRandomByWeight(qualitys, QualityBonusChance);
  386. // 获取通用事件
  387. List<EventConfig> globalEvents = eventConfigs.Where(e =>
  388. e.EventTriggerType == 1 && e.EventQuality == quality &&
  389. eventLists.FirstOrDefault(el => el.eventID == e.ID) == null && CanTriggerEvent(e.ID) &&
  390. CanEventType(e.ID, itemInfoType2)).ToList();
  391. //场景特定事件
  392. List<EventConfig> candidateEvents = eventConfigs.Where(e =>
  393. e.EventQuality == quality &&
  394. eventLists.FirstOrDefault(el => el.eventID == e.ID) == null && CanTriggerEvent(e.ID) &&
  395. CanEventType(e.ID, itemInfoType2)).ToList();
  396. if (candidateEvents.Count == 0 && globalEvents.Count == 0)
  397. {
  398. continue;
  399. }
  400. int randomValue1 = Random.Range(0, 101);
  401. // 达到怪率刷新场景特定事件
  402. //不然刷新通用事件(每个地图都可以刷的)
  403. if (randomValue1 < bigMap.DivineSenseGeneralProbability && candidateEvents.Count > 0)
  404. {
  405. int randomValue2 = Random.Range(0, candidateEvents.Count);
  406. var eventList = AddEvent(candidateEvents[randomValue2].ID);
  407. if (eventList != null)
  408. {
  409. eventLists.Add(eventList);
  410. }
  411. else
  412. {
  413. LogTool.Error("场景没有刷新出来 id:" + candidateEvents[randomValue2].ID);
  414. }
  415. }
  416. else if (globalEvents.Count > 0)
  417. {
  418. List<int> quanzhong = new List<int>();
  419. for (var i1 = 0; i1 < globalEvents.Count; i1++)
  420. {
  421. quanzhong.Add(globalEvents[i1].RefreshProbability);
  422. }
  423. var eventconfig = UtilTools.GetRandomByWeight(globalEvents, quanzhong.ToArray());
  424. // int randomValue2 = Random.Range(0, globalEvents.Count);
  425. var eventList = AddEvent(eventconfig.ID);
  426. if (eventList != null)
  427. {
  428. eventLists.Add(eventList);
  429. }
  430. else
  431. {
  432. LogTool.Error("通用事件没有刷新出来 id:" + eventconfig.ID);
  433. }
  434. }
  435. }
  436. if (eventLists.Count == 0)
  437. {
  438. LogTool.Error("没有可以触发的事件");
  439. return null;
  440. }
  441. return eventLists;
  442. }
  443. //添加事件
  444. public AccountFileInfo.EventList AddEvent(int eventID)
  445. {
  446. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventID);
  447. AccountFileInfo.EventList eventList = null;
  448. if (eventConfig.ID == 0)
  449. {
  450. return null;
  451. }
  452. //主线任务只能刷一次
  453. if (eventConfig.EventTriggerType == 4 || eventConfig.EventTriggerType == 6)
  454. {
  455. AccountFileInfo.EventList e =
  456. AccountFileInfo.Instance.playerData.eventList.FirstOrDefault(e => e.eventID == eventID);
  457. if (e == null)
  458. {
  459. e = AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(e => e.eventID == eventID);
  460. if (e == null)
  461. {
  462. eventList = new AccountFileInfo.EventList();
  463. eventList.eventID = eventID;
  464. }
  465. else
  466. {
  467. return null;
  468. }
  469. eventList.guid = IdGenerater.GenerateIdInt();
  470. eventList.curStep = eventConfig.EventLinksId[0];
  471. eventList.selectEventLinkIds.Add(eventConfig.EventLinksId[0]);
  472. //记录英雄等级 神识刷出来的战斗等级不变
  473. if (PlayerManager.Instance.myHero != null)
  474. eventList.heroLevel = PlayerManager.Instance.myHero.level.Value;
  475. }
  476. }
  477. else
  478. {
  479. eventList = new AccountFileInfo.EventList();
  480. eventList.eventID = eventID;
  481. eventList.guid = IdGenerater.GenerateIdInt();
  482. eventList.curStep = eventConfig.EventLinksId[0];
  483. eventList.selectEventLinkIds.Add(eventConfig.EventLinksId[0]);
  484. //记录英雄等级 神识刷出来的战斗等级不变
  485. if (PlayerManager.Instance.myHero != null)
  486. eventList.heroLevel = PlayerManager.Instance.myHero.level.Value;
  487. }
  488. //初始化神识链条,用于监听条件是否完成
  489. if (eventList != null && eventConfig.EventType != 2)
  490. {
  491. foreach (var i in eventConfig.EventLinksId)
  492. {
  493. EventLinkConfig eventLinkConfig = ConfigComponent.Instance.Get<EventLinkConfig>(i);
  494. AccountFileInfo.EventLinkData eventLinkData = new AccountFileInfo.EventLinkData();
  495. eventLinkData.eventId = eventID;
  496. eventLinkData.eventLinkId = i;
  497. if (eventLinkConfig.ConditionId != null)
  498. {
  499. foreach (var i1 in eventLinkConfig.ConditionId)
  500. {
  501. AccountFileInfo.EventConditionData
  502. eventConditionData = new AccountFileInfo.EventConditionData();
  503. eventConditionData.eventId = eventList.eventID;
  504. eventConditionData.eventCondition = i1;
  505. eventLinkData.eventConditions.Add(eventConditionData);
  506. //初始化先检测一些条件
  507. CeekTaskComplete(eventConditionData, 1, null);
  508. CeekTaskComplete(eventConditionData, 3, null);
  509. }
  510. }
  511. eventList.eventLinks.Add(eventLinkData);
  512. }
  513. }
  514. return eventList;
  515. }
  516. /// <summary>
  517. /// 触发随机事件
  518. /// </summary>
  519. public void DetectRandomEvents()
  520. {
  521. if (isTriggerEvent)
  522. return;
  523. if (isOpenUi)
  524. return;
  525. // 获取随机事件
  526. List<EventConfig> randomEvents =
  527. eventConfigs.Where(e => e.EventTriggerType == 2 && CanTriggerEvent(e.ID)).ToList();
  528. if (randomEvents.Count == 0)
  529. {
  530. LogTool.Warning("没有可以刷新的事件");
  531. return;
  532. }
  533. int idex = Random.Range(0, randomEvents.Count);
  534. TriggerEvent(randomEvents[idex]);
  535. }
  536. /// <summary>
  537. /// 挂机事件触发
  538. /// </summary>
  539. public void TriggerEvent(EventConfig evt)
  540. {
  541. if (isTriggerEvent)
  542. return;
  543. isTriggerEvent = true;
  544. LogTool.Log($"触发事件: {evt.EventName} (ID: {evt.ID}, 品质: {evt.EventQuality})");
  545. CombatDrive.Instance.CombatController.ChangeState(CombatController.idle);
  546. AccountFileInfo.EventList eventList = AddEvent(evt.ID);
  547. CurrentEventList = eventList;
  548. DialogueManager.Instance.StartDialogue(eventList, evt.EventLinksId[0], evt.ID,
  549. () => { CompleteEvent(evt.ID); });
  550. }
  551. /// <summary>
  552. /// 其他类型事件触发
  553. /// </summary>
  554. public async CTask TriggerEvent(AccountFileInfo.EventList evt, Action oncompleteCallBack = null,
  555. Action uiOpenOverCallBack = null)
  556. {
  557. // ChancleEvent();
  558. if (isTriggerEvent)
  559. return;
  560. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(evt.eventID);
  561. SmallPlacesConfig smallPlacesConfig =
  562. ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);
  563. if (eventConfig.SmallPlacesId > 0)
  564. {
  565. if (eventConfig.SmallPlacesId != PlayerManager.Instance.CurrentsmallPlaces.id)
  566. {
  567. AccountFileInfo.SmallPlacesData lastSmallPlacesData =
  568. PlayerManager.Instance.GetSmallPlacesData(eventConfig.SmallPlacesId - 1);
  569. SmallPlacesConfig lastSmallPlacesConfig =
  570. ConfigComponent.Instance.Get<SmallPlacesConfig>(eventConfig.SmallPlacesId - 1);
  571. SmallPlacesConfig currentSmallPlacesConfig =
  572. ConfigComponent.Instance.Get<SmallPlacesConfig>(eventConfig.SmallPlacesId);
  573. if (currentSmallPlacesConfig.ID > 1 && (lastSmallPlacesData == null ||
  574. lastSmallPlacesData.completionEventCount <
  575. lastSmallPlacesConfig.CompletionEventCount))
  576. {
  577. TipMessagePanel tipMessagePanel = await TipMessagePanel.OpenTipMessagePanel(
  578. LanguageManager.Instance.Text(10379,
  579. LanguageManager.Instance.Text(lastSmallPlacesConfig.placeName),
  580. lastSmallPlacesConfig.CompletionEventCount));
  581. if (PlayerGuideManager.Instance.GuideIsCanDo(3))
  582. {
  583. PlayerGuideManager.Instance.SetGuid(3);
  584. }
  585. return;
  586. }
  587. if (lastSmallPlacesConfig.UnlockEnvetid != 0)
  588. {
  589. AccountFileInfo.EventList eventList =
  590. AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce =>
  591. ce.eventID == lastSmallPlacesConfig.UnlockEnvetid);
  592. if (eventList == null || !eventList.isCompleted)
  593. {
  594. var econfig = ConfigComponent.Instance.Get<EventConfig>(lastSmallPlacesConfig.UnlockEnvetid);
  595. TipMessagePanel.OpenTipMessagePanel(LanguageManager.Instance.Text(10380,
  596. LanguageManager.Instance.Text(lastSmallPlacesConfig.placeName),
  597. LanguageManager.Instance.Text(econfig.EventName)));
  598. return;
  599. }
  600. }
  601. SmallPlacesConfig SmallPlacesConfig =
  602. ConfigComponent.Instance.Get<SmallPlacesConfig>(eventConfig.SmallPlacesId);
  603. CTask<bool> cT = CTask<bool>.Create();
  604. PlacesInfoPanel.OpenPanel(SmallPlacesConfig.PlacesId, (b) => { cT.SetResult(b); });
  605. await cT;
  606. if (eventConfig.SmallPlacesId != PlayerManager.Instance.CurrentsmallPlaces.id)
  607. {
  608. return;
  609. }
  610. // if (!cT.Result)
  611. // {
  612. // return;
  613. // }
  614. }
  615. }
  616. else if (eventConfig.placeID > 0)
  617. {
  618. if (eventConfig.placeID != smallPlacesConfig.PlacesId)
  619. {
  620. CTask<bool> cT = CTask<bool>.Create();
  621. PlacesInfoPanel.OpenPanel(eventConfig.placeID, (b) => { cT.SetResult(b); });
  622. await cT;
  623. smallPlacesConfig =
  624. ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);
  625. if (eventConfig.placeID != smallPlacesConfig.PlacesId)
  626. {
  627. return;
  628. }
  629. }
  630. }
  631. CTask cTask = CTask.Create();
  632. this.onCompleteCallback = oncompleteCallBack;
  633. isTriggerEvent = true;
  634. LogTool.Log(
  635. $"触发事件: {LanguageManager.Instance.Text(eventConfig.EventName)} (ID: {eventConfig.ID}, 品质: {eventConfig.EventQuality})");
  636. int dialogueID = 0;
  637. if (evt.curStep == 0)
  638. {
  639. dialogueID = eventConfig.EventLinksId[0];
  640. }
  641. else
  642. {
  643. dialogueID = evt.curStep;
  644. }
  645. CurrentEventList = evt;
  646. CombatDrive.Instance.CombatController.ChangeState(CombatController.idle);
  647. await DialogueManager.Instance.StartDialogue(CurrentEventList, dialogueID, eventConfig.ID, () =>
  648. {
  649. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(CurrentEventList.eventID);
  650. if (eventConfig.EventTriggerType != 4)
  651. {
  652. CompleteEvent(CurrentEventList);
  653. }
  654. else
  655. {
  656. CurrentEventList.isCompleted1 = true;
  657. AccountFileInfo.Instance.SavePlayerData();
  658. CombatDrive.Instance.CombatController.ChangeState(CombatController.update);
  659. onCompleteCallback?.Invoke();
  660. onCompleteCallback = null;
  661. EventManager.Instance.Dispatch(CustomEventType.CompleteUpdate, null);
  662. }
  663. cTask.SetResult();
  664. }, () =>
  665. {
  666. CancelEvent(CurrentEventList);
  667. cTask.SetResult();
  668. });
  669. uiOpenOverCallBack?.Invoke();
  670. DivineSenceEventPreviewPanel divineSenceEventPreviewPanel =
  671. UIManager.Instance.GetComponent<DivineSenceEventPreviewPanel>();
  672. AppBarPanel appBarPanel = UIManager.Instance.GetComponent<AppBarPanel>();
  673. // DivineSenceInfoPanel divineSenceInfoPanel = UIManager.Instance.GetComponent<DivineSenceInfoPanel>();
  674. if (divineSenceEventPreviewPanel != null && !divineSenceEventPreviewPanel.IsClose)
  675. {
  676. divineSenceEventPreviewPanel.GObjectPoolInterface.SetActive(false);
  677. }
  678. // if (appBarPanel != null && !appBarPanel.IsClose)
  679. // {
  680. // appBarPanel.GObjectPoolInterface.SetActive(false);
  681. // }
  682. // if (divineSenceInfoPanel != null)
  683. // {
  684. // divineSenceInfoPanel.GObjectPoolInterface.SetActive(false);
  685. // }
  686. await cTask;
  687. if (divineSenceEventPreviewPanel != null && !divineSenceEventPreviewPanel.IsClose)
  688. {
  689. divineSenceEventPreviewPanel.GObjectPoolInterface.SetActive(true);
  690. }
  691. if (appBarPanel != null && !appBarPanel.IsClose)
  692. {
  693. appBarPanel.GObjectPoolInterface.SetActive(true);
  694. }
  695. // if (divineSenceInfoPanel != null)
  696. // {
  697. // divineSenceInfoPanel.GObjectPoolInterface.SetActive(true);
  698. // }
  699. }
  700. //任务是否完成
  701. public bool IsEvenkLinkComplete(AccountFileInfo.EventConditionData eventCondition)
  702. {
  703. EventConditionConfig eventConditionConfig =
  704. ConfigComponent.Instance.Get<EventConditionConfig>(eventCondition.eventCondition);
  705. if (eventCondition != null)
  706. {
  707. return eventCondition.fishCount >= eventConditionConfig.finishCount;
  708. }
  709. return false;
  710. }
  711. public bool CeekEventGroupComplete(List<AccountFileInfo.EventConditionData> eventConditions)
  712. {
  713. Map<int, List<AccountFileInfo.EventConditionData>> eventConditionDataGroup =
  714. new Map<int, List<AccountFileInfo.EventConditionData>>();
  715. foreach (var eventConditionData in eventConditions)
  716. {
  717. EventConditionConfig eventConditionConfig =
  718. ConfigComponent.Instance.Get<EventConditionConfig>(eventConditionData.eventCondition);
  719. if (!eventConditionDataGroup.ContainsKey(eventConditionConfig.Operation))
  720. {
  721. eventConditionDataGroup.Add(eventConditionConfig.Operation,
  722. new List<AccountFileInfo.EventConditionData>());
  723. }
  724. eventConditionDataGroup[eventConditionConfig.Operation].Add(eventConditionData);
  725. }
  726. bool isUlock = true;
  727. //分组检测 其中一个组绑定成功就可以执行
  728. foreach (var keyValuePair in eventConditionDataGroup)
  729. {
  730. isUlock = true;
  731. foreach (var eventConditionData in keyValuePair.Value)
  732. {
  733. if (!IsEvenkLinkComplete(eventConditionData))
  734. {
  735. isUlock = false;
  736. }
  737. }
  738. if (isUlock)
  739. {
  740. return isUlock;
  741. }
  742. }
  743. return isUlock;
  744. }
  745. public void CeekEventCompletes(int type, int[] value)
  746. {
  747. foreach (var playerDataEventLinkData in AccountFileInfo.Instance.playerData.eventList)
  748. {
  749. foreach (var eventLinkData in playerDataEventLinkData.eventLinks)
  750. {
  751. foreach (var eventConditionData in eventLinkData.eventConditions)
  752. {
  753. CeekTaskComplete(eventConditionData, type, value);
  754. }
  755. }
  756. }
  757. EventManager.Instance.Dispatch(CustomEventType.RemoveEvent, null);
  758. }
  759. public void CeekTaskComplete(AccountFileInfo.EventConditionData conditionData, int type, int[] value)
  760. {
  761. EventConditionConfig eventConditionConfig =
  762. ConfigComponent.Instance.Get<EventConditionConfig>(conditionData.eventCondition);
  763. if (IsEvenkLinkComplete(conditionData))
  764. return;
  765. switch (type)
  766. {
  767. //检测背包道具
  768. case 1:
  769. if (eventConditionConfig.ConditionType == 1)
  770. {
  771. conditionData.fishCount +=
  772. (int)PlayerManager.Instance.BagController.GetItemCount(eventConditionConfig.ConditionPara[0]);
  773. if (IsEvenkLinkComplete(conditionData))
  774. {
  775. // CompleteTask(conditionData.guid);
  776. }
  777. }
  778. break;
  779. //境界检测
  780. case 3:
  781. if (eventConditionConfig.ConditionType == 3 && PlayerManager.Instance.myHero.powerUpConfig.ID >=
  782. eventConditionConfig.ConditionPara[0])
  783. {
  784. conditionData.fishCount++;
  785. if (IsEvenkLinkComplete(conditionData))
  786. {
  787. // CompleteTask(conditionData.guid);
  788. }
  789. }
  790. break;
  791. //战斗胜利
  792. case 5:
  793. if (eventConditionConfig.ConditionType == 5 && eventConditionConfig.ConditionPara[0] == value[0])
  794. {
  795. conditionData.fishCount++;
  796. if (IsEvenkLinkComplete(conditionData))
  797. {
  798. // CompleteEvent(conditionData.guid);
  799. }
  800. }
  801. break;
  802. //获得道具
  803. case 6:
  804. if (eventConditionConfig.ConditionType == 6 && eventConditionConfig.ConditionPara[0] == value[0])
  805. {
  806. conditionData.fishCount += value[1];
  807. if (IsEvenkLinkComplete(conditionData))
  808. {
  809. // CompleteEvent(conditionData.guid);
  810. }
  811. }
  812. break;
  813. //使用神识
  814. case 8:
  815. if (eventConditionConfig.ConditionType == 8)
  816. {
  817. conditionData.fishCount += value[0];
  818. if (IsEvenkLinkComplete(conditionData))
  819. {
  820. }
  821. }
  822. break;
  823. }
  824. AccountFileInfo.Instance.SavePlayerData();
  825. }
  826. private void CompleteTask(object taskID)
  827. {
  828. }
  829. //指定type事件
  830. private bool CanEventType(int eventID, ItemInfo itemInfo)
  831. {
  832. if (itemInfo == null)
  833. {
  834. return true;
  835. }
  836. var evt = eventConfigs.Find(e => e.ID == eventID);
  837. if (evt.PrizeType != null && evt.PrizeType.Contains(itemInfo.config.associateVlaue[0]))
  838. {
  839. return true;
  840. }
  841. return false;
  842. }
  843. /// <summary>
  844. /// 检查事件是否满足触发条件。
  845. /// </summary>
  846. private bool CanTriggerEvent(int eventID)
  847. {
  848. var evt = eventConfigs.Find(e => e.ID == eventID);
  849. if (evt.ID == 0)
  850. return false;
  851. if (evt.EventConditionId == null)
  852. return true;
  853. for (var i = 0; i < evt.EventConditionId.Length; i++)
  854. {
  855. switch (evt.EventConditionId[i])
  856. {
  857. //背包道具检测
  858. case 1:
  859. return PlayerManager.Instance.BagController.GetItemCount(evt.EventValue[i]) >= evt.EventCount[i];
  860. //境界判断
  861. case 2:
  862. return PlayerManager.Instance.myHero.level >= evt.EventCount[i];
  863. //概率判断
  864. case 3:
  865. int randomValue1 = Random.Range(0, 1001);
  866. return randomValue1 <= evt.EventValue[i];
  867. //完成事件判断
  868. case 10:
  869. AccountFileInfo.EventList eventList =
  870. AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce =>
  871. ce.eventID == evt.EventValue[i]);
  872. return eventList != null;
  873. }
  874. }
  875. return true;
  876. }
  877. /// <summary>
  878. /// 完成事件
  879. /// </summary>
  880. /// <param name="eventID">事件ID</param>
  881. public void CompleteEvent(int evtId)
  882. {
  883. isTriggerEvent = false;
  884. LogTool.Log($"完成挂机事件{evtId}");
  885. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(evtId);
  886. AccountFileInfo.EventList eventList = new AccountFileInfo.EventList();
  887. eventList.eventID = evtId;
  888. AccountFileInfo.Instance.playerData.completeEvents.Add(eventList);
  889. int placesId = PlayerManager.Instance.GetMaxSmallPlacesId();
  890. AccountFileInfo.SmallPlacesData smallPlacesData = PlayerManager.Instance.GetSmallPlacesData(placesId);
  891. if (smallPlacesData != null)
  892. {
  893. smallPlacesData.completionEventCount++;
  894. }
  895. SmallPlacesConfig smallPlacesConfig =
  896. ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);
  897. AccountFileInfo.PlacesData placesData = PlayerManager.Instance.GetPlacesData(smallPlacesConfig.PlacesId);
  898. if (placesData.progress < 100)
  899. placesData.progress += eventConfig.Score;
  900. AccountFileInfo.Instance.SavePlayerData();
  901. CombatDrive.Instance.CombatController.ChangeState(CombatController.update);
  902. EventManager.Instance.Dispatch(CustomEventType.CompleteEvent, null);
  903. }
  904. /// <summary>
  905. /// 完成事件
  906. /// </summary>
  907. /// <param name="eventID">事件ID</param>
  908. public async void CompleteEvent(AccountFileInfo.EventList eventList, bool isTriggerEvent = false)
  909. {
  910. this.isTriggerEvent = isTriggerEvent;
  911. LogTool.Log($"完成事件{eventList.eventID}");
  912. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventList.eventID);
  913. AccountFileInfo.EventList ceventList =
  914. AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce => ce.eventID == eventList.eventID);
  915. int placesId = PlayerManager.Instance.GetMaxSmallPlacesId();
  916. AccountFileInfo.SmallPlacesData smallPlacesData = PlayerManager.Instance.GetSmallPlacesData(placesId);
  917. if (smallPlacesData != null)
  918. {
  919. smallPlacesData.completionEventCount++;
  920. }
  921. if (ceventList == null)
  922. {
  923. PlacesConfig[] placesConfigs = ConfigComponent.Instance.GetAll<PlacesConfig>();
  924. int pId = 0;
  925. for (var i = 0; i < placesConfigs.Length; i++)
  926. {
  927. if (placesConfigs[i].MainTaskID == null || placesConfigs[i].ZhixianID == null)
  928. continue;
  929. if (placesConfigs[i].MainTaskID.Contains(eventConfig.ID) ||
  930. placesConfigs[i].ZhixianID.Contains(eventConfig.ID))
  931. {
  932. pId = placesConfigs[i].ID;
  933. break;
  934. }
  935. }
  936. if (pId == 0)
  937. {
  938. SmallPlacesConfig smallPlacesConfig =
  939. ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);
  940. AccountFileInfo.PlacesData
  941. placesData = PlayerManager.Instance.GetPlacesData(smallPlacesConfig.PlacesId);
  942. placesData.progress += eventConfig.Score;
  943. }
  944. else
  945. {
  946. PlayerManager.Instance.GetPlacesData(pId).progress += eventConfig.Score;
  947. }
  948. }
  949. List<ItemInfo> itemInfos = new List<ItemInfo>();
  950. if (eventConfig.PrizeIDs != null)
  951. {
  952. for (var i = 0; i < eventConfig.PrizeIDs.Length; i++)
  953. {
  954. DropConfig dropConfig = ConfigComponent.Instance.Get<DropConfig>(eventConfig.PrizeIDs[i]);
  955. if (dropConfig.dropType == 3)
  956. {
  957. if (eventConfig.PrizeNums[i] < 0)
  958. {
  959. List<ItemInfo> items =
  960. DropManager.Instance.Drop(dropConfig.dropGroupID[0], eventConfig.PrizeNums[i]);
  961. if (items != null)
  962. itemInfos.AddRange(items);
  963. }
  964. else
  965. {
  966. ItemInfo itemInfo = new ItemInfo(dropConfig.dropGroupID[0], eventConfig.PrizeNums[i]);
  967. itemInfos.Add(itemInfo);
  968. }
  969. }
  970. else
  971. {
  972. List<ItemInfo> items = DropManager.Instance.DropItem(eventConfig.PrizeIDs[i]);
  973. if (items != null)
  974. itemInfos.AddRange(items);
  975. }
  976. // itemInfos.Add(new ItemInfo(eventConfig.PrizeIDs[i], eventConfig.PrizeNums[i]));
  977. }
  978. }
  979. foreach (var eventListItemInfo in eventList.itemInfos)
  980. {
  981. itemInfos.Add(new ItemInfo(eventListItemInfo));
  982. }
  983. PlayerManager.Instance.BagController.AddItem(itemInfos);
  984. if (eventConfig.EventTriggerType == 4)
  985. {
  986. eventList.isCompleted = true;
  987. AccountFileInfo.Instance.playerData.completeEvents.Add(eventList);
  988. AccountFileInfo.Instance.playerData.eventList.Remove(eventList);
  989. TaskInfoPanel taskInfoPanel = await TaskInfoPanel.OpenPanel(eventList, 2);
  990. await taskInfoPanel.UIClosed();
  991. }
  992. else
  993. {
  994. //先不移除 下次探索神识移除
  995. eventList.isCompleted = true;
  996. }
  997. if (itemInfos != null && itemInfos.Count > 0)
  998. {
  999. RewardsPanel rewardsPanel = await RewardsPanel.OpenPanel(itemInfos);
  1000. await rewardsPanel.UIClosed();
  1001. }
  1002. if (AccountFileInfo.Instance.playerData.CurrentZuiZhongEventListId == eventList.guid)
  1003. {
  1004. AccountFileInfo.Instance.playerData.CurrentZuiZhongEventListId = 0;
  1005. UpdateZuizhongEventData();
  1006. }
  1007. AccountFileInfo.Instance.SavePlayerData();
  1008. CombatDrive.Instance.CombatController.ChangeState(CombatController.update);
  1009. EventManager.Instance.Dispatch(CustomEventType.CompleteEvent, null);
  1010. EventManager.Instance.Dispatch(CustomEventType.CompleteUpdate, null);
  1011. onCompleteCallback?.Invoke();
  1012. onCompleteCallback = null;
  1013. }
  1014. /// <summary>
  1015. /// 完成事件
  1016. /// </summary>
  1017. /// <param name="eventID">事件ID</param>
  1018. public void CompleteEvent(AccountFileInfo.EventLinkData eventLinkData)
  1019. {
  1020. }
  1021. /// <summary>
  1022. /// 取消事件
  1023. /// </summary>
  1024. /// <param name="eventID">事件ID</param>
  1025. public void CancelEvent(AccountFileInfo.EventList eventList)
  1026. {
  1027. LogTool.Log($"取消事件{eventList.eventID}");
  1028. isTriggerEvent = false;
  1029. EventManager.Instance.Dispatch(CustomEventType.CompleteUpdate, null);
  1030. // EventManager.Instance.Dispatch(CustomEventType.CompleteEvent, null);
  1031. CombatDrive.Instance.CombatController.ChangeState(CombatController.update);
  1032. onCompleteCallback?.Invoke();
  1033. onCompleteCallback = null;
  1034. if (PlayerGuideManager.Instance.GuideIsCanDo(2))
  1035. {
  1036. PlayerGuideManager.Instance.SetGuid(2);
  1037. }
  1038. }
  1039. public void RemoveEvent(AccountFileInfo.EventList eventList)
  1040. {
  1041. AccountFileInfo.Instance.playerData.eventList.Remove(eventList);
  1042. AccountFileInfo.Instance.SavePlayerData();
  1043. EventManager.Instance.Dispatch(CustomEventType.RemoveEvent, null);
  1044. }
  1045. /// <summary>
  1046. /// 获得主线事件
  1047. /// </summary>
  1048. /// <returns></returns>
  1049. public AccountFileInfo.EventList GetMainEventDta()
  1050. {
  1051. foreach (var eventList in AccountFileInfo.Instance.playerData.eventList)
  1052. {
  1053. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventList.eventID);
  1054. if (eventConfig.EventTriggerType == 4)
  1055. {
  1056. return eventList;
  1057. }
  1058. }
  1059. return null;
  1060. }
  1061. public void CancelEvent()
  1062. {
  1063. CombatDrive.Instance.CombatController.ChangeState(CombatController.update);
  1064. DialogueManager.Instance.ChancleEvent();
  1065. CurrentEventList = null;
  1066. isTriggerEvent = false;
  1067. }
  1068. }