예제 #1
0
    public static void LoadItemInfo()//メンバ変数とItemFieldの更新
    {
        string path = SystemVariables.RootPath + "/Data/Item/ItemProperty";

        string[] files = System.IO.Directory.GetFiles(@path, "*.json", System.IO.SearchOption.TopDirectoryOnly);

        ItemField          = new List <ItemProperty>();//メンバ変数とItemFieldを空に
        ItemIDResolution   = new Dictionary <string, int>();
        ItemNameResolution = new List <string>();

        foreach (string i in files)//全アイテムを読み込み, ItemField, ItemIDResolution, ItemNameResolutionに追加
        {
            ItemProperty itemProperty = new ItemProperty();
            if (itemProperty.JsonImport(path, Path.GetFileNameWithoutExtension(i)))
            {
                int idtemp = ItemIDResolution.Count;
                ItemField.Add(itemProperty);
                ItemIDResolution.Add(itemProperty.Name, idtemp);//末尾に追加しIDは0からはじめ、追加前の長さをIDとした
                ItemNameResolution.Add(itemProperty.Name);
            }
        }
    }