分离index.html中用户修改的部分

This commit is contained in:
YouWei Zhao 2018-02-28 15:12:29 +08:00
parent 8f6dbbbe59
commit b7a8820a75
4 changed files with 21 additions and 27 deletions

View File

@ -25,20 +25,15 @@
</div>
<p id='startTopLoadTips'>资源即将开始加载</p>
</div>
<img id='startBackground' src='project/images/bg.png'>
<!-- 标题界面可以改style的color使标题改变颜色 -->
<p id='startLogo' style="color: black"></p>
<img id='startBackground'>
<p id='startLogo'></p>
<div id='startButtonGroup'>
<div id='startButtons'>
<span class='startButton' id='playGame'>开始游戏</span>
<span class='startButton' id='loadGame'>载入游戏</span>
<span class='startButton' id='replayGame'>录像回放</span>
</div>
<div id='levelChooseButtons'>
<span class='startButton' id='easyLevel'>简单</span>
<span class='startButton' id='normalLevel'>普通</span>
<span class='startButton' id='hardLevel'>困难</span>
</div>
<div id='levelChooseButtons'></div>
</div>
</div>
<div id='floorMsgGroup'>

33
main.js
View File

@ -17,6 +17,7 @@ function main() {
'startTopProgress': document.getElementById('startTopProgress'),
'startTopLoadTips': document.getElementById('startTopLoadTips'),
'startBackground': document.getElementById('startBackground'),
'startLogo': document.getElementById('startLogo'),
'startButtonGroup': document.getElementById('startButtonGroup'),
'floorMsgGroup': document.getElementById('floorMsgGroup'),
'logoLabel': document.getElementById('logoLabel'),
@ -33,9 +34,6 @@ function main() {
'loadGame': document.getElementById('loadGame'),
'replayGame': document.getElementById('replayGame'),
'levelChooseButtons': document.getElementById('levelChooseButtons'),
'easyLevel': document.getElementById('easyLevel'),
'normalLevel': document.getElementById('normalLevel'),
'hardLevel': document.getElementById('hardLevel'),
'data': document.getElementById('data'),
'statusLabels': document.getElementsByClassName('statusLabel'),
'floorCol': document.getElementById('floorCol'),
@ -128,6 +126,21 @@ main.prototype.init = function (mode) {
main.loadPureData(function(){
var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
for(var ii in mainData)main[ii]=mainData[ii];
main.dom.startBackground.src="project/images/"+main.startBackground;
main.dom.startLogo.style=main.startLogoStyle;
main.levelChoose.forEach(function(value){
var span = document.createElement('span');
span.setAttribute('class','startButton');
span.innerText=value[0];
(function(span,str_){
span.onclick = function () {
core.events.startGame(str_);
}
})(span,value[1]);
main.dom.levelChooseButtons.appendChild(span);
});
main.loaderJs(function () {
var coreData = {};
for (i = 0; i < main.loadList.length; i++) {
@ -454,20 +467,6 @@ main.dom.replayGame.onclick = function () {
})
}
////// 点击“简单难度”时 //////
main.dom.easyLevel.onclick = function() {
core.events.startGame('Easy');
}
////// 点击“普通难度”时 //////
main.dom.normalLevel.onclick = function () {
core.events.startGame('Normal');
}
////// 点击“困难难度”时 //////
main.dom.hardLevel.onclick = function () {
core.events.startGame('Hard');
}
}//listen end

View File

@ -8,7 +8,7 @@ data_comment_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"bgms": " 在此存放所有的bgm和文件名一致。第一项为默认播放项 \n 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n$leaf(true)$end",
"sounds": " 在此存放所有的SE和文件名一致 \n 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n$leaf(true)$end",
"bgmRemote" : " 是否使用远程的背景音乐;此项一般不要开启 \n$select({\"values\":[false]})$end",
"startBackground" : "标题界面的背景",
"startBackground" : "标题界面的背景,建议使用jpg格式以压缩背景图空间",
"startLogoStyle" : "标题样式:可以改变颜色,也可以隐藏标题(如果背景图自带)",
"levelChoose" : " 难度选择:每个数组的第一个是其在标题界面显示的难度,第二个是在游戏内部传输的字符串,会显示在状态栏,修改此处后需要在project/functions中作相应更改 \n$leaf(true)$end"
},

View File

@ -33,7 +33,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
// 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好
],
"bgmRemote" : false, // 是否使用远程的背景音乐;此项一般不要开启
"startBackground" : "bg.png",// 标题界面的背景
"startBackground" : "bg.png",// 标题界面的背景,建议使用jpg格式以压缩背景图空间
"startLogoStyle" : "color: black",// 标题样式:可以改变颜色,也可以隐藏标题(如果背景图自带)
"levelChoose" : [["简单","Easy"],["普通","Normal"],["困难","Hard"],["噩梦","Hell"]],
//难度选择:每个数组的第一个是其在标题界面显示的难度,第二个是在游戏内部传输的字符串,会显示在状态栏,修改此处后需要在project/functions中作相应更改