示例#1
0
    /////////////////
    public void Init(JsonObject json)
    {
        if (json == null)
        {
            return;
        }

        JsonArray equipments = json.Get <JsonArray>("equipments");

        for (int i = 0; i < equipments.Count; i++)
        {
            string        obj  = (string)equipments[i];
            EquipmentItem item = GameDataStorage.Instance.GetEquipmentByName(obj);

            PlayerEquipments.Add(item);
        }

        JsonArray materials = json.Get <JsonArray>("materials");

        foreach (JsonObject item in materials)
        {
            MaterialData data   = GameDataStorage.Instance.GetMaterialByName((string)item["name"]);
            int          amount = item.GetInt("amount");

            PlayerMaterials.Add(new MaterialInfo(data, amount));
        }
    }