EventSystemManager.cs 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285
  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. }
  662. cTask.SetResult();
  663. }, () =>
  664. {
  665. CancelEvent(CurrentEventList);
  666. cTask.SetResult();
  667. });
  668. uiOpenOverCallBack?.Invoke();
  669. DivineSenceEventPreviewPanel divineSenceEventPreviewPanel =
  670. UIManager.Instance.GetComponent<DivineSenceEventPreviewPanel>();
  671. AppBarPanel appBarPanel = UIManager.Instance.GetComponent<AppBarPanel>();
  672. // DivineSenceInfoPanel divineSenceInfoPanel = UIManager.Instance.GetComponent<DivineSenceInfoPanel>();
  673. if (divineSenceEventPreviewPanel != null && !divineSenceEventPreviewPanel.IsClose)
  674. {
  675. divineSenceEventPreviewPanel.GObjectPoolInterface.SetActive(false);
  676. }
  677. // if (appBarPanel != null && !appBarPanel.IsClose)
  678. // {
  679. // appBarPanel.GObjectPoolInterface.SetActive(false);
  680. // }
  681. // if (divineSenceInfoPanel != null)
  682. // {
  683. // divineSenceInfoPanel.GObjectPoolInterface.SetActive(false);
  684. // }
  685. await cTask;
  686. if (divineSenceEventPreviewPanel != null && !divineSenceEventPreviewPanel.IsClose)
  687. {
  688. divineSenceEventPreviewPanel.GObjectPoolInterface.SetActive(true);
  689. }
  690. if (appBarPanel != null && !appBarPanel.IsClose)
  691. {
  692. appBarPanel.GObjectPoolInterface.SetActive(true);
  693. }
  694. // if (divineSenceInfoPanel != null)
  695. // {
  696. // divineSenceInfoPanel.GObjectPoolInterface.SetActive(true);
  697. // }
  698. }
  699. //任务是否完成
  700. public bool IsEvenkLinkComplete(AccountFileInfo.EventConditionData eventCondition)
  701. {
  702. EventConditionConfig eventConditionConfig =
  703. ConfigComponent.Instance.Get<EventConditionConfig>(eventCondition.eventCondition);
  704. if (eventCondition != null)
  705. {
  706. return eventCondition.fishCount >= eventConditionConfig.finishCount;
  707. }
  708. return false;
  709. }
  710. public bool CeekEventGroupComplete(List<AccountFileInfo.EventConditionData> eventConditions)
  711. {
  712. Map<int, List<AccountFileInfo.EventConditionData>> eventConditionDataGroup =
  713. new Map<int, List<AccountFileInfo.EventConditionData>>();
  714. foreach (var eventConditionData in eventConditions)
  715. {
  716. EventConditionConfig eventConditionConfig =
  717. ConfigComponent.Instance.Get<EventConditionConfig>(eventConditionData.eventCondition);
  718. if (!eventConditionDataGroup.ContainsKey(eventConditionConfig.Operation))
  719. {
  720. eventConditionDataGroup.Add(eventConditionConfig.Operation,
  721. new List<AccountFileInfo.EventConditionData>());
  722. }
  723. eventConditionDataGroup[eventConditionConfig.Operation].Add(eventConditionData);
  724. }
  725. bool isUlock = true;
  726. //分组检测 其中一个组绑定成功就可以执行
  727. foreach (var keyValuePair in eventConditionDataGroup)
  728. {
  729. isUlock = true;
  730. foreach (var eventConditionData in keyValuePair.Value)
  731. {
  732. if (!IsEvenkLinkComplete(eventConditionData))
  733. {
  734. isUlock = false;
  735. }
  736. }
  737. if (isUlock)
  738. {
  739. return isUlock;
  740. }
  741. }
  742. return isUlock;
  743. }
  744. public void CeekEventCompletes(int type, int[] value)
  745. {
  746. foreach (var playerDataEventLinkData in AccountFileInfo.Instance.playerData.eventList)
  747. {
  748. foreach (var eventLinkData in playerDataEventLinkData.eventLinks)
  749. {
  750. foreach (var eventConditionData in eventLinkData.eventConditions)
  751. {
  752. CeekTaskComplete(eventConditionData, type, value);
  753. }
  754. }
  755. }
  756. EventManager.Instance.Dispatch(CustomEventType.RemoveEvent, null);
  757. }
  758. public void CeekTaskComplete(AccountFileInfo.EventConditionData conditionData, int type, int[] value)
  759. {
  760. EventConditionConfig eventConditionConfig =
  761. ConfigComponent.Instance.Get<EventConditionConfig>(conditionData.eventCondition);
  762. if (IsEvenkLinkComplete(conditionData))
  763. return;
  764. switch (type)
  765. {
  766. //检测背包道具
  767. case 1:
  768. if (eventConditionConfig.ConditionType == 1)
  769. {
  770. conditionData.fishCount +=
  771. (int)PlayerManager.Instance.BagController.GetItemCount(eventConditionConfig.ConditionPara[0]);
  772. if (IsEvenkLinkComplete(conditionData))
  773. {
  774. // CompleteTask(conditionData.guid);
  775. }
  776. }
  777. break;
  778. //境界检测
  779. case 3:
  780. if (eventConditionConfig.ConditionType == 3 && PlayerManager.Instance.myHero.powerUpConfig.ID >=
  781. eventConditionConfig.ConditionPara[0])
  782. {
  783. conditionData.fishCount++;
  784. if (IsEvenkLinkComplete(conditionData))
  785. {
  786. // CompleteTask(conditionData.guid);
  787. }
  788. }
  789. break;
  790. //战斗胜利
  791. case 5:
  792. if (eventConditionConfig.ConditionType == 5 && eventConditionConfig.ConditionPara[0] == value[0])
  793. {
  794. conditionData.fishCount++;
  795. if (IsEvenkLinkComplete(conditionData))
  796. {
  797. // CompleteEvent(conditionData.guid);
  798. }
  799. }
  800. break;
  801. //获得道具
  802. case 6:
  803. if (eventConditionConfig.ConditionType == 6 && eventConditionConfig.ConditionPara[0] == value[0])
  804. {
  805. conditionData.fishCount += value[1];
  806. if (IsEvenkLinkComplete(conditionData))
  807. {
  808. // CompleteEvent(conditionData.guid);
  809. }
  810. }
  811. break;
  812. //使用神识
  813. case 8:
  814. if (eventConditionConfig.ConditionType == 8)
  815. {
  816. conditionData.fishCount += value[0];
  817. if (IsEvenkLinkComplete(conditionData))
  818. {
  819. }
  820. }
  821. break;
  822. }
  823. AccountFileInfo.Instance.SavePlayerData();
  824. }
  825. private void CompleteTask(object taskID)
  826. {
  827. }
  828. //指定type事件
  829. private bool CanEventType(int eventID, ItemInfo itemInfo)
  830. {
  831. if (itemInfo == null)
  832. {
  833. return true;
  834. }
  835. var evt = eventConfigs.Find(e => e.ID == eventID);
  836. if (evt.PrizeType != null && evt.PrizeType.Contains(itemInfo.config.associateVlaue[0]))
  837. {
  838. return true;
  839. }
  840. return false;
  841. }
  842. /// <summary>
  843. /// 检查事件是否满足触发条件。
  844. /// </summary>
  845. private bool CanTriggerEvent(int eventID)
  846. {
  847. var evt = eventConfigs.Find(e => e.ID == eventID);
  848. if (evt.ID == 0)
  849. return false;
  850. if (evt.EventConditionId == null)
  851. return true;
  852. for (var i = 0; i < evt.EventConditionId.Length; i++)
  853. {
  854. switch (evt.EventConditionId[i])
  855. {
  856. //背包道具检测
  857. case 1:
  858. return PlayerManager.Instance.BagController.GetItemCount(evt.EventValue[i]) >= evt.EventCount[i];
  859. //境界判断
  860. case 2:
  861. return PlayerManager.Instance.myHero.level >= evt.EventCount[i];
  862. //概率判断
  863. case 3:
  864. int randomValue1 = Random.Range(0, 1001);
  865. return randomValue1 <= evt.EventCount[i];
  866. //完成事件判断
  867. case 10:
  868. AccountFileInfo.EventList eventList =
  869. AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce =>
  870. ce.eventID == evt.EventValue[i]);
  871. return eventList != null;
  872. }
  873. }
  874. return true;
  875. }
  876. /// <summary>
  877. /// 完成事件
  878. /// </summary>
  879. /// <param name="eventID">事件ID</param>
  880. public void CompleteEvent(int evtId)
  881. {
  882. isTriggerEvent = false;
  883. LogTool.Log($"完成挂机事件{evtId}");
  884. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(evtId);
  885. AccountFileInfo.EventList eventList = new AccountFileInfo.EventList();
  886. eventList.eventID = evtId;
  887. AccountFileInfo.Instance.playerData.completeEvents.Add(eventList);
  888. int placesId = PlayerManager.Instance.GetMaxSmallPlacesId();
  889. AccountFileInfo.SmallPlacesData smallPlacesData = PlayerManager.Instance.GetSmallPlacesData(placesId);
  890. if (smallPlacesData != null)
  891. {
  892. smallPlacesData.completionEventCount++;
  893. }
  894. SmallPlacesConfig smallPlacesConfig =
  895. ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);
  896. AccountFileInfo.PlacesData placesData = PlayerManager.Instance.GetPlacesData(smallPlacesConfig.PlacesId);
  897. if (placesData.progress < 100)
  898. placesData.progress += eventConfig.Score;
  899. AccountFileInfo.Instance.SavePlayerData();
  900. CombatDrive.Instance.CombatController.ChangeState(CombatController.update);
  901. EventManager.Instance.Dispatch(CustomEventType.CompleteEvent, null);
  902. }
  903. /// <summary>
  904. /// 完成事件
  905. /// </summary>
  906. /// <param name="eventID">事件ID</param>
  907. public async void CompleteEvent(AccountFileInfo.EventList eventList, bool isTriggerEvent = false)
  908. {
  909. this.isTriggerEvent = isTriggerEvent;
  910. LogTool.Log($"完成事件{eventList.eventID}");
  911. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventList.eventID);
  912. AccountFileInfo.EventList ceventList =
  913. AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce => ce.eventID == eventList.eventID);
  914. int placesId = PlayerManager.Instance.GetMaxSmallPlacesId();
  915. AccountFileInfo.SmallPlacesData smallPlacesData = PlayerManager.Instance.GetSmallPlacesData(placesId);
  916. if (smallPlacesData != null)
  917. {
  918. smallPlacesData.completionEventCount++;
  919. }
  920. if (ceventList == null)
  921. {
  922. PlacesConfig[] placesConfigs = ConfigComponent.Instance.GetAll<PlacesConfig>();
  923. int pId = 0;
  924. for (var i = 0; i < placesConfigs.Length; i++)
  925. {
  926. if (placesConfigs[i].MainTaskID == null || placesConfigs[i].ZhixianID == null)
  927. continue;
  928. if (placesConfigs[i].MainTaskID.Contains(eventConfig.ID) ||
  929. placesConfigs[i].ZhixianID.Contains(eventConfig.ID))
  930. {
  931. pId = placesConfigs[i].ID;
  932. break;
  933. }
  934. }
  935. if (pId == 0)
  936. {
  937. SmallPlacesConfig smallPlacesConfig =
  938. ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);
  939. AccountFileInfo.PlacesData
  940. placesData = PlayerManager.Instance.GetPlacesData(smallPlacesConfig.PlacesId);
  941. placesData.progress += eventConfig.Score;
  942. }
  943. else
  944. {
  945. PlayerManager.Instance.GetPlacesData(pId).progress += eventConfig.Score;
  946. }
  947. }
  948. List<ItemInfo> itemInfos = new List<ItemInfo>();
  949. if (eventConfig.PrizeIDs != null)
  950. {
  951. for (var i = 0; i < eventConfig.PrizeIDs.Length; i++)
  952. {
  953. DropConfig dropConfig = ConfigComponent.Instance.Get<DropConfig>(eventConfig.PrizeIDs[i]);
  954. if (dropConfig.dropType == 3)
  955. {
  956. if (eventConfig.PrizeNums[i] < 0)
  957. {
  958. List<ItemInfo> items =
  959. DropManager.Instance.Drop(dropConfig.dropGroupID[0], eventConfig.PrizeNums[i]);
  960. if (items != null)
  961. itemInfos.AddRange(items);
  962. }
  963. else
  964. {
  965. ItemInfo itemInfo = new ItemInfo(dropConfig.dropGroupID[0], eventConfig.PrizeNums[i]);
  966. itemInfos.Add(itemInfo);
  967. }
  968. }
  969. else
  970. {
  971. List<ItemInfo> items = DropManager.Instance.DropItem(eventConfig.PrizeIDs[i]);
  972. if (items != null)
  973. itemInfos.AddRange(items);
  974. }
  975. // itemInfos.Add(new ItemInfo(eventConfig.PrizeIDs[i], eventConfig.PrizeNums[i]));
  976. }
  977. }
  978. foreach (var eventListItemInfo in eventList.itemInfos)
  979. {
  980. itemInfos.Add(new ItemInfo(eventListItemInfo));
  981. }
  982. PlayerManager.Instance.BagController.AddItem(itemInfos);
  983. if (eventConfig.EventTriggerType == 4)
  984. {
  985. eventList.isCompleted = true;
  986. AccountFileInfo.Instance.playerData.completeEvents.Add(eventList);
  987. AccountFileInfo.Instance.playerData.eventList.Remove(eventList);
  988. TaskInfoPanel taskInfoPanel = await TaskInfoPanel.OpenPanel(eventList, 2);
  989. await taskInfoPanel.UIClosed();
  990. }
  991. else
  992. {
  993. //先不移除 下次探索神识移除
  994. eventList.isCompleted = true;
  995. }
  996. if (itemInfos != null && itemInfos.Count > 0)
  997. {
  998. RewardsPanel rewardsPanel = await RewardsPanel.OpenPanel(itemInfos);
  999. await rewardsPanel.UIClosed();
  1000. }
  1001. if (AccountFileInfo.Instance.playerData.CurrentZuiZhongEventListId == eventList.guid)
  1002. {
  1003. AccountFileInfo.Instance.playerData.CurrentZuiZhongEventListId = 0;
  1004. UpdateZuizhongEventData();
  1005. }
  1006. AccountFileInfo.Instance.SavePlayerData();
  1007. CombatDrive.Instance.CombatController.ChangeState(CombatController.update);
  1008. EventManager.Instance.Dispatch(CustomEventType.CompleteEvent, null);
  1009. EventManager.Instance.Dispatch(CustomEventType.CompleteUpdate, null);
  1010. onCompleteCallback?.Invoke();
  1011. onCompleteCallback = null;
  1012. }
  1013. /// <summary>
  1014. /// 完成事件
  1015. /// </summary>
  1016. /// <param name="eventID">事件ID</param>
  1017. public void CompleteEvent(AccountFileInfo.EventLinkData eventLinkData)
  1018. {
  1019. }
  1020. /// <summary>
  1021. /// 取消事件
  1022. /// </summary>
  1023. /// <param name="eventID">事件ID</param>
  1024. public void CancelEvent(AccountFileInfo.EventList eventList)
  1025. {
  1026. LogTool.Log($"取消事件{eventList.eventID}");
  1027. isTriggerEvent = false;
  1028. EventManager.Instance.Dispatch(CustomEventType.CompleteUpdate, null);
  1029. // EventManager.Instance.Dispatch(CustomEventType.CompleteEvent, null);
  1030. CombatDrive.Instance.CombatController.ChangeState(CombatController.update);
  1031. onCompleteCallback?.Invoke();
  1032. onCompleteCallback = null;
  1033. if (PlayerGuideManager.Instance.GuideIsCanDo(2))
  1034. {
  1035. PlayerGuideManager.Instance.SetGuid(2);
  1036. }
  1037. }
  1038. public void RemoveEvent(AccountFileInfo.EventList eventList)
  1039. {
  1040. AccountFileInfo.Instance.playerData.eventList.Remove(eventList);
  1041. AccountFileInfo.Instance.SavePlayerData();
  1042. EventManager.Instance.Dispatch(CustomEventType.RemoveEvent, null);
  1043. }
  1044. /// <summary>
  1045. /// 获得主线事件
  1046. /// </summary>
  1047. /// <returns></returns>
  1048. public AccountFileInfo.EventList GetMainEventDta()
  1049. {
  1050. foreach (var eventList in AccountFileInfo.Instance.playerData.eventList)
  1051. {
  1052. EventConfig eventConfig = ConfigComponent.Instance.Get<EventConfig>(eventList.eventID);
  1053. if (eventConfig.EventTriggerType == 4)
  1054. {
  1055. return eventList;
  1056. }
  1057. }
  1058. return null;
  1059. }
  1060. public void CancelEvent()
  1061. {
  1062. CombatDrive.Instance.CombatController.ChangeState(CombatController.update);
  1063. DialogueManager.Instance.ChancleEvent();
  1064. CurrentEventList = null;
  1065. isTriggerEvent = false;
  1066. }
  1067. }