| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 | 
							- using System;
 
- using System.Collections.Generic;
 
- namespace GFGGame
 
- {
 
-     //本类为通用关卡数据类,特殊副本类型数据请写到各自的管理器里
 
-     public class InstanceZonesDataManager
 
-     {
 
-         //所有副本关卡通用换装战斗是否使用推荐
 
-         public static bool usedRecommend;
 
-         //所有副本关卡通用
 
-         public static int currentScoreType;
 
-         //所有副本关卡通用
 
-         public static int currentCardId = 0;
 
-         //快速挑战挑战次数
 
-         public static int FightTimes = 10;
 
-         //是否速刷中
 
-         public static bool isQuicklyFighting = false;
 
-         //是否结算中
 
-         public static bool isResultFighting = false;
 
-         public static string[] currentFightTags;
 
-         private static int _currentLevelCfgId;
 
-         //所有副本关卡通用配置表的id
 
-         public static int currentLevelCfgId
 
-         {
 
-             get
 
-             {
 
-                 return _currentLevelCfgId;
 
-             }
 
-             set
 
-             {
 
-                 _currentLevelCfgId = value;
 
-                 var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_currentLevelCfgId);
 
-                 if (levelCfg.type == ConstInstanceZonesType.Story)
 
-                 {
 
-                     MainStoryDataManager.currentLevelCfgId = _currentLevelCfgId;
 
-                 }
 
-                 if (string.IsNullOrEmpty(levelCfg.fightID))
 
-                 {
 
-                     currentFightTags = null;
 
-                 }
 
-                 else
 
-                 {
 
-                     StoryFightCfg storyFightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
 
-                     currentFightTags = storyFightCfg.needTagsArr;
 
-                 }
 
-             }
 
-         }
 
-         //所有副本关卡通用
 
-         public static int currentLevelOrder
 
-         {
 
-             get
 
-             {
 
-                 var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_currentLevelCfgId);
 
-                 return levelCfg.order;
 
-             }
 
-         }
 
-         //副本通关状态,key为CalculateHelper.GenerateInstanceZonesLevelStateKey,值为通到关卡编号
 
-         private static Dictionary<int, int> _passLevelDic = new Dictionary<int, int>();
 
-         //关卡最高分数记录
 
-         private static Dictionary<int, int> _highestScoreDic = new Dictionary<int, int>();
 
-         //关卡星数记录
 
-         private static Dictionary<int, int> _starDic = new Dictionary<int, int>();
 
-         public static void InitScoreList(List<int> ks, List<int> vs)
 
-         {
 
-             usedRecommend = false;
 
-             _highestScoreDic.Clear();
 
-             for (var i = 0; i < ks.Count; ++i)
 
-             {
 
-                 _highestScoreDic.Add(ks[i], vs[i]);
 
-             }
 
-         }
 
-         public static void InitStarList(List<int> ks, List<int> vs)
 
-         {
 
-             _starDic.Clear();
 
-             for (var i = 0; i < ks.Count; ++i)
 
-             {
 
-                 _starDic.Add(ks[i], vs[i]);
 
-             }
 
-         }
 
-         //检查更新最高分
 
-         public static void TryUpdateScore(int levelCfgId, int score)
 
-         {
 
-             _highestScoreDic.TryGetValue(levelCfgId, out var scoreHighest);
 
-             if (score > scoreHighest)
 
-             {
 
-                 _highestScoreDic[levelCfgId] = score;
 
-             }
 
-         }
 
-         public static int GetScoreHighest(int levelID)
 
-         {
 
-             if (_highestScoreDic.ContainsKey(levelID))
 
-             {
 
-                 return _highestScoreDic[levelID];
 
-             }
 
-             return 0;
 
-         }
 
-         //检查并更新关卡星数
 
-         public static void TryUpdateLevelStar(int levelCfgId, int star)
 
-         {
 
-             _starDic.TryGetValue(levelCfgId, out var OldStar);
 
-             if (star > OldStar)
 
-             {
 
-                 _starDic[levelCfgId] = star;
 
-             }
 
-         }
 
-         public static int GetStarCountHistory(int levelCfgId)
 
-         {
 
-             _starDic.TryGetValue(levelCfgId, out var star);
 
-             return star;
 
-         }
 
-         public static int GetChapterStarCount(int chapterID, int type, int subType)
 
-         {
 
-             var star = 0;
 
-             foreach (var item in _starDic)
 
-             {
 
-                 var levelCfg = StoryLevelCfgArray.Instance.GetCfg(item.Key);
 
-                 if (levelCfg.chapterId == chapterID && levelCfg.type == type && levelCfg.subType == subType)
 
-                 {
 
-                     star += item.Value;
 
-                 }
 
-             }
 
-             return star;
 
-         }
 
-         public static void InitLevelPass(List<int> ks, List<int> vs)
 
