Update
This commit is contained in:
parent
3f10919c00
commit
43a58f173d
@ -4,10 +4,8 @@
|
|||||||
<meta http-equiv='content-type' content='text/html' charset='utf-8'>
|
<meta http-equiv='content-type' content='text/html' charset='utf-8'>
|
||||||
<meta http-equiv='X-UA-Compatible' content='IE=Edge, chrome=1'>
|
<meta http-equiv='X-UA-Compatible' content='IE=Edge, chrome=1'>
|
||||||
<meta name='author' content='ckcz123'>
|
<meta name='author' content='ckcz123'>
|
||||||
<meta name='viewport'
|
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=yes'>
|
||||||
content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=yes'>
|
|
||||||
<title></title>
|
<title></title>
|
||||||
<meta name="apple-mobile-web-app-title" content="魔塔样板">
|
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
|
||||||
<meta name="screen-orientation" content="portrait">
|
<meta name="screen-orientation" content="portrait">
|
||||||
<meta name="full-screen" content="yes">
|
<meta name="full-screen" content="yes">
|
||||||
|
|||||||
44
libs/core.js
44
libs/core.js
@ -105,7 +105,8 @@ core.prototype.init = function (dom, statusBar, canvas, images, sounds, floorIds
|
|||||||
for (var key in coreData) {
|
for (var key in coreData) {
|
||||||
core[key] = coreData[key];
|
core[key] = coreData[key];
|
||||||
}
|
}
|
||||||
core.flags = core.data.flags;
|
core.flags = core.clone(core.data.flags);
|
||||||
|
core.flags.battleAnimate = core.getLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||||
core.values = core.clone(core.data.values);
|
core.values = core.clone(core.data.values);
|
||||||
core.firstData = core.data.getFirstData();
|
core.firstData = core.data.getFirstData();
|
||||||
core.initStatus.shops = core.firstData.shops;
|
core.initStatus.shops = core.firstData.shops;
|
||||||
@ -681,8 +682,17 @@ core.prototype.onclick = function (x, y, stepPostfix) {
|
|||||||
core.syncSave("load");
|
core.syncSave("load");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (x>=5 && x<=7 && y==7) {
|
if (x>=5 && x<=7) {
|
||||||
core.ui.drawSettings(false);
|
if (y==7) {
|
||||||
|
core.ui.drawConfirmBox("你确定要清空所有本地存档吗?", function() {
|
||||||
|
localStorage.clear();
|
||||||
|
core.drawText("\t[操作成功]你的本地所有存档已被清空。");
|
||||||
|
}, function() {
|
||||||
|
core.ui.drawSettings(false);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (y==8)
|
||||||
|
core.ui.drawSettings(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2795,9 +2805,9 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
|
|
||||||
var statusLineHeight = BASE_LINEHEIGHT * 9/count;
|
var statusLineHeight = BASE_LINEHEIGHT * 9/count;
|
||||||
|
|
||||||
var shopDisplay, mdefDispaly, expDispaly;
|
var shopDisplay, mdefDisplay, expDisplay;
|
||||||
mdefDispaly = core.flags.enableMDef ? 'block' : 'none';
|
mdefDisplay = core.flags.enableMDef ? 'block' : 'none';
|
||||||
expDispaly = core.flags.enableExperience ? 'block' : 'none';
|
expDisplay = core.flags.enableExperience ? 'block' : 'none';
|
||||||
|
|
||||||
statusBarBorder = '3px #fff solid';
|
statusBarBorder = '3px #fff solid';
|
||||||
toolBarBorder = '3px #fff solid';
|
toolBarBorder = '3px #fff solid';
|
||||||
@ -2898,7 +2908,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
|
|
||||||
var unit = 'px'
|
var unit = 'px'
|
||||||
core.domStyle.styles = [
|
core.domStyle.styles = [
|
||||||
{ id: 'gameGroup',
|
{
|
||||||
|
id: 'gameGroup',
|
||||||
rules:{
|
rules:{
|
||||||
width: gameGroupWidth + unit,
|
width: gameGroupWidth + unit,
|
||||||
height: gameGroupHeight + unit,
|
height: gameGroupHeight + unit,
|
||||||
@ -2906,7 +2917,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
left: (clientWidth-gameGroupWidth)/2 + unit,
|
left: (clientWidth-gameGroupWidth)/2 + unit,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ className: 'gameCanvas',
|
{
|
||||||
|
className: 'gameCanvas',
|
||||||
rules:{
|
rules:{
|
||||||
width: canvasWidth + unit,
|
width: canvasWidth + unit,
|
||||||
height: canvasWidth + unit,
|
height: canvasWidth + unit,
|
||||||
@ -2916,7 +2928,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
border: '3px #fff solid',
|
border: '3px #fff solid',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ id: 'statusBar',
|
{
|
||||||
|
id: 'statusBar',
|
||||||
rules:{
|
rules:{
|
||||||
width: statusBarWidth + unit,
|
width: statusBarWidth + unit,
|
||||||
height: statusBarHeight + unit,
|
height: statusBarHeight + unit,
|
||||||
@ -2930,7 +2943,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
fontSize: fontSize + unit
|
fontSize: fontSize + unit
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ className: 'status',
|
{
|
||||||
|
className: 'status',
|
||||||
rules:{
|
rules:{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
maxWidth: statusMaxWidth + unit,
|
maxWidth: statusMaxWidth + unit,
|
||||||
@ -2945,7 +2959,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
lineHeight: statusLabelsLH + unit,
|
lineHeight: statusLabelsLH + unit,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ id: 'toolBar',
|
{
|
||||||
|
id: 'toolBar',
|
||||||
rules:{
|
rules:{
|
||||||
width: toolBarWidth + unit,
|
width: toolBarWidth + unit,
|
||||||
height: toolBarHeight + unit,
|
height: toolBarHeight + unit,
|
||||||
@ -2958,7 +2973,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
fontSize: fontSize + unit
|
fontSize: fontSize + unit
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ className: 'tools',
|
{
|
||||||
|
className: 'tools',
|
||||||
rules:{
|
rules:{
|
||||||
height: toolsHeight + unit,
|
height: toolsHeight + unit,
|
||||||
maxWidth: toolsPMaxwidth + unit,
|
maxWidth: toolsPMaxwidth + unit,
|
||||||
@ -2975,13 +2991,13 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
{
|
{
|
||||||
id: 'expCol',
|
id: 'expCol',
|
||||||
rules: {
|
rules: {
|
||||||
display: expDispaly
|
display: expDisplay
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'mdefCol',
|
id: 'mdefCol',
|
||||||
rules: {
|
rules: {
|
||||||
display: mdefDispaly
|
display: mdefDisplay
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@ -125,6 +125,8 @@ data.prototype.init = function() {
|
|||||||
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||||
|
|
||||||
/****** 系统相关 ******/
|
/****** 系统相关 ******/
|
||||||
|
"startDirectly": true, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面
|
||||||
|
"battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中关闭
|
||||||
"portalWithoutTrigger": true, // 经过楼梯、传送门时是否能“穿透”。穿透的意思是,自动寻路得到的的路径中间经过了楼梯,行走时是否触发楼层转换事件
|
"portalWithoutTrigger": true, // 经过楼梯、传送门时是否能“穿透”。穿透的意思是,自动寻路得到的的路径中间经过了楼梯,行走时是否触发楼层转换事件
|
||||||
"potionWhileRouting": false, // 寻路算法是否经过血瓶;如果该项为false,则寻路算法会自动尽量绕过血瓶
|
"potionWhileRouting": false, // 寻路算法是否经过血瓶;如果该项为false,则寻路算法会自动尽量绕过血瓶
|
||||||
}
|
}
|
||||||
|
|||||||
@ -282,6 +282,7 @@ events.prototype.doAction = function() {
|
|||||||
break;
|
break;
|
||||||
case "disableShop": // 禁用一个全局商店
|
case "disableShop": // 禁用一个全局商店
|
||||||
core.events.disableQuickShop(data.id);
|
core.events.disableQuickShop(data.id);
|
||||||
|
this.doAction();
|
||||||
break;
|
break;
|
||||||
case "battle": // 强制战斗
|
case "battle": // 强制战斗
|
||||||
core.battle(data.id,null,null,true,function() {
|
core.battle(data.id,null,null,true,function() {
|
||||||
@ -796,11 +797,17 @@ events.prototype.clickSettings = function (x,y) {
|
|||||||
core.changeSoundStatus();
|
core.changeSoundStatus();
|
||||||
core.ui.drawSettings(false);
|
core.ui.drawSettings(false);
|
||||||
}
|
}
|
||||||
if (y == 4) core.ui.drawQuickShop();
|
if (y==4) {
|
||||||
|
core.flags.battleAnimate=!core.flags.battleAnimate;
|
||||||
|
core.setLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||||
|
core.ui.drawSettings(false);
|
||||||
|
}
|
||||||
|
if (y == 5) core.ui.drawQuickShop();
|
||||||
// if (y == 5) this.decreaseHard();
|
// if (y == 5) this.decreaseHard();
|
||||||
if (y == 5) {
|
if (y == 6) {
|
||||||
core.ui.drawSyncSave();
|
core.ui.drawSyncSave();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (y == 6) {
|
if (y == 6) {
|
||||||
core.ui.drawConfirmBox("你确定要清空所有本地存档吗?", function() {
|
core.ui.drawConfirmBox("你确定要清空所有本地存档吗?", function() {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
@ -809,6 +816,7 @@ events.prototype.clickSettings = function (x,y) {
|
|||||||
core.ui.drawSettings(false);
|
core.ui.drawSettings(false);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (y == 7) {
|
if (y == 7) {
|
||||||
core.ui.drawConfirmBox("你确定要重新开始吗?", function () {
|
core.ui.drawConfirmBox("你确定要重新开始吗?", function () {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
|
|||||||
@ -29,8 +29,8 @@ main.floors.sample1 = {
|
|||||||
"4,10": [ // 走到中间时的提示
|
"4,10": [ // 走到中间时的提示
|
||||||
"\t[样板提示]本层楼将会对各类事件进行介绍。",
|
"\t[样板提示]本层楼将会对各类事件进行介绍。",
|
||||||
"左边是一个仿50层的陷阱做法,上方是商店、快捷商店的使用方法,右上是一个典型的杀怪开门的例子,右下是各类可能的NPC事件。",
|
"左边是一个仿50层的陷阱做法,上方是商店、快捷商店的使用方法,右上是一个典型的杀怪开门的例子,右下是各类可能的NPC事件。",
|
||||||
"本样板目前支持的事件列表大致有:\ntext: 显示一段文字(比如你现在正在看到的)\nshow: 使一个事件有效(可见、可被交互)\nhide: 使一个事件失效(不可见、不可被交互)\ntrigger: 触发另一个地点的事件\nbattle: 强制和某怪物战斗\nopenDoor: 无需钥匙开门(例如机关门、暗墙)\nopenShop: 打开一个全局商店\nchangeFloor: 传送勇士到某层某位置\nchangePos: 传送勇士到当层某位置\nwin: 获得胜利(游戏通关)\nlose: 游戏失败",
|
"本样板目前支持的事件列表大致有:\ntext: 显示一段文字(比如你现在正在看到的)\nshow: 使一个事件有效(可见、可被交互)\nhide: 使一个事件失效(不可见、不可被交互)\ntrigger: 触发另一个地点的事件\nbattle: 强制和某怪物战斗\nopenDoor: 无需钥匙开门(例如机关门、暗墙)\nopenShop: 打开一个全局商店\ndisableShop: 禁用一个全局商店\nchangeFloor: 传送勇士到某层某位置\nchangePos: 传送勇士到当层某位置;转向\nsetFg: 更改画面色调",
|
||||||
"move: 移动事件效果\nplaySound: 播放某个音频\nif: 条件判断\nchoices: 提供选项\nsetValue: 设置勇士属性道具,或某个变量/flag\nupdate: 更新状态栏和地图显伤\nsleep: 等待多少毫秒\nexit: 立刻结束当前事件\nrevisit: 立刻结束事件并重新触发\nfunction: 自定义JS脚本\n\n更多支持的事件还在编写中,欢迎您宝贵的意见。",
|
"move: 移动事件效果\nplaySound: 播放某个音频\nif: 条件判断\nchoices: 提供选项\nsetValue: 设置勇士属性道具,或某个变量/flag\nupdate: 更新状态栏和地图显伤\nwin: 获得胜利(游戏通关)\nlose: 游戏失败\nsleep: 等待多少毫秒\nexit: 立刻结束当前事件\nrevisit: 立刻结束事件并重新触发\nfunction: 自定义JS脚本\n更多支持的事件还在编写中,欢迎您宝贵的意见。",
|
||||||
"有关各事件的样例,可参见本层一些NPC的写法。\n所有事件样例本层都有介绍。\n\n一个自定义事件处理完后,需要调用{\"type\": \"hide\"}该事件才不会再次出现。",
|
"有关各事件的样例,可参见本层一些NPC的写法。\n所有事件样例本层都有介绍。\n\n一个自定义事件处理完后,需要调用{\"type\": \"hide\"}该事件才不会再次出现。",
|
||||||
{"type": "hide"}
|
{"type": "hide"}
|
||||||
],
|
],
|
||||||
@ -59,7 +59,7 @@ main.floors.sample1 = {
|
|||||||
{"type": "hide", "loc": [1,8]},
|
{"type": "hide", "loc": [1,8]},
|
||||||
{"type": "hide", "loc": [1,5], "time": 500}, // 隐藏红衣魔王,动画500ms
|
{"type": "hide", "loc": [1,5], "time": 500}, // 隐藏红衣魔王,动画500ms
|
||||||
{"type": "hide"}, // 隐藏本事件
|
{"type": "hide"}, // 隐藏本事件
|
||||||
{"type": "setFg", "color": [255,255,255], 'time': 1250}, // 渐变为黑色
|
{"type": "setFg", "color": [0,0,0], 'time': 1250}, // 渐变为白色
|
||||||
{"type": "sleep", "time": 700},
|
{"type": "sleep", "time": 700},
|
||||||
{"type": "changeFloor", "floorId": "sample1", "loc": [1,11], 'direction': 'right', 'time': 1000}, // 楼层切换。changeFloor必须指定floorId和loc。
|
{"type": "changeFloor", "floorId": "sample1", "loc": [1,11], 'direction': 'right', 'time': 1000}, // 楼层切换。changeFloor必须指定floorId和loc。
|
||||||
// 备注:这里也可以下面的这种写法:
|
// 备注:这里也可以下面的这种写法:
|
||||||
|
|||||||
18
libs/ui.js
18
libs/ui.js
@ -320,10 +320,10 @@ ui.prototype.drawSettings = function (need) {
|
|||||||
|
|
||||||
core.canvas.ui.textAlign = "center";
|
core.canvas.ui.textAlign = "center";
|
||||||
core.fillText('ui', "音乐: " + (core.musicStatus.soundStatus ? "[ON]" : "[OFF]"), 208, top + 56, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', "音乐: " + (core.musicStatus.soundStatus ? "[ON]" : "[OFF]"), 208, top + 56, "#FFFFFF", "bold 17px Verdana");
|
||||||
core.fillText('ui', "快捷商店", 208, top + 88, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', '战斗过程: ' +(core.flags.battleAnimate?'[ON]':'[OFF]'), 208, top + 88, "#FFFFFF", "bold 17px Verdana")
|
||||||
//core.fillText('ui', "降低难度", 208, top + 120, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', "快捷商店", 208, top + 120, "#FFFFFF", "bold 17px Verdana");
|
||||||
core.fillText('ui', "同步存档", 208, top + 120, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', "同步存档", 208, top + 152, "#FFFFFF", "bold 17px Verdana");
|
||||||
core.fillText('ui', "清空存档", 208, top + 152, "#FFFFFF", "bold 17px Verdana");
|
// core.fillText('ui', "清空存档", 208, top + 152, "#FFFFFF", "bold 17px Verdana");
|
||||||
core.fillText('ui', "重新开始", 208, top + 184, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', "重新开始", 208, top + 184, "#FFFFFF", "bold 17px Verdana");
|
||||||
core.fillText('ui', "关于本塔", 208, top + 216, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', "关于本塔", 208, top + 216, "#FFFFFF", "bold 17px Verdana");
|
||||||
core.fillText('ui', "返回游戏", 208, top + 248, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', "返回游戏", 208, top + 248, "#FFFFFF", "bold 17px Verdana");
|
||||||
@ -362,6 +362,13 @@ ui.prototype.drawQuickShop = function (need) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui.prototype.drawBattleAnimate = function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绘制“请等候...”
|
* 绘制“请等候...”
|
||||||
@ -397,13 +404,14 @@ ui.prototype.drawSyncSave = function () {
|
|||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
|
|
||||||
var left = 97, top = 208 - 32 - 16 * 3, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
var left = 97, top = 208 - 32 - 16 * 3, right = 416 - 2 * left, bottom = 416 - 2 * top + 32;
|
||||||
core.fillRect('ui', left, top, right, bottom, background);
|
core.fillRect('ui', left, top, right, bottom, background);
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||||
|
|
||||||
core.canvas.ui.textAlign = "center";
|
core.canvas.ui.textAlign = "center";
|
||||||
core.fillText('ui', "同步存档到服务器", 208, top + 56, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', "同步存档到服务器", 208, top + 56, "#FFFFFF", "bold 17px Verdana");
|
||||||
core.fillText('ui', "从服务器加载存档", 208, top + 56 + 32, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', "从服务器加载存档", 208, top + 56 + 32, "#FFFFFF", "bold 17px Verdana");
|
||||||
|
core.fillText('ui', "清空本地存档", 208, top + 56 + 64, "#FFFFFF", "bold 17px Verdana");
|
||||||
core.fillText('ui', "返回游戏", 208, top + bottom - 40);
|
core.fillText('ui', "返回游戏", 208, top + bottom - 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
main.js
12
main.js
@ -1,5 +1,4 @@
|
|||||||
function main() {
|
function main() {
|
||||||
this.version = "0.1";
|
|
||||||
this.dom = {
|
this.dom = {
|
||||||
'body': document.body,
|
'body': document.body,
|
||||||
'gameGroup': document.getElementById('gameGroup'),
|
'gameGroup': document.getElementById('gameGroup'),
|
||||||
@ -79,6 +78,8 @@ function main() {
|
|||||||
'curse': document.getElementById('curse'),
|
'curse': document.getElementById('curse'),
|
||||||
'hard': document.getElementById("hard")
|
'hard': document.getElementById("hard")
|
||||||
}
|
}
|
||||||
|
this.version = "0.1"; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
|
||||||
|
|
||||||
this.useCompress = false; // 是否使用压缩文件
|
this.useCompress = false; // 是否使用压缩文件
|
||||||
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
||||||
// 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。
|
// 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。
|
||||||
@ -321,13 +322,8 @@ main.statusBar.image.settings.onclick = function () {
|
|||||||
main.dom.playGame.onclick = function () {
|
main.dom.playGame.onclick = function () {
|
||||||
main.dom.startButtons.style.display='none';
|
main.dom.startButtons.style.display='none';
|
||||||
|
|
||||||
/**
|
if (main.core.isset(main.core.flags.startDirectly) && main.core.flags.startDirectly) {
|
||||||
* 如果点击“开始游戏”直接开始游戏而不是进入难度选择页面,则将下面这个改成true
|
core.events.startGame("");
|
||||||
*/
|
|
||||||
var startGameNow = false;
|
|
||||||
|
|
||||||
if (startGameNow) {
|
|
||||||
core.events.startGame();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
main.dom.levelChooseButtons.style.display='block';
|
main.dom.levelChooseButtons.style.display='block';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user