StoryController.cs 6.2 KB

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