You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.7 KiB
101 lines
3.7 KiB
using System.Collections.Generic; |
|
using System.Linq; |
|
|
|
namespace ET |
|
{ |
|
public partial class SkillUpConfigCategory |
|
{ |
|
public Dictionary<int, Dictionary<int, int[]>> AllUnlockedSkillsOfLevel = new Dictionary<int, Dictionary<int, int[]>>(); |
|
|
|
private int[] CheckToGetUnLockSkillList(int[] levelUnlockParameter) |
|
{ |
|
if (levelUnlockParameter.Length == 1 && levelUnlockParameter[0] == 0) |
|
{ |
|
return null; |
|
} |
|
|
|
return levelUnlockParameter; |
|
} |
|
|
|
public override void AfterEndInit() |
|
{ |
|
foreach (var skillUpConfig in this.GetAll()) |
|
{ |
|
List<int[]> unLockSkillList = new List<int[]>(); |
|
unLockSkillList.Add(skillUpConfig.Value.Level1UnlockParameter); |
|
unLockSkillList.Add(skillUpConfig.Value.Level2UnlockParameter); |
|
unLockSkillList.Add(skillUpConfig.Value.Level3UnlockParameter); |
|
unLockSkillList.Add(skillUpConfig.Value.Level4UnlockParameter); |
|
unLockSkillList.Add(skillUpConfig.Value.Level5UnlockParameter); |
|
unLockSkillList.Add(skillUpConfig.Value.Level6UnlockParameter); |
|
unLockSkillList.Add(skillUpConfig.Value.Level7UnlockParameter); |
|
unLockSkillList.Add(skillUpConfig.Value.Level8UnlockParameter); |
|
unLockSkillList.Add(skillUpConfig.Value.Level9UnlockParameter); |
|
unLockSkillList.Add(skillUpConfig.Value.Level10UnlockParameter); |
|
|
|
Dictionary<int, int[]> unlockSkillDict = new Dictionary<int, int[]>(); |
|
for (int i = 0; i < 10; i++) |
|
{ |
|
var list = CheckToGetUnLockSkillList(unLockSkillList[i]); |
|
int[] preList = null; |
|
|
|
if (unlockSkillDict.ContainsKey(i)) |
|
{ |
|
preList = unlockSkillDict[i]; |
|
} |
|
|
|
int[] merge; |
|
if (list != null) |
|
{ |
|
if (preList != null) |
|
{ |
|
merge = new int [list.Length + preList.Length]; |
|
preList.CopyTo(merge, 0); |
|
list.CopyTo(merge, preList.Length); |
|
} |
|
else |
|
{ |
|
merge = new int[list.Length]; |
|
list.CopyTo(merge, 0); |
|
} |
|
unlockSkillDict.Add(i + 1, merge); |
|
} |
|
else |
|
{ |
|
if (preList != null) |
|
{ |
|
merge = new int[preList.Length]; |
|
preList.CopyTo(merge, 0); |
|
unlockSkillDict.Add(i + 1, merge); |
|
} |
|
} |
|
} |
|
|
|
AllUnlockedSkillsOfLevel.Add(skillUpConfig.Key, unlockSkillDict); |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 获得技能在某个解锁等级下解锁的所有子技能 |
|
/// </summary> |
|
/// <param name="skillId">技能解锁的Id</param> |
|
/// <param name="level">解锁等级(从1级开始)</param> |
|
/// <returns></returns> |
|
public int[] GetUnLockedSkillsOfLevel(int skillId, int level) |
|
{ |
|
if (!this.AllUnlockedSkillsOfLevel.ContainsKey(skillId)) |
|
{ |
|
return null; |
|
} |
|
|
|
var dict = this.AllUnlockedSkillsOfLevel[skillId]; |
|
|
|
if (!dict.ContainsKey(level)) |
|
{ |
|
return null; |
|
} |
|
|
|
return dict[level]; |
|
} |
|
} |
|
} |