-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
351 lines (310 loc) · 15.5 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<!@page contentType="text/html" pageEncoding="UTF-8">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>
立体ピクロス
</title>
<script type="text/javascript" src="o3djs/base.js"></script>
<script type="text/javascript" src="Game.js"></script>
<script type="text/javascript" src="InputState.js"></script>
<script type="text/javascript" src="GameInput.js"></script>
<script type="text/javascript" src="Cube.js"></script>
<script type="text/javascript" src="Puzzle.js"></script>
<script type="text/javascript" src="PeeringArrow.js"></script>
<script type="text/javascript" src="Camera.js"></script>
<script type="text/javascript" src="ResourceLoading.js"></script>
<script type="text/javascript" src="DebugOverlay.js"></script>
<script type="text/javascript" src="IngameOverlay.js"></script>
<script type="text/javascript" src="EditInput.js"></script>
<script type="text/javascript">
o3djs.require('o3djs.util');
o3djs.require('o3djs.math');
o3djs.require('o3djs.rendergraph');
o3djs.require('o3djs.io');
o3djs.require('o3djs.effect');
o3djs.require('o3djs.camera');
o3djs.require('o3djs.picking');
o3djs.require('o3djs.shape');
o3djs.require('o3djs.canvas');
window.onload = init;
window.onunload = uninit;
var gGame = null;
var gIngameOverlay = null;
var gPuzzleNames = [
'puzzles/Debug/One.rittai',
'puzzles/Debug/Test.xml',
'puzzles/Debug/test2.xml',
'',
'puzzles/Tutorial/1 - Break a Block.rittai',
'puzzles/Tutorial/2 - Break a Block, Save a Block.xml',
'',
'puzzles/TakeNote.xml',
'puzzles/SmallHeart.xml',
'puzzles/Soboten.xml',
'',
'puzzles/HollowCube.rittai',
'puzzles/My Breakfast.xml',
'',
'puzzles/9x9x9.rittai'
];
function renderCallback(renderEvent)
{
gGame.mClock += renderEvent.elapsedTime * gGame.mTimeMult;
if ( gGame.mDebugOverlay )
{
gGame.mDebugOverlay.update( gGame );
}
}
function init() {
o3djs.util.makeClients(initStep2);
}
function initStep2(clientElements)
{
gGame = new Game( clientElements );
initOptions( gGame );
loadTextures(gGame);
}
function initStep3()
{
gGame.initView();
gGame.initInput();
fillPuzzleList();
gGame.setGameMode( true );
gGame.mClient.setRenderCallback(renderCallback);
gGame.mFinishedInit = true;
}
function uninit() {
if (gGame && gGame.mClient)
{
gGame.mClient.cleanup();
}
}
function toggleHidden(divID) {
var item = document.getElementById(divID);
if (item) {
item.className=(item.className=='hidden')?'unhidden':'hidden';
}
}
function checkColorText( TextareaId )
{
var Item = document.getElementById( TextareaId );
if ( Item )
{
var Value = Item.value.toLowerCase();
for( var travValue = 0; travValue < Value.length; travValue ++)
{
if ( Value[travValue] < '0' || Value[travValue] > 'f' )
{
Value[travValue] = '0';
}
}
Item.value = Value;
}
}
function generateControlEntry( Key, Function )
{
return "<tr><td class=\"ControlsKey\">" + Key + " - </td><td class=\"ControlsFunction\">" + Function + "</td></tr>";
}
function initOptions( Game )
{
var setHideUnneededFaces = getCookie( "HideUnneededFaces" );
if ( setHideUnneededFaces != null )
{
if ( setHideUnneededFaces == "true" )
Game.setHideUnneededFaces( true );
else
Game.setHideUnneededFaces( false );
}
var HideUnneededFacesControl = document.getElementById("HideUnneededFaces");
if ( Game.getHideUnneededFaces() )
{
HideUnneededFacesControl.checked = true;
} else
{
HideUnneededFacesControl.checked = false;
}
var setOnlyDimIfPainted = getCookie( "OnlyDimIfPainted" );
if ( setOnlyDimIfPainted != null )
{
if ( setOnlyDimIfPainted == "true" )
Game.setOnlyDimIfPainted( true );
else
Game.setOnlyDimIfPainted( false );
}
var OnlyDimIfPaintedControl = document.getElementById("OnlyDimIfPainted");
if ( Game.getOnlyDimIfPainted() )
{
OnlyDimIfPaintedControl.checked = true;
} else
{
OnlyDimIfPaintedControl.checked = false;
}
initCheckedCookiedHidden( "DebugLog", "ShowDebugLog", true );
initCheckedCookiedHidden( "OptionsBody", "ToggleOptions", false );
}
function initCheckedCookiedHidden( Hidden, ControlName, DefaultHidden )
{
var Cookie = getCookie( ControlName );
var HiddenElement = document.getElementById( Hidden );
if ( DefaultHidden )
{
if ( Cookie != null && Cookie == "true" )
HiddenElement.className = 'unhidden';
else
HiddenElement.className = 'hidden';
} else
{
if ( Cookie != null && Cookie == "false" )
HiddenElement.className = 'hidden';
else
HiddenElement.className = 'unhidden';
}
var Control = document.getElementById( ControlName );
if ( HiddenElement.className == 'unhidden' )
{
Control.checked = true;
} else
{
Control.checked = false;
}
}
function toggleCheckedCookiedHidden( Hidden, ControlName )
{
toggleHidden(Hidden);
changedOption(ControlName);
}
function changedOption( ControlName )
{
var Control = document.getElementById(ControlName);
setCookie( ControlName, Control.checked, 9909, 12, 31 );
}
// cookie code from http://www.elated.com/articles/javascript-and-cookies/
function setCookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
var cookie_string = name + "=" + escape ( value );
if ( exp_y )
{
var expires = new Date ( exp_y, exp_m, exp_d );
cookie_string += "; expires=" + expires.toGMTString();
}
if ( path )
cookie_string += "; path=" + escape ( path );
if ( domain )
cookie_string += "; domain=" + escape ( domain );
if ( secure )
cookie_string += "; secure";
document.cookie = cookie_string;
}
function getCookie ( cookie_name )
{
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
if ( results )
return ( unescape ( results[2] ) );
else
return null;
}
function deleteCookie ( cookie_name )
{
var cookie_date = new Date ( ); // current date & time
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
</script>
<link href="index.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div class="Body">
立体ピクロス - <a href="http://github.com/yoiang/Rittai-Picross/issues/" target="rittai_todo">Issues</a>
<div id="Subtitle">please load a puzzle from below</div>
<div id="DebugLog"></div>
<table id="main">
<tr>
<td id="o3d">
<div id="o3d"></div>
</td>
<td class="EditModeUI">
<div id="EditModeUI">
Edit Mode<br/>
<br/>
Title:<br/>
<textarea id="EditModePuzzleTitle"></textarea><br/>
Allowed Fails:<br/>
<textarea id="EditModeAllowedFails">2</textarea><br/>
BG Color:<br/>
#<textarea id="EditModeBackgroundColor" class="color" onchange="javascript:checkColorText('EditModeBackgroundColor')">ffffff</textarea><br/>
Paint Color:<br/>
#<textarea id="EditModePaintColor" class="color" onchange="javascript:checkColorText('EditModePaintColor')">000000</textarea><br/>
<br/>
New Cube...<br/>
Finished Color:<br/>
#<textarea id="EditModeFinishedColor" class="color" onchange="javascript:checkColorText('EditModeFinishedColor')">ffffff</textarea><br/>
</div>
</td>
</tr>
</table>
<table id="OptionsTable">
<tr>
<td>
<input type="checkbox" id="ToggleOptions" onClick="toggleCheckedCookiedHidden('OptionsBody', 'ToggleOptions')" checked></input>
</td>
<td>
<div id="OptionsBody">
<form name="puzzleSelectForm">
<span id="puzzleSelectDiv"></span> <input type="text" id="url" size="60"> <input type="button" id="updateButton" onclick="PuzzleManualSelect();" value="Load Puzzle"><br/>
<input type="checkbox" id="HideUnneededFaces" onClick="changedOption('HideUnneededFaces')">Hide Unneeded Faces</input> <input type="checkbox" id="OnlyDimIfPainted" onClick="changedOption('OnlyDimIfPainted')">Only Dim Faces If Paint</input> <input type="checkbox" id="ShowDebugLog" onClick="toggleCheckedCookiedHidden('DebugLog','ShowDebugLog')">Show Debug Log</input><br/>
please refresh page if you've changed an option, require cookies<br/>
</form>
</div>
</td>
</tr>
</table>
<div class="BackgroundInfo">based on a game by HAL Laboratory / Nintendo, show your support and buy the game or request that Nintendo publish it outside of Japan!</div>
<br/>
<table class="Sections">
<tr>
<td class="Sections">
<div id="Controls">
<span class="title">Controls</span> <a href="javascript:toggleHidden('ControlsBody');" class="toggleHidden">+</a>
<div id="ControlsBody" class="hidden">
</div>
</div>
</td>
<td class="Sections">
<div id="Instructions">
<span class="title">Instructions</span> <a href="javascript:toggleHidden('InstructionsBody');" class="toggleHidden">+</a>
<div id="InstructionsBody" class="hidden">The object of the game is to reveal the hidden shape by <span class="bold">BREAK</span>ing all the <span class="bold">SPACE</span> blocks. If you accidentally attempt to <span class="bold">BREAK</span> a <span class="bold">SOLID</span> block you will lose a chance. Lose all your chances and you fail!<br/>
<br/>
Use the numbers on the block faces to determine which blocks are <span class="bold">SOLID</span> and which blocks are <span class="bold">SPACE</span>. The number on a face tells how many <span class="bold">SOLID</span> blocks somewhere in the row in that direction. A number alone means all <span class="bold">SOLID</span> blocks are adjacent. A <span class="bold">CIRCLE</span> around the number means there is one set of adjacent <span class="bold">SPACES</span> between the <span class="bold">SOLID</span> blocks. A <span class="bold">SQUARE</span> around the number means there are more than one sets of adjacent <span class="bold">SPACES</span> between the <span class="bold">SOLID</span> blocks in that row.<br/>
<br/>
<span class="bold">PAINT</span> blocks to mark the ones you think are <span class="bold">SOLID</span>. You cannot accidentally <span class="bold">BREAK</span> a <span class="bold">PAINTED</span> block. You may paint and unpaint any block as much as you'd like.
</div>
</div>
</td>
</tr>
<tr>
<td class="Sections">
<div id="Links">
<span class="title">Links</span> <a href="javascript:toggleHidden('LinksBody');" class="toggleHidden">+</a>
<div id="LinksBody" class="hidden">
<a href="http://github.com/yoiang/Rittai-Picross">http://github.com/yoiang/Rittai-Picross</a><br/>
<a href="git://github.com/yoiang/Rittai-Picross.git">git://github.com/yoiang/Rittai-Picross.git</a>
</div>
</div>
</td>
<td class="Sections">
<div id="EditMode">
<span class="title">Edit Mode</span> <a href="javascript:toggleHidden('EditModeBody');" class="toggleHidden">+</a>
<div id="EditModeBody" class="hidden">
<textarea id="EditModePuzzleFile"></textarea>
</div>
</div>
</td>
</tr>
</table>
<div class="requirements">Requires Google's <a href="http://code.google.com/apis/o3d/">O3D</a>, available <a href="http://code.google.com/apis/o3d/">here</a></div>
</div>
</body>
</html>