Merge pull request #280 from ckcz123/dev

Dynamic canvas
This commit is contained in:
Zhang Chen 2018-12-17 15:56:12 +08:00 committed by GitHub
commit 81a018c462
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 1418 additions and 907 deletions

View File

@ -262,13 +262,12 @@ action
| unfollow_s
| animate_s
| vibrate_s
| showImage_0_s
| showImage_1_s
| animateImage_0_s
| animateImage_1_s
| showImage_s
| hideImage_s
| showTextImage_s
| moveImage_s
| showGif_0_s
| showGif_1_s
| moveImage_0_s
| setFg_0_s
| setFg_1_s
| setWeather_s
@ -279,6 +278,8 @@ action
| playBgm_s
| pauseBgm_s
| resumeBgm_s
| loadBgm_s
| freeBgm_s
| playSound_s
| setVolume_s
| win_s
@ -814,14 +815,16 @@ return code;
*/;
hideStatusBar_s
: '隐藏状态栏' Newline
: '隐藏状态栏' '不隐藏竖屏工具栏' Bool Newline
/* hideStatusBar_s
tooltip : hideStatusBar: 隐藏状态栏
helpUrl : https://h5mota.com/games/template/docs/#/event?id=hideStatusBar%ef%bc%9a%e9%9a%90%e8%97%8f%e7%8a%b6%e6%80%81%e6%a0%8f
colour : this.soundColor
var code = '{"type": "hideStatusBar"},\n';
default : [false]
Bool_0 = Bool_0?', "toolbox": true':'';
var code = '{"type": "hideStatusBar"'+Bool_0+'},\n';
return code;
*/;
@ -1021,58 +1024,50 @@ var code = '{"type": "animate", "name": "'+IdString_0+'"'+EvalString_0+async+'},
return code;
*/;
showImage_0_s
: '显示图片' EvalString '起点像素位置' 'x' PosString 'y' PosString Newline
showImage_s
: '显示图片' '图片编号' Int '图片' EvalString '起点像素位置' 'x' PosString 'y' PosString BGNL?
'放大率 : x' Int '% y' Int '% 不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
/* showImage_0_s
/* showImage_s
tooltip : showImage显示图片
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showimage%EF%BC%9A%E6%98%BE%E7%A4%BA%E5%9B%BE%E7%89%87
default : ["bg.jpg","0","0"]
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showImage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87
default : [1,"bg.jpg","0","0",100,100,1,0,false]
colour : this.printColor
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n';
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var async = Bool_0?', "async": true':'';
var code = '{"type": "showImage", "code": '+Int_0+', "image": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "dw": '+Int_1+', "dh": '+Int_2+', "opacity": '+Number_0+', "time": '+Int_3+async+'},\n';
return code;
*/;
showImage_1_s
: '清除所有图片' Newline
showTextImage_s
: '显示图片化文本' '文本内容' EvalString BGNL?
'图片编号' Int '起点像素位置' 'x' PosString 'y' PosString '不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
/* showImage_1_s
tooltip : showImage清除所有显示图片
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showimage%EF%BC%9A%E6%98%BE%E7%A4%BA%E5%9B%BE%E7%89%87
/* showTextImage_s
tooltip : showTextImage显示图片化文本
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showTextImage%ef%bc%9a%e6%98%be%e7%a4%ba%e6%96%87%e6%9c%ac%e5%8c%96%e5%9b%be%e7%89%87
colour : this.printColor
var code = '{"type": "showImage"},\n';
default : ["可以使用setText事件来控制字体、颜色、大小、偏移量等",1,"0","0",1,0,false]
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var async = Bool_0?', "async": true':'';
var code = '{"type": "showTextImage", "code": '+Int_0+', "text": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "opacity": '+Number_0+', "time": '+Int_1+async+'},\n';
return code;
*/;
animateImage_0_s
: '图片淡入' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int '保留图片' Bool '不等待执行完毕' Bool Newline
hideImage_s
: '清除图片' '图片编号' Int '时间' Int '不等待执行完毕' Bool Newline
/* animateImage_0_s
tooltip : animageImage图片淡入
helpUrl : https://h5mota.com/games/template/docs/#/event?id=animateimage%EF%BC%9A%E5%9B%BE%E7%89%87%E6%B7%A1%E5%85%A5%E6%B7%A1%E5%87%BA
default : ["bg.jpg","0","0",500,true,false]
/* hideImage_s
tooltip : hideImage清除图片
helpUrl : https://h5mota.com/games/template/docs/#/event?id=hideImage%ef%bc%9a%e6%b8%85%e9%99%a4%e5%9b%be%e7%89%87
colour : this.printColor
var keep = Bool_0?', "keep": true':'';
var async = Bool_1?', "async": true':'';
var code = '{"type": "animateImage", "action": "show", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "time": '+Int_0+keep+async+'},\n';
return code;
*/;
animateImage_1_s
: '图片淡出' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int '清除图片' Bool '不等待执行完毕' Bool Newline
/* animateImage_1_s
tooltip : animageImage图片淡出
helpUrl : https://h5mota.com/games/template/docs/#/event?id=animateimage%EF%BC%9A%E5%9B%BE%E7%89%87%E6%B7%A1%E5%85%A5%E6%B7%A1%E5%87%BA
default : ["bg.jpg","0","0",500,true,false]
colour : this.printColor
var keep = Bool_0?', "keep": true':'';
var async = Bool_1?', "async": true':'';
var code = '{"type": "animateImage", "action": "hide", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "time": '+Int_0+keep+async+'},\n';
default : [1,0,false]
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var async = Bool_0?', "async": true':'';
var code = '{"type": "hideImage", "code": '+Int_0+', "time": '+Int_1+async+'},\n';
return code;
*/;
@ -1101,19 +1096,23 @@ var code = '{"type": "showGif"},\n';
return code;
*/;
moveImage_0_s
: '图片移动' EvalString '起点像素位置' 'x' PosString 'y' PosString BGNL
'终点像素位置' 'x' PosString 'y' PosString '移动时间' Int '保留图片' Bool '不等待执行完毕' Bool Newline
moveImage_s
: '图片移动' '图片编号' Int '终点像素位置' 'x' PosString? 'y' PosString? BGNL?
'不透明度' EvalString? '移动时间' Int '不等待执行完毕' Bool Newline
/* moveImage_0_s
/* moveImage_s
tooltip : moveImage图片移动
helpUrl : https://h5mota.com/games/template/docs/#/event?id=moveimage%EF%BC%9A%E5%9B%BE%E7%89%87%E7%A7%BB%E5%8A%A8
default : ["bg.jpg","0","0","0","0",500,true,false]
helpUrl : https://h5mota.com/games/template/docs/#/event?id=moveImage%ef%bc%9a%e5%9b%be%e7%89%87%e7%a7%bb%e5%8a%a8
default : [1,'','','',500,false]
colour : this.printColor
var keep = Bool_0?', "keep": true':'';
var async = Bool_1?', "async": true':'';
var code = '{"type": "moveImage", "name": "'+EvalString_0+'", "from": ['+PosString_0+','+PosString_1+'], "to": ['+PosString_2+','+PosString_3+'], "time": '+Int_0+keep+async+'},\n';
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var toloc = '';
if (PosString_0 && PosString_1)
toloc = ', "to": ['+PosString_0+','+PosString_1+']';
EvalString_0 = (EvalString_0!=='') ? (', "opacity": '+EvalString_0):'';
var async = Bool_0?', "async": true':'';
var code = '{"type": "moveImage", "code": '+Int_0+toloc+EvalString_0+',"time": '+Int_1+async+'},\n';
return code;
*/;
@ -1285,6 +1284,32 @@ var code = '{"type": "resumeBgm"},\n';
return code;
*/;
loadBgm_s
: '预加载背景音乐' EvalString Newline
/* loadBgm_s
tooltip : loadBgm: 预加载某个背景音乐,之后可以直接播放
helpUrl : https://h5mota.com/games/template/docs/#/event?id=loadBgm%ef%bc%9a%e9%a2%84%e5%8a%a0%e8%bd%bd%e4%b8%80%e4%b8%aa%e8%83%8c%e6%99%af%e9%9f%b3%e4%b9%90
default : ["bgm.mp3"]
colour : this.soundColor
var code = '{"type": "loadBgm", "name": "'+EvalString_0+'"},\n';
return code;
*/;
freeBgm_s
: '释放背景音乐的缓存' EvalString Newline
/* freeBgm_s
tooltip : freeBgm: 释放背景音乐的缓存
helpUrl : https://h5mota.com/games/template/docs/#/event?id=freeBgm%ef%bc%9a%e9%87%8a%e6%94%be%e4%b8%80%e4%b8%aa%e8%83%8c%e6%99%af%e9%9f%b3%e4%b9%90%e7%9a%84%e7%bc%93%e5%ad%98
default : ["bgm.mp3"]
colour : this.soundColor
var code = '{"type": "freeBgm", "name": "'+EvalString_0+'"},\n';
return code;
*/;
playSound_s
: '播放音效' EvalString Newline
@ -2077,22 +2102,23 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['vibrate_s'].xmlText([data.time||0, data.async||false, this.next]);
break;
case "showImage": // 显示图片
if(this.isset(data.name)){
this.next = MotaActionBlocks['showImage_0_s'].xmlText([
data.name,data.loc[0],data.loc[1],this.next]);
} else {
this.next = MotaActionBlocks['showImage_1_s'].xmlText([
this.next]);
}
data.loc=data.loc||['','']
this.next = MotaActionBlocks['showImage_s'].xmlText([
data.code,data.image,data.loc[0],data.loc[1],data.dw,data.dh,data.opacity,data.time||0,data.async||false,this.next]);
break;
case "animateImage": // 显示图片
if(data.action == 'show'){
this.next = MotaActionBlocks['animateImage_0_s'].xmlText([
data.name,data.loc[0],data.loc[1],data.time||0,data.keep||false,data.async||false,this.next]);
} else if (data.action == 'hide') {
this.next = MotaActionBlocks['animateImage_1_s'].xmlText([
data.name,data.loc[0],data.loc[1],data.time||0,data.keep||false,data.async||false,this.next]);
}
case "hideImage": // 清除图片
this.next = MotaActionBlocks['hideImage_s'].xmlText([
data.code,data.time||0,data.async||false,this.next]);
break;
case "showTextImage": // 显示图片化文本
data.loc=data.loc||['','']
this.next = MotaActionBlocks['showTextImage_s'].xmlText([
this.EvalString(data.text),data.code,data.loc[0],data.loc[1],data.opacity,data.time||0,data.async||false,this.next]);
break;
case "moveImage": // 移动图片
data.to=data.to||['','']
this.next = MotaActionBlocks['moveImage_s'].xmlText([
data.code, data.to[0], data.to[1], data.opacity, data.time||0, data.async||false, this.next]);
break;
case "showGif": // 显示动图
if(this.isset(data.name)){
@ -2103,11 +2129,6 @@ ActionParser.prototype.parseAction = function() {
this.next]);
}
break;
case "moveImage": // 移动图片
this.next = MotaActionBlocks['moveImage_0_s'].xmlText([
data.name, data.from[0], data.from[1], data.to[0], data.to[1], data.time||0, data.keep||false, data.async||false, this.next
]);
break;
case "setFg": // 颜色渐变
if(this.isset(data.color)){
var alpha = data.color[3];
@ -2164,6 +2185,14 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['resumeBgm_s'].xmlText([
this.next]);
break
case "loadBgm":
this.next = MotaActionBlocks['loadBgm_s'].xmlText([
data.name,this.next]);
break
case "freeBgm":
this.next = MotaActionBlocks['freeBgm_s'].xmlText([
data.name,this.next]);
break
case "setVolume":
this.next = MotaActionBlocks['setVolume_s'].xmlText([
data.value, data.time||0, data.async||false, this.next]);
@ -2257,7 +2286,7 @@ ActionParser.prototype.parseAction = function() {
break;
case "hideStatusBar":
this.next = MotaActionBlocks['hideStatusBar_s'].xmlText([
this.next]);
data.toolbox||false,this.next]);
break;
case "updateEnemys":
this.next = MotaActionBlocks['updateEnemys_s'].xmlText([
@ -2355,7 +2384,7 @@ MotaActionFunctions.IdString_pre = function(IdString){
MotaActionFunctions.PosString_pre = function(PosString){
if (!PosString || /^-?\d+$/.test(PosString)) return PosString;
if (!(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/.test(PosString)))throw new Error(PosString+'中包含了0-9 a-z A-Z _ - :之外的字符,或者是没有以flag: 开头');
if (!(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_:]*$/.test(PosString)))throw new Error(PosString+'中包含了0-9 a-z A-Z _ :之外的字符,或者是没有以flag: 开头');
return '"'+PosString+'"';
}

View File

@ -664,6 +664,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在经过领域/夹击/路障等伤害后禁用快捷商店。"
},
"checkConsole": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否检查控制台的开启情况。"
}
}
}

View File

@ -298,7 +298,7 @@ editor.prototype.updateMap = function () {
var evs = {};
if (editor.currentFloorData && editor.currentFloorData.events) {
for (var loc in editor.currentFloorData.events) {
if (editor.currentFloorData.events[loc].animate == false)
if ((editor.currentFloorData.events[loc]||{}).animate == false)
evs[loc] = {"animate": false};
}
}

View File

@ -63,13 +63,12 @@ editor_blockly = function () {
MotaActionBlocks['autoText_s'].xmlText(),
MotaActionBlocks['scrollText_s'].xmlText(),
MotaActionBlocks['setText_s'].xmlText(),
MotaActionBlocks['showImage_0_s'].xmlText(),
MotaActionBlocks['animateImage_0_s'].xmlText(),
MotaActionBlocks['animateImage_1_s'].xmlText(),
MotaActionBlocks['showImage_1_s'].xmlText(),
MotaActionBlocks['showImage_s'].xmlText(),
MotaActionBlocks['hideImage_s'].xmlText(),
MotaActionBlocks['showTextImage_s'].xmlText(),
MotaActionBlocks['moveImage_s'].xmlText(),
MotaActionBlocks['showGif_0_s'].xmlText(),
MotaActionBlocks['showGif_1_s'].xmlText(),
MotaActionBlocks['moveImage_0_s'].xmlText(),
MotaActionBlocks['tip_s'].xmlText(),
MotaActionBlocks['win_s'].xmlText(),
MotaActionBlocks['lose_s'].xmlText(),
@ -145,6 +144,8 @@ editor_blockly = function () {
MotaActionBlocks['playBgm_s'].xmlText(),
MotaActionBlocks['pauseBgm_s'].xmlText(),
MotaActionBlocks['resumeBgm_s'].xmlText(),
MotaActionBlocks['loadBgm_s'].xmlText(),
MotaActionBlocks['freeBgm_s'].xmlText(),
MotaActionBlocks['playSound_s'].xmlText(),
MotaActionBlocks['setVolume_s'].xmlText(),
],
@ -433,7 +434,7 @@ function omitedcheckUpdateFunction(event) {
MotaActionFunctions.parse(
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g, function (c) {
return {'<': '&lt;', '>': '&gt;', '&': '&amp;'}[c];
})),
}).replace(/\\r/g, '\\\\r').replace(/\\f/g, '\\\\f')),
document.getElementById('entryType').value
);
}
@ -448,7 +449,7 @@ function omitedcheckUpdateFunction(event) {
var type = args.type;
if (!type) return false;
editor_blockly.id = id_;
codeAreaHL.setValue(input.value.replace(/\\r/g,'\\\\r').replace(/\\f/,'\\\\f'));
codeAreaHL.setValue(input.value);
document.getElementById('entryType').value = type;
editor_blockly.parse();
editor_blockly.show();
@ -521,6 +522,7 @@ function omitedcheckUpdateFunction(event) {
'scrollText_s': 'EvalString_0',
'comment_s': 'EvalString_0',
'choices_s': 'EvalString_0',
'showTextImage_s': 'EvalString_0',
'function_s': 'RawEvalString_0',
'shopsub': 'EvalString_3',
}

View File

@ -162,6 +162,12 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_type": "textarea",
"_lint": true,
"_data": "阻激夹域的伤害值计算"
},
"moveOneStep": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "勇士每走一步的操作"
}
}
},

View File

