Beispiel #1
0
 public static CSVSheet Create(string filePath)
 {
     TextAsset csvFile = Resources.Load(filePath) as TextAsset;
     if (csvFile != null)
     {
         var ret = new CSVSheet(filePath, new TextLine(csvFile.text));
         //Debug.Log(ret.Dump());
         return ret;
     }
     return null;
 }
        private void LoadCategoriesFromSheet(CategoryCollection categories, CSVSheet sheet)
        {
            categories.Clear();
            for (int x = 0; x < sheet.Columns; x++) {
                string category = sheet[x, 0];
                if (String.IsNullOrEmpty(category))
                    continue;

                for (int y = 1; y < sheet.Rows; y++)
                    if (!String.IsNullOrEmpty(sheet[x, y]))
                        categories.AddCard(category, sheet[x, y]);
            }
        }
 private CSVSheet SaveCategoriesToSheet(CategoryCollection categories)
 {
     CSVSheet sheet = new CSVSheet();
     for (int x = 0; x < categories.Count; x++) {
         sheet[x, 0] = categories[x].Name;
         for (int y = 0; y < categories[x].Cards.Count; y++)
             sheet[x, y + 1] = categories[x].Cards[y];
     }
     return sheet;
 }
Beispiel #4
0
 StringEnumGenerator(string resPath)
 {
     this.sheet = CSVSheet.Create(resPath);
     Assert.IsTrue(sheet != null);
 }