|
@@ -1,15 +1,149 @@
|
|
-using System.Collections.Generic;
|
|
|
|
|
|
+using ET;
|
|
|
|
+using System;
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
+using static UnityEditor.ShaderData;
|
|
|
|
|
|
namespace GFGGame
|
|
namespace GFGGame
|
|
{
|
|
{
|
|
|
|
+ //本类为通用关卡数据类,特殊副本类型数据请写到各自的管理器里
|
|
public class InstanceZonesDataManager
|
|
public class InstanceZonesDataManager
|
|
{
|
|
{
|
|
- //关卡配置表的id
|
|
|
|
- public static int currentLevelCfgId;
|
|
|
|
|
|
+ //所有副本关卡通用换装战斗是否使用推荐
|
|
|
|
+ public static bool usedRecommend;
|
|
|
|
+ //所有副本关卡通用
|
|
|
|
+ public static int currentScoreType;
|
|
|
|
+ //所有副本关卡通用
|
|
|
|
+ public static int currentCardId = 0;
|
|
|
|
+
|
|
|
|
+ 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)
|
|
|
|
+ {
|
|
|
|
+ StoryDataManager.currentLevelCfgId = _currentLevelCfgId;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //所有副本关卡通用
|
|
|
|
+ public static int currentLevelOrder
|
|
|
|
+ {
|
|
|
|
+ get
|
|
|
|
+ {
|
|
|
|
+ CalculateHelper.GetStoryChapterLevel(_currentLevelCfgId, out int chapterID, out int levelOrder);
|
|
|
|
+ return levelOrder;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //副本通关状态,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)
|
|
|
|
+ {
|
|
|
|
+ var star = 0;
|
|
|
|
+ foreach (var item in _starDic)
|
|
|
|
+ {
|
|
|
|
+ CalculateHelper.GetStoryChapterLevel(item.Key, out var tempChapter, out var levelOrder);
|
|
|
|
+ if (tempChapter == chapterID)
|
|
|
|
+ {
|
|
|
|
+ star += item.Value;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return star;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- //副本通关状态,key为(副本类型+副本id*1000),值为通到第几关
|
|
|
|
- private static Dictionary<int, int> _passLevel = new Dictionary<int, int>();
|
|
|
|
|
|
+ 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>
|
|
/// 获取副本通关关卡
|
|
/// 获取副本通关关卡
|
|
@@ -20,13 +154,19 @@ namespace GFGGame
|
|
public static int GetPassLevelCfgId(int type, int subType, int chapterId)
|
|
public static int GetPassLevelCfgId(int type, int subType, int chapterId)
|
|
{
|
|
{
|
|
var key = CalculateHelper.GenerateInstanceZonesLevelStateKey(type, subType, chapterId);
|
|
var key = CalculateHelper.GenerateInstanceZonesLevelStateKey(type, subType, chapterId);
|
|
- if (_passLevel.TryGetValue(key, out var value))
|
|
|
|
|
|
+ if (_passLevelDic.TryGetValue(key, out var value))
|
|
{
|
|
{
|
|
return value;
|
|
return value;
|
|
}
|
|
}
|
|
return 0;
|
|
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)
|
|
public static int GetPassLevelOrder(int type, int subType, int chapterId)
|
|
{
|
|
{
|
|
var levelCfgId = GetPassLevelCfgId(type, subType, chapterId);
|
|
var levelCfgId = GetPassLevelCfgId(type, subType, chapterId);
|
|
@@ -48,7 +188,7 @@ namespace GFGGame
|
|
var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
|
|
var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
|
|
if (levelCfg != null)
|
|
if (levelCfg != null)
|
|
{
|
|
{
|
|
- var passLevelOrder = InstanceZonesDataManager.GetPassLevelOrder(levelCfg.type, levelCfg.subType, levelCfg.chapterId);
|
|
|
|
|
|
+ var passLevelOrder = GetPassLevelOrder(levelCfg.type, levelCfg.subType, levelCfg.chapterId);
|
|
return levelCfg.order <= passLevelOrder;
|
|
return levelCfg.order <= passLevelOrder;
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
@@ -65,15 +205,58 @@ namespace GFGGame
|
|
public static bool CheckChapterPass(int type, int subType, int chapterId, int levelCount)
|
|
public static bool CheckChapterPass(int type, int subType, int chapterId, int levelCount)
|
|
{
|
|
{
|
|
var chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterId);
|
|
var chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterId);
|
|
- if(chapterCfg != null)
|
|
|
|
|
|
+ if (chapterCfg != null)
|
|
{
|
|
{
|
|
var passLevelOrder = InstanceZonesDataManager.GetPassLevelOrder(type, subType, chapterId);
|
|
var passLevelOrder = InstanceZonesDataManager.GetPassLevelOrder(type, subType, chapterId);
|
|
- if(levelCount <= passLevelOrder)
|
|
|
|
|
|
+ if (levelCount <= passLevelOrder)
|
|
{
|
|
{
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
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 = EquipDataCache.cacher.CheckEquipedFightNeeded();
|
|
|
|
+ if (!equipedNeeded)
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("未穿必需物品");
|
|
|
|
+ return false;//没穿必需品
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int starCount = GetResultStarCount(score);
|
|
|
|
+ if (starCount <= 0)
|
|
|
|
+ {
|
|
|
|
+ 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 = EquipDataCache.cacher.npcTotalScore;
|
|
|
|
+ if (score < npcScore)
|
|
|
|
+ {
|
|
|
|
+ return false;//分数低于对战对象
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static int GetCanFightTime(int levelID)
|
|
|
|
+ {
|
|
|
|
+ StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelID);
|
|
|
|
+ int times = (int)Math.Floor((float)GameGlobal.myNumericComponent.GetAsInt(NumericType.Power) / levelCfg.power);
|
|
|
|
+ return times;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|