-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
259 lines (225 loc) · 6.71 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE HTML>
<!--
#####################
# Mini Game Machine #
#####################
File: index.html
Created by: Sam Walz <mail[at]samwalz.com> 05. September 2013
Last changed by: Sam Walz <mail[at]samwalz.com> 23. September 2013
-->
<html>
<head>
<meta charset="UTF-8" />
<title>Mini Game Machine</title>
<link rel="stylesheet" type="text/css" href="chainjam.css">
<script type="text/javascript" src="gamelist.js"></script>
<script type="text/javascript" src="settings.js"></script>
<script type="text/javascript" src="jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
window.addEventListener("keydown", function(e) {
// space and arrow keys
if([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
e.preventDefault();
}
}, false);
</script>
<script type="text/javascript">
<!--
var unityObjectUrl = "UnityObject2.js";
if (document.location.protocol == 'https:')
unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-");
document.write('<script type="text\/javascript" src="' + unityObjectUrl + '"><\/script>');
-->
</script>
<!-- SIDEBAR LEFT -->
<div id="sideBarLeft">
<div>Game Ends In:</div>
<div id="gameTimeCountdown"></div>
</div>
<!-- CONTENT -->
<div id="content">
<div id="flashPlayer"></div>
<div id="javaPlayer"></div>
<div id="html5Player"></div>
<div id="unityPlayer">
<div class="missing">
<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
<img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />
</a>
</div>
<div class="broken">
<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now! Restart your browser after install.">
<img alt="Unity Web Player. Install now! Restart your browser after install." src="http://webplayer.unity3d.com/installation/getunityrestart.png" width="193" height="63" />
</a>
</div>
</div>
<div id="functions">
<a href="#" onclick="ShowMenu()" id="miniMenuMenu">menu</a>
<a href="#" onclick="GameEnd()" id="miniMenuSkip">skip</a>
<a href="#" onclick="Report()" id="miniMenuReportBroken">report</a>
</div>
<!-- SCORE -->
<div id="score">
<!-- Player 1 -->
<div class="scoreBox">
<div class="scorePlayer1">
<div id="currentScorePlayer1" class="gameScore">0
</div>
<div id="totalScorePlayer1" class="totalScore">0
</div>
</div>
</div>
<!-- Player 2 -->
<div class="scoreBox">
<div class="scorePlayer2">
<div id="currentScorePlayer2" class="gameScore">0
</div>
<div id="totalScorePlayer2" class="totalScore">0
</div>
</div>
</div>
<!-- Player 3 -->
<div class="scoreBox">
<div class="scorePlayer3">
<div id="currentScorePlayer3" class="gameScore">0
</div>
<div id="totalScorePlayer3" class="totalScore">0
</div>
</div>
</div>
<!-- Player 4 -->
<div class="scoreBox">
<div class="scorePlayer4">
<div id="currentScorePlayer4" class="gameScore">0
</div>
<div id="totalScorePlayer4" class="totalScore">0
</div>
</div>
</div>
</div>
</div>
<!-- SIDEBAR RIGHT -->
<div id="sideBarRight"></div>
<script type="text/javascript" src="miniGameMachine.js"></script>
<script type="text/javascript">
<!--
/*
* functions to be called from any unity player
*/
function GameStart() // will tell the framework that the game has begun
{
if (_gameStartReceived) { return; } // security
_gameStartReceived = true;
// stop the timeout: the game has responded
window.clearInterval(_timeToRespondTimer);
// set coundown
_gameTimeCountdownTimer = window.setInterval("CountDownGameTime()", 1000);
_gameTimeCoundown = _maximumTimePerGame + 1;
CountDownGameTime();
// timeout for game's maximum runtime
_maximumTimePerGameTimer = window.setTimeout("GameReachedMaximumTime()", _maximumTimePerGame * 1000);
}
function GameEnd() // will tell the framework that the game has ended
{
if(_gameRunning)
{
_gameRunning = false; // game is not running anymore
// clear countdown display and interval timer
window.clearInterval(_gameTimeCountdownTimer);
// stop game timeout
window.clearTimeout(_maximumTimePerGameTimer);
// color game cube accordingly
ColorGameCube();
// and let us prepare for the next game
ShowCountdownToGame();
}
}
function Report()
{
window.open("https://docs.google.com/forms/d/1tcIUxvCtdrHds0u3x_R7DmHC9kF6hCTB5Q2LomZGb-Q/viewform?entry.2143018531=" + _currentGame.name + "&entry.663015769&entry.879214927", '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
}
function PlayerOnePoints(amount) // will add <amount> points to the current game for player 1
{
PlayerPoints(0, amount);
}
function PlayerTwoPoints(amount) // will add <amount> points to the current game for player 2
{
PlayerPoints(1, amount);
}
function PlayerThreePoints(amount) // will add <amount> points to the current game for player 3
{
PlayerPoints(2, amount);
}
function PlayerFourPoints(amount) // will add <amount> points to the current game for player 4
{
PlayerPoints(3, amount);
}
/*
* can be called from a minigame-unity player to stop a game and go back to the main menu
*/
function ShowMenu() // will show the game menu
{
//LoadUnityGame("menu.unity3d");
LoadHTML5Game("menu.html");
}
// load the initial game menu or just load a single game
var hash = window.location.hash.substring(1);
if (hash == "") // no direct game access
{
ShowMenu();
}
else
{
var params = hash.split("&");
if (params.length == 1) { // one parameter -> find a game with given path in the game directory
var currentItem = _games;
while (currentItem != null)
{
if (currentItem.path == hash)
{
_currentGame = currentItem;
_currentGame.next = null;
_games = _currentGame;
LoadGame(currentItem, false);
break;
}
currentItem = currentItem.next;
}
}
else if (params.length > 1) { // multiple parameters -> debug mode
var game = new Object();
game.path = "";
game.chosen = true;
game.name = "DEBUG MODE";
game.type = "";
game.credits = "DEBUG MODE";
game.instructions = "DEBUG MODE";
game.next = null;
for (var i = 0; i < params.length; i++) {
var split = params[i].split("=");
switch (split[0])
{
case "path":
game.path = split[1];
break;
case "type":
game.type = split[1];
break;
}
}
_games = game;
_currentGame = game;
LoadGame(_games, false);
}
}
$(window).resize(function() {
OptimizeDimensions();
});
//-->
</script>
</body>
</html>