Beispiel #1
0
 public ShopItem(string displayName, string id, int initialCost, ShopItemUI.ItemProgression progression, float ratio, int limit, string imageURL, string description)
 {
     this.displayName = displayName;
     this.id          = id;
     this.initialCost = initialCost;
     this.progression = progression;
     this.ratio       = ratio;
     this.limit       = limit;
     this.imageURL    = imageURL;
     this.description = description;
 }
    public void LegacyLoad(Dictionary <string, object> data)
    {
        List <object> ls = (List <object>)data["lists"];

        for (int i = 0; i < ls.Count; i++)
        {
            Dictionary <string, object> list = (Dictionary <string, object>)ls[i];
            ShopItemList  sil   = new ShopItemList((string)list["listName"]);
            List <object> items = (List <object>)list["items"];
            for (int j = 0; j < items.Count; j++)
            {
                Dictionary <string, object> item = (Dictionary <string, object>)items[j];

                string displayName = (string)item["displayName"];
                string id          = (string)item["id"];
                int    initialCost = ToInt(item["initialCost"]);
                ShopItemUI.ItemProgression progression = (ShopItemUI.ItemProgression)(ToInt(item["progression"]));
                float  ratio       = ToFloat(item["ratio"]);
                int    limit       = ToInt(item["limit"]);
                string imageURL    = (string)item["imageURL"];
                string description = (string)item["description"];

                ShopItem si = new ShopItem(
                    displayName,
                    id,
                    initialCost,
                    progression,
                    ratio,
                    limit,
                    imageURL,
                    description
                    );
                sil.addShopItem(si);
            }

            lists.Add(sil.listName, sil);
        }
    }