Explorar o código

Merge remote-tracking branch 'remotes/origin/guodong' into zhaoyang

zhaoyang %!s(int64=3) %!d(string=hai) anos
pai
achega
9983e5abb7

+ 21 - 1
GameClient/Assets/Game/HotUpdate/Data/InstanceZonesDataManager.cs

@@ -54,6 +54,26 @@ namespace GFGGame
             return false;
         }
 
-
+        /// <summary>
+        /// 检查某章是否通关
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="subType"></param>
+        /// <param name="chapterId"></param>
+        /// <param name="levelCount"></param>
+        /// <returns></returns>
+        public static bool CheckChapterPass(int type, int subType, int chapterId, int levelCount)
+        {
+            var chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterId);
+            if(chapterCfg != null)
+            {
+                var passLevelOrder = InstanceZonesDataManager.GetPassLevelOrder(type, subType, chapterId);
+                if(levelCount <= passLevelOrder)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
     }
 }

+ 27 - 113
GameClient/Assets/Game/HotUpdate/Data/StoryDataManager.cs

@@ -151,15 +151,19 @@ namespace GFGGame
         }
 
         //检查指定章节对应的普通章节是否通关
-        public static bool CheckNeedChapterPass(int chapterId)
+        public static bool CheckNeedChapterPass(int chapterId, out int needChapterId)
         {
-            var chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterId);
-            if (chapterCfg != null)
-{
-                var passLevelOrder = InstanceZonesDataManager.GetPassLevelOrder(chapterCfg.type, chapterCfg.subType, chapterCfg.id);
-                return chapterCfg.levelCount <= passLevelOrder;
+            StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterId);
+            needChapterId = chapterCfg.needChapterId;
+            if (chapterCfg.needChapterId > 0)
+            {
+                var preChapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterCfg.needChapterId);
+                if (preChapterCfg != null)
+                {
+                    return InstanceZonesDataManager.CheckChapterPass(preChapterCfg.type, preChapterCfg.subType, preChapterCfg.id, preChapterCfg.levelCount);
+                }
             }
-            return false;
+            return true;
         }
 
         public static bool CheckChapterUnlock(int chapterId)
@@ -169,40 +173,28 @@ namespace GFGGame
             {
                 return false;
             }
-            if (CalculateHelper.CheckChapterIsHard(chapterId))
-            {
-                //对应普通剧情的章需要开启
-                if (!CheckNeedChapterPass(chapterId))
-                {
-                    return false;
-                }
-                //前一精英章需要通关
-                if (chapterId - 1 > GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterJY))
-                {
-                    return false;
-                }
-            }
-            else
+            //上一关卡
+            int preChapterId = chapterId - 1;
+            var preChapterCfg = StoryChapterCfgArray.Instance.GetCfg(preChapterId);
+            if(preChapterCfg != null)
             {
-                if (chapterId - 1 > GameGlobal.myNumericComponent.GetAsInt(NumericType.Chapter))
-                {
-                    return false;
-                }
+                return InstanceZonesDataManager.CheckChapterPass(preChapterCfg.type, preChapterCfg.subType, preChapterCfg.id, preChapterCfg.levelCount);
             }
-            return true;
+            //前置关卡
+            return CheckNeedChapterPass(chapterId, out var needChapterId);
         }
 
-        public static bool CheckLevelUnlock(int chapterId, int level)
+        public static bool CheckLevelUnlock(int levelCfgId)
         {
-            int passChapter = GetPassChapter(chapterId);
-            int passLevel = GetPassLevel(chapterId);
-            if (chapterId <= passChapter)
+            var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
+            if (levelCfg != null)
             {
-                return true;
-            }
-            if (chapterId == passChapter + 1 && level <= passLevel + 1)
-            {
-                return true;
+                if (!CheckChapterUnlock(levelCfg.chapterId))
+                {
+                    return false;
+                }
+                var passLevelOrder = InstanceZonesDataManager.GetPassLevelOrder(levelCfg.type, levelCfg.subType, levelCfg.chapterId);
+                return levelCfg.order <= passLevelOrder + 1;
             }
             return false;
         }
@@ -270,84 +262,6 @@ namespace GFGGame
             return (score > fightCfg.score1);
         }
 