-         {
 
-             _passLevelDic.Clear();
 
-             for (var i = 0; i < ks.Count; ++i)
 
-             {
 
-                 _passLevelDic[ks[i]] = vs[i];
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 设置某关卡通过,参数为关卡配置id
 
-         /// </summary>
 
-         /// <param name="levelCfgId"></param>
 
-         public static void TrySetLevelPass(int levelCfgId)
 
-         {
 
-             if (!CheckLevelPass(levelCfgId))
 
-             {
 
-                 var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
 
-                 var key = CalculateHelper.GenerateInstanceZonesLevelStateKey(levelCfg.type, levelCfg.subType, levelCfg.chapterId);
 
-                 _passLevelDic[key] = levelCfgId;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 获取副本通关关卡
 
-         /// </summary>
 
-         /// <param name="type" value="副本类型"></param>
 
-         /// <param name="subType" value="章节id"></param>
 
-         /// <returns></returns>
 
-         public static int GetPassLevelCfgId(int type, int subType, int chapterId)
 
-         {
 
-             var key = CalculateHelper.GenerateInstanceZonesLevelStateKey(type, subType, chapterId);
 
-             if (_passLevelDic.TryGetValue(key, out var value))
 
-             {
 
-                 return value;
 
-             }
 
-             return 0;
 
-         }
 
-         /// <summary>
 
-         /// 获取通关关卡的编号
 
-         /// </summary>
 
-         /// <param name="type"></param>
 
-         /// <param name="subType"></param>
 
-         /// <param name="chapterId"></param>
 
-         /// <returns></returns>
 
-         public static int GetPassLevelOrder(int type, int subType, int chapterId)
 
-         {
 
-             var levelCfgId = GetPassLevelCfgId(type, subType, chapterId);
 
-             if (levelCfgId == 0)
 
-             {
 
-                 return 0;
 
-             }
 
-             var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
 
-             if (levelCfg != null)
 
-             {
 
-                 return levelCfg.order;
 
-             }
 
-             return 0;
 
-         }
 
-         /// <summary>
 
-         /// 检查某关卡是否通过,参数为关卡配置id
 
-         /// </summary>
 
-         /// <param name="levelCfgId"></param>
 
-         /// <returns></returns>
 
-         public static bool CheckLevelPass(int levelCfgId)
 
-         {
 
-             var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
 
-             if (levelCfg != null)
 
-             {
 
-                 var passLevelOrder = GetPassLevelOrder(levelCfg.type, levelCfg.subType, levelCfg.chapterId);
 
-                 return levelCfg.order <= passLevelOrder;
 
-             }
 
-             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;
 
-         }
 
-         public static int GetResultStarCount(int score)
 
-         {
 
-             return CalculateHelper.GetStoryChapterStar(currentLevelCfgId, score);
 
-         }
 
-         public static bool GetFightResult(int score, out int npcScore)
 
-         {
 
-             npcScore = 0;
 
-             bool equipedNeeded = MyDressUpHelper.CheckEquipedFightNeeded();
 
-             if (!equipedNeeded)
 
-             {
 
-                 PromptController.Instance.ShowFloatTextPrompt("未穿必需物品");
 
-                 return false;//没穿必需品
 
-             }
 
-             StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(currentLevelCfgId);
 
-             StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
 
-             bool hasFightTarget = fightCfg.targetName != null && fightCfg.targetName.Length > 0;
 
-             if (hasFightTarget)
 
-             {
 
-                 npcScore = FightDataManager.Instance.npcTotalScore;
 
-                 if (score > npcScore)
 
-                 {
 
-                     return true;//分数低于对战对象
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 int starCount = GetResultStarCount(score);
 
-                 if (starCount > 0)
 
-                 {
 
-                     return true;//低于一星
 
-                 }
 
-             }
 
-             return false;
 
-         }
 
-         public static void GetCanFightTime(int type, int subType, int levelCfgId, out int times, out string title)
 
-         {
 
-             var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
 
-             if (levelCfg.power == 0)
 
-             {
 
-                 times = GameConst.MAX_COUNT_FIGHT_QUICKLY;
 
-             }
 
-             else
 
-             {
 
-                 times = (int)Math.Floor((float)RoleDataManager.power / levelCfg.power);//体力次数
 
-             }
 
-             times = Math.Min(GameConst.MAX_COUNT_FIGHT_QUICKLY, times);
 
-             title = "";
 
-             if (type == ConstInstanceZonesType.Studio)
 
-             {
 
-                 StudioData studioData = StudioDataManager.Instance.GetStudioDataById(levelCfg.chapterId);
 
-                 times = Math.Min(times, studioData.TotalPlayTimes - studioData.PlayTimes);
 
-             }
 
-             title = string.Format("挑战{0}次", NumberUtil.GetChiniseNumberText(times));
 
-         }
 
-         public static void GetTotalProgress(out int count, out int totalCount)
 
-         {
 
-             List<StoryChapterCfg> storyChapters = StoryChapterCfgArray.Instance.GetCfgsBysubType(ConstInstanceZonesSubType.Normal);
 
-             totalCount = storyChapters.Count - 1;
 
-             count = 0;
 
-             for (int i = 1; i < storyChapters.Count; i++)
 
-             {
 
-                 bool isPass = InstanceZonesDataManager.CheckChapterPass(storyChapters[i].type, storyChapters[i].subType, storyChapters[i].id, storyChapters[i].levelCount);
 
-                 if (isPass)
 
-                 {
 
-                     count++;
 
-                 }
 
-                 else
 
-                 {
 
-                     break;
 
-                 }
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |