123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>Impact Game</title>
- <style type="text/css">
- html,body {
- background-color: #333;
- color: #fff;
- font-family: helvetica, arial, sans-serif;
- margin: 0;
- padding: 0;
- font-size: 12pt;
- }
- #canvas {
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- margin: auto;
- }
- </style>
- </head>
- <body>
- <canvas id="canvas"></canvas>
- <script type="text/javascript">
- function getParameterByName(name, url) {
- if (!url) url = window.location.href;
- name = name.replace(/[\[\]]/g, "\\$&");
- var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
- results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
- return decodeURIComponent(results[2].replace(/\+/g, " "));
- }
- var sampleGames = {
- memory: {
- id: "1",
- folderName: "memory",
- includePath: "memory",
- displayName: "Memory Level 3",
- backgroundColor: "#8577B3",
- backgroundHighlightColor: "#9688C4",
- complementColor: "#43B6CF",
- complementHighlightColor: "#54C7DF",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 2,
- },
- missingpiece: {
- id: "2",
- folderName: "missingpiece",
- includePath: "missingpiece",
- displayName: "Missing Piece Level 1",
- backgroundColor: "#55AAAA",
- backgroundHighlightColor: "#66BBBB",
- complementColor: "#228888",
- complementHighlightColor: "#339999",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 8,
- },
- swarm: {
- id: "3",
- folderName: "swarm",
- includePath: "swarm",
- displayName: "Swarm Level 2",
- backgroundColor: "#42AC71",
- backgroundHighlightColor: "#53BD82",
- complementColor: "#315B43",
- complementHighlightColor: "#426C54",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 11,
- },
- lights: {
- id: "4",
- folderName: "lights",
- includePath: "lights",
- displayName: "Lights Level 2",
- backgroundColor: "#26455C",
- backgroundHighlightColor: "#37566D",
- complementColor: "#73E9FF",
- complementHighlightColor: "#84F1FF",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 5,
- },
- codebreaker: {
- id: "5",
- folderName: "codebreaker",
- includePath: "codebreaker",
- displayName: "Code Breaker Level 4",
- backgroundColor: "#82837E",
- backgroundHighlightColor: "#93948F",
- complementColor: "#94B053",
- complementHighlightColor: "#BDEB07",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 5,
- },
- breakout: {
- id: "6",
- folderName: "breakout",
- includePath: "breakout",
- displayName: "Breakout Level 1",
- backgroundColor: "#1D2425",
- backgroundHighlightColor: "#2E3536",
- complementColor: "#43B6CF",
- complementHighlightColor: "#54C7DF",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 11,
- },
- wrongswap: {
- id: "7",
- folderName: "wrongswap",
- includePath: "wrongswap",
- displayName: "Wrong Swap",
- backgroundColor: "#67917A",
- backgroundHighlightColor: "#78A28B",
- complementColor: "#CCBF82",
- complementHighlightColor: "#DDCF93",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 2,
- },
- weighty: {
- id: "8",
- folderName: "weighty",
- includePath: "weighty",
- displayName: "Weighty",
- backgroundColor: "#442A42",
- backgroundHighlightColor: "#553B53",
- complementColor: "#BB99B8",
- complementHighlightColor: "#CCAAC9",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 5,
- },
- grouping: {
- id: "9",
- folderName: "grouping",
- includePath: "grouping",
- displayName: "Grouping",
- backgroundColor: "#C7E9FF",
- backgroundHighlightColor: "#D8FAFF",
- complementColor: "#BB99B8",
- complementHighlightColor: "#CCAAC9",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 8,
- },
- nimchips: {
- id: "10",
- folderName: "nimchips",
- includePath: "nimchips",
- displayName: "NIM Chips",
- contrastColor: "#2E594F",
- contrastHighlightColor: "#3F6A5F",
- backgroundColor: "#668E6D",
- backgroundHighlightColor: "#779F7E",
- complementColor: "#ADDA9C",
- complementHighlightColor: "#BEEBAD",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 8,
- },
- sequencer: {
- id: "11",
- folderName: "sequencer",
- includePath: "sequencer",
- displayName: "Sequencer",
- backgroundColor: "#730006",
- backgroundHighlightColor: "#841117",
- contrastColor: "#BF000A",
- contrastHighlightColor: "#CF111B",
- complementColor: "#DBBE94",
- complementHighlightColor: "#ECCFA5",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 2,
- },
- lightningbugs: {
- id: "12",
- folderName: "lightningbugs",
- includePath: "lightningbugs",
- displayName: "lightningbugs",
- backgroundColor: "#1D2425",
- backgroundHighlightColor: "#2E3536",
- complementColor: "#94D553",
- complementHighlightColor: "#A5E664",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 11,
- },
- shuffle: {
- id: "13",
- folderName: "shuffle",
- includePath: "shuffle",
- displayName: "Shuffle Level 1",
- backgroundColor: "#D56D22",
- backgroundHighlightColor: "#F78F44",
- contrastColor: "#B34B00",
- contrastHighlightColor: "#D56D22",
- complementColor: "#E9EB04",
- complementHighlightColor: "#FAFC15",
- gameIcon: "../dist/common/spr-icons-categories-lg.png",
- gameIconIndex: 11,
- },
- };
- let availableGames = Object.keys(sampleGames);
- var gameToPlay = getParameterByName("game");
- if(!gameToPlay) {
- gameToPlay = availableGames[Math.floor(availableGames.length * Math.random())];
- window.location.search = "?game=" + gameToPlay;
- }
- var pmGameData = sampleGames[gameToPlay];
- pmGameData.assetPath = "./";
- pmGameData.start = function() {};
- pmGameData.finish = function() {};
- var script = document.createElement('script');
- script.onload = function () {
- //do stuff with the script
- };
- script.src = "./"+gameToPlay+"/game-baked.js";
- document.head.appendChild(script);
- </script>
- </body>
- </html>
|