-        public static int GetPassChapter(int fromChapter)
-        {
-            if (CalculateHelper.CheckChapterIsHard(fromChapter))
-            {
-                return GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterJY);
-            }
-            return GameGlobal.myNumericComponent.GetAsInt(NumericType.Chapter);
-        }
-
-        public static int GetPassLevel(int fromChapter)
-        {
-            if (CalculateHelper.CheckChapterIsHard(fromChapter))
-            {
-                return GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterLvlJY);
-            }
-            return GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterLvl);
-        }
-
-        public static List<ItemData> PassCurrentLevel(out bool fistPassLastLvl, out bool curLvfirstPass)
-        {
-            fistPassLastLvl = false;
-            curLvfirstPass = false;
-            List<ItemData> currentBonusList = new List<ItemData>();
-            //if (!CheckCurrentLevelPass())
-            //{
-            //    curLvfirstPass = true;
-            //    int tempPassLevel = currentLevel;
-            //    int tempPassChapter = GetPassChapter(currentChapter);
-            //    int nextLevel = currentLevel + 1;
-            //    int nextLevelID = currentChapter*GameConst.STORY_LEVEL_KEY_NUM + nextLevel;
-            //    StoryLevelCfg nextLevelCfg = StoryLevelCfgArray.Instance.GetCfg(nextLevelID);
-            //    if (nextLevelCfg == null)
-            //    {
-            //        tempPassChapter = currentChapter;
-            //        tempPassLevel = 0;
-            //        fistPassLastLvl = true;
-            //    }
-            //    SetPassData(tempPassChapter, tempPassLevel);
-            //    GameProxy.ReqUpdateStoryProgress(_passChapter, _passLevel, _passChapterJY, _passLevelJY);
-            //    currentBonusList = StoryBonusDataCache.GetBonusList(currentLevelID, true, true);
-            //}
-            //else
-            //{
-            //currentBonusList = StoryBonusDataCache.GetBonusList(currentLevelID, false, true);
-            //}
-            //StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(StoryDataManager.currentLevelID);
-            ////消耗体力
-            //if (currentBonusList != null && currentBonusList.Count > 0)
-            //{
-            //    if (GameGlobal.myNumericComponent.GetAsInt(NumericType.Power) >= levelCfg.power)
-            //    {
-            //        RoleDataManager.power -= levelCfg.power;
-            //    }
-            //    else
-            //    {
-            //        RoleDataManager.power = 0;
-            //    }
-            //}
-            //消耗推荐次数
-            //if (usedRecommend)
-            //{
-            //    usedRecommend = false;
-            //    //_recommendCount--;
-            //    //GameProxy.ReqUpdateRecommendCount(_recommendCount);
-            //}
-            //经验奖励
-            //if (levelCfg.fightID != null && levelCfg.fightID.Length > 0)
-            //{
-            //    StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
-            //    RoleDataManager.exp += fightCfg.exp;
-            //}
-            //foreach (ItemData itemData in currentBonusList)
-            //{
-            //    ItemDataManager.Add(itemData.id, itemData.num);
-            //}
-            return currentBonusList;
-        }
-
         public static int GetChapterStarCount(int chapterID)
         {
             var star = 0;

+ 3 - 2
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryChapterListView.cs

@@ -137,9 +137,10 @@ namespace GFGGame
                     }
                     else
                     {
-                        if (CalculateHelper.CheckChapterIsHard(chapterID) && !StoryDataManager.CheckNeedChapterPass(chapterID))
+                        if (CalculateHelper.CheckChapterIsHard(chapterID) && !StoryDataManager.CheckNeedChapterPass(chapterID, out var needChapterId))
                         {
-                            listItem.m_content.m_txtLockDesc.text = "通关同一普通章节开启";
+                            var needChapterCfg = StoryChapterCfgArray.Instance.GetCfg(needChapterId);
+                            listItem.m_content.m_txtLockDesc.text = $"通关第{needChapterCfg.order}章普通剧情后开启";
                         }
                         else
                         {

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryChapterView.cs

@@ -113,7 +113,7 @@ namespace GFGGame
                 {
                     UI_CompStoryLevelItem levelItem = UI_CompStoryLevelItem.Proxy(obj);
                     levelItem.target.data = levelCfg.id;
-                    if (StoryDataManager.CheckLevelUnlock(_chapterID, levelCfg.order))
+                    if (StoryDataManager.CheckLevelUnlock(levelCfg.id))
                     {
                         levelItem.target.visible = true;
                         levelItem.target.onClick.Clear();