index.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Impact Game</title>
  5. <style type="text/css">
  6. html,body {
  7. background-color: #333;
  8. color: #fff;
  9. font-family: helvetica, arial, sans-serif;
  10. margin: 0;
  11. padding: 0;
  12. font-size: 12pt;
  13. }
  14. #canvas {
  15. position: absolute;
  16. left: 0;
  17. right: 0;
  18. top: 0;
  19. bottom: 0;
  20. margin: auto;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <canvas id="canvas"></canvas>
  26. <script type="text/javascript">
  27. function getParameterByName(name, url) {
  28. if (!url) url = window.location.href;
  29. name = name.replace(/[\[\]]/g, "\\$&");
  30. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  31. results = regex.exec(url);
  32. if (!results) return null;
  33. if (!results[2]) return '';
  34. return decodeURIComponent(results[2].replace(/\+/g, " "));
  35. }
  36. var sampleGames = {
  37. memory: {
  38. id: "1",
  39. folderName: "memory",
  40. includePath: "memory",
  41. displayName: "Memory Level 3",
  42. backgroundColor: "#8577B3",
  43. backgroundHighlightColor: "#9688C4",
  44. complementColor: "#43B6CF",
  45. complementHighlightColor: "#54C7DF",
  46. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  47. gameIconIndex: 2,
  48. },
  49. missingpiece: {
  50. id: "2",
  51. folderName: "missingpiece",
  52. includePath: "missingpiece",
  53. displayName: "Missing Piece Level 1",
  54. backgroundColor: "#55AAAA",
  55. backgroundHighlightColor: "#66BBBB",
  56. complementColor: "#228888",
  57. complementHighlightColor: "#339999",
  58. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  59. gameIconIndex: 8,
  60. },
  61. swarm: {
  62. id: "3",
  63. folderName: "swarm",
  64. includePath: "swarm",
  65. displayName: "Swarm Level 2",
  66. backgroundColor: "#42AC71",
  67. backgroundHighlightColor: "#53BD82",
  68. complementColor: "#315B43",
  69. complementHighlightColor: "#426C54",
  70. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  71. gameIconIndex: 11,
  72. },
  73. lights: {
  74. id: "4",
  75. folderName: "lights",
  76. includePath: "lights",
  77. displayName: "Lights Level 2",
  78. backgroundColor: "#26455C",
  79. backgroundHighlightColor: "#37566D",
  80. complementColor: "#73E9FF",
  81. complementHighlightColor: "#84F1FF",
  82. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  83. gameIconIndex: 5,
  84. },
  85. codebreaker: {
  86. id: "5",
  87. folderName: "codebreaker",
  88. includePath: "codebreaker",
  89. displayName: "Code Breaker Level 4",
  90. backgroundColor: "#82837E",
  91. backgroundHighlightColor: "#93948F",
  92. complementColor: "#94B053",
  93. complementHighlightColor: "#BDEB07",
  94. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  95. gameIconIndex: 5,
  96. },
  97. breakout: {
  98. id: "6",
  99. folderName: "breakout",
  100. includePath: "breakout",
  101. displayName: "Breakout Level 1",
  102. backgroundColor: "#1D2425",
  103. backgroundHighlightColor: "#2E3536",
  104. complementColor: "#43B6CF",
  105. complementHighlightColor: "#54C7DF",
  106. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  107. gameIconIndex: 11,
  108. },
  109. wrongswap: {
  110. id: "7",
  111. folderName: "wrongswap",
  112. includePath: "wrongswap",
  113. displayName: "Wrong Swap",
  114. backgroundColor: "#67917A",
  115. backgroundHighlightColor: "#78A28B",
  116. complementColor: "#CCBF82",
  117. complementHighlightColor: "#DDCF93",
  118. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  119. gameIconIndex: 2,
  120. },
  121. weighty: {
  122. id: "8",
  123. folderName: "weighty",
  124. includePath: "weighty",
  125. displayName: "Weighty",
  126. backgroundColor: "#442A42",
  127. backgroundHighlightColor: "#553B53",
  128. complementColor: "#BB99B8",
  129. complementHighlightColor: "#CCAAC9",
  130. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  131. gameIconIndex: 5,
  132. },
  133. grouping: {
  134. id: "9",
  135. folderName: "grouping",
  136. includePath: "grouping",
  137. displayName: "Grouping",
  138. backgroundColor: "#C7E9FF",
  139. backgroundHighlightColor: "#D8FAFF",
  140. complementColor: "#BB99B8",
  141. complementHighlightColor: "#CCAAC9",
  142. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  143. gameIconIndex: 8,
  144. },
  145. nimchips: {
  146. id: "10",
  147. folderName: "nimchips",
  148. includePath: "nimchips",
  149. displayName: "NIM Chips",
  150. contrastColor: "#2E594F",
  151. contrastHighlightColor: "#3F6A5F",
  152. backgroundColor: "#668E6D",
  153. backgroundHighlightColor: "#779F7E",
  154. complementColor: "#ADDA9C",
  155. complementHighlightColor: "#BEEBAD",
  156. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  157. gameIconIndex: 8,
  158. },
  159. sequencer: {
  160. id: "11",
  161. folderName: "sequencer",
  162. includePath: "sequencer",
  163. displayName: "Sequencer",
  164. backgroundColor: "#730006",
  165. backgroundHighlightColor: "#841117",
  166. contrastColor: "#BF000A",
  167. contrastHighlightColor: "#CF111B",
  168. complementColor: "#DBBE94",
  169. complementHighlightColor: "#ECCFA5",
  170. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  171. gameIconIndex: 2,
  172. },
  173. lightningbugs: {
  174. id: "12",
  175. folderName: "lightningbugs",
  176. includePath: "lightningbugs",
  177. displayName: "lightningbugs",
  178. backgroundColor: "#1D2425",
  179. backgroundHighlightColor: "#2E3536",
  180. complementColor: "#94D553",
  181. complementHighlightColor: "#A5E664",
  182. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  183. gameIconIndex: 11,
  184. },
  185. shuffle: {
  186. id: "13",
  187. folderName: "shuffle",
  188. includePath: "shuffle",
  189. displayName: "Shuffle Level 1",
  190. backgroundColor: "#D56D22",
  191. backgroundHighlightColor: "#F78F44",
  192. contrastColor: "#B34B00",
  193. contrastHighlightColor: "#D56D22",
  194. complementColor: "#E9EB04",
  195. complementHighlightColor: "#FAFC15",
  196. gameIcon: "../dist/common/spr-icons-categories-lg.png",
  197. gameIconIndex: 11,
  198. },
  199. };
  200. let availableGames = Object.keys(sampleGames);
  201. var gameToPlay = getParameterByName("game");
  202. if(!gameToPlay) {
  203. gameToPlay = availableGames[Math.floor(availableGames.length * Math.random())];
  204. window.location.search = "?game=" + gameToPlay;
  205. }
  206. var pmGameData = sampleGames[gameToPlay];
  207. pmGameData.assetPath = "./";
  208. pmGameData.start = function() {};
  209. pmGameData.finish = function() {};
  210. var script = document.createElement('script');
  211. script.onload = function () {
  212. //do stuff with the script
  213. };
  214. script.src = "./"+gameToPlay+"/game-baked.js";
  215. document.head.appendChild(script);
  216. </script>
  217. </body>
  218. </html>