PhotoAlignmentPreset.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class PhotoAlignmentPreset
  5. {
  6. public static void Create()
  7. {
  8. if (PhotoAlignmentPreset.datas != null)
  9. {
  10. return;
  11. }
  12. PhotoAlignmentPreset.datas = new List<PhotoAlignmentPreset.Data>();
  13. using (AFileBase afileBase = GameUty.FileSystem.FileOpen("phot_alignmentpreset_list.nei"))
  14. {
  15. using (CsvParser csvParser = new CsvParser())
  16. {
  17. bool condition = csvParser.Open(afileBase);
  18. NDebug.Assert(condition, "phot_alignmentpreset_list.nei\nopen failed.");
  19. for (int i = 1; i < csvParser.max_cell_y; i++)
  20. {
  21. if (csvParser.IsCellToExistData(0, i))
  22. {
  23. int num = 0;
  24. PhotoAlignmentPreset.Data data = new PhotoAlignmentPreset.Data();
  25. data.id = csvParser.GetCellAsInteger(num++, i);
  26. data.thumbnailName = csvParser.GetCellAsString(num++, i);
  27. data.positions = new Vector3[5];
  28. for (int j = 0; j < data.positions.Length; j++)
  29. {
  30. data.positions[j] = csvParser.GetCellAsVector3(num++, i, ',');
  31. }
  32. PhotoAlignmentPreset.datas.Add(data);
  33. }
  34. }
  35. }
  36. }
  37. }
  38. public static PhotoAlignmentPreset.Data GetData(int id)
  39. {
  40. for (int i = 0; i < PhotoAlignmentPreset.datas.Count; i++)
  41. {
  42. if (PhotoAlignmentPreset.datas[i].id == id)
  43. {
  44. return PhotoAlignmentPreset.datas[i];
  45. }
  46. }
  47. return null;
  48. }
  49. public static List<PhotoAlignmentPreset.Data> datas { get; private set; }
  50. public class Data
  51. {
  52. public int id;
  53. public string thumbnailName;
  54. public Vector3[] positions;
  55. }
  56. }