CustomViewItemData.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. namespace SceneEditWindow
  5. {
  6. public class CustomViewItemData
  7. {
  8. public static List<CustomViewItemData.ItemData> itemList { get; private set; }
  9. public static void Create()
  10. {
  11. if (CustomViewItemData.itemList != null)
  12. {
  13. return;
  14. }
  15. CustomViewItemData.itemList = new List<CustomViewItemData.ItemData>();
  16. using (AFileBase afileBase = GameUty.FileSystem.FileOpen("edit_custom_view.nei"))
  17. {
  18. using (CsvParser csvParser = new CsvParser())
  19. {
  20. bool condition = csvParser.Open(afileBase);
  21. NDebug.Assert(condition, "edit_custom_view.nei\nopen failed.");
  22. for (int i = 1; i < csvParser.max_cell_y; i++)
  23. {
  24. if (csvParser.IsCellToExistData(0, i))
  25. {
  26. int num = 0;
  27. CustomViewItemData.ItemData item = default(CustomViewItemData.ItemData);
  28. item.page = csvParser.GetCellAsInteger(num++, i) - 1;
  29. try
  30. {
  31. item.mpn = (MPN)Enum.Parse(typeof(MPN), csvParser.GetCellAsString(num++, i));
  32. }
  33. catch (Exception e)
  34. {
  35. NDebug.AssertParseError("MPN", e);
  36. }
  37. item.iconTexName = Path.ChangeExtension(csvParser.GetCellAsString(num++, i).ToString(), "tex");
  38. item.requestNewFace = (csvParser.GetCellAsString(num++, i) == "〇");
  39. CustomViewItemData.itemList.Add(item);
  40. }
  41. }
  42. }
  43. }
  44. }
  45. public struct ItemData
  46. {
  47. public int page;
  48. public MPN mpn;
  49. public string iconTexName;
  50. public bool requestNewFace;
  51. }
  52. }
  53. }