|
@@ -3,6 +3,7 @@ using System;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
@@ -130,5 +131,125 @@ namespace GFGGame
|
|
|
}
|
|
|
return addNum + 1;
|
|
|
}
|
|
|
+ //判断部分是否可以升级
|
|
|
+ public bool CheckPartCanUP(int pardId)
|
|
|
+ {
|
|
|
+ int rankIndex = CollectPartDataDic[pardId][0];
|
|
|
+ int rankLv = CollectPartDataDic[pardId][1];
|
|
|
+ if (rankLv + 1 > CollectPartDataManager.Instance.MaxLevel)
|
|
|
+ {
|
|
|
+ rankIndex += 1;
|
|
|
+ rankLv = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rankLv += 1;
|
|
|
+ }
|
|
|
+ CollegeBoostCfg collegeBoostCfg = CollegeBoostCfgArray.Instance.GetCfgBytypePartsAndtypePhaseAndlayer(pardId,rankIndex,rankLv);
|
|
|
+ if (collegeBoostCfg == null)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < collegeBoostCfg.consumeArr.Length; i++)
|
|
|
+ {
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(collegeBoostCfg.consumeArr[i][0]);
|
|
|
+ ItemData itemCount;
|
|
|
+ long count;
|
|
|
+ if (itemCfg.itemType == ConstItemType.DRESS_UP)
|
|
|
+ {
|
|
|
+ count = ItemDataManager.GetItemNum(collegeBoostCfg.consumeArr[i][0]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (BagDataManager.Instance.GetBagData().TryGetValue(collegeBoostCfg.consumeArr[i][0], out itemCount))
|
|
|
+ {
|
|
|
+ count = itemCount.num;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ count = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(count < collegeBoostCfg.consumeArr[i][1])
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ //判断所有已开启部位是否可以升级
|
|
|
+ public bool CheckAllOpenPartCanUP()
|
|
|
+ {
|
|
|
+ if(!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingSelectView).Name, false))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ foreach(var item in CollectPartDataDic)
|
|
|
+ {
|
|
|
+ if(IsOpenRank(item.Key))
|
|
|
+ {
|
|
|
+ if(CheckPartCanUP(item.Key))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ public bool IsOpenRank(int partIndex, int levelNum = 9)
|
|
|
+ {
|
|
|
+ List<int> openList;
|
|
|
+ bool isRank = false;
|
|
|
+ bool isLevel = false;
|
|
|
+ bool isPassStory = false;
|
|
|
+ CollegeRankOpenCfg openitem = CollegeRankOpenCfgArray.Instance.GetCfg(partIndex);
|
|
|
+ openList = GetOpenList(partIndex);
|
|
|
+ //判断段位
|
|
|
+ if (openitem.OpenPreconditionArr == null || openitem.OpenPreconditionArr.Length == 0)
|
|
|
+ {
|
|
|
+ isRank = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (CollectPartDataDic[openList[0]][0] >= openList[1])
|
|
|
+ {
|
|
|
+ if (CollectPartDataDic[openList[0]][1] >= openList[2])
|
|
|
+ {
|
|
|
+ isRank = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //判断等级
|
|
|
+ if (RoleDataManager.lvl >= openitem.needRoleLv)
|
|
|
+ {
|
|
|
+ isLevel = true;
|
|
|
+ }
|
|
|
+ //判断关卡
|
|
|
+ if (openitem.needStoryLevelId == 0 || InstanceZonesDataManager.CheckLevelPass(openitem.needStoryLevelId))
|
|
|
+ {
|
|
|
+ isPassStory = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isPassStory = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return isRank && isLevel && isPassStory;
|
|
|
+ }
|
|
|
+ public List<int> GetOpenList(int partIndex)
|
|
|
+ {
|
|
|
+ List<int> openList = new List<int>();
|
|
|
+ string pattern = @"\d+";
|
|
|
+ CollegeRankOpenCfg openitem = CollegeRankOpenCfgArray.Instance.GetCfg(partIndex);
|
|
|
+ for (int i = 0; i < openitem.OpenPreconditionArr.Length; i++)
|
|
|
+ {
|
|
|
+ MatchCollection matches = Regex.Matches(openitem.OpenPreconditionArr[i], pattern);
|
|
|
+ foreach (Match match in matches)
|
|
|
+ {
|
|
|
+ openList.Add(int.Parse(match.Value));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return openList;
|
|
|
+ }
|
|
|
}
|
|
|
}
|