-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrecord.html
170 lines (151 loc) · 5.9 KB
/
record.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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Egret</title>
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<style>
html,
body {
-ms-touch-action: none;
background: #fff;
padding: 0;
border: 0;
margin: 0;
height: 100%;
}
.header {
position: fixed;
top: 0;
width: 100%;
height: 3em;
line-height: 3em;
text-align: center;
background: #f7f7f7;
z-index: 1;
opacity: .99;
border-bottom: solid 1px #EEEEEE;
/*rgba(190, 190, 190, 1)*/
}
.header span:nth-of-type(1) {
position: absolute;
top: 1em;
left: 0.8em;
border-left: 0.1em solid #0078FF;
border-bottom: 0.1em solid #0078FF;
height: 0.68em;
width: 0.68em;
transform: rotate(45deg);
-ms-transform: rotate(45deg);
/* IE 9 */
-moz-transform: rotate(45deg);
/* Firefox */
-webkit-transform: rotate(45deg);
/* Safari 和 Chrome */
-o-transform: rotate(45deg);
/* Opera */
}
.header span:nth-of-type(2) {
color: #0e0e0e;
font-size: 1.05em
}
.content {
/*padding-top:3em;*/
padding: 3em 1em 0 1em;
text-align: center
}
.table {
width: 100%;
padding: 0.5em 0;
}
</style>
<!--这个标签为通过egret提供的第三方库的方式生成的 javascript 文件。删除 modules_files 标签后,库文件加载列表将不会变化,请谨慎操作!-->
<!--modules_files_start-->
<script egret="lib" src="libs/modules/egret/egret.js" src-release="libs/modules/egret/egret.min.js"></script>
<script egret="lib" src="libs/modules/egret/egret.web.js" src-release="libs/modules/egret/egret.web.min.js"></script>
<script egret="lib" src="libs/modules/game/game.js" src-release="libs/modules/game/game.min.js"></script>
<script egret="lib" src="libs/modules/game/game.web.js" src-release="libs/modules/game/game.web.min.js"></script>
<script egret="lib" src="libs/modules/tween/tween.js" src-release="libs/modules/tween/tween.min.js"></script>
<script egret="lib" src="libs/modules/res/res.js" src-release="libs/modules/res/res.min.js"></script>
<script egret="lib" src="libs/modules/tween/tween.js" src-release="libs/modules/tween/tween.min.js"></script>
<!--modules_files_end-->
<!--这个标签为不通过egret提供的第三方库的方式使用的 javascript 文件,请将这些文件放在libs下,但不要放在modules下面。-->
<!--other_libs_files_start-->
<!--other_libs_files_end-->
<!--这个标签会被替换为项目中所有的 javascript 文件。删除 game_files 标签后,项目文件加载列表将不会变化,请谨慎操作!-->
<!--game_files_start-->
<script egret="game" src="bin-debug/ball.js"></script>
<script egret="game" src="bin-debug/Level.js"></script>
<script egret="game" src="bin-debug/Line.js"></script>
<script egret="game" src="bin-debug/LoadingUI.js"></script>
<script egret="game" src="bin-debug/Main.js"></script>
<script egret="game" src="bin-debug/MenuBg.js"></script>
<script egret="game" src="bin-debug/NumBall.js"></script>
<script egret="game" src="bin-debug/Test.js"></script>
<!--game_files_end-->
</head>
<body>
<div class="header">
<span onclick="history.back()"></span>
<span>我的记录</span>
</div>
<div class="content">
<table class="table" id=table>
<tr>
<th>关卡</th>
<th>闯关时间</th>
<th>得分</th>
</tr>
<!--<tr>
<td>第一关</td>
<td>08分40秒</td>
<td>200</td>
</tr>-->
</table>
</div>
<script>
//默认使用 WebGL 渲染模式
egret.runEgret({renderMode:"webgl"});
// var playrecord = '{"record":[{"level":"第1关","time":"5分40秒","score":"200"},{"level":"第2关","time":"3分40秒","score":"100"}]}';
// egret.localStorage.setItem("play_record", playrecord);//第一关
var playRecord = egret.localStorage.getItem("play_record");//, playrecord);//第一关
var recordObj = JSON.parse(playRecord);
// console.log(recordObj.record);
var records = recordObj.record;
var table = document.getElementById('table');
// alert(table.innerHTML );
for(var i=0;i<records.length;i++){
//alert(records[i].level);
var html = '<tr><td>'+records[i].level+'</td><td>'+getRemainTime(records[i].time)+'</td><td>'+records[i].score+'</td></tr>';
table.innerHTML +=html;
}
function getRemainTime(t){
// return t+"毫秒";
var d=Math.floor(t/1000/60/60/24);
var h=Math.floor(t/1000/60/60%24);
var m=Math.floor(t/1000/60%60);
var s=Math.floor(t/1000%60);
console.log(d+":"+h+":"+m+":"+s);
var rt ="";
if(d>0){
rt+=d+"天";
}
if(h>0){
rt+=h+"小时";
}
if(m>0){
rt+=m+"分钟";
}
if(s>0){
rt+=s+"秒";
}
return rt;
}
</script>
</body>
</html>