GameDefinitions.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System;
  2. using System.Collections.Generic;
  3. [Serializable]
  4. public class ModeDefinition
  5. {
  6. public string key;
  7. public string name;
  8. public string tag;
  9. public string description;
  10. public string previewMoves;
  11. public string previewFruits;
  12. }
  13. [Serializable]
  14. public class PowerUpDefinition
  15. {
  16. public string key;
  17. public string name;
  18. public string shortName;
  19. public int price;
  20. public string description;
  21. public string spriteResource;
  22. }
  23. [Serializable]
  24. public class CheckInReward
  25. {
  26. public bool coins;
  27. public int amount;
  28. public string itemKey;
  29. public string label;
  30. }
  31. [Serializable]
  32. public class DrawPrize
  33. {
  34. public bool coins;
  35. public int amount;
  36. public string itemKey;
  37. public int weight;
  38. public string label;
  39. }
  40. public static class GameDefinitions
  41. {
  42. public const int MaxLevel = 20;
  43. public const int MaxCheckInDay = 7;
  44. public const int LedgerLimit = 200;
  45. public const int DefaultCoins = 1500;
  46. public const int MaxAdRevivesPerDay = 5;
  47. public const int AdReviveMoveBonus = 5;
  48. public const string ClassicMode = "classic";
  49. public const string RushMode = "rush";
  50. public const string SealedMode = "sealed";
  51. public const string HammerItem = "hammer";
  52. public const string MovesItem = "moves";
  53. public const string ShuffleItem = "shuffle";
  54. public const string KeyItem = "key";
  55. public static readonly ModeDefinition[] Modes =
  56. {
  57. new ModeDefinition
  58. {
  59. key = ClassicMode,
  60. name = "CLASSIC STAND",
  61. tag = "NO TIMER",
  62. description = "Tap a fruit, then tap a shelf. Empty the stand.",
  63. previewMoves = "17 MOVES",
  64. previewFruits = "4 FRUITS"
  65. },
  66. new ModeDefinition
  67. {
  68. key = RushMode,
  69. name = "RUSH HOUR",
  70. tag = "TIMED",
  71. description = "A countdown runs - every set you serve adds 2 seconds.",
  72. previewMoves = "17 MOVES",
  73. previewFruits = "5 FRUITS"
  74. },
  75. new ModeDefinition
  76. {
  77. key = SealedMode,
  78. name = "SEALED STAND",
  79. tag = "CHAINED",
  80. description = "Chained shelves stay shut until you serve enough sets.",
  81. previewMoves = "18 MOVES",
  82. previewFruits = "6 FRUITS"
  83. }
  84. };
  85. public static readonly PowerUpDefinition[] PowerUps =
  86. {
  87. new PowerUpDefinition
  88. {
  89. key = HammerItem,
  90. name = "HAMMER",
  91. shortName = "HAMMER",
  92. price = 400,
  93. description = "Smash any single fruit off a shelf. Free - does not cost a move.",
  94. spriteResource = "UI/02_game/powerup/spr_powerup_hammer"
  95. },
  96. new PowerUpDefinition
  97. {
  98. key = MovesItem,
  99. name = "+5 MOVES",
  100. shortName = "+5 MOVES",
  101. price = 500,
  102. description = "Instantly add 5 moves to the current level.",
  103. spriteResource = "UI/02_game/powerup/spr_powerup_add_moves"
  104. },
  105. new PowerUpDefinition
  106. {
  107. key = ShuffleItem,
  108. name = "SHUFFLE",
  109. shortName = "SHUFFLE",
  110. price = 450,
  111. description = "Re-deal every visible fruit across the open shelves. Free - does not cost a move.",
  112. spriteResource = "UI/02_game/powerup/spr_powerup_shuffle"
  113. },
  114. new PowerUpDefinition
  115. {
  116. key = KeyItem,
  117. name = "MASTER KEY",
  118. shortName = "KEY",
  119. price = 700,
  120. description = "Snap the chains off one sealed shelf. With no chains left it empties a shelf instead.",
  121. spriteResource = "UI/02_game/powerup/spr_powerup_key"
  122. }
  123. };
  124. public static readonly CheckInReward[] CheckInRewards =
  125. {
  126. new CheckInReward { coins = true, amount = 200, label = "200" },
  127. new CheckInReward { coins = false, amount = 1, itemKey = HammerItem, label = "HAMMER" },
  128. new CheckInReward { coins = true, amount = 300, label = "300" },
  129. new CheckInReward { coins = false, amount = 1, itemKey = ShuffleItem, label = "SHUFFLE" },
  130. new CheckInReward { coins = true, amount = 500, label = "500" },
  131. new CheckInReward { coins = false, amount = 1, itemKey = MovesItem, label = "+5 MOVES" },
  132. new CheckInReward { coins = true, amount = 1000, label = "1000" }
  133. };
  134. public static readonly DrawPrize[] DrawPrizes =
  135. {
  136. new DrawPrize { coins = true, amount = 200, weight = 24, label = "200" },
  137. new DrawPrize { coins = false, amount = 1, itemKey = HammerItem, weight = 10, label = "HAMMER" },
  138. new DrawPrize { coins = true, amount = 500, weight = 16, label = "500" },
  139. new DrawPrize { coins = false, amount = 1, itemKey = ShuffleItem, weight = 10, label = "SHUFFLE" },
  140. new DrawPrize { coins = true, amount = 1000, weight = 7, label = "1000" },
  141. new DrawPrize { coins = false, amount = 1, itemKey = MovesItem, weight = 6, label = "+5 MOVES" },
  142. new DrawPrize { coins = true, amount = 300, weight = 18, label = "300" },
  143. new DrawPrize { coins = false, amount = 1, itemKey = KeyItem, weight = 9, label = "KEY" }
  144. };
  145. // Grid order used by the 3 x 3 draw board. -1 is the centre spin button.
  146. public static readonly int[] DrawGridPrizeMap = { 0, 1, 2, 3, -1, 4, 5, 6, 7 };
  147. // Clockwise ring around the centre of the 3 x 3 draw board.
  148. public static readonly int[] DrawRingGridOrder = { 0, 1, 2, 5, 8, 7, 6, 3 };
  149. // The twelve selectable avatars shown in 07_profile, in visual cell order.
  150. public static readonly int[] AvatarSpriteIndices = { 1, 2, 4, 6, 11, 5, 8, 10, 7, 9, 12, 13 };
  151. public static bool IsSelectableAvatar(int spriteIndex)
  152. {
  153. for (int i = 0; i < AvatarSpriteIndices.Length; i++)
  154. {
  155. if (AvatarSpriteIndices[i] == spriteIndex)
  156. return true;
  157. }
  158. return false;
  159. }
  160. public static ModeDefinition GetMode(string key)
  161. {
  162. for (int i = 0; i < Modes.Length; i++)
  163. {
  164. if (Modes[i].key == key)
  165. return Modes[i];
  166. }
  167. return Modes[0];
  168. }
  169. public static PowerUpDefinition GetPowerUp(string key)
  170. {
  171. for (int i = 0; i < PowerUps.Length; i++)
  172. {
  173. if (PowerUps[i].key == key)
  174. return PowerUps[i];
  175. }
  176. return null;
  177. }
  178. }