@ -184,12 +184,6 @@ core.trigger(x, y) [异步]
触发某个地点的事件。
core.clearMap(mapName)
清空某个画布图层。
mapName可为'bg', 'event', 'hero', 'event2', 'fg', 'damage', 'animate', 'weather', 'ui', 'data', 'all'之一。
如果mapName为'all',则为清空所有画布;否则只清空对应的画布。
core.drawBlock(block)
重绘某个图块。block应为core.status.thisMap.blocks中的一项。
@ -473,6 +467,86 @@ core.maps.removeBlockByIds(floorId, ids)
ui.js主要用来进行UI窗口的绘制比如对话框、怪物手册、楼传器、存读档界面等等。
core.ui.getContextByName(name)
根据画布名找到一个画布的context支持系统画布和自定义画布。如果不存在画布返回null。
core.clearMap(name)
清空某个画布图层。
name为画布名可以是系统画布之一也可以是任意自定义动态创建的画布名。
如果name也可以是'all'若为all则为清空除色调层外的所有系统画布。
core.ui.fillText(name, text, x, y, style, font)
在某个画布上绘制一段文字。
name为画布名可以是系统画布之一也可以是任意自定义动态创建的画布名。下同
text为要绘制的文本x,y为要绘制的坐标style可选为绘制的样式font可选为绘制的字体。
core.ui.fillBoldText(canvas, text, style, x, y, font)
在某个画布上绘制一个描黑边的文字。
canvas为要绘制的画布的contexttext为文本style为颜色样式x,y坐标font可选为要绘制的字体。
core.ui.fillRect(name, x, y, width, height, style)
绘制一个矩形。style可选为绘制样式。
core.ui.strokeRect(name, x, y, width, height, style)
绘制一个矩形的边框。
core.ui.drawLine(name, x1, y1, x2, y2, style, lineWidth)
绘制一条线。lineWidth可选为线宽。
core.ui.drawArrow(name, x1, y1, x2, y2, style, lineWidth)
绘制一个箭头。
core.ui.setFont(name, font) / core.ui.setLineWidth(name, lineWidth)
设置一个画布的字体/线宽。
core.ui.setAlpha(name, font) / core.ui.setOpacity(name, font)
设置一个画布的绘制不透明度和画布本身的不透明度。
两者区别如下:
- setAlpha是设置"接下来绘制的内容的不透明度"不会对已经绘制的内容产生影响。比如setAlpha('ui', 0.5)则会在接下来的绘制中使用0.5的不透明度。
- setOpacity是设置"画布本身的不透明度"已经绘制的内容也会产生影响。比如我已经在UI层绘制了一段文字再setOpacity则也会看起来变得透明。
尽量不要对系统画布使用setOpacity因为会对已经绘制的内容产生影响自定义创建的画布则不受此限制。
core.ui.setFillStyle(name, style) / core.ui.setStrokeStype(name, style)
设置一个画布的填充样式/描边样式。
core.ui.createCanvas(name, x, y, width, height, zIndex)
动态创建一个画布。name为要创建的画布名如果已存在则会直接取用当前存在的。
x,y为创建的画布相对窗口左上角的像素坐标width,height为创建的长宽。
zIndex为创建的纵向高度关系到画布之间的覆盖z值高的将覆盖z值低的系统画布的z值可在个性化中查看。
创建一个画布后,可以通过 core.dymCanvas[name] 进行调用。
core.ui.findCanvas(name)
寻找一个自定义画布的索引;如果存在该画布则返回对应的索引,不存在画布则返回-1。
core.ui.relocateCanvas(name, x, y)
重新定位一个自定义画布。
core.ui.resizeCanvas(name, x, y)
重新设置一个自定义画布的大小。
core.ui.deleteCanvas(name)
删除一个自定义画布。
core.ui.deleteAllCanvas()
清空所有的自定义画布。
core.ui.drawThumbnail(floorId, canvas, blocks, x, y, size, heroLoc, heroIcon)
绘制一个缩略图,比如楼传器界面,存读档界面等情况。
floorId为目标楼层IDcanvas为要绘制到的图层blocks为要绘制的所有图块。

View File

@ -402,6 +402,14 @@ floorId指定的是目标楼层的唯一标识符ID
!> iOS平台以及部分浏览器不支持获得当前网络状态此时即使在使用Wifi也必须要用户点击“音乐开关”才能播放音乐。
从V2.5.3开始,可以使用`loadBgm`事件来预加载一个bgm这样到播放时无需等待直接播放。
同时BGM将使用LRU算法增加缓存机制。默认最多缓存4个BGM在core.js的musicStatus.cachedBgmCount控制
系统会自动释放最久未使用的BGM。
也可以使用`freeBgm`事件来手动释放一个无需再用的bgm。
## 录像
HTML5魔塔一大亮点就是存在录像系统可以很方便进行录像回放。

View File

