Esempio n. 1
0
        public Skill CreateSkill(uint skill_id, Actor owner)
        {
            SkillData skill_data = null;

            if (!mClientSkillInfos.TryGetValue(skill_id, out skill_data))
            {
                var skill_info = DBSkillSev.Instance.GetSkillInfo(skill_id);
                if (skill_info != null)
                {
                    skill_data = SkillData.CreateSkillData(skill_info);

                    // 如果有子技能
                    if (skill_info.ParentSkillId != 0 && skill_info.ParentSkillId == skill_info.Id)
                    {
                        var cur_skill_data = skill_info;
                        while (cur_skill_data.ChildSkillId != 0)
                        {
                            var child_skill_info = DBSkillSev.Instance.GetSkillInfo(cur_skill_data.ChildSkillId);
                            if (child_skill_info == null)
                            {
                                break;
                            }

                            var child_action_data = SkillActionData.CreateSkillActionData(child_skill_info);

                            if (!skill_data.SkillActionList.Contains(child_action_data))
                            {
                                skill_data.SkillActionList.Add(child_action_data);
                            }

                            cur_skill_data = child_skill_info;
                        }
                    }
                }
            }

            if (skill_data != null)
            {
                Skill skill = new Skill(skill_data);
                skill.SetCaster(owner);
                return(skill);
            }

            return(null);
        }