예제 #1
0
        public void SetSkillList(KNMSkillDataList skillList)
        {
            ActiveSkillDict.Clear();
            activeSkillList = new uint[skillList.ActiveSkillData.Count];
            int index = 0;

            foreach (KNMActiveSkillData nmactiveSkillData in skillList.ActiveSkillData)
            {
                ActiveSkillData activeSkillData = new ActiveSkillData();
                activeSkillData.Level    = nmactiveSkillData.SkillLevel;
                activeSkillData.SkillExp = nmactiveSkillData.SkillExp;
                activeSkillData.SkillID  = nmactiveSkillData.SkillID;
                ActiveSkillDict.Add(activeSkillData.SkillID, activeSkillData);
                activeSkillList[index++] = nmactiveSkillData.SkillID;
                KActiveSkill skill = KConfigFileManager.GetInstance().GetActiveSkill(activeSkillData.SkillID, activeSkillData.Level);
                activeSkillData.cdTicket.SetCD(skill.SkillCD);
            }


            PassiveSkillDict.Clear();
            foreach (KNMPassiveSkillData nmapassiveSkillData in skillList.PassiveSkillData)
            {
                PassiveSkillData passiveSkillData = new PassiveSkillData();
                passiveSkillData.Level   = nmapassiveSkillData.SkillLevel;
                passiveSkillData.SkillID = nmapassiveSkillData.SkillID;

                KPassiveSkill passiveSkillSetting = KConfigFileManager.GetInstance().GetPassiveSkill(passiveSkillData.SkillID, 1);
                if (passiveSkillSetting.SkillType > 0)
                {
                    PassiveSkillDict.Add(passiveSkillData.SkillID, passiveSkillData);
                }
                else
                {
                    TalentSkillDict.Add(passiveSkillData.SkillID, passiveSkillData);
                }
            }
        }
예제 #2
0
        //升级主动技能
        public void UpgradeSkill(uint skillID, int type)
        {
            int skillIdx = 0;

            if (type == 1)
            {
                skillIdx = 0;
                ActiveSkillData activeSkillData;
                if (ActiveSkillDict.TryGetValue(skillID, out activeSkillData) == false)
                {
                    activeSkillData         = new ActiveSkillData();
                    activeSkillData.SkillID = skillID;
                    ActiveSkillDict.Add(skillID, activeSkillData);
                    uint [] oldList = activeSkillList;
                    activeSkillList = new uint[activeSkillList.Length + 1];
                    Array.Copy(oldList, activeSkillList, oldList.Length);
                    activeSkillList[oldList.Length] = skillID;

                    HashSet <uint> rushSkillList = KConfigFileManager.GetInstance().GetRushSkillSet();
                    if (!rushSkillList.Contains(skillID))
                    {
                        for (int i = 0; i < ShortCutDataManager.Instance.Count; i++)
                        {
                            ShortCutData data = ShortCutDataManager.Instance.datas[i];
                            if (data.type == SHORTCUTITEM.NONE)
                            {
                                ButtonBarView.GetInstance().SetShortCut(i, SHORTCUTITEM.SKILL, (int)skillID, true);
                                break;
                            }
                        }
                    }
                }
                activeSkillData.Level += 1;
                KActiveSkill skill = KConfigFileManager.GetInstance().GetActiveSkill(activeSkillData.SkillID, activeSkillData.Level);
                activeSkillData.cdTicket.SetCD(skill.SkillCD);
            }
            else
            {
                KPassiveSkill    passiveSkillSetting = KConfigFileManager.GetInstance().GetPassiveSkill(skillID, 1);
                PassiveSkillData passiveSkillData;
                if (passiveSkillSetting.SkillType > 0)
                {
                    if (PassiveSkillDict.TryGetValue(skillID, out passiveSkillData) == false)
                    {
                        passiveSkillData = new PassiveSkillData();
                        PassiveSkillDict.Add(skillID, passiveSkillData);
                    }
                    passiveSkillData.Level += 1;
                    skillIdx = 1;
                }
                else
                {
                    if (TalentSkillDict.TryGetValue(skillID, out passiveSkillData) == false)
                    {
                        passiveSkillData = new PassiveSkillData();
                        TalentSkillDict.Add(skillID, passiveSkillData);
                    }
                    passiveSkillData.Level += 1;
                    skillIdx = 2;
                }
            }
            EventDispatcher.GameWorld.Dispath(ControllerCommand.UPDATE_SKILL, skillIdx, skillID);
        }