public override void Read(XmlElement os) { for (int i = 0; i < os.Attributes.Count; i++) { XmlAttribute child = os.Attributes[i] as XmlAttribute; if (child == null) { continue; } switch (child.Name) { case "Id": this.Id = ReadInt32(child.Value); break; case "Name": this.Name = child.Value; break; case "Dur": this.Dur = ReadFloat(child.Value); break; case "Speed": this.Speed = ReadFloat(child.Value); break; case "CD": this.CD = ReadFloat(child.Value); break; case "Dist": this.Dist = ReadFloat(child.Value); break; case "CostType": this.CostType = (ESkillCostType)ReadInt32(child.Value); break; case "CostNum": this.CostNum = ReadInt32(child.Value); break; } } XmlNode pNode = os.FirstChild; while (pNode != null) { ActData data = new ActData(); data.Read(pNode as XmlElement); Actions.Add(data); pNode = pNode.NextSibling; } }
public override void Read(XmlElement element) { this.Id = element.GetInt32("Id"); this.Name = element.GetString("Name"); this.Icon = element.GetString("Icon"); this.Desc = element.GetString("Desc"); this.SkillType = (ESkillType)element.GetInt32("SkillType"); this.Priority = element.GetInt32("Priority"); this.CountDown = element.GetFloat("CountDown"); this.SkillCostType = (ESkillCostType)element.GetInt32("SkillCostType"); this.SkillCostNum = element.GetInt32("SkillCostNum"); }
private void CaleSkillCost(CSkill pSkill) { if (pSkill == null) { return; } ESkillCostType eType = pSkill.GetCostType(); if (eType == ESkillCostType.ESCT_HP) { int nHP = pSkill.GetSkillCost(); m_pOwner.ChangeHP(m_pOwner, pSkill, -nHP, false); } if (eType == ESkillCostType.ESCT_MP) { int nMP = pSkill.GetSkillCost(); m_pOwner.ChangeMP(-nMP); } }