public DecorationData(CatalogItem d) { id = d.ItemId; name = d.DisplayName; description = d.Description; if (id == "catFoodCandle") { cost = (int)d.VirtualCurrencyPrices["RM"]; } else { cost = (int)d.VirtualCurrencyPrices["NM"]; } sprite = d.ItemImageUrl; //getting the customdata from the object var custom = JsonConvert.DeserializeObject <Dictionary <string, string> >(d.CustomData); starLevel = 0; atmosphere = 0; if (custom["starLevel"] != "") { starLevel = Int32.Parse(custom["starLevel"]); } if (custom["atmosphere"] != "") { atmosphere = Int32.Parse(custom["atmosphere"]); } location = LocationFromString(custom["type"]); }
public DecorationData(XmlNode d, int s, string loc) { if (d.Attributes["id"].Value != "") { id = d.Attributes["id"].Value; } name = d.Attributes["name"].Value; description = d.Attributes["text"].Value; if (d.Attributes["price"].Value != "") { cost = int.Parse(d.Attributes["price"].Value); } if (d.Attributes["atmosphere"].Value != "") { atmosphere = int.Parse(d.Attributes["atmosphere"].Value); } sprite = d.Attributes["image"].Value; starLevel = s; location = LocationFromString(loc); }