-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
137 lines (135 loc) · 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
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" pageEncoding="UTF-8"/>
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="description" content="俄罗斯方块"/>
<meta http-equiv="keywords" content="俄罗斯方块"/>
<link rel="icon" type="image/png" id="favicon" href="images/logo.png"/>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
<script type="text/javascript" src="js/brush.js"></script>
<script type="text/javascript" src="js/map.js"></script>
<script type="text/javascript" src="js/tetris.js"></script>
<script type="text/javascript" src="js/letter.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<title>俄罗斯方块游戏-HTML5 - LeftGeek</title>
<script type="text/javascript">
var main = new Main();
var isStart = false;
var isPause = false;
function gameStart(enable_ai){
main.playClick();
if (isStart){//stop
isStart = false;
main.gameEnd();
document.getElementById("menu_start").innerHTML = "Start";
document.getElementById("menu_start_ai").innerHTML = "AI";
} else {//start
isStart = true;
if (enable_ai == 1){
main.gameStart(1);
document.getElementById("menu_start_ai").innerHTML = "End";
document.getElementById("menu_start").innerHTML = "";
} else {
main.gameStart(0);
document.getElementById("menu_start").innerHTML = "End";
document.getElementById("menu_start_ai").innerHTML = "";
}
}
}
function gamePause(){
if (isPause){//resume
isPause = false;
main.playResume();
main.gameResume();
document.getElementById("menu_pause").innerHTML = "Pause";
} else {//pause
isPause = true;
main.playClick();
main.gamePause();
document.getElementById("menu_pause").innerHTML = "Resume";
}
}
function gameInit(){
main.init();
//setTimeout("gameStart(1)", 30000);
/*
//start at certain time
var executed = false;
var timeTask = setInterval(function(){
gameStart(1);
var date = new Date();
var h = date.getHours();
var m = date.getMinutes();
var s = date.getSeconds();
if (h == 20 && m == 7 && s == 0 && !executed){
executed = true;
gameStart(1);
}
}, 1000);*/
}
</script>
</head>
<body onload="gameInit()">
<div id="container">
<div id="sidebar">
<div id="welcome" title="Happy Birthday to You">
<b>Have <br/>
Fun~</b>
</div>
<ul id="menu">
<li><a id="menu_start" href="javascript:void(0)" onclick="gameStart(0)">Start</a>
<a id="menu_start_ai" href="javascript:void(0)" onclick="gameStart(1)">AI</a></li>
<li><a id="menu_pause" href="javascript:void(0)" onclick="gamePause()">Pause</a></li>
<li><a id="menu_about" href="javascript:void(0)"
title="HTML5俄罗斯方块游戏 - 余亚/2014/2/14">About</a></li>
<li><a id="menu_home" href="/"
title="Goto leftgeek.com">Home</a></li>
</ul>
<div id="game_control">
键盘操作: <br/>
旋转: ↑ <br/>
移动: ← →<br/>
加速: ↓
</div>
<div>
<audio id="level_up" src="audio/level_up.ogg" preload="auto"></audio>
<audio id="click" src="audio/click.wav" preload="auto"></audio>
<audio id="move" src="audio/move.wav" preload="auto"></audio>
<audio id="dead" src="audio/go_on.wav" preload="auto"></audio>
<audio id="resume" src="audio/resume.wav" preload="auto"></audio>
<audio id="clear" src="audio/clear.wav" preload="auto"></audio>
<audio id="game_pass" src="audio/game_pass.wav" preload="auto"></audio>
</div>
</div>
<div id="wrapper">
<div id="game_board" class="left">
<div id="header">
<div id="time_board">
<div class="tag_title">Time</div>
<div class="tag_content" id="elapsed_time">0</div>
</div>
<div id="preview_board">
<canvas id="preview" width="112" height="112"></canvas>
</div>
<div id="score_board">
<div class="tag_title">Score</div>
<div class="tag_content" id="cleared_lines">0</div>
</div>
</div>
<div id="main">
<canvas id="board" width="336" height="504"></canvas>
</div>
</div>
<div id="message_board" class="right">
<div id="notebook">
<canvas id="paper" width="580" height="460"></canvas>
</div>
<div id="message_box">
<div id="message">想知道我说的什么吗,花几分钟时间把游戏通关吧!</div>
</div>
</div>
</div>
</div>
</body>
</html>