Title.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. namespace MaidStatus
  4. {
  5. public static class Title
  6. {
  7. public static string Get(Status status)
  8. {
  9. Title.CreateData();
  10. int num = Title.checkAchivementList.Count - 1;
  11. while (0 <= num)
  12. {
  13. if (Title.checkAchivementList[num].Value.GreaterThanOrEqualToStatus(status))
  14. {
  15. return Title.checkAchivementList[num].Key;
  16. }
  17. num--;
  18. }
  19. return string.Empty;
  20. }
  21. public static void CreateData()
  22. {
  23. if (Title.checkAchivementList != null)
  24. {
  25. return;
  26. }
  27. Title.checkAchivementList = new List<KeyValuePair<string, ParametersPack>>();
  28. using (AFileBase afileBase = GameUty.FileSystem.FileOpen("maid_status_title_list.nei"))
  29. {
  30. using (CsvParser csvParser = new CsvParser())
  31. {
  32. bool condition = csvParser.Open(afileBase);
  33. NDebug.Assert(condition, "maid_status_title_list.nei\nopen failed.");
  34. for (int i = 1; i < csvParser.max_cell_y; i++)
  35. {
  36. int cell_x = 0;
  37. if (!csvParser.IsCellToExistData(cell_x, i))
  38. {
  39. break;
  40. }
  41. string cellAsString = csvParser.GetCellAsString(cell_x++, i);
  42. ParametersPack parametersPack = new ParametersPack();
  43. while (csvParser.IsCellToExistData(cell_x, i))
  44. {
  45. string cellAsString2 = csvParser.GetCellAsString(cell_x++, i);
  46. int cellAsInteger = csvParser.GetCellAsInteger(cell_x++, i);
  47. parametersPack.Add(ParametersPack.NameToStatusType(cellAsString2), cellAsInteger);
  48. }
  49. Title.checkAchivementList.Add(new KeyValuePair<string, ParametersPack>(cellAsString, parametersPack));
  50. }
  51. }
  52. }
  53. }
  54. private static List<KeyValuePair<string, ParametersPack>> checkAchivementList;
  55. }
  56. }