@ -750,7 +750,7 @@ name是可选的代表目标行走图的文件名。
使用`{"type": "hideStatusBar"}`可以隐藏状态栏。读档或重新开始游戏时,状态栏会重新显示。
隐藏状态栏的状态下,将无法点击工具栏里面的按钮(如存读档怪物手册等)。建议仅在事件中使用,事件结束前显示
可以添加`"toolbox": true`来不隐藏竖屏模式下的工具栏
### showStatusBar显示状态栏
@ -923,7 +923,7 @@ async可选如果为true则会异步执行即不等待当前事件执行
]
```
name为动画名**请确保动画在main.js中的this.animates中被定义过。**
name为动画名**请确保动画在全塔属性中的animates中被定义过。**
loc为动画的位置可以是`[x,y]`表示在(x,y)点显示,也可以是字符串`"hero"`表示在勇士点显示。
@ -939,48 +939,66 @@ loc可忽略如果忽略则显示为事件当前点。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "showImage", "name": "bg.jpg", "loc": [231,297]}, // 在(231,297)显示bg.jpg
{"type": "showImage", "name": "1.png", "loc": [109,167]}, // 在(109,167)显示1.png
{"type": "showImage"} // 如果不指定name则清除所有图片。
{"type": "showImage", "code": 1, "image": "bg.jpg", "loc": [231,297], "dw": 100, "dy" : 100, "opacity": 1, "time" : 0}, // 在(231,297)显示bg.jpg
{"type": "showImage", "code": 12, "image": "1.png", "loc": [209,267], "dw": 100, "dy" : 100, "opacity": 0.5, "time" : 1000}, // 在(209,267)渐变显示1.png渐变时间为1000毫秒完成时不透明度为0.5,这张图片将遮盖上一张
{"type": "showImage", "code": 8, "image": "hero.png", "loc": [349,367], "dw": 50, "dy" : 50, "opacity": 1, "time" : 500, "async": true}, // 在(209,267)渐变显示hero.png大小为原图片的一半渐变时间为500毫秒异步执行这张图片将被上一张遮盖
]
```
name为图片名。**请确保图片在data.js中的images中被定义过。**
code为图片编号如果两张图片重叠编号较大会覆盖编号较小的。该值需要在1~50之间。
image为图片名。**请确保图片在全塔属性中的images中被定义过。**
loc为图片左上角坐标以像素为单位进行计算。
如果不指定name则清除所有显示的图片
dw和dh为图片的横向、纵向放大率默认值为100即不进行缩放
调用show/hide/move/animate等几个事件同样会清除所有显示的图片
opacity为图片不透明度在0~1之间默认值为1即不透明
### animateImage图片淡入淡出
我们还可以使用 `{"type": "animateImage"}` 来造成显示图片的淡入淡出效果。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "animateImage", "action": "show", "name": "bg.jpg", "loc": [231,297], "time": 500, "keep": true}, // 在(231,297)淡入bg.jpg动画时间500ms
{"type": "animateImage", "action": "hide", "name": "1.png", "loc": [109,167], "time": 300, "async": true}, // 在(109,167)淡出1.png动画时间300ms异步执行
]
```
action为淡入还是淡出`show`为淡入,`hide`会淡出。
name为图片名。**请确保图片在data.js中的images中被定义过。**
loc为图片左上角坐标以像素为单位进行计算。
time为淡入淡出的时间如果是0则忽略此项。
keep可选如果为true则在淡入图片后立刻调用showImage以保留图片在淡出图片前先清除再动画。
time为渐变时间默认值为0即不渐变直接显示。
async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件
如果多张图片的淡入淡出可以采用以下方式(仅供参考):
### showTextImage显示文本化图片
假设我现在已经有了`1.jpg`显示在屏幕上:
- 淡入显示`2.png`:调用`animateImage`淡入图片,然后立刻调用`showImage`显示图片。
- 淡出`1.png`:清除所有图片,`showImage`显示`2.png`,然后调用`animateImage`淡出`1.jpg`
我们可以使用 `{"type": "showTextImage"}` 以图片的方式显示文本。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "showTextImage", "code": 1, "text": "第一排\n第二排\n\n空行后的一排", "loc": [231,297], "opacity": 1, "time" : 0}, // 在(231,297)显示"第一排\n第二排\n\n空行后的一排"
]
```
code为图片编号如果两张图片重叠编号较大会覆盖编号较小的。该值需要在1~50之间。
text为要显示的文本。默认行宽为416。
loc为图片左上角坐标以像素为单位进行计算。
opacity为图片不透明度在0~1之间默认值为1即不透明。
time为渐变时间默认值为0即不渐变直接显示。
async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件
文本通过图片的方式显示后,即视为一张正常图片,可以被清除或者移动。
### hideImage清除图片
我们可以使用 `{"type": "hideImage"}` 来清除一张图片。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "hideImage", "code": 1, "time" : 0}, // 使1号图片消失
{"type": "hideImage", "code": 12, "time" : 1000}, // 使12号图片渐变消失时间为1000毫秒
]
```
time为渐变时间默认值为0即不渐变直接消除。
code为显示图片时输入的图片编号。
async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件
### showGif显示动图
@ -993,7 +1011,7 @@ async可选如果为true则会异步执行即不等待当前事件执行
]
```
name为图片名。**请确保图片在data.js中的images中被定义过。**
name为图片名。**请确保图片在全塔属性中的images中被定义过。**
loc为动图左上角坐标以像素为单位进行计算。
@ -1001,24 +1019,24 @@ loc为动图左上角坐标以像素为单位进行计算。
### moveImage图片移动
我们可以使用 `{"type": "moveImage"}` 来造成图片移动效果。
我们可以使用 `{"type": "moveImage"}` 来造成图片移动,淡入淡出等效果。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "moveImage", "name": "bg.jpg", "from": [231,297], "to": [22,333], "time": 500, "keep": true, "async": true},
{"type": "moveImage", "code": 1, "to": [22,333], "opacity": 1, "time": 1000}, // 将1号图片移动到(22,333)动画时间为1000ms
{"type": "moveImage", "code": 12, "opacity": 0.5, "time": 500}, // 将二号图片的透明度变为0.5动画时间500ms
{"type": "moveImage", "code": 1, "to": [109,167], "opacity": 0, "time": 300, "async": true}, // 将1号图片移动到(109,167)透明度设为0不可见动画时间300ms异步执行
]
```
name为图片名。**请确保图片在data.js中的images中被定义过。**
code为图片编号。该值需要在1~50之间。
from为起点图片左上角坐标,以像素为单位进行计算。
to为终点图片左上角坐标,以像素为单位进行计算,不填写则视为当前图片位置
to为终点图片左上角坐标以像素为单位进行计算
opacity为完成时图片不透明度移动过程中逐渐变化。在0~1之间
time为总移动的时间。
keep可选如果为true则在移动结束后立刻调用showImage以保留图片。
async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件
### setFg更改画面色调
@ -1199,6 +1217,20 @@ async可选如果为true则会异步执行即不等待当前事件执行
使用`{"type": "resumeBgm"}`可以恢复背景音乐的播放。
### loadBgm预加载一个背景音乐
使用loadBgm可以预加载一个背景音乐。
使用方法:`{"type": "loadBgm", "name": "bgm.mp3"}`
有关BGM播放的详细说明参见[背景音乐](element#背景音乐)
### freeBgm释放一个背景音乐的缓存
使用freeBgm可以预加载一个背景音乐。
使用方法:`{"type": "freeBgm", "name": "bgm.mp3"}`
### playSound播放音效
使用playSound可以立刻播放一个音效。
@ -1851,8 +1883,8 @@ if (core.getFlag("door",0)==2) {
{"text": "攻击+4", "effect": "status:atk+=4"},
{"text": "防御+4", "effect": "status:def+=4"},
{"text": "魔防+10", "effect": "status:mdef+=10"}
// effect只能对status和item进行操作不能修改flag值
// 必须是X+=Y的形式其中Y可以是一个表达式以status:xxx或item:xxx为参数
// effect可以对statusitem和flag进行操作
// 必须是X+=Y的形式其中Y可以是一个表达式以status:xxx, item:xxx或flag:xxx为参数
// 其他effect样例
// "item:yellowKey+=1" 黄钥匙+1
// "item:pickaxe+=3" 破墙镐+3
@ -1894,7 +1926,7 @@ if (core.getFlag("door",0)==2) {
- text 为商店所说的话。可以用${need}表示需要的数值。
- choices 为商店的各个选项是一个list每一项是一个选项
- text为显示文字。请注意这里不支持 ${} 的表达式计算。
- effect 为该选项的效果effect只能对status或items进行操作且必须是 `status:xxx+=yyy``item:xxx+=yyy`的形式。即中间必须是+=符号。
- effect 为该选项的效果effect必须是 `status:xxx+=yyy`, `item:xxx+=yyy`或`flag:xxx+=yyy`的形式。即中间必须是+=符号。
- 如有多个effect例如升级全属性提升使用分号分开参见经验商店的写法。
像这样定义了全局商店后,即可在快捷栏中看到。
@ -2168,6 +2200,7 @@ if (core.getFlag("door",0)==2) {
core.waitHeroToStop(function() {
core.removeGlobalAnimate(0,0,true);
core.clearMap('all'); core.clearMap('curtain'); // 清空全地图
core.deleteAllCanvas();
core.drawText([
"\t[恭喜通关]你的分数是${status:hp}。"
], function () {

View File

@ -8,21 +8,44 @@
HTML5魔塔是使用画布canvas来绘制存在若干个图层它们之间有一个覆盖关系后面的图层将覆盖前面的图层。
所有图层从低往高依次如下:(加[B]的代表该层是大地图)
所有图层从低往高依次如下:(加[B]的代表该层是大地图z-index代表该层的纵向高度
- bg**[B]**背景层绘制背景图层素材bgmap和背景贴图
- event**[B]**事件层所有事件道具、墙壁、NPC、怪物等都绘制在这一层进行处理
- hero勇士层主要用来绘制勇士
- event2**[B]**事件2层本层主要用来绘制48x32的图片素材的上半部分避免和勇士错位
- fg**[B]**前景层绘制前景图层素材fgmap和前景贴图
- damage**[B]**:显伤层;主要用来绘制怪物显伤和领域显伤
- animate动画层主要用来绘制动画。
- weather天气层主要用来绘制天气雨/雪/雾)
- route**[B]**:路线层;主要用来绘制勇士的行走路线图,也用来绘制图块的淡入/淡出效果,图块的移动等。
- curtain色调层用来控制当前楼层的画面色调
- image图片层主要用来绘制显示图片该层之所以在curtain层上是为了可以在全黑时贴大头像图
- uiUI层用来绘制一切UI窗口如剧情文本、怪物手册、楼传器、系统菜单等等
- data数据层用来绘制一些顶层的或更新比较快的数据如左上角的提示战斗界面中数据的变化等等。
- bg**[B]**背景层绘制背景图层素材bgmap和背景贴图 (z-index: 10)
- event**[B]**事件层所有事件道具、墙壁、NPC、怪物等都绘制在这一层进行处理 (z-index: 30)
- hero勇士层主要用来绘制勇士 (z-index: 40)
- event2**[B]**事件2层本层主要用来绘制48x32的图片素材的上半部分避免和勇士错位 (z-index: 50)
- fg**[B]**前景层绘制前景图层素材fgmap和前景贴图 (z-index: 60)
- damage**[B]**:显伤层;主要用来绘制怪物显伤和领域显伤 (z-index: 65)
- animate动画层主要用来绘制动画。 (z-index: 70)
- weather天气层主要用来绘制天气雨/雪/雾) (z-index: 80)
- route**[B]**:路线层;主要用来绘制勇士的行走路线图。 (z-index: 95)
- curtain色调层用来控制当前楼层的画面色调 (z-index: 100)
- uiUI层用来绘制一切UI窗口如剧情文本、怪物手册、楼传器、系统菜单等等 (z-index: 160)
- data数据层用来绘制一些顶层的或更新比较快的数据如左上角的提示战斗界面中数据的变化等等。 (z-index: 170)
### 动态创建canvas
从V2.5.3开始可以在H5样板中任意动态创建canvas并进行使用。
使用`core.createCanvas(name, x, y, w, h, z)`来动态创建一个画布。
其中name为动态canvas名称x,y,w,h为创建的画布相对窗口左上角的像素坐标和长宽z为画布的纵向高度。
例如:`core.createCanvas('test', 10, 20, 100, 200, 74)` 创建了一个名为test的画布其左上角相对窗口的像素坐标为(10,20)宽100高200纵向高度74在动画层和天气层之间
可以通过 `core.dymCanvas[name]` 来获得该画布的context例如 `core.dymCanvas.test` 就是我们上面创建的画布的context然后进行操作。
也可以简单的使用`core.fillText()`, `core.fillRect()`, `core.strokeRect()`等等对画布进行任意绘制。
``` js
core.fillText('test', '这是一段文字', 10, 30, '#FF0000', '16px Verdana'); // 绘制一段文本
```
使用 `core.deleteCanvas(name)` 删除一个动态创建的画布,例如 `core.deleteCanvas('test')`
`core.deleteAllCanvas()`可以删除所有动态创建的画布,`core.relocateCanvas(name, x, y)`和`core.resizeCanvas(name, x, y)`可以对画布的位置和大小进行改变。
更多详细API请参见[API列表](api)。
## 自定义素材
@ -779,6 +802,65 @@ if (core.flags.enableSkill) {
通过上述这几种方式我们就能成功的让H5支持技能啦
## 成就系统
我们还可以给HTML5魔塔增加成就系统。注意到成就是和游戏相关因此需要使用getLocalStorage而不是getFlag判定。
可将下面的代码粘贴到脚本编辑 - 插件编写中。
``` js
// 所有成就项的定义
this.achievements = [
// 每行一个分别定义flag、名称、描述、是否存在提示、成就点数
{"flag": "a1", "name": "成就1", "text": "成就1的达成描述", "hint": false, "point": 1},
// 可以继续往后新增其他的。
];
// 达成成就;如 core.plugin.achieve("a1") 即达成a1对应的成就
this.achieve = function (flag) {
// 获得已达成的成就如果跟存档而不是跟游戏则改成getFlag
var achieved = core.getLocalStorage("achievements", []);
var point = core.getLocalStorage("achievePoint", 0);
// 已经获得该成就
if (achieved.indexOf(flag)>=0) return;
// 尝试达成成就;找到对应的成就项
this.achievements.forEach(function (one) {
if (one.flag == flag) {
// 执行达成成就的操作;也可以自行在上面加上达成成就后的事件
core.insertAction("\t[达成成就:"+one.name+"]"+one.text);
point += one.point || 0;
}
});
achieved.push(flag);
// 存入localStorage中如果跟存档走则使用setFlag
core.setLocalStorage("achievements", achieved);
core.setLocalStorage("achievePoint", point);
}
// 获得所有成就说明这里简单使用两个insertAction你也可以修改成自己的实现
// 简单一点的可以使用insertAction+剧情文本稍微复杂一点的可以使用图片化文本等更复杂的可以自绘UI。
this.getAchievements = function () {
var achieved = core.getLocalStorage("achievements", []);
var yes = [], no = [];
// 对所有成就进行遍历
this.achievements.forEach(function (one) {
// 检测是否达成
if (achieved.indexOf(one.flag)>=0) {
yes.push(one.name+""+one.text);
}
else {
no.push(one.name+""+(one.hint?one.text:"达成条件请自行探索"));
}
});
core.insertAction([
"\t[已达成的成就]"+(yes.length==0?"暂无":yes.join("\n")),
"\t[尚未达成的成就]"+(no.length==0?"暂无":no.join("\n"))
]);
}
```
## 多角色的支持
其实,我们的样板还能支持多角色的制作。比如《黑·白·间》之类的塔也是完全可以刻的。
@ -787,7 +869,7 @@ if (core.flags.enableSkill) {
1. 每个角色弄一张行走图。相关信息参见[自定义事件setHeroIcon](event#setHeroIcon更改角色行走图)。
2. [覆盖楼传事件](#覆盖楼传事件),这样可以通过点工具栏的楼层传送按钮来切换角色。当然你也完全可以自己写一个道具,或[自定义快捷键](#自定义快捷键)来进行绑定。
3. 将下述代码直接贴入脚本编辑 - 插件编写中。(写在`var _useEquipment = ...`之前。)
3. 将下述代码直接贴入脚本编辑 - 插件编写中。
``` js
// 所有需要保存的内容;这些保存的内容不会多角色共用,在切换时会进行恢复。
// 你也可以自行新增或删除,比如不共用金币则可以加上"money"的初始化,不共用道具则可以加上"items"的初始化,
@ -855,38 +937,31 @@ if (core.flags.enableSkill) {
3. 在脚本编辑 - setInitData中加上`core.plugin.initHeros()`来初始化新勇士。(写在`core.events.afterLoadData()`后,反大括号之前。)
4. 如果需要切换角色包括事件、道具或者快捷键等可以直接调用自定义JS脚本`core.plugin.changeHero();`进行切换。也可以指定参数调用`core.plugin.changeHero(1)`来切换到某个具体的勇士上。
## 根据难度分歧来自定义地图
## 系统使用的flag变量
遗憾的是所有地图数据必须在剧本的map中指定换句话说我们无法在游戏进行中动态修改地图比如为简单难度增加一个血瓶
众所周知自定义flag变量都可以任意定义并取用未定义直接取用的flag默认值为0
幸运的是,我们可以采用如下方式进行难度分歧,为用户简单难度下增加额外的血瓶或宝石。
下面是一些可能会被系统设置或取用的flag变量
``` js
"firstArrive": [ // 第一次到该楼层触发的事件
{"type": "if", "condition": "flag:hard!=3", // 判断是否困难难度
"true": [ // 不为困难,则为普通或简单难度
{"type": "show", "loc": [3,6]} // 显示血瓶
{"type": "if", "condition": "flag:hard==1", // 判断是否是简单难度
"true": [
{"type": "show", "loc": [3,7]} // 简单难度则显示宝石
],
"false": [] // 普通难度则只显示血瓶
},
],
"false": [] // 困难难度,不进行任何操作
},
],
"events": {
"3,6": {"enable": false} // 比如[3,6]点是一个血瓶,初始不可见
"3,7": {"enable": false} // 比如[3,7]点是一个宝石,初始不可见
}
```
如上所示,我们在地图上设置一个额外的血瓶和宝石,并初始时设为禁用状态。
当第一次到达该楼层时,进行一次判断;如果不为困难难度,则将血瓶显示出来;再判断是否为简单难度,如果是则再把宝石显示出来。
通过对`flag:hard`进行判断的方式,我们也可以达成“对于不同的难度有着不同的地图效果”。
- **`flag:hard`**: 当前的难度标志此flag变量在setInitData中被定义可以直接取用来判定当前难度分歧。上传成绩时将根据此flag来对不同难度进行排序。
- **`flag:posion`**, **`flag:weak`**, **`flag:curse`**: 中毒、衰弱、诅咒状态。
- **`flag:no_zone`**, **`flag:no_snipe`**, **`flag:no_laser`**, **`flag:no_betweenAttack`**: 是否分别免疫领域、阻击、激光、夹击效果。
- **`flag:hatred`**: 当前的仇恨数值。
- **`flag:commonTimes`**: 全局商店共用次数时的访问次数。
- **`flag:input`**: 接受用户输入的事件后,存放用户输入的结果。
- **`flag:type`**, **`flag:keycode`**, **`flag:x`**, **`flag:y`**: 等待用户操作后用户的操作类型按键keycode或点击坐标。
- **`flag:skill`**, **`flag:skillName`**: 开启的技能编号和技能名。
- **`flag:heroIcon`**: 当前的勇士行走图名称。
- **`flag:saveEquips`**: 快速换装时保存的套装。
- **`flag:__visited__`**: 当前访问过的楼层。
- **`flag:equip_atk_buff`**, **`flag:equip_def_buff`**, **`flag:equip_mdef_buff`**: 当前攻防魔防的实际计算比例加成。
- **`flag:forceSave`**: 是否允许事件中强制自动存档。如果将此项置为true并调用core.autosave()即可在事件中强制自动存档,读档时会自动执行该楼层的`eachArrive`事件。
- **`flag:__color__`**, **`flag:__weather__`**, **`flag:__volume__`**: 当前的画面色调、天气和音量。
- **`flag:textAttribute`**, **`flag:globalAttribute`**: 当前的剧情文本属性,当前的全局属性。
- **`flag:cannotMoveDirectly`**, **`flag:clickMove`**: 当前是否不允许瞬间移动,当前用户是否开启了单击瞬移。
- **`flag:hideStatusBar`**, **`flag:showToolbox`**: 是否隐藏状态栏,是否显示工具栏。
- **`flag:debug`**, **`flag:consoleOpened`**: 当前是否开启了调试模式,是否开启了控制台。
- **`flag:__seed__`**, **`flag:__rand__`**: 伪随机数生成种子和当前的状态
==========================================================================================

View File

@ -443,7 +443,6 @@
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='route' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='curtain' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='image' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
</div>

View File

@ -428,7 +428,6 @@
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='route' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='curtain' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='image' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
</div>

View File

@ -143,7 +143,6 @@
<canvas class='gameCanvas' id='weather' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='route' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='curtain' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='image' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
</div>

View File

@ -655,6 +655,13 @@ actions.prototype.longClick = function (x, y, fromEvent) {
core.doAction();
return true;
}
// 长按楼传器的箭头可以快速翻页
if (core.status.event.id=='fly') {
if ((x==10 || x==11) && (y==5 || y==9)) {
this.clickFly(x, y);
return true;
}
}
}
else if (!fromEvent) {
core.waitHeroToStop(function () {
@ -1073,13 +1080,13 @@ actions.prototype.clickShop = function(x,y) {
core.status.event.selection=y-topIndex;
var money = core.getStatus('money'), experience = core.getStatus('experience');
var times = shop.times, need = eval(shop.need);
var times = shop.times, need = core.calValue(shop.need, null, times);
var use = shop.use;
var use_text = use=='money'?"金币":"经验";
var choice = choices[y-topIndex];
if (core.isset(choice.need))
need = eval(choice.need);
need = core.calValue(choice.need, null, times);
if (need > eval(use)) {
core.drawTip("你的"+use_text+"不足");
@ -1094,7 +1101,7 @@ actions.prototype.clickShop = function(x,y) {
// 更新属性
choice.effect.split(";").forEach(function (t) {
core.doEffect(t);
core.doEffect(t, need, times);
});
core.updateStatusBar();
shop.times++;
@ -1880,9 +1887,11 @@ actions.prototype.clickSettings = function (x,y) {
core.ui.drawKeyBoard();
break;
case 2:
core.clearLastEvent();
core.ui.drawMaps();
break;
case 3:
core.clearLastEvent();
core.ui.drawPaint();
break;
case 4:

View File

@ -57,6 +57,7 @@ control.prototype.setRequestAnimationFrame = function () {
core.animateFrame.globalTime = core.animateFrame.globalTime||timestamp;
core.animateFrame.boxTime = core.animateFrame.boxTime||timestamp;
core.animateFrame.selectorTime = core.animateFrame.selectorTime||timestamp;
core.animateFrame.animateTime = core.animateFrame.animateTime||timestamp;
core.animateFrame.moveTime = core.animateFrame.moveTime||timestamp;
core.animateFrame.lastLegTime = core.animateFrame.lastLegTime||timestamp;
@ -110,15 +111,28 @@ control.prototype.setRequestAnimationFrame = function () {
core.animateFrame.boxTime = timestamp;
}
// selectorTime
if (timestamp-core.animateFrame.selectorTime>20 && core.isset(core.dymCanvas.selector)) {
var opacity = parseFloat(core.dymCanvas.selector.canvas.style.opacity);
if (core.animateFrame.selectorUp)
opacity += 0.02;
else
opacity -= 0.02;
if (opacity > 0.95 || opacity < 0.55)
core.animateFrame.selectorUp = !core.animateFrame.selectorUp;
core.setOpacity("selector", opacity);
core.animateFrame.selectorTime = timestamp;
}
// Animate
if (timestamp-core.animateFrame.animateTime>50 && core.isset(core.status.animateObjs) && core.status.animateObjs.length>0) {
core.clearMap('animate');
core.status.animateObjs = core.status.animateObjs.filter(function (obj) {
return obj.index < obj.animate.frames.length;
})
});
core.status.animateObjs.forEach(function (obj) {
core.maps.drawAnimateFrame(obj.animate, obj.centerX, obj.centerY, obj.index++);
})
});
core.animateFrame.animateTime = timestamp;
}
@ -274,6 +288,7 @@ control.prototype.showStartAnimate = function (noAnimate, callback) {
core.clearStatus();
core.clearMap('all');
core.clearMap('curtain');
core.deleteAllCanvas();
// 重置音量
core.events.setVolume(1, 0);
@ -341,6 +356,7 @@ control.prototype.clearStatus = function() {
}
core.status = {};
core.clearStatusBar();
core.deleteAllCanvas();
core.status.played = false;
core.events.setHeroIcon('hero.png', true);
}
@ -376,6 +392,8 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
'currTime': 0,
'hp': 0,
"battle": 0,
'money': 0,
'experience': 0,
'battleDamage': 0,
'poisonDamage': 0,
'extraDamage': 0,
@ -398,7 +416,7 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
core.events.initGame();
this.updateGlobalAttribute(Object.keys(core.status.globalAttribute));
this.triggerStatusBar(core.getFlag('hideStatusBar', false)?'hide':'show');
this.triggerStatusBar(core.getFlag('hideStatusBar', false)?'hide':'show', core.getFlag("showToolbox"));
core.status.played = true;
}
@ -1025,19 +1043,7 @@ control.prototype.jumpHero = function (ex, ey, time, callback) {
////// 每移动一格后执行的事件 //////
control.prototype.moveOneStep = function() {
core.status.hero.steps++;
// 中毒状态
if (core.hasFlag('poison')) {
core.status.hero.statistics.poisonDamage += core.values.poisonDamage;
core.status.hero.hp -= core.values.poisonDamage;
if (core.status.hero.hp<=0) {
core.status.hero.hp=0;
core.updateStatusBar();
core.events.lose();
return;
}
core.updateStatusBar();
}
return this.controldata.moveOneStep();
}
////// 停止勇士的一切行动等待勇士行动结束后再执行callback //////
@ -1336,135 +1342,13 @@ control.prototype.checkBlock = function () {
////// 阻击事件(动画效果) //////
control.prototype.snipe = function (snipes) {
var scan = {
'up': {'x': 0, 'y': -1},
'left': {'x': -1, 'y': 0},
'down': {'x': 0, 'y': 1},
'right': {'x': 1, 'y': 0}
};
snipes.forEach(function (snipe) {
var x=snipe.x, y=snipe.y, direction = snipe.direction;
snipe.nx = x+scan[snipe.direction].x;
snipe.ny = y+scan[snipe.direction].y;
core.removeGlobalAnimate(x, y);
var block = core.getBlock(x,y).block;
var cls = block.event.cls;
var height = block.event.height || 32;
snipe.animate = block.event.animate || 1;
snipe.blockIcon = core.material.icons[cls][block.event.id];
snipe.blockImage = core.material.images[cls];
snipe.height = height;
var damage = core.enemys.getDamage(block.event.id, x, y);
var color = '#000000';
if (damage == null) {
damage = "???";
color = '#FF0000';
}
else {
if (damage <= 0) color = '#00FF00';
else if (damage < core.status.hero.hp / 3) color = '#FFFFFF';
else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00';
else if (damage < core.status.hero.hp) color = '#FF7F00';
else color = '#FF0000';
damage = core.formatBigNumber(damage, true);
if (core.enemys.hasSpecial(core.material.enemys[block.event.id], 19))
damage += "+";
if (core.enemys.hasSpecial(core.material.enemys[block.event.id], 21))
damage += "-";
if (core.enemys.hasSpecial(core.material.enemys[block.event.id], 11))
damage += "^";
}
snipe.damage = damage;
snipe.color = color;
snipe.block = core.clone(block);
})
var finishSnipe = function () {
snipes.forEach(function (t) {
core.removeBlock(t.x, t.y);
var nBlock = core.clone(t.block);
nBlock.x = t.nx; nBlock.y = t.ny;
core.status.thisMap.blocks.push(nBlock);
core.drawBlock(nBlock);
core.addGlobalAnimate(nBlock);
});
core.syncGlobalAnimate();
core.updateStatusBar();
return;
}
if (core.status.replay.replaying) {
finishSnipe();
}
else {
core.waitHeroToStop(function() {
core.lockControl();
var time = 500, step = 0;
var animateCurrent = 0;
var animateTime = 0;
core.canvas.damage.textAlign = 'left';
var animate=window.setInterval(function() {
step++;
animateTime += time / 16;
if (animateTime >= core.values.animateSpeed) {
animateCurrent++;
animateTime = 0;
}
snipes.forEach(function (snipe) {
var x=snipe.x, y=snipe.y, direction = snipe.direction;
var dx = scan[direction].x*2*step, dy = scan[direction].y*2*step;
var nowX = 32*x+dx, nowY = 32*y+dy;
// 清空上一次
core.clearMap('damage', nowX-2*scan[direction].x, nowY-2*scan[direction].y, 32, 32);
core.canvas.event.clearRect(nowX-2*scan[direction].x, nowY-2*scan[direction].y, 32, 32);
core.canvas.event2.clearRect(nowX-2*scan[direction].x, nowY-2*scan[direction].y-32, 32, 32)
core.drawBlock(snipe.block, animateCurrent, dx, dy);
if (core.hasItem('book')) {
// drawDamage
core.setFillStyle('damage', '#000000');
core.canvas.damage.fillText(snipe.damage, nowX + 2, nowY + 30);
core.canvas.damage.fillText(snipe.damage, nowX, nowY + 30);
core.canvas.damage.fillText(snipe.damage, nowX + 2, nowY + 32);
core.canvas.damage.fillText(snipe.damage, nowX, nowY + 32);
core.setFillStyle('damage', snipe.color);
core.canvas.damage.fillText(snipe.damage, nowX + 1, nowY + 31);
}
})
if (step==16) { // 移动完毕
clearInterval(animate);
finishSnipe();
// 不存在自定义事件
if (core.status.event.id==null)
core.unLockControl();
}
}, time/16);
});
}
// 阻击改成moveBlock事件完成
var actions = [];
snipes.forEach(function (t) {
actions.push({"type": "move", "loc": [t.x, t.y], "steps": [t.direction], "time": 500, "keep": true, "async": true});
});
actions.push({"type": "waitAsync"});
core.insertAction(actions);
}
////// 更改天气效果 //////
@ -1611,36 +1495,9 @@ control.prototype.updateDamage = function (floorId, canvas) {
var id = mapBlocks[b].event.id;
if (core.flags.displayEnemyDamage) {
var damage = core.enemys.getDamage(id, x, y);
var color = '#000000';
if (damage == null) {
damage = "???";
color = '#FF0000';
}
else {
if (damage <= 0) color = '#00FF00';
else if (damage < hero_hp / 3) color = '#FFFFFF';
else if (damage < hero_hp * 2 / 3) color = '#FFFF00';
else if (damage < hero_hp) color = '#FF7F00';
else color = '#FF0000';
damage = core.formatBigNumber(damage, true);
if (core.enemys.hasSpecial(core.material.enemys[id], 19))
damage += "+";
if (core.enemys.hasSpecial(core.material.enemys[id], 21))
damage += "-";
if (core.enemys.hasSpecial(core.material.enemys[id], 11))
damage += "^";
}
canvas.fillStyle = '#000000';
canvas.fillText(damage, 32 * x + 2, 32 * (y + 1) - 2);
canvas.fillText(damage, 32 * x, 32 * (y + 1) - 2);
canvas.fillText(damage, 32 * x + 2, 32 * (y + 1));
canvas.fillText(damage, 32 * x, 32 * (y + 1));
canvas.fillStyle = color;
canvas.fillText(damage, 32 * x + 1, 32 * (y + 1) - 1);
var damageString = core.enemys.getDamageString(id, x, y);
var damage = damageString.damage, color = damageString.color;
core.fillBoldText(canvas, damage, color, 32*x+1, 32*(y+1)-1);
}
// 临界显伤
@ -1649,13 +1506,7 @@ control.prototype.updateDamage = function (floorId, canvas) {
if (critical.length>0) critical=critical[0];
critical = core.formatBigNumber(critical[0], true);
if (critical == '???') critical = '?';
canvas.fillStyle = '#000000';
canvas.fillText(critical, 32 * x + 2, 32 * (y + 1) - 2 - 10);
canvas.fillText(critical, 32 * x, 32 * (y + 1) - 2 - 10);
canvas.fillText(critical, 32 * x + 2, 32 * (y + 1) - 10);
canvas.fillText(critical, 32 * x, 32 * (y + 1) - 10);
canvas.fillStyle = '#FFFFFF';
canvas.fillText(critical, 32 * x + 1, 32 * (y + 1) - 1 - 10);
core.fillBoldText(canvas, critical, '#FFFFFF', 32*x+1, 32*(y+1)-11);
}
}
@ -1680,14 +1531,7 @@ control.prototype.updateDamage = function (floorId, canvas) {
var damage = core.status.checkBlock.damage[x+core.bigmap.width*y];
if (damage>0) {
damage = core.formatBigNumber(damage, true);
canvas.fillStyle = '#000000';
canvas.fillText(damage, 32 * x + 17, 32 * (y + 1) - 13);
canvas.fillText(damage, 32 * x + 15, 32 * (y + 1) - 15);
canvas.fillText(damage, 32 * x + 17, 32 * (y + 1) - 15);
canvas.fillText(damage, 32 * x + 15, 32 * (y + 1) - 13);
canvas.fillStyle = '#FF7F00';
canvas.fillText(damage, 32 * x + 16, 32 * (y + 1) - 14);
core.fillBoldText(canvas, damage, "#FF7F00", 32*x+16, 32*(y+1)-14);
}
}
}
@ -1702,11 +1546,11 @@ control.prototype.updateDamage = function (floorId, canvas) {
}
////// 执行一个表达式的effect操作 //////
control.prototype.doEffect = function (effect) {
control.prototype.doEffect = function (effect, need, times) {
effect.split(";").forEach(function (expression) {
var arr = expression.split("+=");
if (arr.length!=2) return;
var name=arr[0], value=core.calValue(arr[1]);
var name=arr[0], value=core.calValue(arr[1], need, times);
if (name.indexOf("status:")==0) {
var status=name.substring(7);
core.setStatus(status, core.getStatus(status)+value);
@ -1715,6 +1559,10 @@ control.prototype.doEffect = function (effect) {
var itemId=name.substring(5);
core.setItem(itemId, core.itemCount(itemId)+value);
}
else if (name.indexOf("flag:")==0) {
var flag=name.substring(5);
core.setFlag(flag, core.getFlag(flag, 0)+value);
}
});
}
@ -2280,17 +2128,23 @@ control.prototype.openSettings = function (need) {
////// 自动存档 //////
control.prototype.autosave = function (removeLast) {
if (core.status.event.id!=null)
return;
var addLast = true;
if (core.status.event.id!=null) {
// 检查是否是强制自动存档
if (core.status.event.id=='action' && core.hasFlag("forceSave")) addLast = false;
else return;
}
var x=null;
if (removeLast)
x=core.status.route.pop();
// 加入当前方向
core.status.route.push("turn:"+core.getHeroLoc('direction'));
core.setLocalForage("autoSave", core.saveData())
core.status.route.pop();
if (addLast)
core.status.route.push("turn:"+core.getHeroLoc('direction'));
core.setLocalForage("autoSave", core.saveData());
if (addLast)
core.status.route.pop();
if (removeLast && core.isset(x))
core.status.route.push(x);
core.removeFlag("forceSave");
}
////// 实际进行存读档事件 //////
@ -2659,6 +2513,8 @@ control.prototype.playBgm = function (bgm) {
}
try {
// 缓存BGM
core.loader.loadBgm(bgm);
// 如果当前正在播放且和本BGM相同直接忽略
if (core.musicStatus.playingBgm == bgm && core.musicStatus.isPlaying) {
return;
@ -2831,17 +2687,28 @@ control.prototype.updateStatusBar = function () {
}
}
control.prototype.triggerStatusBar = function (name) {
control.prototype.triggerStatusBar = function (name, showToolbox) {
if (name!='hide') name='show';
// 如果是隐藏 -> 显示工具栏,则先显示
if (name == 'hide' && showToolbox && !core.domStyle.showStatusBar && !core.hasFlag("showToolbox")) {
this.triggerStatusBar("show");
this.triggerStatusBar("hide", showToolbox);
return;
}
var statusItems = core.dom.status;
var toolItems = core.dom.tools;
core.domStyle.showStatusBar = name == 'show';
core.setFlag('hideStatusBar', core.domStyle.showStatusBar?null:true);
core.setFlag('showToolbox', showToolbox?true:null);
if (!core.domStyle.showStatusBar) {
for (var i = 0; i < statusItems.length; ++i)
statusItems[i].style.opacity = 0;
for (var i = 0; i < toolItems.length; ++i)
toolItems[i].style.display = 'none';
if (!core.domStyle.isVertical || !showToolbox) {
for (var i = 0; i < toolItems.length; ++i)
toolItems[i].style.display = 'none';
}
}
else {
for (var i = 0; i < statusItems.length; ++i)
@ -2930,7 +2797,16 @@ control.prototype.updateGlobalAttribute = function (name) {
////// 改变工具栏为按钮1-7 //////
control.prototype.setToolbarButton = function (useButton) {
if (!core.domStyle.showStatusBar) return;
if (!core.domStyle.showStatusBar) {
// 隐藏状态栏时检查竖屏
if (!core.domStyle.isVertical) {
for (var i = 0; i < core.dom.tools.length; ++i)
core.dom.tools[i].style.display = 'none';
return;
}
if (!core.hasFlag('showToolbox')) return;
else core.dom.tools.hard.style.display = 'block';
}
if (!core.isset(useButton)) useButton = core.domStyle.toolbarBtn;
if (!core.domStyle.isVertical) useButton = false;
@ -3362,5 +3238,12 @@ control.prototype.domRenderer = function(){
core.canvas[cn].canvas.style.height = core.bigmap.height*32*core.domStyle.scale + "px";
});
}
// 动态canvas
for (var i = 0; i < core.dymCanvas._list.length; i++) {
var spirit = core.dymCanvas._list[i];
core.dymCanvas[spirit.id].canvas.style.width = core.dymCanvas[spirit.id].canvas.width * core.domStyle.scale + "px";
core.dymCanvas[spirit.id].canvas.style.height = core.dymCanvas[spirit.id].canvas.height * core.domStyle.scale + "px";
core.dymCanvas[spirit.id].canvas.style.left = spirit.style.left * core.domStyle.scale + "px";
core.dymCanvas[spirit.id].canvas.style.top = spirit.style.top * core.domStyle.scale + "px"
}
}

View File

@ -32,6 +32,8 @@ function core() {
'globalAnimate': false,
'globalTime': null,
'boxTime': null,
'selectorTime': null,
'selectorUp': true,
'animateTime': null,
'moveTime': null,
'lastLegTime': null,
@ -56,6 +58,8 @@ function core() {
'isPlaying': false,
'gainNode': null,
'volume': 1.0, // 音量
'cachedBgms': [], // 缓存BGM内容
'cachedBgmCount': 4, // 缓存的bgm数量
}
this.platform = {
'isOnline': true, // 是否http
@ -188,6 +192,9 @@ function core() {
'animateObjs': [],
};
this.status = {};
this.dymCanvas = {
"_list": []
};
}
/////////// 系统事件相关 ///////////
@ -315,7 +322,7 @@ core.prototype.init = function (coreData, callback) {
core.musicStatus.bgmStatus = core.getLocalStorage('bgmStatus', true);
if (!core.musicStatus.startDirectly) // 如果当前网络环境不允许
core.musicStatus.bgmStatus = false;
core.setLocalStorage('bgmStatus', core.musicStatus.bgmStatus);
// core.setLocalStorage('bgmStatus', core.musicStatus.bgmStatus);
core.musicStatus.soundStatus = core.getLocalStorage('soundStatus', true);
core.setLocalStorage('soundStatus', core.musicStatus.soundStatus);
@ -624,68 +631,106 @@ core.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback,
}
////// 清除地图 //////
core.prototype.clearMap = function (map, x, y, width, height) {
core.ui.clearMap(map, x, y, width, height);
core.prototype.clearMap = function (name, x, y, width, height) {
core.ui.clearMap(name, x, y, width, height);
}
////// 在某个canvas上绘制一段文字 //////
core.prototype.fillText = function (map, text, x, y, style, font) {
core.ui.fillText(map, text, x, y, style, font);
core.prototype.fillText = function (name, text, x, y, style, font) {
core.ui.fillText(name, text, x, y, style, font);
}
////// 在某个canvas上绘制一段描边文字 //////
core.prototype.fillBoldText = function (canvas, text, style, x, y, font) {
core.ui.fillBoldText(canvas, text, style , x, y, font);
}
////// 在某个canvas上绘制一个矩形 //////
core.prototype.fillRect = function (map, x, y, width, height, style) {
core.ui.fillRect(map, x, y, width, height, style)
core.prototype.fillRect = function (name, x, y, width, height, style) {
core.ui.fillRect(name, x, y, width, height, style)
}
////// 在某个canvas上绘制一个矩形的边框 //////
core.prototype.strokeRect = function (map, x, y, width, height, style, lineWidth) {
core.ui.strokeRect(map, x, y, width, height, style, lineWidth)
core.prototype.strokeRect = function (name, x, y, width, height, style, lineWidth) {
core.ui.strokeRect(name, x, y, width, height, style, lineWidth)
}
////// 在某个canvas上绘制一条线 //////
core.prototype.drawLine = function (map, x1, y1, x2, y2, style, lineWidth) {
core.ui.drawLine(map, x1, y1, x2, y2, style, lineWidth);
core.prototype.drawLine = function (name, x1, y1, x2, y2, style, lineWidth) {
core.ui.drawLine(name, x1, y1, x2, y2, style, lineWidth);
}
////// 在某个canvas上绘制一个箭头 //////
core.prototype.drawArrow = function (name, x1, y1, x2, y2, style, lineWidth) {
core.ui.drawArrow(name, x1, y1, x2, y2, style, lineWidth);
}
////// 设置某个canvas的文字字体 //////
core.prototype.setFont = function (map, font) {
core.ui.setFont(map, font);
core.prototype.setFont = function (name, font) {
core.ui.setFont(name, font);
}
////// 设置某个canvas的线宽度 //////
core.prototype.setLineWidth = function (map, lineWidth) {
core.ui.setLineWidth(map, lineWidth);
core.prototype.setLineWidth = function (name, lineWidth) {
core.ui.setLineWidth(name, lineWidth);
}
////// 保存某个canvas状态 //////
core.prototype.saveCanvas = function (map) {
core.ui.saveCanvas(map);
core.prototype.saveCanvas = function (name) {
core.ui.saveCanvas(name);
}
////// 加载某个canvas状态 //////
core.prototype.loadCanvas = function (map) {
core.ui.loadCanvas(map);
core.prototype.loadCanvas = function (name) {
core.ui.loadCanvas(name);
}
////// 设置某个canvas边框属性 //////
core.prototype.setStrokeStyle = function (map, style) {
core.ui.setStrokeStyle(map, style);
}
////// 设置某个canvas的alpha值 //////
core.prototype.setAlpha = function (map, alpha) {
core.ui.setAlpha(map, alpha);
core.prototype.setAlpha = function (name, alpha) {
core.ui.setAlpha(name, alpha);
}
////// 设置某个canvas的透明度 //////
core.prototype.setOpacity = function (map, opacity) {
core.ui.setOpacity(map, opacity);
core.prototype.setOpacity = function (name, opacity) {
core.ui.setOpacity(name, opacity);
}
////// 设置某个canvas的绘制属性如颜色等 //////
core.prototype.setFillStyle = function (map, style) {
core.ui.setFillStyle(map, style);
core.prototype.setFillStyle = function (name, style) {
core.ui.setFillStyle(name, style);
}
////// 设置某个canvas的边框属性 //////
core.prototype.setStrokeStyle = function (name, style) {
core.ui.setStrokeStyle(name, style);
}
////// canvas创建 //////
core.prototype.createCanvas = function (name, x, y, width, height, z) {
core.ui.createCanvas(name, x, y, width, height, z);
}
////// canvas查找 //////
core.prototype.findCanvas = function (name) {
return core.ui.findCanvas(name);
}
////// canvas重定位 //////
core.prototype.relocateCanvas = function (name, x, y) {
core.ui.relocateCanvas(name, x, y);
}
////// canvas重置 //////
core.prototype.resizeCanvas = function (name, width, height) {
core.ui.resizeCanvas(name, width, height);
}
////// canvas删除 //////
core.prototype.deleteCanvas = function (name) {
core.ui.deleteCanvas(name);
}
////// 删除所有canvas //////
core.prototype.deleteAllCanvas = function () {
core.ui.deleteAllCanvas();
}
core.prototype.drawBlock = function (block, animate, dx, dy) {
@ -693,8 +738,8 @@ core.prototype.drawBlock = function (block, animate, dx, dy) {
}
////// 绘制某张地图 //////
core.prototype.drawMap = function (mapName, callback) {
core.maps.drawMap(mapName, callback);
core.prototype.drawMap = function (floorId, callback) {
core.maps.drawMap(floorId, callback);
}
////// 绘制Autotile //////
@ -965,18 +1010,18 @@ core.prototype.drawText = function (contents, callback) {
/////////// 系统机制 ///////////
////// 将文字中的${和}(表达式)进行替换 //////
core.prototype.replaceText = function (text) {
return core.utils.replaceText(text);
core.prototype.replaceText = function (text, need, times) {
return core.utils.replaceText(text, need, times);
}
////// 计算表达式的值 //////
core.prototype.calValue = function (value) {
return core.utils.calValue(value);
core.prototype.calValue = function (value, need, times) {
return core.utils.calValue(value, need, times);
}
////// 执行一个表达式的effect操作 //////
core.prototype.doEffect = function (expression) {
core.control.doEffect(expression);
core.prototype.doEffect = function (expression, need, times) {
core.control.doEffect(expression, need, times);
}
////// 字符串自动换行的分割 //////
@ -1092,6 +1137,11 @@ core.prototype.closePanel = function () {
core.ui.closePanel();
}
////// 一般清除事件 //////
core.prototype.clearLastEvent = function () {
core.ui.clearLastEvent();
}
////// 更改播放状态 //////
core.prototype.triggerReplay = function () {
core.control.triggerReplay();
@ -1366,6 +1416,16 @@ core.prototype.resumeBgm = function () {
core.control.resumeBgm();
}
////// 预加载一个背景音乐 //////
core.prototype.loadBgm = function (bgm) {
core.loader.loadBgm(bgm);
}
////// 手动释放一个背景音乐的缓存 //////
core.prototype.freeBgm = function (bgm) {
core.loader.freeBgm(bgm);
}
////// 播放音频 //////
core.prototype.playSound = function (sound) {
core.control.playSound(sound);

View File

@ -127,6 +127,38 @@ enemys.prototype.getExtraDamage = function (enemy) {
return extra_damage;
}
enemys.prototype.getDamageString = function (enemy, x, y) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
var damage = core.enemys.getDamage(enemy, x, y);
var color = '#000000';
if (damage == null) {
damage = "???";
color = '#FF0000';
}
else {
if (damage <= 0) color = '#00FF00';
else if (damage < core.status.hero.hp / 3) color = '#FFFFFF';
else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00';
else if (damage < core.status.hero.hp) color = '#FF7F00';
else color = '#FF0000';
damage = core.formatBigNumber(damage, true);
if (core.enemys.hasSpecial(enemy, 19))
damage += "+";
if (core.enemys.hasSpecial(enemy, 21))
damage += "-";
if (core.enemys.hasSpecial(enemy, 11))
damage += "^";
}
return {
"damage": damage,
"color": color
};
}
////// 接下来N个临界值和临界减伤计算 //////
enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];

View File

@ -9,7 +9,11 @@ events.prototype.init = function () {
this.eventdata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.events;
this.events = {
'battle': function (data, core, callback) {
//core.autosave(true);
// 正在执行自定义事件:不允许战斗
if (core.status.event.id == 'action') {
if (core.isset(callback)) callback();
return;
}
core.battle(data.event.id, data.x, data.y);
if (core.isset(callback))
callback();
@ -20,13 +24,22 @@ events.prototype.init = function () {
callback();
},
'openDoor': function (data, core, callback) {
//core.autosave(true);
// 正在执行自定义事件:不允许开门
if (core.status.event.id == 'action') {
if (core.isset(callback)) callback();
return;
}
core.openDoor(data.event.id, data.x, data.y, true, function () {
if (core.isset(callback)) callback();
core.replay();
});
},
'changeFloor': function (data, core, callback) {
// 正在执行自定义事件:不允许切换楼层
if (core.status.event.id == 'action') {
if (core.isset(callback)) callback();
return;
}
var heroLoc = {};
if (core.isset(data.event.data.loc))
heroLoc = {'x': data.event.data.loc[0], 'y': data.event.data.loc[1]};
@ -109,6 +122,7 @@ events.prototype.startGame = function (hard, seed, route, callback) {
core.clearMap('all');
core.clearMap('curtain');
core.deleteAllCanvas();
core.clearStatusBar();
var post_start = function () {
@ -212,8 +226,7 @@ events.prototype.gameOver = function (ending, fromReplay, norank) {
// 清空图片和天气
core.clearMap('animate');
core.clearMap('image');
core.clearMap('weather')
core.clearMap('weather');
core.dom.gif2.innerHTML = "";
core.animateFrame.weather.type = null;
core.animateFrame.weather.level = 0;
@ -363,8 +376,7 @@ events.prototype.doAction = function() {
clearInterval(core.status.event.interval);
core.status.event.interval = null;
core.clearMap('ui');
core.setAlpha('ui', 1.0);
core.clearLastEvent();
// 事件处理完毕
if (core.status.event.data.list.length==0) {
@ -720,29 +732,54 @@ events.prototype.doAction = function() {
this.doAction();
break;
case "showImage": // 显示图片
if (!core.isset(data.loc)) data.loc=[];
core.events.showImage(data.name, data.loc[0], data.loc[1]);
this.doAction();
break;
case "animateImage": // 淡入淡出图片
if (core.status.replay.replaying) { // 正在播放录像
if (!core.isset(data.loc)) data.loc=[0, 0];
if (core.status.replay.replaying) {
data.time = 0;
}
var image = core.material.images.images[data.image];
if (!core.isset(image)) {
this.doAction();
break;
}
if (data.async || data.time == 0) {
core.events.showImage(data.code, image, data.loc[0], data.loc[1], data.dw, data.dh, data.opacity, data.time);
this.doAction();
}
else {
if (core.isset(data.loc) && core.isset(core.material.images.images[data.name]) && (data.action=="show" || data.action=="hide")) {
if (data.async) {
core.events.animateImage(data.action, core.material.images.images[data.name], data.loc, data.time, data.keep);
this.doAction();
}
else {
core.events.animateImage(data.action, core.material.images.images[data.name], data.loc, data.time, data.keep, function() {
core.events.doAction();
});
}
}
else {
this.doAction();
}
core.events.showImage(data.code, image, data.loc[0], data.loc[1], data.dw, data.dh, data.opacity, data.time, function () {
core.events.doAction();
});
}
break;
case "showTextImage": // 显示图片化文本
if (!core.isset(data.loc)) data.loc=[0, 0];
if (core.status.replay.replaying) {
data.time = 0;
}
var content = core.replaceText(data.text);
var image = core.events.textImage(content);
if (data.async || data.time == 0) {
core.events.showImage(data.code, image, data.loc[0], data.loc[1], 100, 100, data.opacity, data.time);
this.doAction();
}
else {
core.events.showImage(data.code, image, data.loc[0], data.loc[1], 100, 100, data.opacity, data.time, function() {
core.events.doAction();
});
}
break;
case "hideImage": // 隐藏图片
if (core.status.replay.replaying) {
data.time = 0;
}
if (data.async || data.time == 0) {
core.events.hideImage(data.code, data.time);
this.doAction();
}
else {
core.events.hideImage(data.code, data.time, function () {
core.events.doAction();
});
}
break;
case "showGif": // 显示动图
@ -766,19 +803,14 @@ events.prototype.doAction = function() {
this.doAction();
}
else {
if (core.isset(data.from) && core.isset(data.to) && core.isset(core.material.images.images[data.name])) {
if (data.async) {
core.events.moveImage(core.material.images.images[data.name], data.from, data.to, data.time, data.keep);
this.doAction();
}
else {
core.events.moveImage(core.material.images.images[data.name], data.from, data.to, data.time, data.keep, function() {
core.events.doAction();
});
}
if (data.async) {
core.events.moveImage(data.code, data.to, data.opacity, data.time);
this.doAction();
}
else {
this.doAction();
core.events.moveImage(data.code, data.to, data.opacity, data.time, function() {
core.events.doAction();
});
}
}
break;
@ -883,6 +915,14 @@ events.prototype.doAction = function() {
core.resumeBgm();
this.doAction();
break
case "loadBgm":
core.loadBgm(data.name);
this.doAction();
break;
case "freeBgm":
core.freeBgm(data.name);
this.doAction();
break;
case "setVolume":
data.value = core.clamp(parseInt(data.value)/100, 0, 1);
core.setFlag("__volume__", data.value);
@ -1100,7 +1140,7 @@ events.prototype.doAction = function() {
this.doAction();
break;
case "hideStatusBar":
core.control.triggerStatusBar("hide");
core.control.triggerStatusBar("hide", data.toolbox);
this.doAction();
break;
case "updateEnemys":
@ -1120,13 +1160,9 @@ events.prototype.doAction = function() {
}
break;
case "sleep": // 等待多少毫秒
if (core.status.replay.replaying)
setTimeout(function() {
core.events.doAction();
else {
setTimeout(function () {
core.events.doAction();
}, data.time);
}
}, core.status.replay.replaying?20:data.time);
break;
case "wait":
if (core.status.replay.replaying) {
@ -1188,6 +1224,8 @@ events.prototype.doAction = function() {
////// 往当前事件列表之前添加一个或多个事件 //////
events.prototype.insertAction = function (action, x, y, callback) {
if (core.hasFlag("__statistics__")) return;
if (core.status.event.id != 'action') {
this.doEvents(action, x, y, callback);
}
@ -1544,92 +1582,150 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
}, 25);
}
////// 绘制图片 //////
events.prototype.showImage = function (name, x, y) {
if (core.isset(name) && core.isset(x) && core.isset(y) && core.isset(core.material.images.images[name])) {
core.canvas.image.drawImage(core.material.images.images[name], core.calValue(x), core.calValue(y));
////// 显示图片 //////
events.prototype.showImage = function (code, image, x, y, dw, dh, opacityVal, time, callback) {
dw /= 100;
dh /= 100;
x = core.calValue(x) || 0;
y = core.calValue(y) || 0;
var zIndex = code + 100;
time = time || 0;
var name = "image"+ zIndex;
if (core.findCanvas(name) != -1) {
core.relocateCanvas(name, x, y);
core.resizeCanvas(name, image.width * dw, image.height * dh);
core.dymCanvas[name].style.zIndex = zIndex;
}
else
core.createCanvas(name, x, y, image.width * dw, image.height * dh, zIndex);
core.dymCanvas[name].drawImage(image, 0, 0, image.width * dw, image.height * dh);
if (time == 0)
core.setOpacity(name, opacityVal);
else {
var per_time = 10, steps = parseInt(time / per_time), per_add = opacityVal / steps;
var opacity = 0;
core.setOpacity(name, 0);
var animate = setInterval(function () {
opacity += per_add;
core.setOpacity(name, opacity);
if (opacity >= opacityVal) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
core.setOpacity(name, opacityVal);
if (core.isset(callback)) callback();
}
}, per_time);
core.animateFrame.asyncId[animate] = true;
}
else core.clearMap('image');
}
////// 图片淡入/淡出 //////
events.prototype.animateImage = function (type, image, loc, time, keep, callback) {
time = time||0;
if ((type!='show' && type!='hide') || time<=0) {
////// 隐藏图片 //////
events.prototype.hideImage = function (code, time, callback) {
time = time || 0;
var name = "image"+ (code+100);
if (!core.isset(core.dymCanvas[name])) {
console.log(code+"号图片不存在")
if (core.isset(callback)) callback();
return;
}
if (time == 0)
core.deleteCanvas(name);
else {
var opacityVal = parseFloat(core.dymCanvas[name].canvas.style.opacity);
var per_time = 10, steps = parseInt(time / per_time), per_add = opacityVal / steps;
var animate = setInterval(function () {
opacityVal -= per_add;
core.setOpacity(name, opacityVal);
if (opacityVal < 0) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
core.deleteCanvas(name);
if (core.isset(callback)) callback();
}
}, per_time);
clearInterval(core.interval.tipAnimate);
var alpha = 0;
if (type == 'hide') alpha = 1;
var x = core.calValue(loc[0]), y = core.calValue(loc[1]);
if (type == 'hide' && keep) {
core.clearMap('image', x, y, image.width, image.height);
core.animateFrame.asyncId[animate] = true;
}
core.setAlpha('data', alpha);
core.canvas.data.drawImage(image, x, y);
core.setAlpha('data', 1);
}
var per_time = 10, steps = parseInt(time / per_time), delta = 1 / steps;
////// 文本图片化 //////
events.prototype.textImage = function (content) {
content = content || "";
var animate = setInterval(function () {
if (type=='show') alpha += delta;
else alpha -= delta;
core.clearMap('data', x, y, image.width, image.height);
if (alpha >=1 || alpha<=0) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
if (type == 'show' && keep)
core.canvas.image.drawImage(image, x, y);
core.setAlpha('data', 1);
if (core.isset(callback)) callback();
}
else {
core.setAlpha('data', alpha);
core.canvas.data.drawImage(image, x, y);
core.setAlpha('data', 1);
}
}, per_time);
// 获得颜色的盒子等信息
var textAttribute = core.status.textAttribute || core.initStatus.textAttribute;
var textfont = textAttribute.textfont || 16;
var offset = textAttribute.offset || 15;
var textColor = core.arrayToRGBA(textAttribute.text);
core.animateFrame.asyncId[animate] = true;
var font = textfont+"px "+core.status.globalAttribute.font;
if (textAttribute.bold) font = "bold "+font;
var contents = core.splitLines('ui', content), lines = contents.length;
// 计算总高度按1.4倍行距计算
var width = 416, height = textfont * 1.4 * lines;
var tempCanvas = core.bigmap.tempCanvas;
tempCanvas.canvas.width = width;
tempCanvas.canvas.height = height;
tempCanvas.clearRect(0, 0, width, height);
tempCanvas.font = font;
tempCanvas.fillStyle = textColor;
// 全部绘制
var currH = textfont;
for (var i = 0; i < lines; ++i) {
var text = contents[i];
tempCanvas.fillText(text, offset, currH);
currH += 1.4 * textfont;
}
return tempCanvas.canvas;
}
////// 移动图片 //////
events.prototype.moveImage = function (image, from, to, time, keep, callback) {
events.prototype.moveImage = function (code, to, opacityVal, time, callback) {
time = time || 1000;
clearInterval(core.interval.tipAnimate);
core.setAlpha('data', 1);
var width = image.width, height = image.height;
var name = "image"+ (code+100), index = core.findCanvas(name);
if (index == -1) {
console.log(code+"号图片不存在")
if (core.isset(callback)) callback();
return;
}
var fromX = core.dymCanvas._list[index].style.left,
fromY = core.dymCanvas._list[index].style.top,
preX = fromX, preY = fromY, toX = fromX, toY = fromY;
// core.status.replay.animate=true;
var fromX = core.calValue(from[0]), fromY = core.calValue(from[1]),
toX = core.calValue(to[0]), toY = core.calValue(to[1]);
if (keep) core.clearMap('image', fromX, fromY, width, height);
var step = 0, preX = fromX, preY = fromY;
var per_time = 10, steps = parseInt(time / per_time);
var drawImage = function () {
preX = parseInt(fromX + (toX-fromX)*step/steps);
preY = parseInt(fromY + (toY-fromY)*step/steps);
core.canvas.data.drawImage(image, preX, preY);
if (core.isset(to)) {
toX = core.calValue(to[0]) || toX;
toY = core.calValue(to[1]) || toY;
}
drawImage();
var step = 0;
var per_time = 10, steps = parseInt(time / per_time);
var preOpac = parseFloat(core.dymCanvas[name].canvas.style.opacity), opacStep = 0;
if (core.isset(opacityVal)) {
opacityVal = core.calValue(opacityVal);
opacStep = (opacityVal - preOpac) / steps;
}
var moveStep = function () {
preOpac += opacStep;
core.setOpacity(name, preOpac);
preX = parseInt(fromX + (toX-fromX)*step/steps);
preY = parseInt(fromY + (toY-fromY)*step/steps);
core.relocateCanvas(name, preX, preY);
}
var animate = setInterval(function () {
core.clearMap('data', preX, preY, width, height);
step++;
if (step <= steps)
drawImage();
else {
moveStep();
if (step > steps) {
if (core.isset(opacityVal))
core.setOpacity(name, opacityVal);
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
if (keep) core.canvas.image.drawImage(image, toX, toY);
if (core.isset(callback)) callback();
}
}, per_time);
@ -1773,20 +1869,18 @@ events.prototype.openShop = function(shopId, needVisited) {
// 拼词
var content = "\t["+shop.name+","+shop.icon+"]";
var times = shop.times, need=eval(shop.need);
var times = shop.times, need=core.calValue(shop.need, null, times);
content = content + shop.text.replace(/\${([^}]+)}/g, function (word, value) {
return eval(value);
});
content += core.replaceText(shop.text, need, times);
var use = shop.use=='experience'?'经验':'金币';
var choices = [];
for (var i=0;i<shop.choices.length;i++) {
var choice = shop.choices[i];
var text = choice.text;
var text = core.replaceText(choice.text, need, times);
if (core.isset(choice.need))
text += ""+eval(choice.need)+use+"";
text += ""+core.calValue(choice.need, null, times)+use+"";
choices.push({"text": text, "color":shop.visited?null:"#999999"});
}
choices.push("离开");
@ -1818,19 +1912,28 @@ events.prototype.setHeroIcon = function (name, noDraw) {
////// 检查升级事件 //////
events.prototype.checkLvUp = function () {
if (!core.flags.enableLevelUp || !core.isset(core.firstData.levelUp)
|| core.status.hero.lv>=core.firstData.levelUp.length) return;
// 计算下一个所需要的数值
var next = (core.firstData.levelUp[core.status.hero.lv]||{});
var need = core.calValue(next.need);
if (!core.isset(need)) return;
if (core.status.hero.experience>=need) {
// 升级
core.status.hero.lv++;
if (next.clear) core.status.hero.experience -= need;
core.insertAction(next.action);
this.checkLvUp();
var check = function () {
if (!core.flags.enableLevelUp || !core.isset(core.firstData.levelUp)
|| core.status.hero.lv>=core.firstData.levelUp.length) return null;
// 计算下一个所需要的数值
var next = (core.firstData.levelUp[core.status.hero.lv]||{});
var need = core.calValue(next.need);
if (!core.isset(need)) return null;
if (core.status.hero.experience>=need) {
// 升级
core.status.hero.lv++;
if (next.clear) core.status.hero.experience -= need;
return next.action||[];
}
return null;
}
var actions = [];
while (true) {
var next = check();
if (next == null) break;
actions = actions.concat(next);
}
if (actions.length>0) core.insertAction(actions);
}
////// 尝试使用道具 //////

View File

@ -91,7 +91,7 @@ items.prototype.useItem = function (itemId, callback) {
delete core.status.hero.items[itemCls][itemId];
core.updateStatusBar();
core.status.event.data = null;
if (!core.isset(core.status.event.id)) core.status.event.data = null;
if (core.isset(callback)) callback();
}

View File

@ -208,12 +208,7 @@ loader.prototype.loadMusic = function () {
}
}
else {
var music = new Audio();
music.preload = 'none';
if (main.bgmRemote) music.src = main.bgmRemoteRoot+core.firstData.name+'/'+t;
else music.src = 'project/sounds/'+t;
music.loop = 'loop';
core.material.bgms[t] = music;
core.loader.loadOneMusic(t);
}
});
@ -251,3 +246,45 @@ loader.prototype.loadMusic = function () {
if (core.musicStatus.startDirectly && core.bgms.length>0)
core.playBgm(core.bgms[0]);
}
loader.prototype.loadOneMusic = function (name) {
var music = new Audio();
music.preload = 'none';
if (main.bgmRemote) music.src = main.bgmRemoteRoot+core.firstData.name+'/'+name;
else music.src = 'project/sounds/'+name;
music.loop = 'loop';
core.material.bgms[name] = music;
}
loader.prototype.freeBgm = function (name) {
if (!core.isset(core.material.bgms[name])) return;
// 从cachedBgms中删除
core.musicStatus.cachedBgms = core.musicStatus.cachedBgms.filter(function (t) {return t!=name; });
// 清掉缓存
core.material.bgms[name].removeAttribute("src");
core.material.bgms[name].load();
core.material.bgms[name] = null;
// 三秒后重新加载
setTimeout(function () {
core.loader.loadOneMusic(name);
}, 3000);
}
loader.prototype.loadBgm = function (name) {
if (!core.isset(core.material.bgms[name])) return;
// 是否已经预加载过
var index = core.musicStatus.cachedBgms.indexOf(name);
if (index>=0) {
core.musicStatus.cachedBgms.splice(index, 1);
}
else {
// 预加载BGM
core.material.bgms[name].load();
// 清理尾巴
if (core.musicStatus.cachedBgms.length == core.musicStatus.cachedBgmCount) {
this.freeBgm(core.musicStatus.cachedBgms.pop());
}
}
// 移动到缓存最前方
core.musicStatus.cachedBgms.unshift(name);
}

View File

@ -370,29 +370,13 @@ maps.prototype.drawBlock = function (block, animate, dx, dy) {
// none空地
if (block.event.id=='none') return;
var cls = block.event.cls, height = block.event.height || 32;
var cls = block.event.cls;
var image, x, y;
var blockInfo = this.__getBlockInfo(block);
if (blockInfo == null) return;
var image = blockInfo.image, x = blockInfo.bx, y = blockInfo.by, height = blockInfo.height;
if (!blockInfo.isTileset) x = (animate||0)%(block.event.animate||1);
if (cls == 'tileset') {
var offset = core.icons.getTilesetOffset(block.event.id);
if (offset == null) return;
image = core.material.images.tilesets[offset.image];
x = offset.x;
y = offset.y;
}
else if (cls == 'autotile') return;
// 空气墙的单独处理
else if (block.id==17) {
if (!core.isset(core.material.images.airwall)) return;
image = core.material.images.airwall;
x = y = 0;
}
else {
image = core.material.images[cls];
x = (animate||0)%(block.event.animate||1);
y = core.material.icons[cls][block.event.id];
}
dx = dx || 0;
dy = dy || 0;
@ -490,9 +474,9 @@ maps.prototype.drawBgFgMap = function (floorId, canvas, name, animate) {
}
////// 绘制某张地图 //////
maps.prototype.drawMap = function (mapName, callback) {
mapName = mapName || core.status.floorId;
if (!core.isset(mapName)) {
maps.prototype.drawMap = function (floorId, callback) {
floorId = floorId || core.status.floorId;
if (!core.isset(floorId)) {
if (core.isset(callback))
callback();
return;
@ -501,10 +485,10 @@ maps.prototype.drawMap = function (mapName, callback) {
core.removeGlobalAnimate(null, null, true);
var drawBg = function(){
var width = core.floors[mapName].width || 13;
var height = core.floors[mapName].height || 13;
var width = core.floors[floorId].width || 13;
var height = core.floors[floorId].height || 13;
var groundId = (core.status.maps||core.floors)[mapName].defaultGround || "ground";
var groundId = (core.status.maps||core.floors)[floorId].defaultGround || "ground";
var blockIcon = core.material.icons.terrains[groundId];
for (var x = 0; x < width; x++) {
for (var y = 0; y < height; y++) {
@ -513,8 +497,8 @@ maps.prototype.drawMap = function (mapName, callback) {
}
var images = [];
if (core.isset(core.status.maps[mapName].images)) {
images = core.status.maps[mapName].images;
if (core.isset(core.status.maps[floorId].images)) {
images = core.status.maps[floorId].images;
if (typeof images == 'string') {
images = [[0, 0, images]];
}
@ -523,7 +507,7 @@ maps.prototype.drawMap = function (mapName, callback) {
if (typeof t == 'string') t = [0,0,t];
var dx=parseInt(t[0]), dy=parseInt(t[1]), p=t[2];
if (core.isset(dx) && core.isset(dy) &&
!core.hasFlag("floorimg_"+mapName+"_"+dx+"_"+dy) &&
!core.hasFlag("floorimg_"+floorId+"_"+dx+"_"+dy) &&
core.isset(core.material.images.images[p])) {
var image = core.material.images.images[p];
if (!t[3]) {
@ -553,8 +537,8 @@ maps.prototype.drawMap = function (mapName, callback) {
}
});
core.maps.drawBgFgMap(mapName, core.canvas.bg, "bg", true);
core.maps.drawBgFgMap(mapName, core.canvas.fg, "fg", true);
core.maps.drawBgFgMap(floorId, core.canvas.bg, "bg", true);
core.maps.drawBgFgMap(floorId, core.canvas.fg, "fg", true);
}
if (main.mode=='editor'){
@ -570,8 +554,8 @@ maps.prototype.drawMap = function (mapName, callback) {
drawBg();
}
core.status.floorId = mapName;
core.status.thisMap = core.status.maps[mapName];
core.status.floorId = floorId;
core.status.thisMap = core.status.maps[floorId];
var drawEvent = function(){
var mapData = core.status.maps[core.status.floorId];
@ -776,6 +760,101 @@ maps.prototype.getBlockCls = function (x, y, floorId, showDisable) {
return null;
}
maps.prototype.__getBlockInfo = function (block) {
var image, bx, by, height = block.event.height || 32;
var faceIds = {}, isTileset = false;
if (block.event.cls == 'tileset') {
var offset = core.icons.getTilesetOffset(block.event.id);
if (offset==null) {
return null;
}
bx = offset.x;
by = offset.y;
image = core.material.images.tilesets[offset.image];
isTileset = true;
}
// 不支持autotile
else if (block.event.cls == 'autotile') {
return null;
}
// 空气墙;忽略事件
else if (block.id==17) {
if (!core.isset(core.material.images.airwall)) return null;
image = core.material.images.airwall;
bx = by = 0;
}
else {
image = core.material.images[block.event.cls];
bx = 0;
by = core.material.icons[block.event.cls][block.event.id];
faceIds = block.event.faceIds||{};
}
return {
"image": image,
"bx": bx,
"by": by,
"height": height,
"isTileset": isTileset,
"faceIds": faceIds
};
}
maps.prototype.__moveBlockCanvas = function (image, bx, by, height, nowX, nowY, opacity, headCanvas, bodyCanvas, damageCanvas) {
// 重绘block & 重定位
if (headCanvas != null) {
core.dymCanvas[headCanvas].clearRect(0, 0, 32, height);
core.dymCanvas[headCanvas].drawImage(image, bx * 32, by * height, 32, height - 32, 0, 0, 32, height - 32);
core.relocateCanvas(headCanvas, nowX - core.bigmap.offsetX, nowY+32-height - core.bigmap.offsetY);
core.setOpacity(headCanvas, opacity);
}
if (bodyCanvas != null) {
core.dymCanvas[bodyCanvas].clearRect(0, 0, 32, 32);
core.dymCanvas[bodyCanvas].drawImage(image, bx * 32, by * height + height - 32, 32, 32, 0, 0, 32, 32);
core.relocateCanvas(bodyCanvas, nowX - core.bigmap.offsetX, nowY - core.bigmap.offsetY);
core.setOpacity(bodyCanvas, opacity);
}
if (damageCanvas != null) {
core.relocateCanvas(damageCanvas, nowX - core.bigmap.offsetX, nowY - core.bigmap.offsetY);
core.setOpacity(damageCanvas, opacity);
}
}
maps.prototype.__initBlockCanvas = function (block, height, x, y) {
var headCanvas = null, bodyCanvas = 'block'+x+"_"+y, damageCanvas = null;
core.createCanvas(bodyCanvas, 0, 0, 32, 32, 35);
if (height > 32) {
headCanvas = "blockHead"+x+"_"+y;
core.createCanvas(headCanvas, 0, 0, 32, height - 32, 55);
}
// 显伤
var damage = null, damageColor = null;
if ((block.event.cls == 'enemys' || block.event.cls == 'enemy48') && core.hasItem('book')
&& block.event.displayDamage !== false) {
var damageString = core.enemys.getDamageString(block.event.id, x, y);
damage = damageString.damage; damageColor = damageString.color;
}
if (damage != null) {
damageCanvas = "blockDamage"+x+"_"+y;
core.createCanvas(damageCanvas, 0, 0, 32, 32, 65);
core.dymCanvas[damageCanvas].textAlign = 'left';
core.dymCanvas[damageCanvas].font = "bold 11px Arial";
core.fillBoldText(core.dymCanvas[damageCanvas], damage, damageColor, 1, 31);
if (core.flags.displayCritical) {
var critical = core.enemys.nextCriticals(block.event.id);
if (critical.length>0) critical=critical[0];
critical = core.formatBigNumber(critical[0], true);
if (critical == '???') critical = '?';
core.fillBoldText(core.dymCanvas[damageCanvas], critical, '#FFFFFF', 1, 21);
}
}
return {
"headCanvas": headCanvas,
"bodyCanvas": bodyCanvas,
"damageCanvas": damageCanvas
}
}
////// 显示移动某块的动画,达到{“type”:”move”}的效果 //////
maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
time = time || 500;
@ -791,39 +870,12 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
core.removeBlock(x,y);
block=block.block;
var image, bx, by, height = block.event.height || 32;
var faceIds = {};
if (block.event.cls == 'tileset') {
var offset = core.icons.getTilesetOffset(block.event.id);
if (offset==null) {
if (core.isset(callback)) callback();
return;
}
bx = offset.x;
by = offset.y;
image = core.material.images.tilesets[offset.image];
}
// 不支持autotile
else if (block.event.cls == 'autotile') {
var blockInfo = this.__getBlockInfo(block);
if (blockInfo == null) {
if (core.isset(callback)) callback();
return;
}
// 空气墙;忽略事件
else if (block.id==17) {
if (core.isset(callback)) callback();
return;
}
else {
image = core.material.images[block.event.cls];
bx = 0;
by = core.material.icons[block.event.cls][block.event.id];
faceIds = block.event.faceIds||{};
}
var alpha = 1;
core.setAlpha('route', alpha);
core.canvas.route.drawImage(image, bx * 32, by * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
var image = blockInfo.image, bx = blockInfo.bx, by = blockInfo.by, height = blockInfo.height, isTileset = blockInfo.isTileset, faceIds = blockInfo.faceIds;
// 要运行的轨迹将steps展开
var moveSteps=[];
@ -851,9 +903,12 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
'right': {'x': 1, 'y': 0}
};
var animateValue = block.event.animate || 1;
var animateCurrent = 0;
var animateTime = 0;
var animateValue = block.event.animate || 1, animateCurrent = isTileset?bx:0, animateTime = 0;
var blockCanvas = this.__initBlockCanvas(block, height, x, y);
var headCanvas = blockCanvas.headCanvas, bodyCanvas = blockCanvas.bodyCanvas, damageCanvas = blockCanvas.damageCanvas;
var opacity = 1;
core.maps.__moveBlockCanvas(image, animateCurrent, by, height, nowX, nowY, opacity, headCanvas, bodyCanvas, damageCanvas);
var animate=window.setInterval(function() {
@ -863,30 +918,27 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
animateTime = 0;
if (animateCurrent>=animateValue) animateCurrent=0;
}
if (block.event.cls=='tileset') {
animateCurrent = bx;
}
if (isTileset) animateCurrent = bx;
// 已经移动完毕,消失
if (moveSteps.length==0) {
if (keep) alpha=0;
else alpha -= 0.06;
core.clearMap('route', nowX, nowY-height+32, 32, height);
if (alpha<=0) {
if (keep) opacity=0;
else opacity -= 0.06;
if (opacity<=0) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
core.deleteCanvas(headCanvas);
core.deleteCanvas(bodyCanvas);
core.deleteCanvas(damageCanvas);
// 不消失
if (keep) {
core.setBlock(id, nowX/32, nowY/32);
core.showBlock(nowX/32, nowY/32);
}
core.setAlpha('route',1);
if (core.isset(callback)) callback();
}
else {
core.setAlpha('route', alpha);
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, nowX, nowY-height+32, 32, height);
core.setAlpha('route', 1);
core.maps.__moveBlockCanvas(image, animateCurrent, by, height, nowX, nowY, opacity, headCanvas, bodyCanvas, damageCanvas);
}
}
else {
@ -901,13 +953,11 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) {
by = tby;
}
}
core.clearMap('route', nowX, nowY-height+32, 32, height);
step++;
nowX+=scan[direction].x*2;
nowY+=scan[direction].y*2;
// 绘制
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, nowX, nowY-height+32, 32, height);
// 移动
core.maps.__moveBlockCanvas(image, animateCurrent, by, height, nowX, nowY, opacity, headCanvas, bodyCanvas, damageCanvas);
if (step==16) {
// 该移动完毕,继续
step=0;
@ -934,36 +984,12 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
core.removeBlock(sx,sy);
block=block.block;
var image, bx, by, height = block.event.height || 32;
if (block.event.cls == 'tileset') {
var offset = core.icons.getTilesetOffset(block.event.id);
if (offset==null) {
if (core.isset(callback)) callback();
return;
}
bx = offset.x;
by = offset.y;
image = core.material.images.tilesets[offset.image];
}
// 不支持autotile
else if (block.event.cls == 'autotile') {
var blockInfo = this.__getBlockInfo(block);
if (blockInfo == null) {
if (core.isset(callback)) callback();
return;
}
// 空气墙;忽略事件
else if (block.id==17) {
if (core.isset(callback)) callback();
return;
}
else {
image = core.material.images[block.event.cls];
bx = 0;
by = core.material.icons[block.event.cls][block.event.id];
}
var alpha = 1;
core.setAlpha('route', alpha);
core.canvas.route.drawImage(image, bx*32, by * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height);
var image = blockInfo.image, bx = blockInfo.bx, by = blockInfo.by, height = blockInfo.height, isTileset = blockInfo.isTileset, faceIds = blockInfo.faceIds;
core.playSound('jump.mp3');
@ -991,35 +1017,27 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
curry = (curry * jump_count + ey) / (jump_count + 1.0);
}
var animateValue = block.event.animate || 1;
var animateCurrent = 0;
var animateTime = 0;
var blockCanvas = this.__initBlockCanvas(block, height, sx, sy);
var headCanvas = blockCanvas.headCanvas, bodyCanvas = blockCanvas.bodyCanvas, damageCanvas = blockCanvas.damageCanvas;
var opacity = 1;
core.maps.__moveBlockCanvas(image, bx, by, height, drawX(), drawY(), opacity, headCanvas, bodyCanvas, damageCanvas);
var animate=window.setInterval(function() {
animateTime += time / 16 / core.status.replay.speed;
if (animateTime >= core.values.animateSpeed) {
animateCurrent++;
animateTime = 0;
if (animateCurrent >= animateValue) animateCurrent = 0;
}
if (block.event.cls=='tileset') {
animateCurrent = bx;
}
if (jump_count>0) {
core.clearMap('route', drawX(), drawY()-height+32, 32, height);
updateJump();
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, drawX(), drawY()-height+32, 32, height);
core.maps.__moveBlockCanvas(image, bx, by, height, drawX(), drawY(), opacity, headCanvas, bodyCanvas, damageCanvas);
}
else {
if (keep) alpha=0;
else alpha -= 0.06;
core.clearMap('route', drawX(), drawY()-height+32, 32, height);
if (alpha<=0) {
if (keep) opacity=0;
else opacity -= 0.06;
if (opacity<=0) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
core.clearMap('route');
core.setAlpha('route', 1);
core.deleteCanvas(headCanvas);
core.deleteCanvas(bodyCanvas);
core.deleteCanvas(damageCanvas);
if (keep) {
core.setBlock(id, ex, ey);
core.showBlock(ex, ey);
@ -1027,9 +1045,7 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) {
if (core.isset(callback)) callback();
}
else {
core.setAlpha('route', alpha);
core.canvas.route.drawImage(image, animateCurrent * 32, by * height, 32, height, drawX(), drawY()-height+32, 32, height);
core.setAlpha('route', 1);
core.maps.__moveBlockCanvas(image, bx, by, height, drawX(), drawY(), opacity, headCanvas, bodyCanvas, damageCanvas);
}
}
@ -1050,66 +1066,47 @@ maps.prototype.animateBlock = function (loc,type,time,callback) {
var block = core.getBlock(t[0],t[1],null,true);
if (block==null) return;
block=block.block;
var image, bx, by, height = block.event.height || 32;
if (block.event.cls == 'tileset') {
var offset = core.icons.getTilesetOffset(block.event.id);
if (offset==null) {
if (core.isset(callback)) callback();
return;
}
bx = offset.x;
by = offset.y;
image = core.material.images.tilesets[offset.image];
}
// 不支持autotile
else if (block.event.cls == 'autotile') {
return;
}
// 空气墙,忽略事件
else if (block.id==17) return;
else {
image = core.material.images[block.event.cls];
bx = 0;
by = core.material.icons[block.event.cls][block.event.id];
}
var blockInfo = core.maps.__getBlockInfo(block);
if (blockInfo == null) return;
var blockCanvas = core.maps.__initBlockCanvas(block, blockInfo.height, t[0], t[1]);
var headCanvas = blockCanvas.headCanvas, bodyCanvas = blockCanvas.bodyCanvas, damageCanvas = blockCanvas.damageCanvas;
list.push({
'x': t[0], 'y': t[1], 'height': height,
'bx': bx, 'by': by, 'image': image
})
})
'x': t[0], 'y': t[1], 'height': blockInfo.height,
'bx': blockInfo.bx, 'by': blockInfo.by, 'image': blockInfo.image,
'headCanvas': headCanvas, 'bodyCanvas': bodyCanvas, 'damageCanvas': damageCanvas
});
});
if (list.length==0) {
if (core.isset(callback)) callback();
return;
}
// core.status.replay.animate=true;
var clear = function () {
list.forEach(function (t) {
core.clearMap('route', t.x*32, t.y*32+32-t.height, 32, t.height);
})
}
var opacity = 0;
if (type=='hide') opacity=1;
var draw = function () {
list.forEach(function (t) {
core.canvas.route.drawImage(t.image, t.bx*32, t.by*t.height, 32, t.height, t.x*32, t.y*32+32-t.height, 32, t.height);
core.maps.__moveBlockCanvas(t.image, t.bx, t.by, t.height, t.x*32, t.y*32, opacity, t.headCanvas, t.bodyCanvas, t.damageCanvas);
})
}
var alpha = 0;
if (type=='hide') alpha=1;
core.setAlpha('route', alpha);
};
draw();
var per_time = 10, steps = parseInt(time / per_time), delta = 1 / steps;
var animate = setInterval(function () {
if (type=='show') alpha += delta;
else alpha -= delta;
clear();
if (alpha >=1 || alpha<=0) {
if (type=='show') opacity += delta;
else opacity -= delta;
if (opacity >=1 || opacity<=0) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
core.setAlpha('route', 1);
list.forEach(function (t) {
core.deleteCanvas(t.headCanvas);
core.deleteCanvas(t.bodyCanvas);
core.deleteCanvas(t.damageCanvas);
});
if (type == 'show') {
loc.forEach(function (t) {
core.showBlock(t[0],t[1],data.floorId);
@ -1123,7 +1120,6 @@ maps.prototype.animateBlock = function (loc,type,time,callback) {
if (core.isset(callback)) callback();
}
else {
core.setAlpha('route', alpha);
draw();
}
}, per_time);

View File

@ -17,9 +17,17 @@ ui.prototype.init = function () {
////////////////// 地图设置
ui.prototype.getContextByName = function (name) {
if (core.isset(core.canvas[name]))
return core.canvas[name];
if (core.isset(core.dymCanvas[name]))
return core.dymCanvas[name];
return null;
}
////// 清除地图 //////
ui.prototype.clearMap = function (map, x, y, width, height) {
if (map == 'all') {
ui.prototype.clearMap = function (name, x, y, width, height) {
if (name == 'all') {
for (var m in core.canvas) {
// 不擦除curtain层
if (m=='curtain') continue;
@ -28,144 +36,144 @@ ui.prototype.clearMap = function (map, x, y, width, height) {
core.dom.gif.innerHTML = "";
}
else {
core.canvas[map].clearRect(x||0, y||0, width||core.bigmap.width*32, height||core.bigmap.height*32);
var ctx = this.getContextByName(name);
if (ctx) ctx.clearRect(x||0, y||0, width||ctx.canvas.width, height||ctx.canvas.height);
}
}
////// 在某个canvas上绘制一段文字 //////
ui.prototype.fillText = function (map, text, x, y, style, font) {
ui.prototype.fillText = function (name, text, x, y, style, font) {
if (core.isset(style)) {
core.setFillStyle(map, style);
core.setFillStyle(name, style);
}
if (core.isset(font)) {
core.setFont(map, font);
core.setFont(name, font);
}
core.canvas[map].fillText(text, x, y);
var ctx = this.getContextByName(name);
if (ctx) ctx.fillText(text, x, y);
}
////// 在某个canvas上绘制粗体 //////
ui.prototype.fillBoldText = function (canvas, text, style, x, y, font) {
if (core.isset(font)) canvas.font = font;
canvas.fillStyle = '#000000';
canvas.fillText(text, x-1, y-1);
canvas.fillText(text, x-1, y+1);
canvas.fillText(text, x+1, y-1);
canvas.fillText(text, x+1, y+1);
canvas.fillStyle = style;
canvas.fillText(text, x, y);
}
////// 在某个canvas上绘制一个矩形 //////
ui.prototype.fillRect = function (map, x, y, width, height, style) {
ui.prototype.fillRect = function (name, x, y, width, height, style) {
if (core.isset(style)) {
core.setFillStyle(map, style);
core.setFillStyle(name, style);
}
core.canvas[map].fillRect(x, y, width, height);
var ctx = this.getContextByName(name);
if (ctx) ctx.fillRect(x, y, width, height);
}
////// 在某个canvas上绘制一个矩形的边框 //////
ui.prototype.strokeRect = function (map, x, y, width, height, style, lineWidth) {
ui.prototype.strokeRect = function (name, x, y, width, height, style, lineWidth) {
if (core.isset(style)) {
core.setStrokeStyle(map, style);
core.setStrokeStyle(name, style);
}
if (core.isset(lineWidth)) {
core.setLineWidth(map, lineWidth);
core.setLineWidth(name, lineWidth);
}
core.canvas[map].strokeRect(x, y, width, height);
var ctx = this.getContextByName(name);
if (ctx) ctx.strokeRect(x, y, width, height);
}
////// 在某个canvas上绘制一条线 //////
ui.prototype.drawLine = function (map, x1, y1, x2, y2, style, lineWidth) {
ui.prototype.drawLine = function (name, x1, y1, x2, y2, style, lineWidth) {
if (core.isset(style)) {
core.setStrokeStyle(map, style);
core.setStrokeStyle(name, style);
}
if (core.isset(lineWidth)) {
core.setLineWidth(map, lineWidth);
core.setLineWidth(name, lineWidth);
}
var ctx = this.getContextByName(name);
if (ctx) {
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();
}
core.canvas[map].beginPath();
core.canvas[map].moveTo(x1, y1);
core.canvas[map].lineTo(x2, y2);
core.canvas[map].stroke();
}
////// 在某个canvas上绘制一个箭头 //////
ui.prototype.drawArrow = function (map, x1, y1, x2, y2, style, lineWidth) {
ui.prototype.drawArrow = function (name, x1, y1, x2, y2, style, lineWidth) {
if (x1==x2 && y1==y2) return;
if (core.isset(style)) {
core.setStrokeStyle(map, style);
core.setStrokeStyle(name, style);
}
if (core.isset(lineWidth)) {
core.setLineWidth(map, lineWidth);
core.setLineWidth(name, lineWidth);
}
var ctx = this.getContextByName(name);
if (ctx) {
var head = 10;
var dx = x2-x1, dy=y2-y1;
var angle = Math.atan2(dy,dx);
ctx.beginPath();
ctx.moveTo(x1,y1);
ctx.lineTo(x2, y2);
ctx.lineTo(x2-head*Math.cos(angle-Math.PI/6),y2-head*Math.sin(angle-Math.PI/6));
ctx.moveTo(x2, y2);
ctx.lineTo(x2-head*Math.cos(angle+Math.PI/6),y2-head*Math.sin(angle+Math.PI/6));
ctx.stroke();
}
var head = 10;
var dx = x2-x1, dy=y2-y1;
var angle = Math.atan2(dy,dx);
core.canvas[map].beginPath();
core.canvas[map].moveTo(x1,y1);
core.canvas[map].lineTo(x2, y2);
core.canvas[map].lineTo(x2-head*Math.cos(angle-Math.PI/6),y2-head*Math.sin(angle-Math.PI/6));
core.canvas[map].moveTo(x2, y2);
core.canvas[map].lineTo(x2-head*Math.cos(angle+Math.PI/6),y2-head*Math.sin(angle+Math.PI/6));
core.canvas[map].stroke();
}
////// 设置某个canvas的文字字体 //////
ui.prototype.setFont = function (map, font) {
core.canvas[map].font = font;
ui.prototype.setFont = function (name, font) {
var ctx = this.getContextByName(name);
if (ctx) ctx.font = font;
}
////// 设置某个canvas的线宽度 //////
ui.prototype.setLineWidth = function (map, lineWidth) {
if (map == 'all') {
for (var m in core.canvas) {
core.canvas[m].lineWidth = lineWidth;
}
}
core.canvas[map].lineWidth = lineWidth;
ui.prototype.setLineWidth = function (name, lineWidth) {
var ctx = this.getContextByName(name);
if (ctx) ctx.lineWidth = lineWidth;
}
////// 保存某个canvas状态 //////
ui.prototype.saveCanvas = function (map) {
core.canvas[map].save();
ui.prototype.saveCanvas = function (name) {
var ctx = this.getContextByName(name);
if (ctx) ctx.save();
}
////// 加载某个canvas状态 //////
ui.prototype.loadCanvas = function (map) {
core.canvas[map].restore();
}
////// 设置某个canvas边框属性 //////
ui.prototype.setStrokeStyle = function (map, style) {
if (map == 'all') {
for (var m in core.canvas) {
core.canvas[m].strokeStyle = style;
}
}
else {
core.canvas[map].strokeStyle = style;
}
ui.prototype.loadCanvas = function (name) {
var ctx = this.getContextByName(name);
if (ctx) ctx.restore();
}
////// 设置某个canvas的alpha值 //////
ui.prototype.setAlpha = function (map, alpha) {
if (map == 'all') {
for (var m in core.canvas) {
core.canvas[m].globalAlpha = alpha;
}
}
else core.canvas[map].globalAlpha = alpha;
ui.prototype.setAlpha = function (name, alpha) {
var ctx = this.getContextByName(name);
if (ctx) ctx.globalAlpha = alpha;
}
////// 设置某个canvas的透明度尽量不要使用本函数而是全部换成setAlpha实现 //////
ui.prototype.setOpacity = function (map, opacity) {
if (map == 'all') {
for (var m in core.canvas) {
core.canvas[m].canvas.style.opacity = opacity;
}
}
else core.canvas[map].canvas.style.opacity = opacity;
ui.prototype.setOpacity = function (name, opacity) {
var ctx = this.getContextByName(name);
if (ctx) ctx.canvas.style.opacity = opacity;
}
////// 设置某个canvas的绘制属性如颜色等 //////
ui.prototype.setFillStyle = function (map, style) {
if (map == 'all') {
for (var m in core.canvas) {
core.canvas[m].fillStyle = style;
}
}
else {
core.canvas[map].fillStyle = style;
}
ui.prototype.setFillStyle = function (name, style) {
var ctx = this.getContextByName(name);
if (ctx) ctx.fillStyle = style;
}
////// 设置某个canvas边框属性 //////
ui.prototype.setStrokeStyle = function (name, style) {
var ctx = this.getContextByName(name);
if (ctx) ctx.strokeStyle = style;
}
///////////////// UI绘制
@ -174,8 +182,7 @@ ui.prototype.setFillStyle = function (map, style) {
ui.prototype.closePanel = function () {
core.status.boxAnimateObjs = [];
clearInterval(core.status.event.interval);
core.clearMap('ui');
core.setAlpha('ui', 1.0);
core.clearLastEvent();
core.unLockControl();
core.status.event.data = null;
core.status.event.id = null;
@ -184,6 +191,14 @@ ui.prototype.closePanel = function () {
core.status.event.interval = null;
}
////// 一般清除事件 //////
ui.prototype.clearLastEvent = function () {
if (core.isset(core.dymCanvas.selector))
core.deleteCanvas("selector");
core.clearMap('ui');
core.setAlpha('ui', 1);
}
////// 左上角绘制一段提示 //////
ui.prototype.drawTip = function (text, itemIcon) {
var textX, textY, width, height, hide = false, alpha = 0;
@ -351,21 +366,28 @@ ui.prototype.getTitleAndIcon = function (content) {
}
// 绘制选择光标
ui.prototype.drawWindowSelector = function(background,canvas,x,y,w,h) {
var dstImage = core.canvas[canvas];
ui.prototype.drawWindowSelector = function(background,x,y,w,h) {
if (core.isset(core.dymCanvas.selector)) {
core.relocateCanvas("selector", x, y);
core.resizeCanvas("selector", w, h);
}
else {
core.ui.createCanvas("selector", x, y, w, h, 165);
}
core.setOpacity("selector", 0.8);
var dstImage = core.dymCanvas.selector;
// back
dstImage.drawImage(background,130,66,28,28,x+2,y+2,w-4,h-4);
dstImage.drawImage(background, 130, 66, 28, 28, 2, 2,w-4,h-4);
// corner
dstImage.drawImage(background,128,64,2,2,x,y,2,2);
dstImage.drawImage(background,158,64,2,2,x+w-2,y,2,2);
dstImage.drawImage(background,128,94,2,2,x,y+h-2,2,2);
dstImage.drawImage(background,158,94,2,2,x+w-2,y+h-2,2,2);
dstImage.drawImage(background, 128, 64, 2, 2, 0, 0, 2, 2);
dstImage.drawImage(background, 158, 64, 2, 2,w-2, 0, 2, 2);
dstImage.drawImage(background, 128, 94, 2, 2, 0,h-2, 2, 2);
dstImage.drawImage(background, 158, 94, 2, 2,w-2,h-2, 2, 2);
// border
dstImage.drawImage(background,130,64,28,2,x+2,y,w-4,2);
dstImage.drawImage(background,130,94,28,2,x+2,y+h-2,w-4,2);
dstImage.drawImage(background,128,66,2,28,x,y+2,2,h-4);
dstImage.drawImage(background,158,66,2,28,x+w-2,y+2,2,h-4);
dstImage.drawImage(background, 130, 64, 28, 2, 2, 0,w-4, 2);
dstImage.drawImage(background, 130, 94, 28, 2, 2,h-2,w-4, 2);
dstImage.drawImage(background, 128, 66, 2, 28, 0, 2, 2,h-4);
dstImage.drawImage(background, 158, 66, 2, 28,w-2, 2, 2,h-4);
}
// 绘制皮肤
@ -502,7 +524,7 @@ ui.prototype.drawTextBox = function(content, showAll) {
content = core.replaceText(content);
core.status.boxAnimateObjs = [];
core.clearMap('ui');
core.clearLastEvent();
// drawImage
content = content.replace(/(\f|\\f)\[(.*?)]/g, function (text, sympol, str) {
@ -536,14 +558,10 @@ ui.prototype.drawTextBox = function(content, showAll) {
validWidth = this.calTextBoxWidth('ui', realContent, min_width, max_width);
width = validWidth + leftSpace + rightSpace;
// left必须在7~416-7-width区间内以保证left>=7right<=416-7
left = core.clamp(32*px+16-width/2, 7, 416-7-width);
left -= core.bigmap.offsetX;
left = core.clamp(32*px+16-width/2-core.bigmap.offsetX, 7, 416-7-width);
right = left + width;
}
var content_left = left + leftSpace;
var height = 30 + (textfont+5)*core.splitLines("ui", realContent, validWidth, font).length;
if (core.isset(name)) height += titlefont + 5;
@ -740,7 +758,7 @@ ui.prototype.drawScrollText = function (content, time, callback) {
if (textAttribute.bold) font = "bold "+font;
var contents = core.splitLines('ui', content), lines = contents.length;
// 计算总高度按1.2倍行距计算
// 计算总高度按1.4倍行距计算
var width = 416, height = textfont * 1.4 * lines;
var tempCanvas = core.bigmap.tempCanvas;
tempCanvas.canvas.width = width;
@ -909,7 +927,7 @@ ui.prototype.drawChoices = function(content, choices) {
while (core.status.event.selection>=choices.length) core.status.event.selection-=choices.length;
var len = core.canvas.ui.measureText(core.replaceText(choices[core.status.event.selection].text || choices[core.status.event.selection])).width;
if (isWindowSkin)
this.drawWindowSelector(background, 'ui' ,208-len/2-5, choice_top + 32 * core.status.event.selection - 20, len+10, 28);
this.drawWindowSelector(background, 208-len/2-5, choice_top + 32 * core.status.event.selection - 20, len+10, 28);
else
core.strokeRect('ui', 208-len/2-5, choice_top + 32 * core.status.event.selection - 20, len+10, 28, "#FFD700", 2);
}
@ -927,6 +945,8 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
if (!core.isset(core.status.event.selection) || core.status.event.selection>1) core.status.event.selection=1;
if (core.status.event.selection<0) core.status.event.selection=0;
core.clearLastEvent();
var background = core.status.textAttribute.background;
var isWindowSkin = false;
if (typeof background == 'string') {
@ -976,7 +996,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
var strokeLeft = 208 + (76*core.status.event.selection-38) - parseInt(len/2) - 5;
if (isWindowSkin)
this.drawWindowSelector(background, 'ui', strokeLeft, bottom-35-20, len+10, 28);
this.drawWindowSelector(background, strokeLeft, bottom-35-20, len+10, 28);
else
core.strokeRect('ui', strokeLeft, bottom-35-20, len+10, 28, "#FFD700", 2);
@ -1334,22 +1354,39 @@ ui.prototype.drawWaiting = function(text) {
core.lockControl();
core.status.event.id = 'waiting';
core.clearMap('ui');
core.setAlpha('ui', 1);
core.setFillStyle('ui', core.material.groundPattern);
core.clearLastEvent();
var background = core.status.textAttribute.background;
var isWindowSkin = false;
if (typeof background == 'string') {
background = core.material.images.images[background];
if (core.isset(background) && background.width==192 && background.height==128) isWindowSkin = true;
else background = core.initStatus.textAttribute.background;
}
if (!isWindowSkin) background = core.arrayToRGBA(background);
var borderColor = core.status.globalAttribute.borderColor;
var textColor = core.arrayToRGBA(core.status.textAttribute.text);
var globalFont = core.status.globalAttribute.font;
core.setFont('ui', 'bold 17px '+globalFont);
core.setFont('ui', "bold 19px "+globalFont);
var text_length = core.canvas.ui.measureText(text).width;
var right = Math.max(text_length+50, 220);
var left = 208-parseInt(right/2), top = 208 - 32 - 16, bottom = 416 - 2 * top;
core.fillRect('ui', left, top, right, bottom);
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
core.clearMap('ui');
if (isWindowSkin) {
core.setAlpha('ui', 0.85);
this.drawWindowSkin(background,'ui',left,top,right,bottom);
}
else {
core.fillRect('ui', left, top, right, bottom, background);
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, borderColor, 2);
}
core.setAlpha('ui', 1);
core.canvas.ui.textAlign = "center";
core.fillText('ui', text, 208, top + 56, '#FFFFFF');
core.fillText('ui', text, 208, top + 56, textColor);
}
@ -1453,11 +1490,7 @@ ui.prototype.drawCursor = function () {
ui.prototype.drawBook = function (index) {
var enemys = core.enemys.getCurrentEnemys(core.floorIds[(core.status.event.selection||{}).index]);
clearInterval(core.interval.tipAnimate);
core.clearMap('data');
core.clearMap('ui');
core.setAlpha('ui', 1);
core.clearLastEvent();
core.setFillStyle('ui', core.material.groundPattern);
core.fillRect('ui', 0, 0, 416, 416);
@ -1554,8 +1587,8 @@ ui.prototype.drawBook = function (index) {
if (line_cnt==2) damageOffset=361;
core.canvas.ui.textAlign = "center";
var damage = enemy.damage;
var damage = enemy.damage;
var color = '#FFFF00';
if (damage == null) {
damage = '无法战斗';
@ -1575,7 +1608,6 @@ ui.prototype.drawBook = function (index) {
}
if (enemy.notBomb)
damage += "[b]";
core.fillText('ui', damage, damageOffset, 62 * i + 50, color, 'bold 13px '+globalFont);
core.canvas.ui.textAlign = "left";
@ -1771,8 +1803,7 @@ ui.prototype.drawMaps = function (index, x, y) {
if (!core.isset(index)) {
core.status.event.data = null;
core.clearMap('ui');
core.setAlpha('ui', 1);
core.clearLastEvent();
core.clearMap('animate');
core.fillRect('animate', 0, 0, 416, 416, 'rgba(0,0,0,0.4)');
@ -2426,7 +2457,7 @@ ui.prototype.drawKeyBoard = function () {
core.lockControl();
core.status.event.id = 'keyBoard';
core.clearMap('ui');
core.clearLastEvent();
var left = 16, top = 48, right = 416 - 2 * left, bottom = 416 - 2 * top;
core.fillRect('ui', left, top, right, bottom, core.material.groundPattern);
@ -2464,8 +2495,7 @@ ui.prototype.drawKeyBoard = function () {
////// 绘制状态栏 /////
ui.prototype.drawStatusBar = function () {
if (this.uidata.drawStatusBar)
this.uidata.drawStatusBar();
this.uidata.drawStatusBar();
}
////// 绘制“数据统计”界面 //////
@ -2537,6 +2567,8 @@ ui.prototype.drawStatistics = function () {
var temp = core.clone(core.status.hero);
core.setFlag("__statistics__", true);
if (core.isset(total.count[id])) {
var hp=0, atk=0, def=0, mdef=0;
@ -2544,6 +2576,7 @@ ui.prototype.drawStatistics = function () {
var ratio = floor.item_ratio||1;
if (core.isset(core.items.itemEffect[id])) {
try {
// 需要检查是否是测试状态...
eval(core.items.itemEffect[id]);
}
catch (e) {}
@ -2644,7 +2677,8 @@ ui.prototype.drawStatistics = function () {
+",总游戏时长"+formatTime(statistics.totalTime)
+"。\n瞬间移动次数"+statistics.moveDirectly+",共计少走"+statistics.ignoreSteps+"步。"
+"\n\n总计通过血瓶恢复生命值为"+core.formatBigNumber(statistics.hp)+"点。\n\n"
+"总计打死了"+statistics.battle+"个怪物,受到的伤害为"+core.formatBigNumber(statistics.battleDamage+statistics.poisonDamage+statistics.extraDamage)
+"总计打死了"+statistics.battle+"个怪物,得到了"+core.formatBigNumber(statistics.money)+"金币,"+core.formatBigNumber(statistics.experience)+"点经验。\n\n"
+"受到的总伤害为"+core.formatBigNumber(statistics.battleDamage+statistics.poisonDamage+statistics.extraDamage)
+",其中战斗伤害"+core.formatBigNumber(statistics.battleDamage)+"点"
+(core.flags.enableDebuff?(",中毒伤害"+core.formatBigNumber(statistics.poisonDamage)+"点"):"")
+",领域/夹击/阻击/血网伤害"+core.formatBigNumber(statistics.extraDamage)+"点。",
@ -2676,7 +2710,7 @@ ui.prototype.drawPaint = function () {
core.status.event.id = 'paint';
core.status.event.data = {"x": null, "y": null, "erase": false};
core.clearMap('ui');
core.clearLastEvent();
core.clearMap('route');
core.setAlpha('route', 1);
@ -2730,3 +2764,93 @@ ui.prototype.drawHelp = function () {
]);
}
////// 动态canvas //////
////// canvas创建 //////
ui.prototype.createCanvas = function (name, x, y, width, height, z) {
// 如果画布已存在则直接调用
var cv = this.findCanvas(name);
if (cv!=-1) {
this.relocateCanvas(name, x, y);
this.resizeCanvas(name, width, height);
core.dymCanvas[name].canvas.style.zIndex = z;
return;
}
var newCanvas = document.createElement("canvas");
newCanvas.id = name;
newCanvas.style.display = 'block';
newCanvas.width = width;
newCanvas.height = height;
newCanvas.style.width = width * core.domStyle.scale + 'px';
newCanvas.style.height = height * core.domStyle.scale + 'px';
newCanvas.style.left = x * core.domStyle.scale + 'px';
newCanvas.style.top = y * core.domStyle.scale + 'px';
newCanvas.style.zIndex = z;
newCanvas.style.position = 'absolute';
core.dymCanvas[name] = newCanvas.getContext('2d');
core.dymCanvas._list.push({
"id": name,
"style": {
"left": x,
"top": y,
}
});
core.dom.gameDraw.appendChild(newCanvas);
}
////// canvas查找 //////
ui.prototype.findCanvas = function (name) {
if (!core.isset(name)) return -1;
for (var index = 0; index < core.dymCanvas._list.length; index++) {
if (core.dymCanvas._list[index].id == name)
return index;
}
return -1;
}
////// canvas重定位 //////
ui.prototype.relocateCanvas = function (name, x, y) {
if (!core.isset(name)) return;
var index = core.findCanvas(name);
if (index < 0) return;
if (core.isset(x)) {
core.dymCanvas[name].canvas.style.left = x * core.domStyle.scale + 'px';
core.dymCanvas._list[index].style.left = x;
}
if (core.isset(y)) {
core.dymCanvas[name].canvas.style.top = y * core.domStyle.scale + 'px';
core.dymCanvas._list[index].style.top = y;
}
}
////// canvas重置 //////
ui.prototype.resizeCanvas = function (name, width, height) {
if (!core.isset(name)) return;
var dstCanvas = core.dymCanvas[name].canvas;
if (core.isset(width)) {
dstCanvas.width = width;
dstCanvas.style.width = width * core.domStyle.scale + 'px';
}
if (core.isset(height)) {
dstCanvas.height = height;
dstCanvas.style.height = height * core.domStyle.scale + 'px';
}
}
////// canvas删除 //////
ui.prototype.deleteCanvas = function (name) {
if (!core.isset(name)) return;
var index = core.findCanvas(name);
if (index == -1) return;
core.dom.gameDraw.removeChild(core.dymCanvas[name].canvas);
delete core.dymCanvas[name];
core.dymCanvas._list.splice(index,1);
}
////// 删除所有动态canvas //////
ui.prototype.deleteAllCanvas = function () {
core.dymCanvas._list.forEach(function (t) {
core.dom.gameDraw.removeChild(core.dymCanvas[t.id].canvas);
delete core.dymCanvas[t.id];
});
core.dymCanvas._list = [];
}

View File

@ -39,14 +39,14 @@ utils.prototype.init = function () {
}
////// 将文字中的${和}(表达式)进行替换 //////
utils.prototype.replaceText = function (text) {
utils.prototype.replaceText = function (text, need, times) {
return text.replace(/\${(.*?)}/g, function (word, value) {
return core.calValue(value);
return core.calValue(value, need, times);
});
}
////// 计算表达式的值 //////
utils.prototype.calValue = function (value) {
utils.prototype.calValue = function (value, need, times) {
if (!core.isset(value)) return value;
if (typeof value == 'number') {
return value;
@ -839,9 +839,9 @@ utils.prototype.decodeCanvas = function (arr, width, height) {
}
utils.prototype.consoleOpened = function () {
if (!core.flags.checkConsole) return false;
if (window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized)
return true;
if (!core.platform.isPC) return false;
var threshold = 160;
var zoom = Math.min(window.outerWidth/window.innerWidth, window.outerHeight/window.innerHeight);
return window.outerWidth - zoom*window.innerWidth > threshold

View File

@ -68,7 +68,7 @@ function main() {
'debuffCol': document.getElementById('debuffCol'),
'skillCol': document.getElementById('skillCol'),
'hard': document.getElementById('hard'),
'statusCanvas': document.getElementById('statusCanvas')
'statusCanvas': document.getElementById('statusCanvas'),
};
this.mode = 'play';
this.loadList = [

View File

@ -110,11 +110,16 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
},
{
"type": "showImage",
"name": "bg.jpg",
"code": 1,
"image": "bg.jpg",
"loc": [
0,
0
]
],
"dw": 100,
"dh": 100,
"opacity": 100,
"time": 0
},
{
"type": "comment",
@ -163,7 +168,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
]
},
{
"type": "showImage"
"type": "hideImage",
"code": 1,
"time": 0
},
{
"type": "comment",
@ -179,7 +186,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"function": "function(){\ncore.control.checkBgm()\n}"
},
{
"type": "showImage"
"type": "hideImage",
"code": 1,
"time": 0
},
{
"type": "comment",
@ -202,6 +211,11 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"type": "function",
"function": "function(){\ncore.control.checkBgm()\n}"
},
{
"type": "hideImage",
"code": 1,
"time": 0
},
{
"type": "comment",
"text": "这段代码会结束事件,选择录像文件,播放录像或重新开始"
@ -339,7 +353,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"hatred": 2,
"moveSpeed": 100,
"animateSpeed": 300,
"floorChangeTime": 800,
"floorChangeTime": 800
},
"flags": {
"enableFloor": true,
@ -385,6 +399,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"canGoDeadZone": false,
"enableMoveDirectly": true,
"enableDisabledShop": true,
"disableShopOnDamage": false
"disableShopOnDamage": false,
"checkConsole": false
}
}

View File

@ -60,6 +60,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.waitHeroToStop(function() {
core.removeGlobalAnimate(0,0,true);
core.clearMap('all'); core.clearMap('curtain'); // 清空全地图
core.deleteAllCanvas();
// 请注意:
// 成绩统计时是按照hp进行上传并排名因此光在这里改${status:hp}是无效的
// 如需按照其他的的分数统计方式请先将hp设置为你的得分
@ -89,7 +90,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// floorId是切换到的楼层fromLoad若为true则代表是从读档行为造成的楼层切换
// 每次抵达楼层时执行的事件
if (!fromLoad) {
if (!fromLoad || core.hasFlag("forceSave")) {
core.insertAction(core.floors[floorId].eachArrive);
}
@ -158,9 +159,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (core.hasItem('coin')) money *= 2;
if (core.hasFlag('curse')) money=0;
core.status.hero.money += money;
core.status.hero.statistics.money += money;
var experience =enemy.experience;
if (core.hasFlag('curse')) experience=0;
core.status.hero.experience += experience;
core.status.hero.statistics.experience += experience;
var hint = "打败 " + enemy.name;
if (core.flags.enableMoney)
hint += ",金币+" + money;
@ -420,12 +423,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var mon_hp = enemy.hp, mon_atk = enemy.atk, mon_def = enemy.def, mon_special = enemy.special;
var mon_money = enemy.money, mon_experience = enemy.experience, mon_point = enemy.point;
// 模仿
if (this.hasSpecial(mon_special, 10)) {
if (core.hasSpecial(mon_special, 10)) {
mon_atk = hero_atk;
mon_def = hero_def;
}
// 坚固
if (this.hasSpecial(mon_special, 3) && mon_def < hero_atk - 1) {
if (core.hasSpecial(mon_special, 3) && mon_def < hero_atk - 1) {
mon_def = hero_atk - 1;
}
@ -461,7 +464,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// TODO可以在这里新增其他的怪物数据变化
// 比如仿攻(怪物攻击不低于勇士攻击):
// if (this.hasSpecial(mon_special, 27) && mon_atk < hero_atk) {
// if (core.hasSpecial(mon_special, 27) && mon_atk < hero_atk) {
// mon_atk = hero_atk;
// }
// 也可以按需增加各种自定义内容(比如幻塔的魔杖效果等)
@ -509,14 +512,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
// 如果是无敌属性,且勇士未持有十字架
if (this.hasSpecial(mon_special, 20) && !core.hasItem("cross"))
if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross"))
return null; // 不可战斗
// 战前造成的额外伤害(可被魔防抵消)
var init_damage = 0;
// 吸血
if (this.hasSpecial(mon_special, 11)) {
if (core.hasSpecial(mon_special, 11)) {
var vampire_damage = hero_hp * enemy.value;
// 如果有神圣盾免疫吸血等可以在这里写
@ -534,28 +537,28 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 每回合怪物对勇士造成的战斗伤害
var per_damage = mon_atk - hero_def;
// 魔攻:战斗伤害就是怪物攻击力
if (this.hasSpecial(mon_special, 2)) per_damage = mon_atk;
if (core.hasSpecial(mon_special, 2)) per_damage = mon_atk;
// 战斗伤害不能为负值
if (per_damage < 0) per_damage = 0;
// 2连击 & 3连击 & N连击
if (this.hasSpecial(mon_special, 4)) per_damage *= 2;
if (this.hasSpecial(mon_special, 5)) per_damage *= 3;
if (this.hasSpecial(mon_special, 6)) per_damage *= (enemy.n||4);
if (core.hasSpecial(mon_special, 4)) per_damage *= 2;
if (core.hasSpecial(mon_special, 5)) per_damage *= 3;
if (core.hasSpecial(mon_special, 6)) per_damage *= (enemy.n||4);
// 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合
var counterDamage = 0;
if (this.hasSpecial(mon_special, 8)) counterDamage += Math.floor(core.values.counterAttack * hero_atk);
if (core.hasSpecial(mon_special, 8)) counterDamage += Math.floor(core.values.counterAttack * hero_atk);
// 先攻
if (this.hasSpecial(mon_special, 1)) init_damage += per_damage;
if (core.hasSpecial(mon_special, 1)) init_damage += per_damage;
// 破甲
if (this.hasSpecial(mon_special, 7))
if (core.hasSpecial(mon_special, 7))
init_damage += Math.floor(core.values.breakArmor * hero_def);
// 净化
if (this.hasSpecial(mon_special, 9))
if (core.hasSpecial(mon_special, 9))
init_damage += Math.floor(core.values.purify * hero_mdef);
// 勇士每回合对怪物造成的伤害
@ -1010,6 +1013,27 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
}
}
},
"moveOneStep": function () {
// 勇士每走一步后执行的操作
core.status.hero.steps++;
// 中毒状态:扣血
if (core.hasFlag('poison')) {
core.status.hero.statistics.poisonDamage += core.values.poisonDamage;
core.status.hero.hp -= core.values.poisonDamage;
if (core.status.hero.hp<=0) {
core.status.hero.hp=0;
core.updateStatusBar();
core.events.lose();
return;
}
core.updateStatusBar();
}
// 备注:瞬间移动不会执行该函数。如果要控制能否瞬间移动有三种方法:
// 1. 将全塔属性中的cannotMoveDirectly这个开关勾上即可在全塔中全程禁止使用瞬移。
// 2, 将楼层属性中的cannotMoveDirectly这个开关勾上即禁止在该层楼使用瞬移。
// 3. 将flag:cannotMoveDirectly置为true即可使用flag控制在某段剧情范围内禁止瞬移。
}
},
"ui": {
@ -1183,21 +1207,23 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// core.plugin.drawLight([255,255,0,0.2], [[25,11,46,0.1]]); // 全图为不透明度0.2的黄色,其中在(25,11)点存在一个半径为46的灯光效果灯光中心不透明度0.1。
// core.plugin.drawLight(0.9, [[25,11,46],[105,121,88],[301,221,106]]); // 存在三个灯光效果,分别是中心(25,11)半径46中心(105,121)半径88中心(301,221)半径106。
// core.plugin.drawLight([0,0,255,0.3], [[25,11,46],[105,121,88,0.2]], 0.4); // 存在两个灯光效果它们在内圈40%范围内保持全亮且40%后才开始衰减。
// 【注意事项】
// 此函数会和更改画面色调发生冲突,请只选择一个使用。
this.drawLight = function (color, lights, lightDec) {
// 清空色调层
var ctx = core.canvas.curtain;
// 清空色调层也可以修改成其它层比如animate/weather层或者用自己创建的canvas
var canvasName = 'curtain';
var ctx = core.ui.getContextByName(canvasName);
if (ctx == null) return;
ctx.mozImageSmoothingEnabled = false;
ctx.webkitImageSmoothingEnabled = false;
ctx.msImageSmoothingEnabled = false;
ctx.imageSmoothingEnabled = false;
core.clearMap('curtain');
ctx.clearRect(0, 0, 416, 416);
// 绘制色调层,默认不透明度
if (!core.isset(color)) color = 0.9;
if (typeof color == "number") color = [0,0,0,color];
core.fillRect('curtain', 0, 0, 416, 416, core.arrayToRGBA(color));
ctx.fillStyle = core.arrayToRGBA(color);
ctx.fillRect(0, 0, 416, 416);
// 绘制每个灯光效果
if (!core.isset(lights) || lights.length==0) return;

View File

@ -21,7 +21,7 @@
position: fixed;
top: 10px;
left: 10px;
z-index: 320;
z-index: 370;
}
#startPanel {
@ -32,7 +32,7 @@
left: 0;
background-color: #fff;
overflow: hidden;
z-index: 250;
z-index: 300;
}
#startTop {
@ -42,7 +42,7 @@
top: 0;
left: 0;
background-color: #000;
z-index: 300;
z-index: 350;
}
#startTopProgressBar {
@ -77,12 +77,12 @@
height: 100%;
width: auto;
transform:translate(-50%,-50%);
z-index: 210;
z-index: 260;
}
#startLogo {
position: absolute;
z-index: 240;
z-index: 290;
left: 0;
right: 0;
margin-left: auto;
@ -95,7 +95,7 @@
#startTitle {
position: absolute;
z-index: 230;
z-index: 280;
}
#startButtonGroup {
@ -106,7 +106,7 @@
background-color: #000;
opacity: 0.85;
display: none;
z-index: 260;
z-index: 310;
bottom: 0;
margin-bottom: 7%;
}
@ -142,7 +142,7 @@
display: none;
color: #fff;
background-color: #000;
z-index: 180;
z-index: 230;
}
#logoLabel {
@ -170,7 +170,7 @@
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
background: url(project/images/ground.png) repeat;
z-index: 135;
z-index: 185;
display: none;
}
#statusBar .status{
@ -200,7 +200,7 @@
#toolBar {
position: absolute;
background: url(project/images/ground.png) repeat;
z-index: 160;
z-index: 210;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
@ -255,7 +255,7 @@ p#name {
position: absolute;
background: #000000;
overflow: hidden;
z-index: 135;
z-index: 185;
}
#bg {
@ -298,16 +298,12 @@ p#name {
z-index: 100;
}
#image {
z-index: 105;
}
#ui {
z-index: 110;
z-index: 160;
}
#data {
z-index: 120;
z-index: 170;
}
.clearfix:before,