StoryController.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. using System.Collections;
  4. using cfg.GfgCfg;
  5. using ET;
  6. namespace GFGGame
  7. {
  8. //主线剧情专用类
  9. public class StoryController
  10. {
  11. public static void ShowLevelView(int levelCfgId, int needitemId = 0, int needItemCount = 0)
  12. {
  13. InstanceZonesController.ShowLevelView(levelCfgId, OnFinishStoryLevel, needitemId, needItemCount);
  14. }
  15. public static void OnFinishStoryLevel(int levelCfgId, bool firstPass, bool success)
  16. {
  17. if (success)
  18. {
  19. //判断是否是首次打通最后一关
  20. int nextLevelID = levelCfgId + 1;
  21. StoryLevelCfg nextLevelCfg = CommonDataManager.Tables.TblStoryLevelCfg.GetOrDefault(nextLevelID);
  22. var fistPassLastLvl = (nextLevelCfg == null) && firstPass;
  23. if (fistPassLastLvl)
  24. {
  25. MainStorySProxy.GetStoryBonusDate().Coroutine();
  26. StoryLevelCfg levelCfg = CommonDataManager.Tables.TblStoryLevelCfg.GetOrDefault(levelCfgId);
  27. StoryChapterCfg nextStoryChapterCfg = CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId + 1);
  28. if (nextStoryChapterCfg != null)
  29. {
  30. StoryLevelCfg nextChapterLevelCfg = StoryLevelConfigManager.GetConfigs(nextStoryChapterCfg.Type, nextStoryChapterCfg.SubType, nextStoryChapterCfg.Id)[0];
  31. int LevelID = nextChapterLevelCfg.Id;
  32. MainStoryDataManager.currentLevelCfgId = LevelID;
  33. }
  34. else
  35. {
  36. MainStoryDataManager.currentLevelCfgId = 0;
  37. }
  38. int index = 0;
  39. if (levelCfg.Type == ConstInstanceZonesType.Story && levelCfg.SubType == ConstInstanceZonesSubType.Hard)
  40. {
  41. index = 1;
  42. }
  43. //当副本表内最后一章通关时
  44. if (nextStoryChapterCfg == null)
  45. {
  46. StoryChapterCfg lastChapter = CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId);
  47. ViewManager.Show<StoryChapterListView>(new object[] { index, lastChapter.Order }, true);
  48. return;
  49. }
  50. else
  51. {
  52. //ViewManager.Show<StoryChapterListView>(new object[] { index, nextStoryChapterCfg.order }, true);
  53. StoryChapterCfg previousChapterCfg = CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId);
  54. StoryChapterCfg nextChapterCfg = CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId + 1);
  55. bool lv = nextChapterCfg.Lvl < GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  56. if (CheckSuitGot(previousChapterCfg.SuitId) && MainStoryDataManager.CheckChapterUnlock(levelCfg.ChapterId) && lv)
  57. {
  58. ViewManager.Show<StoryChapterListView>(new object[] { index, nextStoryChapterCfg.Order }, true);
  59. }
  60. else
  61. {
  62. //MainStoryDataManager.currentChapterCfgId = previousChapterCfg.id;
  63. ViewManager.Show<StoryChapterView>(new object[] { previousChapterCfg.Id, 0 }, true);
  64. }
  65. }
  66. }
  67. else
  68. {
  69. ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId);
  70. }
  71. }
  72. else
  73. {
  74. //异常返回到关卡列表界面
  75. ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId);
  76. }
  77. }
  78. public static bool CheckSuitGot(int suitID = 0)
  79. {
  80. if(suitID == 0)
  81. {
  82. return true;
  83. }
  84. int count;
  85. int totalCount;
  86. DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitID, out count, out totalCount);
  87. if(count >= totalCount)
  88. {
  89. return true;
  90. }
  91. return false;
  92. }
  93. public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData)
  94. {
  95. ViewManager.Show<StoryDialogView>(new object[] { cardStoryCfg.StoryStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData ,false}, true);
  96. }
  97. private static void OnCompleteCardStoryDialog(bool isSkip, object param)
  98. {
  99. //CardData cardData = param as CardData;
  100. //ViewManager.Show<CardFosterView>(cardData, new object[] { typeof(CardDetailView).FullName}, true);
  101. //ViewManager.Show<CardStoryView>(cardData);
  102. }
  103. public static void ShowPriorStoryDialog()
  104. {
  105. InstanceZonesDataManager.currentLevelCfgId = 100001001;
  106. string stroyStartID = "1";
  107. // string stroyStartID = MainStoryDataManager.priorId;
  108. ViewManager.Show<StoryDialogView>(new object[] { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog),null,false }, true);
  109. }
  110. private static void OnCompletePriorStoryDialog(bool done, object param)
  111. {
  112. //ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(typeof(StoryChapterView).FullName), true);
  113. }
  114. public static void ShowFilingStoryDialog(StoryLevelCfg storyLevelCfg)
  115. {
  116. InstanceZonesDataManager.currentLevelCfgId = storyLevelCfg.Id;
  117. ViewManager.Show<StoryDialogView>(new object[] { storyLevelCfg.StoryStartID, false, new OnCompleteStoryDialogCall(OnCompleteFilingStoryDialog) ,null,false}, true);
  118. }
  119. private static void OnCompleteFilingStoryDialog(bool isSkip, object param)
  120. {
  121. //InstanceZonesController.OnCompleteChapterStoryDialog(isSkip, param);
  122. //ViewManager.Show<StudioFilingView>(MainStoryDataManager.currentChapterCfgId, null, true);
  123. //, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName)
  124. }
  125. }
  126. }