-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
117 lines (108 loc) · 3.57 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>植物大战僵尸</title>
<script src="./libs/easeljs.js"></script>
<script src="./libs/preloadjs.js"></script>
<script src="./libs/soundjs.js"></script>
<script src="./libs/tweenjs.js"></script>
<link rel="icon" href="./assets/imgs/favicon.ico">
<style>
#main-mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000000DD;
z-index: 100;
}
#start-button {
position: absolute;
top: 80%;
left: 50%;
transform: translate(-50%, -50%);
width: 200px;
height: 60px;
background-color: #00000000;
border: 1px solid #fff;
color: #fff;
font-size: 30px;
text-align: center;
line-height: 60px;
cursor: pointer;
}
.title {
position: absolute;
top: 10%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 60px;
background-color: #00000000;
color: #fff;
font-size: 30px;
text-align: center;
line-height: 60px;
}
.desc {
position: absolute;
top: 20%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 30px;
background-color: #00000000;
color: #fff;
font-size: 20px;
text-align: center;
line-height: 60px;
}
canvas {
/* 居中 */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#steps{
/* 固定在中间顶部 */
position: absolute;
top: 0%;
left: 50%;
transform: translate(-50%, 0%);
width: 20%;
height: 40px;
background-color: #000000FF;
color: #fff;
text-align: center;
z-index: 100;
}
</style>
</head>
<body>
<canvas width="900" height="600" id="canvas"></canvas>
<div id="main-mask">
<div class="title">声控版植物大战僵尸</div>
<div class="desc">
<div>请务必使用Chorme浏览器,并按照以下提示操作</div>
<div>请允许麦克风权限,并在chrome://flags/#unsafely-treat-insecure-origin-as-secure中添加运行该游戏的网址</div>
<div>然后重启浏览器,并重新打开此项目</div>
<div>此操作是为了程序能够在非HTTPS的条件下读取到麦克风</div>
</div>
<div id="start-button">进入游戏</div>
</div>
<div>当前识别到的命令:</div>
<div id="speech">您没有说话或没有按照步骤授予麦克风权限</div>
<div>无法识别请尝试点下方按钮</div>
<div style="background-color:#333333;color:#ffffff;width:20%;cursor: pointer;" onclick=window.speech.start()>
重新激活音频服务</div>
<div>既可以通过语音交互也可以通过鼠标交互</div>
<div style="margin-top:20px">当前页面支持的指令:</div>
<div id="steps">欢迎游玩</div>
</body>
<script src="./js/App.js" type="module"></script>
</html>