Пример #1
0
    private void LoadDb(TextAsset csvFile)
    {
        var blank = "";

        string[][] grid = CsvReadWrite.LoadTextFile(csvFile);
        for (int i = 1; i < grid.Length; i++)
        {
            if (grid[i][0] == blank)
            {
                return;
            }

            ItemData row = new ItemData();
            row.GlobalID     = Int32.Parse(grid[i][0]);
            row.CategoryID   = Int32.Parse(grid[i][1]);
            row.CategoryName = grid[i][2];
            row.TypeID       = Int32.Parse(grid[i][3]);
            row.TypeName     = grid[i][4];
            TypeNameList.Add(row.TypeName);
            row.Size       = new IntVector2(Int32.Parse(grid[i][5]), Int32.Parse(grid[i][6]));
            row.Icon       = Resources.Load <Sprite>("ItemIcons/" + grid[i][4]); // TODO : Use Stringbuilder 스트링빌더 이용하기
            row.MinYield   = Int32.Parse(grid[i][7]);
            row.MaxYield   = Int32.Parse(grid[i][8]);
            row.YieldAdder = Int32.Parse(grid[i][9]);
            dbList.Add(row);
        }
    }
Пример #2
0
    public List <ItemClass> LoadItems(TextAsset itemFile)
    {
        string[][]       grid     = CsvReadWrite.LoadTextFile(itemFile);
        List <ItemClass> itemList = new List <ItemClass>();

        for (int i = 1; i < grid.Length; i++)
        {
            ItemClass item = new ItemClass();
            ItemClass.SetItemValues(item, Int32.Parse(grid[i][0]), Int32.Parse(grid[i][1]), Int32.Parse(grid[i][2]));
            itemList.Add(item);
        }
        return(itemList);
    }
Пример #3
0
 private void LoadDb(TextAsset csvFile)
 {
     string[][] grid = CsvReadWrite.LoadTextFile(csvFile);
     for (int i = 1; i < grid.Length; i++)
     {
         ItemData row = new ItemData();
         row.GlobalID     = Int32.Parse(grid[i][0]);
         row.CategoryID   = Int32.Parse(grid[i][1]);
         row.CategoryName = grid[i][2];
         row.TypeID       = Int32.Parse(grid[i][3]);
         row.TypeName     = grid[i][4];
         TypeNameList.Add(row.TypeName);
         row.Size = new IntVector2(Int32.Parse(grid[i][5]), Int32.Parse(grid[i][6]));
         row.Icon = Resources.Load <Sprite>("ItemIcons/" + grid[i][4]);
         dbList.Add(row);
     }
 }