Ejemplo n.º 1
0
 public static IReward[] XMLStringToActiveRewards(string xml)
 {
     FastList<IReward> rewards = new FastList<IReward> ();
     XmlDocument doc = new XmlDocument ();
     doc.LoadXml (xml);
     foreach (XmlNode rewardNode in doc.SelectNodes("boost")) {
         XmlAttributeCollection atts = rewardNode.Attributes;
         Boost b = new Boost();
         b.ValueID = Data.StringToValueID(atts ["name"].Value);
         b.Value = float.Parse(atts ["value"].Value);
         if (atts ["endDate"] != null) {
             b.EndDate = DateTime.Parse (atts ["endDate"].Value);
         }
         b.Activate ();
         rewards.Add (b);
     }
     return rewards.ToArray ();
 }