Ejemplo n.º 1
0
 private static void GenerateList()
 {
     try
     {
         XmlDocument document = new XmlDocument();
         document.Load(path);
         for (XmlNode primaryNode = document.FirstChild; primaryNode != null; primaryNode = primaryNode.NextSibling)
         {
             if ("list".Equals(primaryNode.Name))
             {
                 for (XmlNode secundaryNode = primaryNode.FirstChild; secundaryNode != null; secundaryNode = secundaryNode.NextSibling)
                 {
                     if ("Chara".Equals(secundaryNode.Name))
                     {
                         XmlNamedNodeMap xml   = secundaryNode.Attributes;
                         CharaModel      chara = new CharaModel
                         {
                             Id   = int.Parse(xml.GetNamedItem("Id").Value),
                             Type = int.Parse(xml.GetNamedItem("Type").Value),
                             Life = int.Parse(xml.GetNamedItem("Life").Value)
                         };
                         charas.Add(chara);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Exception(ex);
     }
 }
Ejemplo n.º 2
0
 public static int GetLifeById(int charaId, int type)
 {
     for (int i = 0; i < charas.Count; i++)
     {
         CharaModel chara = charas[i];
         if (chara.Id == charaId && chara.Type == type)
         {
             return(chara.Life);
         }
     }
     return(100);
 }