GameSaveData.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using System;
  2. using System.Collections.Generic;
  3. [Serializable]
  4. public class SaveItemCounts
  5. {
  6. public int hammer = 1;
  7. public int moves = 1;
  8. public int shuffle = 1;
  9. public int key = 0;
  10. public int Get(string itemKey)
  11. {
  12. switch (itemKey)
  13. {
  14. case GameDefinitions.HammerItem: return hammer;
  15. case GameDefinitions.MovesItem: return moves;
  16. case GameDefinitions.ShuffleItem: return shuffle;
  17. case GameDefinitions.KeyItem: return key;
  18. default: return 0;
  19. }
  20. }
  21. public void Add(string itemKey, int amount)
  22. {
  23. switch (itemKey)
  24. {
  25. case GameDefinitions.HammerItem: hammer += amount; break;
  26. case GameDefinitions.MovesItem: moves += amount; break;
  27. case GameDefinitions.ShuffleItem: shuffle += amount; break;
  28. case GameDefinitions.KeyItem: key += amount; break;
  29. }
  30. }
  31. }
  32. [Serializable]
  33. public class SaveModeClears
  34. {
  35. public int classic;
  36. public int rush;
  37. public int sealedLevels;
  38. public int Get(string modeKey)
  39. {
  40. switch (modeKey)
  41. {
  42. case GameDefinitions.ClassicMode: return classic;
  43. case GameDefinitions.RushMode: return rush;
  44. case GameDefinitions.SealedMode: return sealedLevels;
  45. default: return 0;
  46. }
  47. }
  48. public void Set(string modeKey, int value)
  49. {
  50. value = Math.Max(0, Math.Min(GameDefinitions.MaxLevel, value));
  51. switch (modeKey)
  52. {
  53. case GameDefinitions.ClassicMode: classic = value; break;
  54. case GameDefinitions.RushMode: rush = value; break;
  55. case GameDefinitions.SealedMode: sealedLevels = value; break;
  56. }
  57. }
  58. public int Total()
  59. {
  60. return classic + rush + sealedLevels;
  61. }
  62. }
  63. [Serializable]
  64. public class SaveCheckInState
  65. {
  66. public int day = 1;
  67. public string last = "";
  68. }
  69. [Serializable]
  70. public class SaveLotteryState
  71. {
  72. public string last = "";
  73. }
  74. [Serializable]
  75. public class SavePlayerState
  76. {
  77. public string name = "LuckyPlayer";
  78. public string id = "";
  79. public int avatar = 1;
  80. }
  81. [Serializable]
  82. public class SavePlayerStats
  83. {
  84. public int clears;
  85. public int served;
  86. public int best;
  87. public int earned;
  88. }
  89. [Serializable]
  90. public class SaveSettings
  91. {
  92. public bool bgm = true;
  93. public bool sfx = true;
  94. public bool reduceMotion;
  95. public string localeId = "en";
  96. }
  97. [Serializable]
  98. public class SaveAdState
  99. {
  100. public string reviveDate = "";
  101. public int reviveCount;
  102. }
  103. [Serializable]
  104. public class LedgerEntry
  105. {
  106. public string type;
  107. public string note;
  108. public int amount;
  109. public string time;
  110. }
  111. [Serializable]
  112. public class GameSaveData
  113. {
  114. public int version = 1;
  115. public int coins = GameDefinitions.DefaultCoins;
  116. public SaveItemCounts items = new SaveItemCounts();
  117. public SaveModeClears cleared = new SaveModeClears();
  118. public SaveCheckInState checkin = new SaveCheckInState();
  119. public SaveLotteryState lottery = new SaveLotteryState();
  120. public int tickets;
  121. public string selectedMode = GameDefinitions.ClassicMode;
  122. public SavePlayerState player = new SavePlayerState();
  123. public SavePlayerStats stats = new SavePlayerStats();
  124. public SaveSettings settings = new SaveSettings();
  125. public SaveAdState ads = new SaveAdState();
  126. public int tut;
  127. public int story;
  128. public List<LedgerEntry> ledger = new List<LedgerEntry>();
  129. }