startUsingCanvas
This commit is contained in:
parent
0da4364eda
commit
379dbd0348
@ -276,6 +276,13 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
}
|
||||
}
|
||||
},
|
||||
"startCanvas": {
|
||||
"_leaf": true,
|
||||
"_type": "event",
|
||||
"_event": "firstArrive",
|
||||
"_range": "thiseval==null || thiseval instanceof Array",
|
||||
"_data": "使用画布绘制开始菜单。可以在这里自定义需要的标题界面等内容。"
|
||||
},
|
||||
"startText": {
|
||||
"_leaf": true,
|
||||
"_type": "event",
|
||||
@ -560,6 +567,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"_bool": "bool",
|
||||
"_data": "是否循环计算临界;如果此项为true则使用循环法(而不是回合数计算法)来算临界"
|
||||
},
|
||||
"startUsingCanvas": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_bool": "bool",
|
||||
"_data": "是否开始菜单canvas化;如果此项为true,则将使用canvas来绘制开始菜单"
|
||||
},
|
||||
"startDirectly": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
|
||||
@ -222,6 +222,14 @@ control.prototype.showStartAnimate = function (noAnimate, callback) {
|
||||
core.clearStatus();
|
||||
core.clearMap('all');
|
||||
|
||||
if (core.flags.startUsingCanvas) {
|
||||
core.dom.startTop.style.display = 'none';
|
||||
core.dom.startButtonGroup.style.display = 'block';
|
||||
core.events.startGame('');
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
}
|
||||
|
||||
if(noAnimate) {
|
||||
core.dom.startTop.style.display = 'none';
|
||||
// core.playGame();
|
||||
@ -1655,15 +1663,22 @@ control.prototype.chooseReplayFile = function () {
|
||||
}
|
||||
if (core.isset(obj.version) && obj.version!=core.firstData.version) {
|
||||
// alert("游戏版本不一致!");
|
||||
if (!confirm("游戏版本不一致!\n你仍然想播放录像吗?"))
|
||||
if (!confirm("游戏版本不一致!\n你仍然想播放录像吗?")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!core.isset(obj.route) || !core.isset(obj.hard)) {
|
||||
if (!core.isset(obj.route)) {
|
||||
alert("无效的录像!");
|
||||
return;
|
||||
}
|
||||
|
||||
core.startGame(obj.hard, obj.seed, core.decodeRoute(obj.route));
|
||||
if (core.flags.startUsingCanvas) {
|
||||
core.status.isStarting = false;
|
||||
core.startGame('', obj.seed, core.decodeRoute(obj.route));
|
||||
}
|
||||
else {
|
||||
core.startGame(obj.hard, obj.seed, core.decodeRoute(obj.route));
|
||||
}
|
||||
}, function () {
|
||||
|
||||
})
|
||||
@ -2672,6 +2687,16 @@ control.prototype.playSound = function (sound) {
|
||||
}
|
||||
}
|
||||
|
||||
control.prototype.checkBgm = function() {
|
||||
if (core.musicStatus.startDirectly && core.musicStatus.bgmStatus) {
|
||||
if (core.musicStatus.playingBgm==null
|
||||
|| core.material.bgms[core.musicStatus.playingBgm].paused) {
|
||||
core.musicStatus.playingBgm=null;
|
||||
core.playBgm(core.bgms[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////// 清空状态栏 //////
|
||||
control.prototype.clearStatusBar = function() {
|
||||
|
||||
|
||||
@ -106,7 +106,9 @@ events.prototype.startGame = function (hard, seed, route, callback) {
|
||||
}
|
||||
else core.utils.__init_seed();
|
||||
|
||||
core.events.setInitData(hard);
|
||||
if (!core.flags.startUsingCanvas)
|
||||
core.events.setInitData(hard);
|
||||
|
||||
core.clearMap('all');
|
||||
core.clearStatusBar();
|
||||
|
||||
@ -114,6 +116,8 @@ events.prototype.startGame = function (hard, seed, route, callback) {
|
||||
|
||||
core.status.isStarting = false;
|
||||
|
||||
core.control.triggerStatusBar('show');
|
||||
|
||||
core.changeFloor(core.status.floorId, null, core.status.hero.loc, null, function() {
|
||||
if (core.isset(callback)) callback();
|
||||
}, true);
|
||||
@ -125,7 +129,7 @@ events.prototype.startGame = function (hard, seed, route, callback) {
|
||||
formData.append('name', core.firstData.name);
|
||||
formData.append('version', core.firstData.version);
|
||||
formData.append('platform', core.platform.isPC?"PC":core.platform.isAndroid?"Android":core.platform.isIOS?"iOS":"");
|
||||
formData.append('hard', core.encodeBase64(hard));
|
||||
formData.append('hard', core.encodeBase64(core.status.hard));
|
||||
formData.append('hardCode', core.getFlag('hard', 0));
|
||||
formData.append('base64', 1);
|
||||
|
||||
@ -133,23 +137,35 @@ events.prototype.startGame = function (hard, seed, route, callback) {
|
||||
})
|
||||
}
|
||||
|
||||
core.insertAction(core.clone(core.firstData.startText), null, null, function() {
|
||||
if (!core.status.replay.replaying && core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项
|
||||
core.status.event.selection = core.flags.battleAnimate ? 0 : 1;
|
||||
core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n(强烈建议新手开启此项)", function () {
|
||||
core.flags.battleAnimate = true;
|
||||
core.setLocalStorage('battleAnimate', true);
|
||||
var real_start = function () {
|
||||
core.insertAction(core.clone(core.firstData.startText), null, null, function() {
|
||||
if (!core.flags.startUsingCanvas && !core.status.replay.replaying && core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项
|
||||
core.status.event.selection = core.flags.battleAnimate ? 0 : 1;
|
||||
core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n(强烈建议新手开启此项)", function () {
|
||||
core.flags.battleAnimate = true;
|
||||
core.setLocalStorage('battleAnimate', true);
|
||||
post_start();
|
||||
}, function () {
|
||||
core.flags.battleAnimate = false;
|
||||
core.setLocalStorage('battleAnimate', false);
|
||||
post_start();
|
||||
});
|
||||
}
|
||||
else {
|
||||
post_start();
|
||||
}, function () {
|
||||
core.flags.battleAnimate = false;
|
||||
core.setLocalStorage('battleAnimate', false);
|
||||
post_start();
|
||||
});
|
||||
}
|
||||
else {
|
||||
post_start();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (core.flags.startUsingCanvas) {
|
||||
core.control.triggerStatusBar('hide');
|
||||
core.insertAction(core.clone(core.firstData.startCanvas), null, null, function() {
|
||||
real_start();
|
||||
});
|
||||
}
|
||||
else {
|
||||
real_start();
|
||||
}
|
||||
|
||||
if (core.isset(route)) {
|
||||
core.startReplay(route);
|
||||
@ -157,6 +173,12 @@ events.prototype.startGame = function (hard, seed, route, callback) {
|
||||
|
||||
}
|
||||
|
||||
if (core.flags.startUsingCanvas) {
|
||||
core.dom.startPanel.style.display = 'none';
|
||||
start();
|
||||
return;
|
||||
}
|
||||
|
||||
if (core.isset(route)) {
|
||||
core.dom.startPanel.style.display = 'none';
|
||||
start();
|
||||
|
||||
34
main.js
34
main.js
@ -523,15 +523,7 @@ main.statusBar.image.settings.onclick = function () {
|
||||
////// 点击“开始游戏”时 //////
|
||||
main.dom.playGame.onclick = function () {
|
||||
main.dom.startButtons.style.display='none';
|
||||
|
||||
if (main.core.isset(main.core.musicStatus) && main.core.musicStatus.startDirectly
|
||||
&& main.core.musicStatus.bgmStatus) {
|
||||
if (main.core.musicStatus.playingBgm==null
|
||||
|| core.material.bgms[main.core.musicStatus.playingBgm].paused) {
|
||||
main.core.musicStatus.playingBgm=null;
|
||||
main.core.playBgm(main.core.bgms[0]);
|
||||
}
|
||||
}
|
||||
main.core.control.checkBgm();
|
||||
|
||||
if (main.core.isset(main.core.flags.startDirectly) && main.core.flags.startDirectly) {
|
||||
core.events.startGame("");
|
||||
@ -543,32 +535,14 @@ main.dom.playGame.onclick = function () {
|
||||
|
||||
////// 点击“载入游戏”时 //////
|
||||
main.dom.loadGame.onclick = function() {
|
||||
|
||||
if (main.core.isset(main.core.musicStatus) && main.core.musicStatus.startDirectly
|
||||
&& main.core.musicStatus.bgmStatus) {
|
||||
if (main.core.musicStatus.playingBgm==null
|
||||
|| core.material.bgms[main.core.musicStatus.playingBgm].paused) {
|
||||
main.core.musicStatus.playingBgm=null;
|
||||
main.core.playBgm(main.core.bgms[0]);
|
||||
}
|
||||
}
|
||||
|
||||
main.core.control.checkBgm();
|
||||
main.core.load();
|
||||
}
|
||||
|
||||
////// 点击“录像回放”时 //////
|
||||
main.dom.replayGame.onclick = function () {
|
||||
|
||||
if (main.core.isset(main.core.musicStatus) && main.core.musicStatus.startDirectly
|
||||
&& main.core.musicStatus.bgmStatus) {
|
||||
if (main.core.musicStatus.playingBgm==null
|
||||
|| core.material.bgms[main.core.musicStatus.playingBgm].paused) {
|
||||
main.core.musicStatus.playingBgm=null;
|
||||
main.core.playBgm(main.core.bgms[0]);
|
||||
}
|
||||
}
|
||||
|
||||
core.chooseReplayFile();
|
||||
main.core.control.checkBgm();
|
||||
main.core.chooseReplayFile();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
{
|
||||
"main": {
|
||||
"floorIds": [
|
||||
@ -103,6 +103,78 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"flags": {},
|
||||
"steps": 0
|
||||
},
|
||||
"startCanvas": [
|
||||
{
|
||||
"type": "showImage",
|
||||
"name": "bg.jpg",
|
||||
"loc": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "choices",
|
||||
"choices": [
|
||||
{
|
||||
"text": "开始游戏",
|
||||
"action": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.control.checkBgm()\n}"
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.flags.startDirectly",
|
||||
"true": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.events.setInitData('')\n}"
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\n// 动态生成难度选择项\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\"text\": one[0], \"action\": [\n\t\t{\"type\": \"function\", \"function\": \"function() { core.status.hard = '\"+one[1]+\"'; core.events.setInitData('\"+one[1]+\"'); }\"}\n\t]});\n})\ncore.insertAction({\"type\": \"choices\", \"choices\": choices});\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "showImage"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "读取存档",
|
||||
"action": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.control.checkBgm()\n}"
|
||||
},
|
||||
{
|
||||
"type": "showImage"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.insertAction([{\"type\": \"exit\"}], null, null, function() {\n\tcore.status.played = false;\n\tcore.status.isStarting = false;\n\tcore.load();\n})\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "回放录像",
|
||||
"action": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.control.checkBgm()\n}"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.insertAction([{\"type\": \"exit\"}], null, null, function() {\n\tcore.restart();\n\tcore.chooseReplayFile();\n})\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"startText": [
|
||||
"Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!",
|
||||
"这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。",
|
||||
@ -248,6 +320,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"hatredDecrease": true,
|
||||
"betweenAttackCeil": false,
|
||||
"useLoop": false,
|
||||
"startUsingCanvas": true,
|
||||
"startDirectly": false,
|
||||
"canOpenBattleAnimate": true,
|
||||
"showBattleAnimateConfirm": false,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user