示例#1
0
        internal CardItem(XmlNode cardNode, XmlNode langNode, CardTypeItem typeItem)
            : this()
        {
            this.UniqueID = Guid.NewGuid().ToString();

              this.Id = cardNode["id"].InnerText;
              this.SetCode = cardNode["set"].InnerText;
              this.TypeCode = cardNode["type"].InnerText;
              this.RarityCode = cardNode["rarity"].InnerText;
              this.StyleCode = cardNode["style"].InnerText;

              this.Name = langNode["name"].InnerText;
              this.Text = langNode["text"].InnerText;
              this.FlavorText = langNode["flavorText"] != null ? langNode["flavorText"].InnerText : string.Empty;
              this.Type = typeItem.Name;

              this.Artist = cardNode["artist"].InnerText;
              this.ImagePath = cardNode["imagePath"].InnerText;
              this.BgImagePathLarge = cardNode["bgimagepathLarge"].InnerText;
              this.BgImagePathSmall = cardNode["bgimagepathSmall"].InnerText;
              this.Cost = cardNode["cost"].InnerText;
              this.Characteristics = cardNode["characteristics"].InnerText;

              foreach(XmlNode colorNode in cardNode.SelectNodes("colors/color"))
            this.Colors.Add(colorNode.InnerText);

              this.ColorCode = string.Concat(this.Colors.ToArray());
        }
 public CardTypeItem GetByCode(string code)
 {
     CardTypeItem item = null;
       XmlNode nodeItem = typesNode.SelectSingleNode(string.Concat("item[@code='", code, "']"));
       if(nodeItem != null)
       {
     XmlNode nodeLang = typesLangNode.SelectSingleNode(string.Concat("item[@code='", nodeItem.Attributes["code"].Value, "']"));
     item = new CardTypeItem(nodeItem, nodeLang);
       }
       return item;
 }