123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- using ET;
- using System.Collections.Generic;
- namespace GFGGame
- {
- public class StoryController
- {
- public static void ShowLevelView(int chapterID, int level)
- {
- int levelID = chapterID*GameConst.STORY_LEVEL_KEY_NUM + level;
- StoryDataManager.currentChapter = chapterID;
- StoryDataManager.currentLevelCfgId = levelID;
- StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelID);
- StoryDataManager.currentLevel = level;
- if (levelCfg.fightID.Length > 0)
- {
- ViewManager.Show(ViewName.STORY_LEVEL_INFO_VIEW, levelID);
- }
- else if (levelCfg.storyStartID.Length > 0)
- {
- bool skipable = StoryDataManager.CheckCurrentLevelPass();
- ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { levelCfg.storyStartID, skipable, new OnCompleteStoryDialogCall(OnCompleteChapterStoryDialog) }, null, true);
- }
- }
- public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData)
- {
- ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { cardStoryCfg.storyStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData }, null, true);
- }
- public static void ShowPriorStoryDialog()
- {
- StoryDataManager.currentChapter = 1;
- StoryDataManager.currentLevelCfgId = 1001;
- ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { StoryDataManager.priorId, false, new OnCompleteStoryDialogCall(OnCompleteChapterStoryDialog) }, null, true);
- }
- public static async ETTask CheckStoryFightResult()
- {
- var score = EquipDataCache.cacher.totalScore;
- //客户端先做判断,成功和失败处理不同
- var success = StoryDataManager.GetFightResult(score, out var npcScore);
- if(success)
- {
- await StorySProxy.FinishStoryFightLevel(StoryDataManager.currentLevelCfgId, score, npcScore, StoryDataManager.usedRecommend);
- }
- else
- {
- ViewManager.Show(ViewName.STORY_FIGHT_RESULT_VIEW, new StoryFightResultData
- {
- Result = false,
- Score = score,
- FirstPass = false,
- Star = 0
- }, null, true);
- //失败仅判断并更新最高分
- if(score > StoryDataManager.GetScoreHighest(StoryDataManager.currentCardId))
- {
- StorySProxy.StoryFightLevelFail(StoryDataManager.currentLevelCfgId, score).Coroutine();
- }
- }
- }
- public static void OnFinishStoryLevel(int levelCfgId, bool firstPass)
- {
- //判断是否是首次打通最后一关
- int nextLevelID = levelCfgId + 1;
- StoryLevelCfg nextLevelCfg = StoryLevelCfgArray.Instance.GetCfg(nextLevelID);
- var fistPassLastLvl = (nextLevelCfg == null) && firstPass;
- if (fistPassLastLvl)
- {
- ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW);
- }
- else
- {
- ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW));
- }
- }
- private static void OnCompleteChapterStoryDialog(bool isSkip, object param)
- {
- //List<ItemData> bonusList = null;
- bool _fistPassLastLvl = false;
- bool _curLvfirstPass = false;
- if (!StoryDataManager.CheckCurrentLevelPass())
- {
- //bonusList = StoryDataManager.PassCurrentLevel(out _fistPassLastLvl, out _curLvfirstPass);
- StorySProxy.FinishStoryDialogLevel(StoryDataManager.currentLevelCfgId).Coroutine();
- }
-
- //if (bonusList != null && bonusList.Count > 0)
- //{
- // ViewManager.Show(ViewName.GET_BONUS_VIEW, bonusList);
- //}
- }
- private static void OnCompleteCardStoryDialog(bool isSkip, object param)
- {
- CardData cardData = param as CardData;
- ViewManager.Show(ViewName.CARD_FOSTER_VIEW, cardData, new object[] { ViewName.CARD_DETAIL_VIEW }, true);
- ViewManager.Show(ViewName.CARD_STORY_VIEW, cardData);
- }
- }
- }
|