Esempio n. 1
0
    public void AddSkill(GameCmd.stAddSkillUserCmd_S cmd)
    {
        ISkillPart skillPart = SkillHelper.GetMainPlayerSkillPart();

        List <GameCmd.stAddSkillUserCmd_S.Item> skillList = new List <stAddSkillUserCmd_S.Item>();

        skillList = cmd.data;

        List <uint> updateSkillIds = new List <uint>();
        Dictionary <uint, SkillInfo> skillInfos = new Dictionary <uint, SkillInfo>();
        SkillInfo skillInfo = null;


        for (int i = 0; i < skillList.Count; i++)
        {
            var  item    = skillList[i];
            uint totalid = item.id;

            ushort skillID = (ushort)(totalid >> 16);
            ushort level   = (ushort)totalid;

            uint coldTime = item.cold;
            skillInfo = new SkillInfo((uint)skillID, (uint)level, coldTime);
            DataManager.Manager <LearnSkillDataManager>().InitUserSkill((uint)skillID, (uint)level, coldTime, item.hookfalg);
            DataManager.Manager <ArenaSetSkillManager>().InitUserSkill((uint)skillID, (uint)level, coldTime);
            DataManager.Manager <ClanManger>().InitUserSkill((uint)skillID, (uint)level, coldTime);
            Log.LogGroup("ZDY", "add skill {0} lev = {1}", skillID, level);
            if (skillPart != null)
            {
                skillPart.OnAddSkill((uint)skillID, (uint)level, coldTime);
            }
            else
            {
                Log.Error("skillpart is null");
            }


            if (!skillInfos.ContainsKey(skillID))
            {
                skillInfos.Add(skillID, skillInfo);
            }
        }

        //氏族技能
        DataManager.Manager <ClanManger>().OnPlayerSkillUpdate(skillInfos.Keys.ToList());
        DataManager.Manager <LearnSkillDataManager>().OnSkillAdd(skillInfos, (GameCmd.SkillAddType)cmd.type);
        DataManager.Manager <LearnSkillDataManager>().DispatchRedPoingMsg();
    }