public void GainSkills(string skillId) { if (GetSkillAsset(skillId) == null) { return; } SkillAsset sa = GetSkillAsset(skillId); foreach (SkillPrerequist s in sa.PrerequistSkills) { SkillInfo preSkill = GetOwnedSkill(s.skillId); if (preSkill == null || preSkill.SkillLvl < s.level) { return; } } SkillInfo skillInfo = GetOwnedSkill(skillId); if (skillInfo == null) { skillInfo = new SkillInfo(skillId); OwnedSkills.Add(skillInfo); skillInfo.SkillLvl = 1; } else { skillInfo.SkillLvl += 1; mCardMgr.RemoveSkillCards(skillId); } if (skillInfo.SkillLvl - 1 < sa.AttachCards.Count) { string[] cards = sa.AttachCards[skillInfo.SkillLvl - 1].Split(','); mCardMgr.AddSkillCards(skillId, new List <string>(cards)); } }
public void GainSkills(string skillId) { if (GetSkillAsset(skillId) == null) { return; } SkillAsset sa = GetSkillAsset(skillId); foreach (SkillPrerequist s in sa.PrerequistSkills) { SkillInfo preSkill = GetOwnedSkill(s.skillId); if (preSkill == null || preSkill.SkillLvl < s.level) { return; } } SkillInfo skillInfo = GetOwnedSkill(skillId); if (skillInfo == null) { skillInfo = new SkillInfo(skillId, sa); OwnedSkills.Add(skillInfo); skillInfo.SkillLvl = 1; BaseSkillAsset bsa = sa as BaseSkillAsset; if (bsa != null) { mCardMgr.AddSkillCards(skillId, new List <string>(bsa.BaseCardList)); } } else { skillInfo.SkillLvl += 1; } mRoleMdl.AddAllStatus(sa.LevelStatusAdd[skillInfo.SkillLvl - 1]); Debug.Log("加了" + sa.LevelStatusAdd[skillInfo.SkillLvl - 1]); ExtentSkillAsset esa = sa as ExtentSkillAsset; if (esa == null) { return; } if (skillInfo.SkillLvl > 1) { AttachCardsInfo attachInfo = esa.AttachCardInfos[skillInfo.SkillLvl - 2]; for (int i = 0; i < attachInfo.operators.Count; i++) { mCardMgr.ChangeSkillCard(esa.BaseSkillId, attachInfo.operators[i].to, attachInfo.operators[i].from); } } { AttachCardsInfo attachInfo = esa.AttachCardInfos[skillInfo.SkillLvl - 1]; for (int i = 0; i < attachInfo.operators.Count; i++) { mCardMgr.ChangeSkillCard(esa.BaseSkillId, attachInfo.operators[i].from, attachInfo.operators[i].to); } } }