private void GenFakeExtendSKills() { for (int i = 0; i < 30; i++) { for (int n = 0; n < 5; n++) { ExtentSkillAsset sa = new ExtentSkillAsset(); sa.SkillId = string.Format("test_extend_{0:00}_{1:00}", i + 1, n + 1); sa.BaseSkillId = string.Format("test_{0:00}", i + 1); sa.SkillName = string.Format("扩展技能{0:00}-{1:00}", i + 1, n + 1); sa.SkingDesp = string.Format("这是测试用的扩展技能{0:00}-{1:00}", i + 1, n + 1); sa.Prices.Add(0); sa.MaxLevel = 5; for (int j = 0; j < 5; j++) { if (n < 2) { sa.LevelDesp.Add(string.Format("将一张基础攻击卡升级为test_{0:00}", i + 1 + j + 1)); } else if (n < 4) { sa.LevelDesp.Add(string.Format("将一张基础防御卡升级为test_armor_{0:00}", i + 1 + j + 1)); } else { sa.LevelDesp.Add(string.Format("将一张基础加血卡升级为test_xue_{0:00}", i + 1 + j + 1)); } sa.Difficulties.Add(i * 3 + j); sa.LevelStatusAdd.Add(i + j); } for (int j = 0; j < 5; j++) { AttachCardsInfo attached = new AttachCardsInfo(); CardOperator opt1 = new CardOperator(); BaseSkillAsset bsa = GetSkillAsset(sa.BaseSkillId) as BaseSkillAsset; opt1.opt = eCardOperatorMode.Replace; if (n < 2) { opt1.from = string.Format("test_{0:00}", i + 1); opt1.to = string.Format("test_{0:00}", i + 1 + j + 1); } else if (n < 4) { opt1.from = string.Format("test_armor_{0:00}", i + 1); opt1.to = string.Format("test_armor_{0:00}", i + 1 + j + 1); } else { opt1.from = string.Format("test_xue_{0:00}", i + 1); opt1.to = string.Format("test_xue_{0:00}", i + 1 + j + 1); } //opt1.from = string.Format("test_{0:00}", i + 1); //opt1.to = string.Format("test_{0:00}", i + 1 + j + 1); attached.operators.Add(opt1); sa.AttachCardInfos.Add(attached); } SkillAssetDict.Add(sa.SkillId, sa); } } }
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); } } }