Exemplo n.º 1
0
        public static SkillItem Parse(ISkill skill)
        {
            if (skill == null)
            {
                return(null);
            }
            SkillItem result;

            if (skill is CheatSkill)
            {
                CheatSkillItem csi = new CheatSkillItem();
                CheatSkill     cs  = skill as CheatSkill;
                result        = csi;
                csi.CardId    = cs.CardId;
                csi.CheatType = (int)cs.CheatType;
                csi.SkillName = cs.SkillName;
            }
            else if (skill is IAdditionalTypedSkill)
            {
                var atsi = new AdditionalTypedSkillItem();
                var ats  = skill as IAdditionalTypedSkill;
                result = atsi;
                atsi.AdditionalTypeId = GameEngine.Serialize(ats.AdditionalType);
            }
            else
            {
                result = new SkillItem();
            }

            result.PlayerItem = PlayerItem.Parse(skill.Owner);
            if (skill.Owner != null)
            {
                result.SkillId = (byte)skill.Owner.ActionableSkills.IndexOf(skill);
            }
            return(result);
        }
Exemplo n.º 2
0
        public static SkillItem Parse(ISkill skill)
        {
            if (skill == null) return null;
            SkillItem result;
            if (skill is CheatSkill)
            {
                CheatSkillItem csi = new CheatSkillItem();
                CheatSkill cs = skill as CheatSkill;
                result = csi;
                csi.CardId = cs.CardId;
                csi.CheatType = (int)cs.CheatType;
                csi.SkillName = cs.SkillName;
            }
            else if (skill is IAdditionalTypedSkill)
            {
                var atsi = new AdditionalTypedSkillItem();
                var ats = skill as IAdditionalTypedSkill;
                result = atsi;
                atsi.AdditionalTypeId = GameEngine.Serialize(ats.AdditionalType);
            }
            else
            {
                result = new SkillItem();
            }

            result.PlayerItem = PlayerItem.Parse(skill.Owner);
            if (skill.Owner != null)
            {
                result.SkillId = (byte)skill.Owner.ActionableSkills.IndexOf(skill);
            }
            return result;
        }