merge v2.x
This commit is contained in:
commit
4a3bf0e96a
@ -287,18 +287,22 @@
|
|||||||
|
|
||||||
我们可以使用 `status:xxx` 代表勇士的一个属性值;`item:xxx` 代表某个道具的个数;`flag:xxx` 代表某个自定义的变量或flag值。
|
我们可以使用 `status:xxx` 代表勇士的一个属性值;`item:xxx` 代表某个道具的个数;`flag:xxx` 代表某个自定义的变量或flag值。
|
||||||
|
|
||||||
|
从V2.6开始,也可以使用`global:xxx`代表全局存储(和存档无关的存储)。
|
||||||
|
|
||||||
``` js
|
``` js
|
||||||
[
|
[
|
||||||
"你当前的攻击力是${status:atk}, 防御是${status:def},坐标是(${status:x},${status:y})",
|
"你当前的攻击力是${status:atk}, 防御是${status:def},坐标是(${status:x},${status:y})",
|
||||||
"你的攻防和的十倍是${10*(status:atk+status:def)}",
|
"你的攻防和的十倍是${10*(status:atk+status:def)}",
|
||||||
"你的红黄蓝钥匙总数为${item:yellowKey+item:blueKey+item:redKey}",
|
"你的红黄蓝钥匙总数为${item:yellowKey+item:blueKey+item:redKey}",
|
||||||
"你访问某个老人的次数为${flag:man_times}",
|
"你访问某个老人的次数为${flag:man_times}",
|
||||||
|
"当前的存档编号是${global:saveIndex}",
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
- `status:xxx` 获取勇士属性时只能使用如下几个:hp(生命值),atk(攻击力),def(防御力),mdef(魔防值),money(金币),experience(经验),x(勇士的横坐标),y(勇士的纵坐标),direction(勇士的方向)。
|
- `status:xxx` 获取勇士属性时只能使用如下几个:hp(生命值),atk(攻击力),def(防御力),mdef(魔防值),money(金币),experience(经验),x(勇士的横坐标),y(勇士的纵坐标),direction(勇士的方向)。
|
||||||
- `item:xxx` 中的xxx为道具ID。所有道具的ID定义在items.js中,请自行查看。例如,`item:centerFly` 代表中心对称飞行器的个数。
|
- `item:xxx` 中的xxx为道具ID。所有道具的ID定义在items.js中,请自行查看。例如,`item:centerFly` 代表中心对称飞行器的个数。
|
||||||
- `flag:xxx` 中的xxx为一个自定义的变量/Flag;如果没有对其进行赋值则默认值为false。
|
- `flag:xxx` 中的xxx为一个自定义的变量/Flag(支持中文);如果没有对其进行赋值则默认值为0。
|
||||||
|
- `global:xxx` 中的xxx为一个全局存储的名称(支持中文);如果没有对其进行赋值则默认值为0。
|
||||||
|
|
||||||
### autoText:自动剧情文本
|
### autoText:自动剧情文本
|
||||||
|
|
||||||
@ -417,7 +421,7 @@ icon是可选的,如果设置则会绘制图标,其可以是一个有效的I
|
|||||||
|
|
||||||
name为你要修改的属性/道具/Flag,每次只能修改一个值。写法和上面完全相同,`status:xxx` 表示勇士一个属性,`item:xxx` 表示某个道具个数,`flag:xxx` 表示某个变量或flag值。参见上面的介绍。
|
name为你要修改的属性/道具/Flag,每次只能修改一个值。写法和上面完全相同,`status:xxx` 表示勇士一个属性,`item:xxx` 表示某个道具个数,`flag:xxx` 表示某个变量或flag值。参见上面的介绍。
|
||||||
|
|
||||||
value是一个表达式,将通过这个表达式计算出的结果赋值给name。该表达式同样可以使用`status:xxx`, `item:xxx`, `flag:xxx`的写法表示勇士当前属性,道具个数和某个变量/Flag值。
|
value是一个表达式,将通过这个表达式计算出的结果赋值给name。该表达式同样可以使用`status:xxx`, `item:xxx`, `flag:xxx`, `global:xxx`的写法表示勇士当前属性,道具个数,某个变量/Flag值和某个全局存储值。
|
||||||
|
|
||||||
``` js
|
``` js
|
||||||
[
|
[
|
||||||
@ -428,6 +432,7 @@ value是一个表达式,将通过这个表达式计算出的结果赋值给nam
|
|||||||
{"type": "setValue", "name": "item:bomb", "value": "item:bomb+10" } // 炸弹个数+10
|
{"type": "setValue", "name": "item:bomb", "value": "item:bomb+10" } // 炸弹个数+10
|
||||||
{"type": "setValue", "name": "flag:man_times", "value": "0" } // 将变量man_times设为0
|
{"type": "setValue", "name": "flag:man_times", "value": "0" } // 将变量man_times设为0
|
||||||
{"type": "setValue", "name": "flag:man_times", "value": "flag:man_times+2*status:atk" } // 将变量man_times的值加上勇士的攻击数值的两倍
|
{"type": "setValue", "name": "flag:man_times", "value": "flag:man_times+2*status:atk" } // 将变量man_times的值加上勇士的攻击数值的两倍
|
||||||
|
{"type": "setValue", "name": "global:123", "value": "4"} // 设置全局存储233为4(任何存档都可以读取它)
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -574,24 +579,22 @@ NPC对话事件结束后如果需要NPC消失也需要调用 `{"type": "hide"}`
|
|||||||
|
|
||||||
`{"type":"trigger"}` 会立刻触发当层另一个地点的自定义事件。
|
`{"type":"trigger"}` 会立刻触发当层另一个地点的自定义事件。
|
||||||
|
|
||||||
上面我们说到,show事件会让一个禁用事件启用且可被交互;但是如果我想立刻让它执行应该怎么办呢?使用trigger就行。
|
|
||||||
|
|
||||||
其基本写法如下:
|
其基本写法如下:
|
||||||
|
|
||||||
``` js
|
``` js
|
||||||
[
|
[
|
||||||
{"type": "trigger", "loc": [3,6]}, // 立即触发loc位置的事件,当前剩下的事件全部不再执行
|
{"type": "trigger", "loc": [3,6]}, // 立即触发loc位置的事件,当前剩下的事件全部不再执行
|
||||||
"执行trigger后,这段文字将不会再被显示"
|
{"type": "trigger", "loc": [3,6], "keep": true}, // 触发loc位置的事件,不结束当前事件
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
其后面带有loc选项,代表另一个地点的坐标。
|
其后面带有loc选项,代表另一个地点的坐标。
|
||||||
|
|
||||||
执行trigger事件后,当前事件将立刻被结束,剩下所有内容被忽略;然后重新启动另一个地点的action事件。
|
keep可选,如果此项为true则不会结束当前的事件列表,否则会中断当前的事件流。
|
||||||
|
|
||||||
例如上面这个例子,下面的文字将不会再被显示,而是直接跳转到`"3,6"`对应的事件列表从头执行。
|
从V2.5.4开始允许执行另一个点的系统事件,如打怪开门拾取道具等等,对应点的战后等事件也会被插入执行。
|
||||||
|
|
||||||
!> 从V2.5.4开始,允许执行另一个点的“系统事件”,如打怪、开门、拾取道具等等。对应点的战后事件等也会被执行。
|
值得注意的是,此事件会**改变当前点坐标**为目标点。
|
||||||
|
|
||||||
### insert:插入公共事件或另一个地点的事件并执行
|
### insert:插入公共事件或另一个地点的事件并执行
|
||||||
|
|
||||||
@ -619,11 +622,12 @@ NPC对话事件结束后如果需要NPC消失也需要调用 `{"type": "hide"}`
|
|||||||
- floorId可选,代表另一个地点所在的楼层;如果不写则默认为当前层。
|
- floorId可选,代表另一个地点所在的楼层;如果不写则默认为当前层。
|
||||||
- 从V2.6开始,还可以传可选的which,可以为`afterBattle`/`afterGetItem`/`afterOpenDoor`,代表插入该点的战后/获得道具后/开门后事件。
|
- 从V2.6开始,还可以传可选的which,可以为`afterBattle`/`afterGetItem`/`afterOpenDoor`,代表插入该点的战后/获得道具后/开门后事件。
|
||||||
|
|
||||||
和`type:trigger`不同的是,**`type:trigger`是立刻将当前事件结束(剩下所有内容都忽略),然后重新启动另一个地点的action事件。**
|
和`type:trigger`不同点如下:
|
||||||
|
- `type:trigger`只能指定当前楼层且会改变当前点坐标,`type:insert`可以跨楼层且不会改变当前点坐标。
|
||||||
|
- `type:trigger`如果不设置`keep:true`则还会结束当前事件,`type:insert`而是将另一个点的事件插入到当前事件列表中执行。
|
||||||
|
- `type:trigger`可以触发系统事件,`type:insert`只能触发该点的自定义事件或战后事件等。
|
||||||
|
|
||||||
但是`type:insert`不会结束当前事件,而是直接将另一个地点的事件列表“插入”到当前事件列表中执行。
|
插入的事件执行完毕后,会继续执行接下来的内容。
|
||||||
|
|
||||||
**这个过程中,当前事件不会被结束,当前的楼层和事件坐标不会发生改变。** 插入的事件执行完毕后,会继续执行接下来的内容。
|
|
||||||
|
|
||||||
从V2.6开始,插入事件允许传参。如果需要传参,则需要增加一个`args`数组。
|
从V2.6开始,插入事件允许传参。如果需要传参,则需要增加一个`args`数组。
|
||||||
|
|
||||||
@ -840,28 +844,20 @@ name是可选的,代表目标行走图的文件名。
|
|||||||
|
|
||||||
调用battle可强制与某怪物进行战斗(而无需去触碰到它)。
|
调用battle可强制与某怪物进行战斗(而无需去触碰到它)。
|
||||||
|
|
||||||
其基本写法是: `{"type": "battle", "id": xxx}`,其中xxx为怪物ID。
|
|
||||||
|
|
||||||
``` js
|
``` js
|
||||||
[
|
[
|
||||||
"\t[blackKing]你终于还是来了。",
|
{"type": "battle", "id": "blackKing"}, // 强制战斗黑衣魔王
|
||||||
"\t[hero]放开我们的公主!",
|
{"type": "battle", "loc": [2,3]}, // 强制战斗(2,3)点的怪物
|
||||||
"\t[blackKing]如果我不愿意呢?",
|
|
||||||
"\t[hero]无需多说,拔剑吧!",
|
|
||||||
{"type": "battle", "id": "blackKing"}, // 强制战斗
|
|
||||||
// 如果战斗失败直接死亡,不会继续触发接下来的剧情。
|
|
||||||
{"type": "hide", "loc": [10,2]}, // 战斗后需要手动使怪物消失;战斗后不会引发afterBattle事件。
|
|
||||||
{"type": "openDoor", "loc": [8,7]}, // 开门口的机关门
|
|
||||||
"\t[blackKing]没想到你已经变得这么强大了... 算你厉害。\n公主就交给你了,请好好对她。",
|
|
||||||
{"type": "hide"} // 隐藏本事件
|
|
||||||
],
|
],
|
||||||
```
|
```
|
||||||
|
|
||||||
上面就是样板层中右上角的强制战斗例子。
|
从V2.6开始,有两种写法:
|
||||||
|
- 写id,则视为和空降怪物进行强制战斗,不会执行一些战后事件,也不会隐藏任何点。
|
||||||
|
- 写loc(可选,不填默认当前点),则视为和某点怪物进行强制战斗,会隐藏该点并且插入该点战后事件执行。
|
||||||
|
|
||||||
如果强制战斗失败,则会立刻生命归0并死亡,调用lose函数,接下来的事件不会再被执行。
|
强制战斗不会自动存档,如果战斗失败则立刻死亡。
|
||||||
|
|
||||||
强制战斗没有指定loc的选项,因此战斗后需要调用hide使怪物消失(如果有必要)。
|
值得注意的是,如果是和某个点的怪物强制战斗,并且该点存在战后事件,执行时会**修改当前点坐标**为目标点。
|
||||||
|
|
||||||
### openDoor:开门
|
### openDoor:开门
|
||||||
|
|
||||||
@ -871,7 +867,7 @@ name是可选的,代表目标行走图的文件名。
|
|||||||
[
|
[
|
||||||
{"type": "openDoor", "loc": [3,6], "floorId": "MT1"}, // 打开MT1层的[3,6]位置的门
|
{"type": "openDoor", "loc": [3,6], "floorId": "MT1"}, // 打开MT1层的[3,6]位置的门
|
||||||
{"type": "openDoor", "loc": [3,6]}, // 如果是本层则可省略floorId
|
{"type": "openDoor", "loc": [3,6]}, // 如果是本层则可省略floorId
|
||||||
{"type": "openDoor", "loc": [3,6], "needKey": true} // 打开此门需要钥匙
|
{"type": "openDoor", "loc": [3,6], "needKey": true, "async": true} // 打开此门需要钥匙,异步执行
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -883,8 +879,12 @@ loc指定门的坐标,floorId指定门所在的楼层ID。如果是当前层
|
|||||||
|
|
||||||
needKey是可选的,如果设置为true则需要钥匙才能打开此门。如果没有钥匙则跳过此事件。
|
needKey是可选的,如果设置为true则需要钥匙才能打开此门。如果没有钥匙则跳过此事件。
|
||||||
|
|
||||||
|
async可选,如果为true则会异步执行(即不等待当前事件执行完毕,立刻执行下一个事件)。
|
||||||
|
|
||||||
!> needKey仅对当前楼层开门有效!跨楼层的门仍然不需要钥匙即可打开,如有需求请自行判定。
|
!> needKey仅对当前楼层开门有效!跨楼层的门仍然不需要钥匙即可打开,如有需求请自行判定。
|
||||||
|
|
||||||
|
值得注意的是,如果该点存在开门事件,执行时会**修改当前点坐标**为目标点。
|
||||||
|
|
||||||
### closeDoor:关门
|
### closeDoor:关门
|
||||||
|
|
||||||
从V2.6开始提供了关门事件`{"type": "closeDoor"}`,拥有关门动画和对应的音效。
|
从V2.6开始提供了关门事件`{"type": "closeDoor"}`,拥有关门动画和对应的音效。
|
||||||
@ -907,6 +907,8 @@ yellowWall, blueWall, whiteWall
|
|||||||
|
|
||||||
loc可选,为要关的位置,不填默认为当前点。
|
loc可选,为要关的位置,不填默认为当前点。
|
||||||
|
|
||||||
|
async可选,如果为true则会异步执行(即不等待当前事件执行完毕,立刻执行下一个事件)。
|
||||||
|
|
||||||
关门事件需要保证该点是空地,否则将无视此事件。
|
关门事件需要保证该点是空地,否则将无视此事件。
|
||||||
|
|
||||||
### changeFloor:楼层切换
|
### changeFloor:楼层切换
|
||||||
|
|||||||
@ -224,7 +224,11 @@ function () {
|
|||||||
- 清晰明了。很容易方便知道自己修改过什么,尤其是可以和系统原有代码进行对比。
|
- 清晰明了。很容易方便知道自己修改过什么,尤其是可以和系统原有代码进行对比。
|
||||||
- 方便整理成新的插件,给其他的塔使用。
|
- 方便整理成新的插件,给其他的塔使用。
|
||||||
|
|
||||||
如果我想对xxx文件中的yyy函数进行重写,其模式一般是:`core.xxx.yyy = function (参数列表) { ... }`
|
一般而言,复写规则如下:
|
||||||
|
|
||||||
|
**对xxx文件中的yyy函数进行复写,规则是`core.xxx.yyy = function (参数列表) { ... }`。**
|
||||||
|
|
||||||
|
但是,对于`registerXXX`所注册的函数是无效的,例如直接复写`core.control._animationFrame_globalAnimate`函数是没有效果的。对于这种情况引入的函数,需要注册同名函数,可参见最下面的样例。
|
||||||
|
|
||||||
下面是几个例子,从简单到复杂。
|
下面是几个例子,从简单到复杂。
|
||||||
|
|
||||||
@ -317,6 +321,32 @@ core.maps.drawMap = function (floorId, callback) {
|
|||||||
|
|
||||||
详见[call和apply的用法](https://www.jianshu.com/p/80ea0d1c04f8)。
|
详见[call和apply的用法](https://www.jianshu.com/p/80ea0d1c04f8)。
|
||||||
|
|
||||||
|
### 复写全局动画绘制函数
|
||||||
|
|
||||||
|
全局动画绘制在`control.js`的`_animationFrame_globalAnimate`函数。
|
||||||
|
|
||||||
|
注意到此函数是由`registerAnimationFrame`注册的,因此直接复写是无效的。
|
||||||
|
|
||||||
|
其在control.js的注册的定义如下:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// 注册全局动画函数
|
||||||
|
this.registerAnimationFrame("globalAnimate", true, this._animationFrame_globalAnimate);
|
||||||
|
```
|
||||||
|
|
||||||
|
因此,可以在插件中自行注册一个**同名**的函数来覆盖原始的内容。
|
||||||
|
|
||||||
|
```js
|
||||||
|
// 插件中复写全局动画绘制函数
|
||||||
|
this.myGlobalAnimate = function (timestamp) {
|
||||||
|
// ...... 实际复写的函数内容
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注册同名(globalAnimate)函数来覆盖系统原始内容
|
||||||
|
core.registerAnimationFrame("globalAnimate", true, "myGlobalAnimate");
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
==========================================================================================
|
==========================================================================================
|
||||||
|
|
||||||
[继续阅读下一章:API列表](api)
|
[继续阅读下一章:API列表](api)
|
||||||
|
|||||||
@ -287,6 +287,7 @@ action
|
|||||||
| wait_s
|
| wait_s
|
||||||
| waitAsync_s
|
| waitAsync_s
|
||||||
| battle_s
|
| battle_s
|
||||||
|
| battle_1_s
|
||||||
| openDoor_s
|
| openDoor_s
|
||||||
| closeDoor_s
|
| closeDoor_s
|
||||||
| changeFloor_s
|
| changeFloor_s
|
||||||
@ -441,7 +442,7 @@ helpUrl : https://h5mota.com/games/template/docs/#/event?id=settext%EF%BC%9A%E8%
|
|||||||
default : [null,"",null,"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',null,"","",""]
|
default : [null,"",null,"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',null,"","",""]
|
||||||
SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"';
|
SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"';
|
||||||
SetTextAlign_List_0 =SetTextAlign_List_0==='null'?'': ', "align": "'+SetTextAlign_List_0+'"';
|
SetTextAlign_List_0 =SetTextAlign_List_0==='null'?'': ', "align": "'+SetTextAlign_List_0+'"';
|
||||||
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
var colorRe = MotaActionFunctions.pattern.colorRe;
|
||||||
if (EvalString_0) {
|
if (EvalString_0) {
|
||||||
if (!/^\d+$/.test(EvalString_0))throw new Error('像素偏移量必须是整数或不填');
|
if (!/^\d+$/.test(EvalString_0))throw new Error('像素偏移量必须是整数或不填');
|
||||||
EvalString_0 = ', "offset": '+EvalString_0;
|
EvalString_0 = ', "offset": '+EvalString_0;
|
||||||
@ -587,7 +588,7 @@ default : ["","","",500,false]
|
|||||||
colour : this.mapColor
|
colour : this.mapColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (EvalString_0 && EvalString_1) {
|
if (EvalString_0 && EvalString_1) {
|
||||||
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
var pattern1 = MotaActionFunctions.pattern.id;
|
||||||
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
||||||
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
||||||
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
||||||
@ -620,7 +621,7 @@ default : ["","","",500,false]
|
|||||||
colour : this.mapColor
|
colour : this.mapColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (EvalString_0 && EvalString_1) {
|
if (EvalString_0 && EvalString_1) {
|
||||||
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
var pattern1 = MotaActionFunctions.pattern.id;
|
||||||
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
||||||
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
||||||
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
||||||
@ -643,15 +644,16 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
trigger_s
|
trigger_s
|
||||||
: '触发事件' 'x' PosString ',' 'y' PosString Newline
|
: '触发事件' 'x' PosString ',' 'y' PosString '不结束当前事件' Bool Newline
|
||||||
|
|
||||||
|
|
||||||
/* trigger_s
|
/* trigger_s
|
||||||
tooltip : trigger: 立即触发另一个地点的事件
|
tooltip : trigger: 立即触发另一个地点的事件
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=trigger%EF%BC%9A%E7%AB%8B%E5%8D%B3%E8%A7%A6%E5%8F%91%E5%8F%A6%E4%B8%80%E4%B8%AA%E5%9C%B0%E7%82%B9%E7%9A%84%E4%BA%8B%E4%BB%B6
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=trigger%EF%BC%9A%E7%AB%8B%E5%8D%B3%E8%A7%A6%E5%8F%91%E5%8F%A6%E4%B8%80%E4%B8%AA%E5%9C%B0%E7%82%B9%E7%9A%84%E4%BA%8B%E4%BB%B6
|
||||||
default : ["0","0"]
|
default : ["0","0",false]
|
||||||
colour : this.eventColor
|
colour : this.eventColor
|
||||||
var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']},\n';
|
Bool_0 = Bool_0 ?', "keep": true':'';
|
||||||
|
var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']'+Bool_0+'},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
@ -761,7 +763,7 @@ default : ["","",""]
|
|||||||
colour : this.mapColor
|
colour : this.mapColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (EvalString_0 && EvalString_1) {
|
if (EvalString_0 && EvalString_1) {
|
||||||
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
var pattern1 = MotaActionFunctions.pattern.id;
|
||||||
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
||||||
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
||||||
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
||||||
@ -792,7 +794,7 @@ default : ["","",""]
|
|||||||
colour : this.mapColor
|
colour : this.mapColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (EvalString_0 && EvalString_1) {
|
if (EvalString_0 && EvalString_1) {
|
||||||
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
var pattern1 = MotaActionFunctions.pattern.id;
|
||||||
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
||||||
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
||||||
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
||||||
@ -823,7 +825,7 @@ default : ["bg","","",""]
|
|||||||
colour : this.mapColor
|
colour : this.mapColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (EvalString_0 && EvalString_1) {
|
if (EvalString_0 && EvalString_1) {
|
||||||
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
var pattern1 = MotaActionFunctions.pattern.id;
|
||||||
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
||||||
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
||||||
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
||||||
@ -854,7 +856,7 @@ default : ["bg","","",""]
|
|||||||
colour : this.mapColor
|
colour : this.mapColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (EvalString_0 && EvalString_1) {
|
if (EvalString_0 && EvalString_1) {
|
||||||
var pattern1 = /^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
var pattern1 = MotaActionFunctions.pattern.id;
|
||||||
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
||||||
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
||||||
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
||||||
@ -984,14 +986,32 @@ var code = '{"type": "battle", "id": "'+IdString_0+'"},\n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
|
||||||
|
battle_1_s
|
||||||
|
: '强制战斗' 'x' PosString? ',' 'y' PosString? Newline
|
||||||
|
|
||||||
|
|
||||||
|
/* battle_1_s
|
||||||
|
tooltip : battle: 强制战斗
|
||||||
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=battle%EF%BC%9A%E5%BC%BA%E5%88%B6%E6%88%98%E6%96%97
|
||||||
|
default : ["","",""]
|
||||||
|
colour : this.mapColor
|
||||||
|
var floorstr = '';
|
||||||
|
if (PosString_0 && PosString_1) {
|
||||||
|
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||||
|
}
|
||||||
|
var code = '{"type": "battle"'+floorstr+'},\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
openDoor_s
|
openDoor_s
|
||||||
: '开门' 'x' PosString? ',' 'y' PosString? '楼层' IdString? '需要钥匙' Bool? Newline
|
: '开门' 'x' PosString? ',' 'y' PosString? '楼层' IdString? '需要钥匙' Bool? '不等待执行完毕' Bool Newline
|
||||||
|
|
||||||
|
|
||||||
/* openDoor_s
|
/* openDoor_s
|
||||||
tooltip : openDoor: 开门,楼层可不填表示当前层
|
tooltip : openDoor: 开门,楼层可不填表示当前层
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=opendoor%EF%BC%9A%E5%BC%80%E9%97%A8
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=opendoor%EF%BC%9A%E5%BC%80%E9%97%A8
|
||||||
default : ["","","",false]
|
default : ["","","",false,false]
|
||||||
colour : this.mapColor
|
colour : this.mapColor
|
||||||
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
@ -999,24 +1019,26 @@ if (PosString_0 && PosString_1) {
|
|||||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||||
}
|
}
|
||||||
Bool_0 = Bool_0 ? ', "needKey": true' : '';
|
Bool_0 = Bool_0 ? ', "needKey": true' : '';
|
||||||
var code = '{"type": "openDoor"'+floorstr+IdString_0+Bool_0+'},\n';
|
Bool_1 = Bool_1 ? ', "async": true' : '';
|
||||||
|
var code = '{"type": "openDoor"'+floorstr+IdString_0+Bool_0+Bool_1+'},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
closeDoor_s
|
closeDoor_s
|
||||||
: '关门' 'x' PosString? ',' 'y' PosString? 'ID' IdString Newline
|
: '关门' 'x' PosString? ',' 'y' PosString? 'ID' IdString '不等待执行完毕' Bool Newline
|
||||||
|
|
||||||
|
|
||||||
/* closeDoor_s
|
/* closeDoor_s
|
||||||
tooltip : closeDoor: 关门事件,需要该点本身无事件
|
tooltip : closeDoor: 关门事件,需要该点本身无事件
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=opendoor%EF%BC%9A%E5%BC%80%E9%97%A8
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=opendoor%EF%BC%9A%E5%BC%80%E9%97%A8
|
||||||
default : ["","","yellowDoor"]
|
default : ["","","yellowDoor",false]
|
||||||
colour : this.mapColor
|
colour : this.mapColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (PosString_0 && PosString_1) {
|
if (PosString_0 && PosString_1) {
|
||||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||||
}
|
}
|
||||||
var code = '{"type": "closeDoor", "id": "'+IdString_0+'"'+floorstr+'},\n';
|
Bool_0 = Bool_0 ? ', "async": true' : '';
|
||||||
|
var code = '{"type": "closeDoor", "id": "'+IdString_0+'"'+floorstr+Bool_0+'},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
@ -1157,7 +1179,7 @@ helpUrl : https://h5mota.com/games/template/docs/#/event?id=animate%EF%BC%9A%E6%
|
|||||||
default : ["zone","hero",false]
|
default : ["zone","hero",false]
|
||||||
colour : this.soundColor
|
colour : this.soundColor
|
||||||
if (EvalString_0) {
|
if (EvalString_0) {
|
||||||
if(/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+),flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/.test(EvalString_0)) {
|
if(MotaActionFunctions.pattern.id2.test(EvalString_0)) {
|
||||||
EvalString_0=', "loc": ["'+EvalString_0.split(',').join('","')+'"]';
|
EvalString_0=', "loc": ["'+EvalString_0.split(',').join('","')+'"]';
|
||||||
} else if (/hero|([+-]?\d+),([+-]?\d+)/.test(EvalString_0)) {
|
} else if (/hero|([+-]?\d+),([+-]?\d+)/.test(EvalString_0)) {
|
||||||
if(EvalString_0.indexOf(',')!==-1)EvalString_0='['+EvalString_0+']';
|
if(EvalString_0.indexOf(',')!==-1)EvalString_0='['+EvalString_0+']';
|
||||||
@ -1293,7 +1315,7 @@ tooltip : setCurtain: 更改画面色调,动画时间可不填
|
|||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setcurtain%EF%BC%9A%E6%9B%B4%E6%94%B9%E7%94%BB%E9%9D%A2%E8%89%B2%E8%B0%83
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setcurtain%EF%BC%9A%E6%9B%B4%E6%94%B9%E7%94%BB%E9%9D%A2%E8%89%B2%E8%B0%83
|
||||||
default : ["255,255,255,1",'rgba(255,255,255,1)',500,false]
|
default : ["255,255,255,1",'rgba(255,255,255,1)',500,false]
|
||||||
colour : this.soundColor
|
colour : this.soundColor
|
||||||
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
var colorRe = MotaActionFunctions.pattern.colorRe;
|
||||||
if (!colorRe.test(EvalString_0))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
|
if (!colorRe.test(EvalString_0))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
|
||||||
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
|
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
|
||||||
var async = Bool_0?', "async": true':'';
|
var async = Bool_0?', "async": true':'';
|
||||||
@ -1324,7 +1346,7 @@ tooltip : screenFlash: 画面闪烁,动画时间可不填
|
|||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=screenFlash%EF%BC%9A%E7%94%BB%E9%9D%A2%E9%97%AA%E7%83%81
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=screenFlash%EF%BC%9A%E7%94%BB%E9%9D%A2%E9%97%AA%E7%83%81
|
||||||
default : ["255,255,255,1",'rgba(255,255,255,1)',500,1,false]
|
default : ["255,255,255,1",'rgba(255,255,255,1)',500,1,false]
|
||||||
colour : this.soundColor
|
colour : this.soundColor
|
||||||
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
var colorRe = MotaActionFunctions.pattern.colorRe;
|
||||||
if (!colorRe.test(EvalString_0))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
|
if (!colorRe.test(EvalString_0))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
|
||||||
Int_1 = Int_1!=='' ?(', "times": '+Int_1):'';
|
Int_1 = Int_1!=='' ?(', "times": '+Int_1):'';
|
||||||
var async = Bool_0?', "async": true':'';
|
var async = Bool_0?', "async": true':'';
|
||||||
@ -1354,7 +1376,7 @@ move_s
|
|||||||
/* move_s
|
/* move_s
|
||||||
tooltip : move: 让某个NPC/怪物移动,位置可不填代表当前事件
|
tooltip : move: 让某个NPC/怪物移动,位置可不填代表当前事件
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=move%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AAnpc%E6%80%AA%E7%89%A9%E7%A7%BB%E5%8A%A8
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=move%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AAnpc%E6%80%AA%E7%89%A9%E7%A7%BB%E5%8A%A8
|
||||||
default : ["","",500,false,false,"上右3下2左上左2"]
|
default : ["","",500,false,false,"上右3下2后4左前2"]
|
||||||
colour : this.mapColor
|
colour : this.mapColor
|
||||||
var floorstr = '';
|
var floorstr = '';
|
||||||
if (PosString_0 && PosString_1) {
|
if (PosString_0 && PosString_1) {
|
||||||
@ -1682,7 +1704,7 @@ helpUrl : https://h5mota.com/games/template/docs/#/event?id=choices%EF%BC%9A%E7%
|
|||||||
default : ["提示文字:红钥匙","",""]
|
default : ["提示文字:红钥匙","",""]
|
||||||
colour : this.subColor
|
colour : this.subColor
|
||||||
if (EvalString_1) {
|
if (EvalString_1) {
|
||||||
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
var colorRe = MotaActionFunctions.pattern.colorRe;
|
||||||
if (colorRe.test(EvalString_1))
|
if (colorRe.test(EvalString_1))
|
||||||
EvalString_1 = ', "color": ['+EvalString_1+']';
|
EvalString_1 = ', "color": ['+EvalString_1+']';
|
||||||
else
|
else
|
||||||
@ -1735,7 +1757,7 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
break_s
|
break_s
|
||||||
: '跳出循环' Newline
|
: '跳出当前循环或公共事件' Newline
|
||||||
|
|
||||||
/* break_s
|
/* break_s
|
||||||
tooltip : break:跳出循环, 如果break事件不在任何循环中被执行,则和exit等价,即会立刻结束当前事件!
|
tooltip : break:跳出循环, 如果break事件不在任何循环中被执行,则和exit等价,即会立刻结束当前事件!
|
||||||
@ -2113,8 +2135,8 @@ FixedId_List
|
|||||||
/*FixedId_List ['status:hp','status:atk','status:def','status:mdef','item:yellowKey','item:blueKey','item:redKey','status:money','status:experience']*/;
|
/*FixedId_List ['status:hp','status:atk','status:def','status:mdef','item:yellowKey','item:blueKey','item:redKey','status:money','status:experience']*/;
|
||||||
|
|
||||||
Id_List
|
Id_List
|
||||||
: '变量' | '状态' | '物品' | '独立开关'
|
: '变量' | '状态' | '物品' | '独立开关' | '全局存储'
|
||||||
/*Id_List ['flag','status','item', 'switch']*/;
|
/*Id_List ['flag','status','item', 'switch', 'global']*/;
|
||||||
|
|
||||||
//转blockly后不保留需要加"
|
//转blockly后不保留需要加"
|
||||||
EvalString
|
EvalString
|
||||||
@ -2532,12 +2554,12 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
case "openDoor": // 开一个门, 包括暗墙
|
case "openDoor": // 开一个门, 包括暗墙
|
||||||
data.loc=data.loc||['','']
|
data.loc=data.loc||['','']
|
||||||
this.next = MotaActionBlocks['openDoor_s'].xmlText([
|
this.next = MotaActionBlocks['openDoor_s'].xmlText([
|
||||||
data.loc[0],data.loc[1],data.floorId||'',data.needKey||false,this.next]);
|
data.loc[0],data.loc[1],data.floorId||'',data.needKey||false,data.async||false,this.next]);
|
||||||
break;
|
break;
|
||||||
case "closeDoor": // 关一个门,需要该点无事件
|
case "closeDoor": // 关一个门,需要该点无事件
|
||||||
data.loc=data.loc||['','']
|
data.loc=data.loc||['','']
|
||||||
this.next = MotaActionBlocks['closeDoor_s'].xmlText([
|
this.next = MotaActionBlocks['closeDoor_s'].xmlText([
|
||||||
data.loc[0],data.loc[1],data.id,this.next]);
|
data.loc[0],data.loc[1],data.id,data.async||false,this.next]);
|
||||||
break;
|
break;
|
||||||
case "useItem": // 使用道具
|
case "useItem": // 使用道具
|
||||||
this.next = MotaActionBlocks['useItem_s'].xmlText([
|
this.next = MotaActionBlocks['useItem_s'].xmlText([
|
||||||
@ -2552,12 +2574,19 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
data.id,this.next]);
|
data.id,this.next]);
|
||||||
break;
|
break;
|
||||||
case "battle": // 强制战斗
|
case "battle": // 强制战斗
|
||||||
this.next = MotaActionBlocks['battle_s'].xmlText([
|
if (data.id) {
|
||||||
data.id,this.next]);
|
this.next = MotaActionBlocks['battle_s'].xmlText([
|
||||||
|
data.id,this.next]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data.loc = data.loc || [];
|
||||||
|
this.next = MotaActionBlocks['battle_1_s'].xmlText([
|
||||||
|
data.loc[0],data.loc[1],this.next]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的
|
case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的
|
||||||
this.next = MotaActionBlocks['trigger_s'].xmlText([
|
this.next = MotaActionBlocks['trigger_s'].xmlText([
|
||||||
data.loc[0],data.loc[1],this.next]);
|
data.loc[0],data.loc[1],data.keep,this.next]);
|
||||||
break;
|
break;
|
||||||
case "insert": // 强制插入另一个点的事件在当前事件列表执行,当前坐标和楼层不会改变
|
case "insert": // 强制插入另一个点的事件在当前事件列表执行,当前坐标和楼层不会改变
|
||||||
if (data.args instanceof Array) {
|
if (data.args instanceof Array) {
|
||||||
@ -2857,14 +2886,14 @@ MotaActionFunctions.EvalString_pre = function(EvalString){
|
|||||||
|
|
||||||
MotaActionFunctions.IdString_pre = function(IdString){
|
MotaActionFunctions.IdString_pre = function(IdString){
|
||||||
if (IdString.indexOf('__door__')!==-1) throw new Error('请修改开门变量__door__,如door1,door2,door3等依次向后。请勿存在两个门使用相同的开门变量。');
|
if (IdString.indexOf('__door__')!==-1) throw new Error('请修改开门变量__door__,如door1,door2,door3等依次向后。请勿存在两个门使用相同的开门变量。');
|
||||||
if (IdString && !(/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/.test(IdString)) && !(/^[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/.test(IdString)))
|
if (IdString && !(MotaActionFunctions.pattern.id.test(IdString)) && !(MotaActionFunctions.pattern.idWithoutFlag.test(IdString)))
|
||||||
throw new Error('id: '+IdString+'中包含了0-9 a-z A-Z _ - :之外的字符');
|
throw new Error('id: '+IdString+'中包含了0-9 a-z A-Z _ - :之外的字符');
|
||||||
return IdString;
|
return IdString;
|
||||||
}
|
}
|
||||||
|
|
||||||
MotaActionFunctions.PosString_pre = function(PosString){
|
MotaActionFunctions.PosString_pre = function(PosString){
|
||||||
if (!PosString || /^-?\d+$/.test(PosString)) return PosString;
|
if (!PosString || /^-?\d+$/.test(PosString)) return PosString;
|
||||||
if (!(/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/.test(PosString)))throw new Error(PosString+'中包含了0-9 a-z A-Z _ 和中文之外的字符,或者是没有以flag: 开头');
|
if (!(MotaActionFunctions.pattern.id.test(PosString)))throw new Error(PosString+'中包含了0-9 a-z A-Z _ 和中文之外的字符,或者是没有以flag: 开头');
|
||||||
return '"'+PosString+'"';
|
return '"'+PosString+'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2906,4 +2935,10 @@ MotaActionFunctions.StepString_pre = function(StepString){
|
|||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MotaActionFunctions.pattern=MotaActionFunctions.pattern||{};
|
||||||
|
MotaActionFunctions.pattern.id=/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
||||||
|
MotaActionFunctions.pattern.id2=/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+),flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
||||||
|
MotaActionFunctions.pattern.idWithoutFlag=/^[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
|
||||||
|
MotaActionFunctions.pattern.colorRe=/^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -112,6 +112,7 @@ editor_blockly = function () {
|
|||||||
MotaActionBlocks['unfollow_s'].xmlText(),
|
MotaActionBlocks['unfollow_s'].xmlText(),
|
||||||
],
|
],
|
||||||
'地图处理':[
|
'地图处理':[
|
||||||
|
MotaActionBlocks['battle_1_s'].xmlText(),
|
||||||
MotaActionBlocks['openDoor_s'].xmlText(),
|
MotaActionBlocks['openDoor_s'].xmlText(),
|
||||||
MotaActionBlocks['closeDoor_s'].xmlText(),
|
MotaActionBlocks['closeDoor_s'].xmlText(),
|
||||||
MotaActionBlocks['show_s'].xmlText(),
|
MotaActionBlocks['show_s'].xmlText(),
|
||||||
|
|||||||
@ -239,70 +239,78 @@ editor_file = function (editor, callback) {
|
|||||||
|
|
||||||
editor.file.changeIdAndIdnum = function (id, idnum, info, callback) {
|
editor.file.changeIdAndIdnum = function (id, idnum, info, callback) {
|
||||||
checkCallback(callback);
|
checkCallback(callback);
|
||||||
//检查maps中是否有重复的idnum或id
|
|
||||||
var change = -1;
|
var changeOrNew=core.isset(editor_mode.info.id)?'change':'new'
|
||||||
for (var ii in editor.core.maps.blocksInfo) {
|
if(changeOrNew=='new'){
|
||||||
if (ii == idnum) {
|
//检查maps中是否有重复的idnum或id
|
||||||
//暂时只允许创建新的不允许修改已有的
|
for (var ii in editor.core.maps.blocksInfo) {
|
||||||
//if (info.idnum==idnum){change=ii;break;}//修改id
|
if (ii == idnum) {
|
||||||
callback('idnum重复了');
|
callback('idnum重复了');
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (editor.core.maps.blocksInfo[ii].id == id) {
|
|
||||||
//if (info.id==id){change=ii;break;}//修改idnum
|
|
||||||
callback('id重复了');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if (change!=-1 && change!=idnum){//修改idnum
|
|
||||||
editor.core.maps.blocksInfo[idnum] = editor.core.maps.blocksInfo[change];
|
|
||||||
delete(editor.core.maps.blocksInfo[change]);
|
|
||||||
} else if (change==idnum) {//修改id
|
|
||||||
var oldid = editor.core.maps.blocksInfo[idnum].id;
|
|
||||||
editor.core.maps.blocksInfo[idnum].id = id;
|
|
||||||
for(var ii in editor.core.icons.icons){
|
|
||||||
if (ii.hasOwnProperty(oldid)){
|
|
||||||
ii[id]=ii[oldid];
|
|
||||||
delete(ii[oldid]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {//创建新的
|
|
||||||
editor.core.maps.blocksInfo[idnum]={'cls': info.images, 'id':id};
|
|
||||||
editor.core.icons.icons[info.images][id]=info.y;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
var templist = [];
|
|
||||||
var tempcallback = function (err) {
|
|
||||||
templist.push(err);
|
|
||||||
if (templist.length == 2) {
|
|
||||||
if (templist[0] != null || templist[1] != null)
|
|
||||||
callback((templist[0] || '') + '\n' + (templist[1] || ''));
|
|
||||||
//这里如果一个成功一个失败会出严重bug
|
|
||||||
else
|
|
||||||
callback(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
saveSetting('maps', [["add", "['" + idnum + "']", {'cls': info.images, 'id': id}]], tempcallback);
|
|
||||||
saveSetting('icons', [["add", "['" + info.images + "']['" + id + "']", info.y]], tempcallback);
|
|
||||||
if (info.images === 'items') {
|
|
||||||
saveSetting('items', [["add", "['items']['" + id + "']", editor.file.comment._data.items_template]], function (err) {
|
|
||||||
if (err) {
|
|
||||||
printe(err);
|
|
||||||
throw(err)
|
|
||||||
}
|
}
|
||||||
});
|
if (editor.core.maps.blocksInfo[ii].id == id) {
|
||||||
}
|
callback('id重复了');
|
||||||
if (info.images === 'enemys' || info.images === 'enemy48') {
|
return;
|
||||||
saveSetting('enemys', [["add", "['" + id + "']", editor.file.comment._data.enemys_template]], function (err) {
|
|
||||||
if (err) {
|
|
||||||
printe(err);
|
|
||||||
throw(err)
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
var templist = [];
|
||||||
|
var tempcallback = function (err) {
|
||||||
|
templist.push(err);
|
||||||
|
if (templist.length == 2) {
|
||||||
|
if (templist[0] != null || templist[1] != null)
|
||||||
|
callback((templist[0] || '') + '\n' + (templist[1] || ''));
|
||||||
|
//这里如果一个成功一个失败会出严重bug
|
||||||
|
else
|
||||||
|
callback(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveSetting('maps', [["add", "['" + idnum + "']", {'cls': info.images, 'id': id}]], tempcallback);
|
||||||
|
saveSetting('icons', [["add", "['" + info.images + "']['" + id + "']", info.y]], tempcallback);
|
||||||
|
if (info.images === 'items') {
|
||||||
|
saveSetting('items', [["add", "['items']['" + id + "']", editor.file.comment._data.items_template]], function (err) {
|
||||||
|
if (err) {
|
||||||
|
printe(err);
|
||||||
|
throw(err)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (info.images === 'enemys' || info.images === 'enemy48') {
|
||||||
|
saveSetting('enemys', [["add", "['" + id + "']", editor.file.comment._data.enemys_template]], function (err) {
|
||||||
|
if (err) {
|
||||||
|
printe(err);
|
||||||
|
throw(err)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
callback(null);
|
callback(null);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//检查maps中是否有重复的idnum或id
|
||||||
|
for (var ii in editor.core.maps.blocksInfo) {
|
||||||
|
if (editor.core.maps.blocksInfo[ii].id == id) {
|
||||||
|
callback('id重复了');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
idnum = info.idnum;
|
||||||
|
|
||||||
|
maps_90f36752_8815_4be8_b32b_d7fad1d0542e[idnum].id = id;
|
||||||
|
|
||||||
|
var arr=[icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1,items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a,{enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80:enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80}]
|
||||||
|
arr.forEach(function (obj) {
|
||||||
|
for(var jj in obj){
|
||||||
|
var ii=obj[jj]
|
||||||
|
if (ii.hasOwnProperty(info.id)){
|
||||||
|
ii[id]=ii[info.id];
|
||||||
|
delete(ii[info.id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
editor.file.save_icons_maps_items_enemys(callback)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//callback(err:String)
|
//callback(err:String)
|
||||||
editor.file.editItem = function (id, actionList, callback) {
|
editor.file.editItem = function (id, actionList, callback) {
|
||||||
@ -667,7 +675,38 @@ editor_file = function (editor, callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var encode = editor.util.encode64
|
var encode = editor.util.encode64;
|
||||||
|
|
||||||
|
var alertWhenCompress = function(){
|
||||||
|
if(editor.useCompress===true){
|
||||||
|
editor.useCompress='alerted';
|
||||||
|
setTimeout("alert('当前游戏使用的是压缩文件,修改完成后请使用启动服务.exe->Js代码压缩工具重新压缩,或者把main.js的useCompress改成false来使用原始文件')",1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.file.save_icons_maps_items_enemys=function(callback){
|
||||||
|
var check=[]
|
||||||
|
saveSetting('icons',[],function(err){
|
||||||
|
if(err){callback(err);return;}
|
||||||
|
check.push('icons')
|
||||||
|
if(check.length==4)callback(null);
|
||||||
|
})
|
||||||
|
saveSetting('maps',[],function(err){
|
||||||
|
if(err){callback(err);return;}
|
||||||
|
check.push('maps')
|
||||||
|
if(check.length==4)callback(null);
|
||||||
|
})
|
||||||
|
saveSetting('items',[],function(err){
|
||||||
|
if(err){callback(err);return;}
|
||||||
|
check.push('items')
|
||||||
|
if(check.length==4)callback(null);
|
||||||
|
})
|
||||||
|
saveSetting('enemys',[],function(err){
|
||||||
|
if(err){callback(err);return;}
|
||||||
|
check.push('enemys')
|
||||||
|
if(check.length==4)callback(null);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var saveSetting = function (file, actionList, callback) {
|
var saveSetting = function (file, actionList, callback) {
|
||||||
//console.log(file);
|
//console.log(file);
|
||||||
|
|||||||
@ -145,13 +145,15 @@ editor_mode = function (editor) {
|
|||||||
|
|
||||||
if (!core.isset(editor_mode.info.id)) {
|
if (!core.isset(editor_mode.info.id)) {
|
||||||
// document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML = '';
|
// document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML = '';
|
||||||
document.getElementById('enemyItemTable').style.display = 'none';
|
|
||||||
document.getElementById('newIdIdnum').style.display = 'block';
|
document.getElementById('newIdIdnum').style.display = 'block';
|
||||||
|
document.getElementById('enemyItemTable').style.display = 'none';
|
||||||
|
document.getElementById('changeId').style.display = 'none';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('newIdIdnum').style.display = 'none';
|
document.getElementById('newIdIdnum').style.display = 'none';
|
||||||
document.getElementById('enemyItemTable').style.display = 'block';
|
document.getElementById('enemyItemTable').style.display = 'block';
|
||||||
|
document.getElementById('changeId').style.display = 'block';
|
||||||
|
|
||||||
var objs = [];
|
var objs = [];
|
||||||
if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') {
|
if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') {
|
||||||
|
|||||||
@ -19,7 +19,7 @@ editor_unsorted_2_wrapper=function(editor_mode){
|
|||||||
printe(err);
|
printe(err);
|
||||||
throw(err)
|
throw(err)
|
||||||
}
|
}
|
||||||
printe('添加id的idnum成功,请F5刷新编辑器');
|
printe('添加id和idnum成功,请F5刷新编辑器');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
printe('请输入id和idnum');
|
printe('请输入id和idnum');
|
||||||
@ -36,6 +36,26 @@ editor_unsorted_2_wrapper=function(editor_mode){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var changeId = document.getElementById('changeId');
|
||||||
|
changeId.children[1].onclick = function () {
|
||||||
|
var id = changeId.children[0].value;
|
||||||
|
if (id) {
|
||||||
|
if (!/^[0-9a-zA-Z_]+$/.test(id)) {
|
||||||
|
printe('不合法的id,请使用字母、数字或下划线')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
editor.file.changeIdAndIdnum(id, null, editor_mode.info, function (err) {
|
||||||
|
if (err) {
|
||||||
|
printe(err);
|
||||||
|
throw(err);
|
||||||
|
}
|
||||||
|
printe('修改id成功,请F5刷新编辑器');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
printe('请输入要修改到的ID');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var selectFloor = document.getElementById('selectFloor');
|
var selectFloor = document.getElementById('selectFloor');
|
||||||
editor.game.getFloorFileList(function (floors) {
|
editor.game.getFloorFileList(function (floors) {
|
||||||
var outstr = [];
|
var outstr = [];
|
||||||
|
|||||||
@ -81,12 +81,12 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"_lint": true,
|
"_lint": true,
|
||||||
"_data": "当前能否使用该道具,仅对cls为tools或constants有效。"
|
"_data": "当前能否使用该道具,仅对cls为tools或constants有效。"
|
||||||
},
|
},
|
||||||
"canEquip": {
|
"equipCondition": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
"_string": true,
|
"_string": true,
|
||||||
"_lint": true,
|
"_lint": true,
|
||||||
"_data": "当前能否装备某个装备,仅对cls为equips有效。\n与canUseItemEffect不同,这里null代表可以装备。"
|
"_data": "能装备某个装备的条件,仅对cls为equips有效。\n与canUseItemEffect不同,这里null代表可以装备。"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -121,13 +121,6 @@
|
|||||||
<h3 class="leftTabHeader">图块属性 <button onclick="editor.mode.onmode('save')">保存</button> <button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button> <button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button> <button onclick="editor_multi.editCommentJs('enemyitem')">配置表格</button>
|
<h3 class="leftTabHeader">图块属性 <button onclick="editor.mode.onmode('save')">保存</button> <button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button> <button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button> <button onclick="editor_multi.editCommentJs('enemyitem')">配置表格</button>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="leftTabContent">
|
<div class="leftTabContent">
|
||||||
<div id='newIdIdnum'><!-- id and idnum -->
|
|
||||||
<input placeholder="新id(唯一标识符)"/>
|
|
||||||
<input placeholder="新idnum(10000以内数字)"/>
|
|
||||||
<button>save</button>
|
|
||||||
<br/>
|
|
||||||
<button style="margin-top: 10px">自动注册</button>
|
|
||||||
</div>
|
|
||||||
<div id="enemyItemTable"><!-- enemy and item -->
|
<div id="enemyItemTable"><!-- enemy and item -->
|
||||||
<div class='etable'>
|
<div class='etable'>
|
||||||
<table>
|
<table>
|
||||||
@ -141,6 +134,17 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id='newIdIdnum'><!-- id and idnum -->
|
||||||
|
<input placeholder="新id(唯一标识符)"/>
|
||||||
|
<input placeholder="新idnum(10000以内数字)"/>
|
||||||
|
<button>save</button>
|
||||||
|
<br/>
|
||||||
|
<button style="margin-top: 10px">自动注册</button>
|
||||||
|
</div>
|
||||||
|
<div id='changeId'><!-- id and idnum -->
|
||||||
|
<input placeholder="修改图块id为"/>
|
||||||
|
<button>save</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor -->
|
<div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor -->
|
||||||
|
|||||||
28
editor.html
28
editor.html
@ -117,6 +117,19 @@
|
|||||||
<h3 class="leftTabHeader">图块属性 <button onclick="editor.mode.onmode('save')">保存</button> <button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button> <button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button> <button onclick="editor_multi.editCommentJs('enemyitem')">配置表格</button>
|
<h3 class="leftTabHeader">图块属性 <button onclick="editor.mode.onmode('save')">保存</button> <button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button> <button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button> <button onclick="editor_multi.editCommentJs('enemyitem')">配置表格</button>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="leftTabContent">
|
<div class="leftTabContent">
|
||||||
|
<div id="enemyItemTable"><!-- enemy and item -->
|
||||||
|
<div class='etable'>
|
||||||
|
<table>
|
||||||
|
<tbody id='table_a3f03d4c_55b8_4ef6_b362_b345783acd72'>
|
||||||
|
<tr>
|
||||||
|
<td>条目</td>
|
||||||
|
<td>注释</td>
|
||||||
|
<td>值</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id='newIdIdnum'><!-- id and idnum -->
|
<div id='newIdIdnum'><!-- id and idnum -->
|
||||||
<input placeholder="新id(唯一标识符)"/>
|
<input placeholder="新id(唯一标识符)"/>
|
||||||
<input placeholder="新idnum(10000以内数字)"/>
|
<input placeholder="新idnum(10000以内数字)"/>
|
||||||
@ -124,18 +137,9 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<button style="margin-top: 10px">自动注册</button>
|
<button style="margin-top: 10px">自动注册</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="enemyItemTable"><!-- enemy and item -->
|
<div id='changeId'><!-- id and idnum -->
|
||||||
<div class='etable'>
|
<input placeholder="修改图块id为"/>
|
||||||
<table>
|
<button>save</button>
|
||||||
<tbody id='table_a3f03d4c_55b8_4ef6_b362_b345783acd72'>
|
|
||||||
<tr>
|
|
||||||
<td>条目</td>
|
|
||||||
<td>注释</td>
|
|
||||||
<td>值</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -162,19 +162,21 @@ actions.prototype._sys_onkeyUp_replay = function (e) {
|
|||||||
core.triggerReplay();
|
core.triggerReplay();
|
||||||
else if (e.keyCode == 65) // A
|
else if (e.keyCode == 65) // A
|
||||||
core.rewindReplay();
|
core.rewindReplay();
|
||||||
else if (e.keyCode == 83)
|
else if (e.keyCode == 83) // S
|
||||||
core.saveReplay();
|
core.saveReplay();
|
||||||
else if (e.keyCode == 67)
|
else if (e.keyCode == 67) // C
|
||||||
core.bookReplay();
|
core.bookReplay();
|
||||||
else if (e.keyCode == 33 || e.keyCode == 34)
|
else if (e.keyCode == 33 || e.keyCode == 34) // PgUp/PgDn
|
||||||
core.viewMapReplay();
|
core.viewMapReplay();
|
||||||
else if (e.keyCode >= 49 && e.keyCode <= 51)
|
else if (e.keyCode == 78) // N
|
||||||
|
core.stepReplay();
|
||||||
|
else if (e.keyCode >= 49 && e.keyCode <= 51) // 1-3
|
||||||
core.setReplaySpeed(e.keyCode - 48);
|
core.setReplaySpeed(e.keyCode - 48);
|
||||||
else if (e.keyCode == 52)
|
else if (e.keyCode == 52) // 4
|
||||||
core.setReplaySpeed(6);
|
core.setReplaySpeed(6);
|
||||||
else if (e.keyCode == 53)
|
else if (e.keyCode == 53) // 5
|
||||||
core.setReplaySpeed(12);
|
core.setReplaySpeed(12);
|
||||||
else if (e.keyCode == 54)
|
else if (e.keyCode == 54) // 6
|
||||||
core.setReplaySpeed(24);
|
core.setReplaySpeed(24);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -249,6 +251,8 @@ actions.prototype._sys_keyDown_lockControl = function (keyCode) {
|
|||||||
this._keyDownSL(keyCode);
|
this._keyDownSL(keyCode);
|
||||||
break;
|
break;
|
||||||
case 'shop':
|
case 'shop':
|
||||||
|
this._keyDownShop(keyCode);
|
||||||
|
break;
|
||||||
case 'selectShop':
|
case 'selectShop':
|
||||||
case 'switchs':
|
case 'switchs':
|
||||||
case 'settings':
|
case 'settings':
|
||||||
@ -758,13 +762,17 @@ actions.prototype._sys_longClick_lockControl = function (x, y) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 长按SL快速翻页
|
// 长按SL上下页快速翻页
|
||||||
if (["save","load","replayLoad","replayRemain"].indexOf(core.status.event.id) >= 0) {
|
if (["save","load","replayLoad","replayRemain"].indexOf(core.status.event.id) >= 0) {
|
||||||
if ([this.HSIZE-2, this.HSIZE-3, this.HSIZE+2, this.HSIZE+3].indexOf(x) >= 0 && y == this.LAST) {
|
if ([this.HSIZE-2, this.HSIZE-3, this.HSIZE+2, this.HSIZE+3].indexOf(x) >= 0 && y == this.LAST) {
|
||||||
this._clickSL(x, y);
|
this._clickSL(x, y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 长按商店连续购买
|
||||||
|
if (core.status.event.id == 'shop' && x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
|
||||||
|
return this._clickShop(x, y);
|
||||||
|
}
|
||||||
// 长按可以跳过等待事件
|
// 长按可以跳过等待事件
|
||||||
if (core.status.event.id == 'action' && core.status.event.data.type == 'sleep'
|
if (core.status.event.id == 'action' && core.status.event.data.type == 'sleep'
|
||||||
&& !core.status.event.data.current.noSkip) {
|
&& !core.status.event.data.current.noSkip) {
|
||||||
@ -916,7 +924,7 @@ actions.prototype._clickAction = function (x, y) {
|
|||||||
core.insertAction(core.status.event.ui.yes);
|
core.insertAction(core.status.event.ui.yes);
|
||||||
core.doAction();
|
core.doAction();
|
||||||
}
|
}
|
||||||
if ((x == this.HSIZE+2 || x == this.HSIZE+1) && y == this.HSIZE+1) {
|
else if ((x == this.HSIZE+2 || x == this.HSIZE+1) && y == this.HSIZE+1) {
|
||||||
core.status.route.push("choices:1");
|
core.status.route.push("choices:1");
|
||||||
core.insertAction(core.status.event.ui.no);
|
core.insertAction(core.status.event.ui.no);
|
||||||
core.doAction();
|
core.doAction();
|
||||||
@ -1243,13 +1251,25 @@ actions.prototype._clickShop = function (x, y) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actions.prototype._keyDownShop = function (keycode) {
|
||||||
|
// 商店界面长按空格连续购买
|
||||||
|
if (keycode == 32) {
|
||||||
|
this._selectChoices(core.status.event.data.shop.choices.length + 1, keycode, this._clickShop);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._keyDownChoices(keycode);
|
||||||
|
}
|
||||||
|
|
||||||
////// 商店界面时,放开某个键的操作 //////
|
////// 商店界面时,放开某个键的操作 //////
|
||||||
actions.prototype._keyUpShop = function (keycode) {
|
actions.prototype._keyUpShop = function (keycode) {
|
||||||
if (keycode == 27 || keycode == 88) {
|
if (keycode == 27 || keycode == 88) {
|
||||||
core.events._exitShop();
|
core.events._exitShop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._selectChoices(core.status.event.data.shop.choices.length + 1, keycode, this._clickShop);
|
if (keycode != 32) {
|
||||||
|
this._selectChoices(core.status.event.data.shop.choices.length + 1, keycode, this._clickShop);
|
||||||
|
return;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -189,7 +189,6 @@ control.prototype._animationFrame_animate = function (timestamp) {
|
|||||||
|
|
||||||
control.prototype._animationFrame_heroMoving = function (timestamp) {
|
control.prototype._animationFrame_heroMoving = function (timestamp) {
|
||||||
if (core.status.heroMoving <= 0) return;
|
if (core.status.heroMoving <= 0) return;
|
||||||
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y'), direction = core.getHeroLoc('direction');
|
|
||||||
// 换腿
|
// 换腿
|
||||||
if (timestamp - core.animateFrame.moveTime > (core.values.moveSpeed||100)) {
|
if (timestamp - core.animateFrame.moveTime > (core.values.moveSpeed||100)) {
|
||||||
core.animateFrame.leftLeg = !core.animateFrame.leftLeg;
|
core.animateFrame.leftLeg = !core.animateFrame.leftLeg;
|
||||||
@ -777,9 +776,9 @@ control.prototype.drawHero = function (status, offset) {
|
|||||||
core.clearMap('hero');
|
core.clearMap('hero');
|
||||||
|
|
||||||
this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
|
this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
|
||||||
core.drawImage('hero', block.img, block.heroIcon[block.status]*32,
|
core.drawImage('hero', block.img, block.heroIcon[block.status]*block.width,
|
||||||
block.heroIcon.loc * block.height, 32, block.height,
|
block.heroIcon.loc * block.height, block.width, block.height,
|
||||||
block.posx, block.posy+32-block.height, 32, block.height);
|
block.posx+(32-block.width)/2, block.posy+32-block.height, block.width, block.height);
|
||||||
});
|
});
|
||||||
|
|
||||||
core.control.updateViewport();
|
core.control.updateViewport();
|
||||||
@ -789,6 +788,7 @@ control.prototype._drawHero_getDrawObjs = function (direction, x, y, status, off
|
|||||||
var heroIconArr = core.material.icons.hero, drawObjs = [], index = 0;
|
var heroIconArr = core.material.icons.hero, drawObjs = [], index = 0;
|
||||||
drawObjs.push({
|
drawObjs.push({
|
||||||
"img": core.material.images.hero,
|
"img": core.material.images.hero,
|
||||||
|
"width": core.material.icons.hero.width || 32,
|
||||||
"height": core.material.icons.hero.height,
|
"height": core.material.icons.hero.height,
|
||||||
"heroIcon": heroIconArr[direction],
|
"heroIcon": heroIconArr[direction],
|
||||||
"posx": x * 32 - core.bigmap.offsetX + core.utils.scan[direction].x * offset,
|
"posx": x * 32 - core.bigmap.offsetX + core.utils.scan[direction].x * offset,
|
||||||
@ -799,6 +799,7 @@ control.prototype._drawHero_getDrawObjs = function (direction, x, y, status, off
|
|||||||
(core.status.hero.followers||[]).forEach(function (t) {
|
(core.status.hero.followers||[]).forEach(function (t) {
|
||||||
drawObjs.push({
|
drawObjs.push({
|
||||||
"img": core.material.images.images[t.name],
|
"img": core.material.images.images[t.name],
|
||||||
|
"width": core.material.images.images[t.name].width/4,
|
||||||
"height": core.material.images.images[t.name].height/4,
|
"height": core.material.images.images[t.name].height/4,
|
||||||
"heroIcon": heroIconArr[t.direction],
|
"heroIcon": heroIconArr[t.direction],
|
||||||
"posx": 32*t.x - core.bigmap.offsetX + (t.stop?0:core.utils.scan[t.direction].x*offset),
|
"posx": 32*t.x - core.bigmap.offsetX + (t.stop?0:core.utils.scan[t.direction].x*offset),
|
||||||
@ -1056,7 +1057,7 @@ control.prototype.chooseReplayFile = function () {
|
|||||||
control.prototype.startReplay = function (list) {
|
control.prototype.startReplay = function (list) {
|
||||||
if (!core.isPlaying()) return;
|
if (!core.isPlaying()) return;
|
||||||
core.status.replay.replaying=true;
|
core.status.replay.replaying=true;
|
||||||
core.status.replay.pausing=false;
|
core.status.replay.pausing=true;
|
||||||
core.status.replay.speed=1.0;
|
core.status.replay.speed=1.0;
|
||||||
core.status.replay.toReplay = core.clone(list);
|
core.status.replay.toReplay = core.clone(list);
|
||||||
core.status.replay.totalList = core.status.route.concat(list);
|
core.status.replay.totalList = core.status.route.concat(list);
|
||||||
@ -1092,16 +1093,24 @@ control.prototype.resumeReplay = function () {
|
|||||||
core.replay();
|
core.replay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 单步播放 //////
|
||||||
|
control.prototype.stepReplay = function () {
|
||||||
|
if (!core.isPlaying() || !core.isReplaying()) return;
|
||||||
|
if (!core.status.replay.pausing) return core.drawTip("请先暂停录像");
|
||||||
|
if (core.isMoving() || core.status.replay.animate || core.status.event.id)
|
||||||
|
return core.drawTip("请等待当前事件的处理结束");
|
||||||
|
core.replay(true);
|
||||||
|
}
|
||||||
|
|
||||||
////// 加速播放 //////
|
////// 加速播放 //////
|
||||||
control.prototype.speedUpReplay = function () {
|
control.prototype.speedUpReplay = function () {
|
||||||
if (!core.isPlaying() || !core.isReplaying()) return;
|
if (!core.isPlaying() || !core.isReplaying()) return;
|
||||||
if (core.status.replay.speed==12) core.status.replay.speed=24;
|
var speeds = [0.2, 0.5, 1, 2, 3, 6, 12, 24];
|
||||||
else if (core.status.replay.speed==6) core.status.replay.speed=12;
|
for (var i = speeds.length - 2; i >= 0; i--) {
|
||||||
else if (core.status.replay.speed==3) core.status.replay.speed=6;
|
if (speeds[i] <= core.status.replay.speed) {
|
||||||
else if (core.status.replay.speed==2.5) core.status.replay.speed=3;
|
core.status.replay.speed = speeds[i+1];
|
||||||
else if (core.status.replay.speed==2) core.status.replay.speed=2.5;
|
break;
|
||||||
else if (core.status.replay.speed<2) {
|
}
|
||||||
core.status.replay.speed = parseInt(10*core.status.replay.speed + 2)/10;
|
|
||||||
}
|
}
|
||||||
core.drawTip("x"+core.status.replay.speed+"倍");
|
core.drawTip("x"+core.status.replay.speed+"倍");
|
||||||
}
|
}
|
||||||
@ -1109,15 +1118,13 @@ control.prototype.speedUpReplay = function () {
|
|||||||
////// 减速播放 //////
|
////// 减速播放 //////
|
||||||
control.prototype.speedDownReplay = function () {
|
control.prototype.speedDownReplay = function () {
|
||||||
if (!core.isPlaying() || !core.isReplaying()) return;
|
if (!core.isPlaying() || !core.isReplaying()) return;
|
||||||
if (core.status.replay.speed==24) core.status.replay.speed=12;
|
var speeds = [0.2, 0.5, 1, 2, 3, 6, 12, 24];
|
||||||
else if (core.status.replay.speed==12) core.status.replay.speed=6;
|
for (var i = 1; i <= speeds.length; i++) {
|
||||||
else if (core.status.replay.speed==6) core.status.replay.speed=3;
|
if (speeds[i] >= core.status.replay.speed) {
|
||||||
else if (core.status.replay.speed==3) core.status.replay.speed=2.5;
|
core.status.replay.speed = speeds[i-1];
|
||||||
else if (core.status.replay.speed==2.5) core.status.replay.speed=2;
|
break;
|
||||||
else {
|
}
|
||||||
core.status.replay.speed = parseInt(10*core.status.replay.speed - 2)/10;
|
|
||||||
}
|
}
|
||||||
if (core.status.replay.speed<0.2) core.status.replay.speed=0.2;
|
|
||||||
core.drawTip("x"+core.status.replay.speed+"倍");
|
core.drawTip("x"+core.status.replay.speed+"倍");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1218,9 +1225,10 @@ control.prototype.isReplaying = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 回放 //////
|
////// 回放 //////
|
||||||
control.prototype.replay = function () {
|
control.prototype.replay = function (force) {
|
||||||
if (!core.isPlaying() || !core.isReplaying()
|
if (!core.isPlaying() || !core.isReplaying()
|
||||||
|| core.status.replay.pausing || core.status.replay.animate || core.status.event.id) return;
|
|| core.status.replay.animate || core.status.event.id) return;
|
||||||
|
if (core.status.replay.pausing && !force) return;
|
||||||
if (core.status.replay.toReplay.length==0)
|
if (core.status.replay.toReplay.length==0)
|
||||||
return this._replay_finished();
|
return this._replay_finished();
|
||||||
this._replay_save();
|
this._replay_save();
|
||||||
@ -1291,6 +1299,7 @@ control.prototype._replay_save = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
control.prototype._replay_error = function (action) {
|
control.prototype._replay_error = function (action) {
|
||||||
|
core.ui.closePanel();
|
||||||
core.status.replay.replaying = false;
|
core.status.replay.replaying = false;
|
||||||
var len = core.status.replay.toReplay.length;
|
var len = core.status.replay.toReplay.length;
|
||||||
var prevList = core.status.replay.totalList.slice(-len - 11, -len - 1);
|
var prevList = core.status.replay.totalList.slice(-len - 11, -len - 1);
|
||||||
@ -1412,14 +1421,13 @@ control.prototype._replayAction_shop = function (action) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var choices = shop.choices;
|
var choices = shop.choices;
|
||||||
var topIndex = core.__HALF_SIZE__ - parseInt(choices.length / 2);
|
|
||||||
core.status.event.selection = parseInt(selections.shift());
|
core.status.event.selection = parseInt(selections.shift());
|
||||||
core.events.openShop(shopId, false);
|
core.events.openShop(shopId, false);
|
||||||
|
var topIndex = core.__HALF_SIZE__ - parseInt(choices.length / 2) + (core.status.event.ui.offset || 0);
|
||||||
var shopInterval = setInterval(function () {
|
var shopInterval = setInterval(function () {
|
||||||
if (!core.actions._clickShop(core.__HALF_SIZE__, topIndex+core.status.event.selection)) {
|
if (!core.actions._clickShop(core.__HALF_SIZE__, topIndex+core.status.event.selection)) {
|
||||||
clearInterval(shopInterval);
|
clearInterval(shopInterval);
|
||||||
core.stopReplay();
|
core.control._replay_error(action);
|
||||||
core.drawTip("录像文件出错");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selections.length==0) {
|
if (selections.length==0) {
|
||||||
@ -2065,6 +2073,7 @@ control.prototype.setCurtain = function(color, time, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
control.prototype._setCurtain_animate = function (nowColor, color, time, callback) {
|
control.prototype._setCurtain_animate = function (nowColor, color, time, callback) {
|
||||||
|
time /= Math.max(core.status.replay.speed, 1)
|
||||||
var per_time = 10, step = parseInt(time / per_time);
|
var per_time = 10, step = parseInt(time / per_time);
|
||||||
var animate = setInterval(function() {
|
var animate = setInterval(function() {
|
||||||
nowColor = [
|
nowColor = [
|
||||||
@ -2337,14 +2346,15 @@ control.prototype.updateHeroIcon = function (name) {
|
|||||||
|
|
||||||
var image = core.material.images.hero;
|
var image = core.material.images.hero;
|
||||||
// 全身图
|
// 全身图
|
||||||
var height = core.material.icons.hero.height;
|
var w = core.material.icons.hero.width || 32;
|
||||||
var ratio = 32 / height, width = 32 * ratio, left = 16-width/2;
|
var h = core.material.icons.hero.height || 48;
|
||||||
|
var ratio = Math.max(w / h, 1), width = 32 * ratio, left = 16 - width/2;
|
||||||
|
|
||||||
var canvas = document.createElement("canvas");
|
var canvas = document.createElement("canvas");
|
||||||
var context = canvas.getContext("2d");
|
var context = canvas.getContext("2d");
|
||||||
canvas.width = 32;
|
canvas.width = 32;
|
||||||
canvas.height = 32;
|
canvas.height = 32;
|
||||||
context.drawImage(image, 0, 0, 32, height, left, 0, width, 32);
|
context.drawImage(image, 0, 0, w, h, left, 0, width, 32);
|
||||||
|
|
||||||
core.statusBar.image.name.src = canvas.toDataURL("image/png");
|
core.statusBar.image.name.src = canvas.toDataURL("image/png");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -241,6 +241,11 @@ enemys.prototype._nextCriticals_useBinarySearch = function (enemy, info, number,
|
|||||||
|
|
||||||
enemys.prototype._nextCriticals_useTurn = function (enemy, info, number, x, y, floorId) {
|
enemys.prototype._nextCriticals_useTurn = function (enemy, info, number, x, y, floorId) {
|
||||||
var mon_hp = info.mon_hp, hero_atk = core.status.hero.atk, mon_def = info.mon_def, turn = info.turn;
|
var mon_hp = info.mon_hp, hero_atk = core.status.hero.atk, mon_def = info.mon_def, turn = info.turn;
|
||||||
|
// ------ 超大回合数强制使用二分算临界
|
||||||
|
// 以避免1攻10e回合,2攻5e回合导致下述循环卡死问题
|
||||||
|
if (turn >= 1e6) { // 100w回合以上强制二分计算临界
|
||||||
|
return this._nextCriticals_useBinarySearch(enemy, info, number, x, y, floorId);
|
||||||
|
}
|
||||||
var list = [], pre = null;
|
var list = [], pre = null;
|
||||||
for (var t = turn - 1; t >= 1; t--) {
|
for (var t = turn - 1; t >= 1; t--) {
|
||||||
var nextAtk = Math.ceil(mon_hp / t) + mon_def;
|
var nextAtk = Math.ceil(mon_hp / t) + mon_def;
|
||||||
|
|||||||
@ -419,20 +419,23 @@ events.prototype._openDoor_animate = function (id, x, y, callback) {
|
|||||||
var locked = core.status.lockControl;
|
var locked = core.status.lockControl;
|
||||||
core.lockControl();
|
core.lockControl();
|
||||||
core.status.replay.animate = true;
|
core.status.replay.animate = true;
|
||||||
|
core.removeBlock(x, y);
|
||||||
|
core.drawImage('event', core.material.images.animates, 0, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||||
var state = 0;
|
var state = 0;
|
||||||
var animate = window.setInterval(function () {
|
var animate = window.setInterval(function () {
|
||||||
|
core.clearMap('event', 32 * x, 32 * y, 32, 32);
|
||||||
state++;
|
state++;
|
||||||
if (state == 4) {
|
if (state == 4) {
|
||||||
clearInterval(animate);
|
clearInterval(animate);
|
||||||
core.removeBlock(x, y);
|
delete core.animateFrame.asyncId[animate];
|
||||||
if (!locked) core.unLockControl();
|
if (!locked) core.unLockControl();
|
||||||
core.status.replay.animate = false;
|
core.status.replay.animate = false;
|
||||||
core.events.afterOpenDoor(id, x, y, callback);
|
core.events.afterOpenDoor(id, x, y, callback);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.clearMap('event', 32 * x, 32 * y, 32, 32);
|
|
||||||
core.drawImage('event', core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
core.drawImage('event', core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||||
}, speed / core.status.replay.speed);
|
}, speed / Math.max(core.status.replay.speed, 1));
|
||||||
|
core.animateFrame.asyncId[animate] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 开一个门后触发的事件 //////
|
////// 开一个门后触发的事件 //////
|
||||||
@ -840,7 +843,10 @@ events.prototype.insertAction = function (action, x, y, callback, addToLast) {
|
|||||||
|
|
||||||
// ------ 判定commonEvent
|
// ------ 判定commonEvent
|
||||||
var commonEvent = this.getCommonEvent(action);
|
var commonEvent = this.getCommonEvent(action);
|
||||||
if (commonEvent instanceof Array) action = commonEvent;
|
if (commonEvent instanceof Array) {
|
||||||
|
// 将公共事件视为一个do-while事件插入执行,可被break跳出
|
||||||
|
action = [{"type": "dowhile", "condition": "false", "data": commonEvent}];
|
||||||
|
}
|
||||||
if (!action) return;
|
if (!action) return;
|
||||||
|
|
||||||
if (core.status.event.id != 'action') {
|
if (core.status.event.id != 'action') {
|
||||||
@ -1133,7 +1139,7 @@ events.prototype._action_openDoor = function (data, x, y, prefix) {
|
|||||||
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
||||||
var floorId = data.floorId || core.status.floorId;
|
var floorId = data.floorId || core.status.floorId;
|
||||||
if (floorId == core.status.floorId) {
|
if (floorId == core.status.floorId) {
|
||||||
core.openDoor(loc[0], loc[1], data.needKey, core.doAction);
|
this.__action_doAsyncFunc(data.async, core.openDoor, loc[0], loc[1], data.needKey);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.removeBlock(loc[0], loc[1], floorId);
|
core.removeBlock(loc[0], loc[1], floorId);
|
||||||
@ -1143,7 +1149,7 @@ events.prototype._action_openDoor = function (data, x, y, prefix) {
|
|||||||
|
|
||||||
events.prototype._action_closeDoor = function (data, x, y, prefix) {
|
events.prototype._action_closeDoor = function (data, x, y, prefix) {
|
||||||
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
||||||
core.closeDoor(loc[0], loc[1], data.id, core.doAction);
|
this.__action_doAsyncFunc(data.async, core.closeDoor, loc[0], loc[1], data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._action_useItem = function (data, x, y, prefix) {
|
events.prototype._action_useItem = function (data, x, y, prefix) {
|
||||||
@ -1172,7 +1178,13 @@ events.prototype._action_disableShop = function (data, x, y, prefix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._action_battle = function (data, x, y, prefix) {
|
events.prototype._action_battle = function (data, x, y, prefix) {
|
||||||
this.battle(data.id, null, null, true, core.doAction);
|
if (data.id) {
|
||||||
|
this.battle(data.id, null, null, true, core.doAction);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
||||||
|
this.battle(null, loc[0], loc[1], true, core.doAction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._action_trigger = function (data, x, y, prefix) {
|
events.prototype._action_trigger = function (data, x, y, prefix) {
|
||||||
@ -1180,9 +1192,9 @@ events.prototype._action_trigger = function (data, x, y, prefix) {
|
|||||||
var block = core.getBlock(loc[0], loc[1]);
|
var block = core.getBlock(loc[0], loc[1]);
|
||||||
if (block != null && block.block.event.trigger) {
|
if (block != null && block.block.event.trigger) {
|
||||||
block = block.block;
|
block = block.block;
|
||||||
this.setEvents([], block.x, block.y);
|
this.setEvents(data.keep ? null : [], block.x, block.y);
|
||||||
if (block.event.trigger == 'action')
|
if (block.event.trigger == 'action')
|
||||||
this.setEvents(block.event.data);
|
this.insertAction(block.event.data);
|
||||||
else {
|
else {
|
||||||
core.doSystemEvent(block.event.trigger, block, core.doAction);
|
core.doSystemEvent(block.event.trigger, block, core.doAction);
|
||||||
return;
|
return;
|
||||||
@ -1327,10 +1339,8 @@ events.prototype.__action_getInput = function (hint, isText, callback) {
|
|||||||
callback(value);
|
callback(value);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
main.log(e);
|
core.control._replay_error(action);
|
||||||
core.stopReplay();
|
return;
|
||||||
core.insertAction(["录像文件出错,请在控制台查看报错信息。", {"type": "exit"}]);
|
|
||||||
core.doAction();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1375,10 +1385,7 @@ events.prototype._action_choices = function (data, x, y, prefix) {
|
|||||||
}, 750 / Math.max(1, core.status.replay.speed))
|
}, 750 / Math.max(1, core.status.replay.speed))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
main.log("录像文件出错!当前需要一个 choices: 项,实际为 " + action);
|
core.control._replay_error(action);
|
||||||
core.stopReplay();
|
|
||||||
core.insertAction(["录像文件出错,请在控制台查看报错信息。", {"type": "exit"}]);
|
|
||||||
core.doAction();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1401,10 +1408,7 @@ events.prototype._action_confirm = function (data, x, y, prefix) {
|
|||||||
}, 750 / Math.max(1, core.status.replay.speed))
|
}, 750 / Math.max(1, core.status.replay.speed))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
main.log("录像文件出错!当前需要一个 choices: 项,实际为 " + action);
|
core.control._replay_error(action);
|
||||||
core.stopReplay();
|
|
||||||
core.insertAction(["录像文件出错,请在控制台查看报错信息。", {"type": "exit"}]);
|
|
||||||
core.doAction();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1749,8 +1753,7 @@ events.prototype.hasAsync = function () {
|
|||||||
events.prototype.follow = function (name) {
|
events.prototype.follow = function (name) {
|
||||||
core.status.hero.followers = core.status.hero.followers || [];
|
core.status.hero.followers = core.status.hero.followers || [];
|
||||||
name = core.getMappedName(name);
|
name = core.getMappedName(name);
|
||||||
if (core.material.images.images[name]
|
if (core.material.images.images[name]) {
|
||||||
&& core.material.images.images[name].width == 128) {
|
|
||||||
core.status.hero.followers.push({"name": name});
|
core.status.hero.followers.push({"name": name});
|
||||||
core.gatherFollowers();
|
core.gatherFollowers();
|
||||||
core.clearMap('hero');
|
core.clearMap('hero');
|
||||||
@ -1786,6 +1789,7 @@ events.prototype.setValue = function (name, value, prefix, add) {
|
|||||||
this._setValue_setItem(name, value);
|
this._setValue_setItem(name, value);
|
||||||
this._setValue_setFlag(name, value);
|
this._setValue_setFlag(name, value);
|
||||||
this._setValue_setSwitch(name, value, prefix);
|
this._setValue_setSwitch(name, value, prefix);
|
||||||
|
this._setValue_setGlobal(name, value);
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1816,6 +1820,11 @@ events.prototype._setValue_setSwitch = function (name, value, prefix) {
|
|||||||
core.setFlag((prefix || ":f@x@y") + "@" + name.substring(7), value);
|
core.setFlag((prefix || ":f@x@y") + "@" + name.substring(7), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype._setValue_setGlobal = function (name, value) {
|
||||||
|
if (name.indexOf("global:") !== 0) return;
|
||||||
|
core.setGlobal(name.substring(7), value);
|
||||||
|
}
|
||||||
|
|
||||||
////// 数值增减 //////
|
////// 数值增减 //////
|
||||||
events.prototype.addValue = function (name, value, prefix) {
|
events.prototype.addValue = function (name, value, prefix) {
|
||||||
this.setValue(name, value, prefix, true);
|
this.setValue(name, value, prefix, true);
|
||||||
@ -1884,7 +1893,7 @@ events.prototype.closeDoor = function (x, y, id, callback) {
|
|||||||
}
|
}
|
||||||
core.clearMap('event', 32 * x, 32 * y, 32, 32);
|
core.clearMap('event', 32 * x, 32 * y, 32, 32);
|
||||||
core.drawImage('event', core.material.images.animates, 32 * (4-state), 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
core.drawImage('event', core.material.images.animates, 32 * (4-state), 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||||
}, speed / core.status.replay.speed);
|
}, speed / Math.max(core.status.replay.speed, 1));
|
||||||
core.animateFrame.asyncId[animate] = true;
|
core.animateFrame.asyncId[animate] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1958,7 +1967,8 @@ events.prototype.moveImage = function (code, to, opacityVal, time, callback) {
|
|||||||
var opacity = parseFloat(canvas.style.opacity), toOpacity = getOrDefault(opacityVal, opacity);
|
var opacity = parseFloat(canvas.style.opacity), toOpacity = getOrDefault(opacityVal, opacity);
|
||||||
|
|
||||||
this._moveImage_moving(name, {
|
this._moveImage_moving(name, {
|
||||||
fromX: fromX, fromY: fromY, toX: toX, toY: toY, opacity: opacity, toOpacity: toOpacity, time: time
|
fromX: fromX, fromY: fromY, toX: toX, toY: toY, opacity: opacity, toOpacity: toOpacity,
|
||||||
|
time: time / Math.max(core.status.replay.speed, 1)
|
||||||
}, callback)
|
}, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2016,6 +2026,7 @@ events.prototype.setVolume = function (value, time, callback) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var currVolume = core.musicStatus.volume;
|
var currVolume = core.musicStatus.volume;
|
||||||
|
time /= Math.max(core.status.replay.speed, 1);
|
||||||
var per_time = 10, step = 0, steps = parseInt(time / per_time);
|
var per_time = 10, step = 0, steps = parseInt(time / per_time);
|
||||||
var fade = setInterval(function () {
|
var fade = setInterval(function () {
|
||||||
step++;
|
step++;
|
||||||
@ -2037,6 +2048,7 @@ events.prototype.vibrate = function (time, callback) {
|
|||||||
}
|
}
|
||||||
if (!time || time < 1000) time = 1000;
|
if (!time || time < 1000) time = 1000;
|
||||||
// --- 将time调整为500的倍数(上整),不然会出错
|
// --- 将time调整为500的倍数(上整),不然会出错
|
||||||
|
time /= Math.max(core.status.replay.speed, 1)
|
||||||
time = Math.ceil(time / 500) * 500;
|
time = Math.ceil(time / 500) * 500;
|
||||||
var shakeInfo = {duration: time * 3 / 50, speed: 5, power: 5, direction: 1, shake: 0};
|
var shakeInfo = {duration: time * 3 / 50, speed: 5, power: 5, direction: 1, shake: 0};
|
||||||
var animate = setInterval(function () {
|
var animate = setInterval(function () {
|
||||||
@ -2127,6 +2139,7 @@ events.prototype.jumpHero = function (ex, ey, time, callback) {
|
|||||||
core.playSound('jump.mp3');
|
core.playSound('jump.mp3');
|
||||||
var jumpInfo = core.maps.__generateJumpInfo(sx, sy, ex, ey, time || 500);
|
var jumpInfo = core.maps.__generateJumpInfo(sx, sy, ex, ey, time || 500);
|
||||||
jumpInfo.icon = core.material.icons.hero[core.getHeroLoc('direction')];
|
jumpInfo.icon = core.material.icons.hero[core.getHeroLoc('direction')];
|
||||||
|
jumpInfo.width = core.material.icons.hero.width || 32;
|
||||||
jumpInfo.height = core.material.icons.hero.height;
|
jumpInfo.height = core.material.icons.hero.height;
|
||||||
|
|
||||||
this._jumpHero_doJump(jumpInfo, callback);
|
this._jumpHero_doJump(jumpInfo, callback);
|
||||||
@ -2146,12 +2159,12 @@ events.prototype._jumpHero_doJump = function (jumpInfo, callback) {
|
|||||||
events.prototype._jumpHero_jumping = function (jumpInfo) {
|
events.prototype._jumpHero_jumping = function (jumpInfo) {
|
||||||
core.clearMap('hero');
|
core.clearMap('hero');
|
||||||
core.maps.__updateJumpInfo(jumpInfo);
|
core.maps.__updateJumpInfo(jumpInfo);
|
||||||
var nowx = jumpInfo.px, nowy = jumpInfo.py, height = jumpInfo.height;
|
var nowx = jumpInfo.px, nowy = jumpInfo.py, width = jumpInfo.width || 32, height = jumpInfo.height;
|
||||||
core.bigmap.offsetX = core.clamp(nowx - 32*core.__HALF_SIZE__, 0, 32*core.bigmap.width-core.__PIXELS__);
|
core.bigmap.offsetX = core.clamp(nowx - 32*core.__HALF_SIZE__, 0, 32*core.bigmap.width-core.__PIXELS__);
|
||||||
core.bigmap.offsetY = core.clamp(nowy - 32*core.__HALF_SIZE__, 0, 32*core.bigmap.height-core.__PIXELS__);
|
core.bigmap.offsetY = core.clamp(nowy - 32*core.__HALF_SIZE__, 0, 32*core.bigmap.height-core.__PIXELS__);
|
||||||
core.control.updateViewport();
|
core.control.updateViewport();
|
||||||
core.drawImage('hero', core.material.images.hero, jumpInfo.icon.stop, jumpInfo.icon.loc * height, 32, height,
|
core.drawImage('hero', core.material.images.hero, jumpInfo.icon.stop, jumpInfo.icon.loc * height, width, height,
|
||||||
nowx - core.bigmap.offsetX, nowy + 32-height - core.bigmap.offsetY, 32, height);
|
nowx + (32 - width) / 2 - core.bigmap.offsetX, nowy + 32-height - core.bigmap.offsetY, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._jumpHero_finished = function (animate, ex, ey, callback) {
|
events.prototype._jumpHero_finished = function (animate, ex, ey, callback) {
|
||||||
@ -2239,9 +2252,10 @@ events.prototype.canUseQuickShop = function (shopId) {
|
|||||||
events.prototype.setHeroIcon = function (name, noDraw) {
|
events.prototype.setHeroIcon = function (name, noDraw) {
|
||||||
name = core.getMappedName(name);
|
name = core.getMappedName(name);
|
||||||
var img = core.material.images.images[name];
|
var img = core.material.images.images[name];
|
||||||
if (!img || img.width != 128) return;
|
if (!img) return;
|
||||||
core.setFlag("heroIcon", name);
|
core.setFlag("heroIcon", name);
|
||||||
core.material.images.hero.onload = function () {
|
core.material.images.hero.onload = function () {
|
||||||
|
core.material.icons.hero.width = img.width / 4;
|
||||||
core.material.icons.hero.height = img.height / 4;
|
core.material.icons.hero.height = img.height / 4;
|
||||||
core.control.updateHeroIcon(name);
|
core.control.updateHeroIcon(name);
|
||||||
if (!noDraw) core.drawHero();
|
if (!noDraw) core.drawHero();
|
||||||
|
|||||||
@ -11,9 +11,9 @@ items.prototype._init = function () {
|
|||||||
this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;
|
this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;
|
||||||
this.useItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEffect;
|
this.useItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEffect;
|
||||||
this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect;
|
this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect;
|
||||||
if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canEquip)
|
if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition)
|
||||||
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canEquip = {};
|
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition = {};
|
||||||
this.equipCondition = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canEquip;
|
this.equipCondition = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 获得所有道具 //////
|
////// 获得所有道具 //////
|
||||||
@ -35,7 +35,7 @@ items.prototype._resetItems = function () {
|
|||||||
if (core.flags.bombFourDirections)
|
if (core.flags.bombFourDirections)
|
||||||
core.material.items.bomb.text = "可以炸掉勇士四周的怪物";
|
core.material.items.bomb.text = "可以炸掉勇士四周的怪物";
|
||||||
if (core.flags.snowFourDirections)
|
if (core.flags.snowFourDirections)
|
||||||
core.material.items.bomb.text = "可以将四周的熔岩变成平地";
|
core.material.items.snow.text = "可以将四周的熔岩变成平地";
|
||||||
if (core.flags.equipment) {
|
if (core.flags.equipment) {
|
||||||
core.material.items.sword1.cls = 'equips';
|
core.material.items.sword1.cls = 'equips';
|
||||||
core.material.items.sword2.cls = 'equips';
|
core.material.items.sword2.cls = 'equips';
|
||||||
|
|||||||
66
libs/maps.js
66
libs/maps.js
@ -91,6 +91,9 @@ maps.prototype.initBlock = function (x, y, id, addInfo, eventFloor) {
|
|||||||
else if (core.icons.getTilesetOffset(id)) block.event = {"cls": "tileset", "id": "X" + id, "noPass": true};
|
else if (core.icons.getTilesetOffset(id)) block.event = {"cls": "tileset", "id": "X" + id, "noPass": true};
|
||||||
else block.event = {'cls': 'terrains', 'id': 'none', 'noPass': false};
|
else block.event = {'cls': 'terrains', 'id': 'none', 'noPass': false};
|
||||||
|
|
||||||
|
if (typeof block.event.noPass === 'string')
|
||||||
|
block.event.noPass = JSON.parse(block.event.noPass);
|
||||||
|
|
||||||
if (addInfo) this._addInfo(block);
|
if (addInfo) this._addInfo(block);
|
||||||
if (eventFloor) {
|
if (eventFloor) {
|
||||||
this._addEvent(block, x, y, (eventFloor.events || {})[x + "," + y]);
|
this._addEvent(block, x, y, (eventFloor.events || {})[x + "," + y]);
|
||||||
@ -238,7 +241,8 @@ maps.prototype.saveMap = function (floorId) {
|
|||||||
if (!floorId) {
|
if (!floorId) {
|
||||||
var map = {};
|
var map = {};
|
||||||
for (var id in maps) {
|
for (var id in maps) {
|
||||||
map[id] = this.saveMap(id);
|
var obj = this.saveMap(id);
|
||||||
|
if (Object.keys(obj).length > 0) map[id] = obj;
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@ -1446,8 +1450,13 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
|
|||||||
else number = core.getNumberById(number);
|
else number = core.getNumberById(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
var originBlock = core.getBlock(x, y, floorId, true);
|
|
||||||
var block = this.initBlock(x, y, number, true, core.floors[floorId]);
|
var block = this.initBlock(x, y, number, true, core.floors[floorId]);
|
||||||
|
if (block.id == 0 && !block.event.trigger) {
|
||||||
|
// 转变图块为0且该点无事件,视为隐藏
|
||||||
|
core.removeBlock(x, y, floorId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var originBlock = core.getBlock(x, y, floorId, true);
|
||||||
if (floorId == core.status.floorId) {
|
if (floorId == core.status.floorId) {
|
||||||
core.removeGlobalAnimate(x, y);
|
core.removeGlobalAnimate(x, y);
|
||||||
core.clearMap('event', x * 32, y * 32, 32, 32);
|
core.clearMap('event', x * 32, y * 32, 32, 32);
|
||||||
@ -1614,13 +1623,13 @@ maps.prototype.moveBlock = function (x, y, steps, time, keep, callback) {
|
|||||||
}
|
}
|
||||||
var block = blockArr[0], blockInfo = blockArr[1];
|
var block = blockArr[0], blockInfo = blockArr[1];
|
||||||
var moveSteps = (steps||[]).filter(function (t) {
|
var moveSteps = (steps||[]).filter(function (t) {
|
||||||
return ['up','down','left','right'].indexOf(t)>=0;
|
return ['up','down','left','right','forward','backward'].indexOf(t)>=0;
|
||||||
});
|
});
|
||||||
var canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false);
|
var canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false);
|
||||||
this._moveDetachedBlock(blockInfo, 32 * x, 32 * y, 1, canvases);
|
this._moveDetachedBlock(blockInfo, 32 * x, 32 * y, 1, canvases);
|
||||||
|
|
||||||
var moveInfo = {
|
var moveInfo = {
|
||||||
x: x, y: y, px: 32 * x, py: 32 * y, opacity: 1, keep: keep,
|
x: x, y: y, px: 32 * x, py: 32 * y, opacity: 1, keep: keep, lastDirection: null, offset: 1,
|
||||||
moveSteps: moveSteps, step: 0, per_time: time / 16 / core.status.replay.speed
|
moveSteps: moveSteps, step: 0, per_time: time / 16 / core.status.replay.speed
|
||||||
}
|
}
|
||||||
this._moveBlock_doMove(blockInfo, canvases, moveInfo, callback);
|
this._moveBlock_doMove(blockInfo, canvases, moveInfo, callback);
|
||||||
@ -1645,21 +1654,46 @@ maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, call
|
|||||||
core.animateFrame.asyncId[animate] = true;
|
core.animateFrame.asyncId[animate] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
maps.prototype._moveBlock_moving = function (blockInfo, canvases, moveInfo) {
|
maps.prototype._moveBlock_updateDirection = function (blockInfo, moveInfo) {
|
||||||
|
moveInfo.offset = 1;
|
||||||
var direction = moveInfo.moveSteps[0];
|
var direction = moveInfo.moveSteps[0];
|
||||||
if (moveInfo.step == 0) {
|
if (moveInfo.lastDirection == null) {
|
||||||
moveInfo.x += core.utils.scan[direction].x;
|
for (var d in blockInfo.faceIds) {
|
||||||
moveInfo.y += core.utils.scan[direction].y;
|
if (blockInfo.faceIds[d] == blockInfo.id) {
|
||||||
// 根据faceIds修改朝向
|
moveInfo.lastDirection = d;
|
||||||
var currid = blockInfo.faceIds[direction];
|
break;
|
||||||
if (currid) {
|
}
|
||||||
var posY = core.material.icons[blockInfo.cls][currid];
|
|
||||||
if (posY != null) blockInfo.posY = posY;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (direction == 'forward' || direction == 'backward') {
|
||||||
|
if (moveInfo.lastDirection == null) {
|
||||||
|
moveInfo.moveSteps.shift();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (direction == 'backward')
|
||||||
|
moveInfo.offset = -1;
|
||||||
|
direction = moveInfo.lastDirection;
|
||||||
|
}
|
||||||
|
moveInfo.lastDirection = moveInfo.moveSteps[0] = direction;
|
||||||
|
moveInfo.x += core.utils.scan[direction].x * moveInfo.offset;
|
||||||
|
moveInfo.y += core.utils.scan[direction].y * moveInfo.offset;
|
||||||
|
// 根据faceIds修改朝向
|
||||||
|
var currid = blockInfo.faceIds[direction];
|
||||||
|
if (currid) {
|
||||||
|
var posY = core.material.icons[blockInfo.cls][currid];
|
||||||
|
if (posY != null) blockInfo.posY = posY;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
maps.prototype._moveBlock_moving = function (blockInfo, canvases, moveInfo) {
|
||||||
|
if (moveInfo.step == 0) {
|
||||||
|
if (!this._moveBlock_updateDirection(blockInfo, moveInfo)) return;
|
||||||
|
}
|
||||||
|
var direction = moveInfo.moveSteps[0];
|
||||||
moveInfo.step++;
|
moveInfo.step++;
|
||||||
moveInfo.px += core.utils.scan[direction].x * 2;
|
moveInfo.px += core.utils.scan[direction].x * 2 * moveInfo.offset;
|
||||||
moveInfo.py += core.utils.scan[direction].y * 2;
|
moveInfo.py += core.utils.scan[direction].y * 2 * moveInfo.offset;
|
||||||
this._moveDetachedBlock(blockInfo, moveInfo.px, moveInfo.py, moveInfo.opacity, canvases);
|
this._moveDetachedBlock(blockInfo, moveInfo.px, moveInfo.py, moveInfo.opacity, canvases);
|
||||||
if (moveInfo.step == 16) {
|
if (moveInfo.step == 16) {
|
||||||
moveInfo.step = 0;
|
moveInfo.step = 0;
|
||||||
@ -1688,6 +1722,7 @@ maps.prototype.jumpBlock = function (sx, sy, ex, ey, time, keep, callback) {
|
|||||||
maps.prototype.__generateJumpInfo = function (sx, sy, ex, ey, time) {
|
maps.prototype.__generateJumpInfo = function (sx, sy, ex, ey, time) {
|
||||||
var dx = ex - sx, dy = ey - sy, distance = Math.round(Math.sqrt(dx * dx + dy * dy));
|
var dx = ex - sx, dy = ey - sy, distance = Math.round(Math.sqrt(dx * dx + dy * dy));
|
||||||
var jump_peak = 6 + distance, jump_count = jump_peak * 2;
|
var jump_peak = 6 + distance, jump_count = jump_peak * 2;
|
||||||
|
time /= Math.max(core.status.replay.speed, 1)
|
||||||
return {
|
return {
|
||||||
x: sx, y: sy, ex: ex, ey: ey, px: 32 * sx, py: 32 * sy, opacity: 1,
|
x: sx, y: sy, ex: ex, ey: ey, px: 32 * sx, py: 32 * sy, opacity: 1,
|
||||||
jump_peak: jump_peak, jump_count: jump_count,
|
jump_peak: jump_peak, jump_count: jump_count,
|
||||||
@ -1751,6 +1786,7 @@ maps.prototype.animateBlock = function (loc, type, time, callback) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._animateBlock_drawList(list, isHide ? 1 : 0);
|
this._animateBlock_drawList(list, isHide ? 1 : 0);
|
||||||
|
time /= Math.max(core.status.replay.speed, 1)
|
||||||
this._animateBlock_doAnimate(loc, list, isHide, 10 / time, callback);
|
this._animateBlock_doAnimate(loc, list, isHide, 10 / time, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
28
libs/ui.js
28
libs/ui.js
@ -373,7 +373,8 @@ ui.prototype._getTitleAndIcon = function (content) {
|
|||||||
title = core.status.hero.name;
|
title = core.status.hero.name;
|
||||||
image = core.material.images.hero;
|
image = core.material.images.hero;
|
||||||
icon = 0;
|
icon = 0;
|
||||||
height = core.material.icons.hero.height;
|
var w = core.material.icons.hero.width || 32;
|
||||||
|
height = 32 * core.material.icons.hero.height / w;
|
||||||
}
|
}
|
||||||
else if (s4.endsWith(".png")) {
|
else if (s4.endsWith(".png")) {
|
||||||
s4 = core.getMappedName(s4);
|
s4 = core.getMappedName(s4);
|
||||||
@ -466,6 +467,11 @@ ui.prototype.drawWindowSelector = function(background, x, y, w, h) {
|
|||||||
|
|
||||||
////// 绘制 WindowSkin
|
////// 绘制 WindowSkin
|
||||||
ui.prototype.drawWindowSkin = function(background, ctx, x, y, w, h, direction, px, py) {
|
ui.prototype.drawWindowSkin = function(background, ctx, x, y, w, h, direction, px, py) {
|
||||||
|
background = background || core.status.textAttribute.background;
|
||||||
|
if (typeof background == 'string') {
|
||||||
|
background = core.getMappedName(background);
|
||||||
|
background = core.material.images.images[background];
|
||||||
|
}
|
||||||
// 仿RM窗口皮肤 ↓
|
// 仿RM窗口皮肤 ↓
|
||||||
var dstImage = core.getContextByName(ctx);
|
var dstImage = core.getContextByName(ctx);
|
||||||
if (!dstImage) return;
|
if (!dstImage) return;
|
||||||
@ -928,11 +934,20 @@ ui.prototype._drawTextBox_drawTitleAndIcon = function (titleInfo, hPos, vPos, al
|
|||||||
core.strokeRect('ui', hPos.left + 15 - 1, image_top-1, 34, titleInfo.height + 2, null, 2);
|
core.strokeRect('ui', hPos.left + 15 - 1, image_top-1, 34, titleInfo.height + 2, null, 2);
|
||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
core.status.boxAnimateObjs.push({
|
// --- 勇士
|
||||||
'bgx': hPos.left + 15, 'bgy': image_top, 'bgWidth': 32, 'bgHeight': titleInfo.height,
|
if (titleInfo.image == core.material.images.hero) {
|
||||||
'x': hPos.left + 15, 'y': image_top, 'height': titleInfo.height, 'animate': titleInfo.animate,
|
core.clearMap('ui', hPos.left + 15, image_top, 32, titleInfo.height);
|
||||||
'image': titleInfo.image, 'pos': titleInfo.icon * titleInfo.height
|
core.fillRect('ui', hPos.left + 15, image_top, 32, titleInfo.height, core.material.groundPattern);
|
||||||
});
|
core.drawImage('ui', titleInfo.image, 0, 0, core.material.icons.hero.width || 32, core.material.icons.hero.height,
|
||||||
|
hPos.left + 15, image_top, 32, titleInfo.height);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.status.boxAnimateObjs.push({
|
||||||
|
'bgx': hPos.left + 15, 'bgy': image_top, 'bgWidth': 32, 'bgHeight': titleInfo.height,
|
||||||
|
'x': hPos.left + 15, 'y': image_top, 'height': titleInfo.height, 'animate': titleInfo.animate,
|
||||||
|
'image': titleInfo.image, 'pos': titleInfo.icon * titleInfo.height
|
||||||
|
});
|
||||||
|
}
|
||||||
core.drawBoxAnimate();
|
core.drawBoxAnimate();
|
||||||
}
|
}
|
||||||
if (titleInfo.image != null && titleInfo.icon == null) { // 头像图
|
if (titleInfo.image != null && titleInfo.icon == null) { // 头像图
|
||||||
@ -971,6 +986,7 @@ ui.prototype.drawScrollText = function (content, time, lineHeight, callback) {
|
|||||||
|
|
||||||
ui.prototype._drawScrollText_animate = function (ctx, time, callback) {
|
ui.prototype._drawScrollText_animate = function (ctx, time, callback) {
|
||||||
// 开始绘制到UI上
|
// 开始绘制到UI上
|
||||||
|
time /= Math.max(core.status.replay.speed, 1)
|
||||||
var per_pixel = 1, height = ctx.canvas.height, per_time = time * per_pixel / (this.PIXEL+height);
|
var per_pixel = 1, height = ctx.canvas.height, per_time = time * per_pixel / (this.PIXEL+height);
|
||||||
var currH = this.PIXEL;
|
var currH = this.PIXEL;
|
||||||
core.drawImage('ui', ctx.canvas, 0, currH);
|
core.drawImage('ui', ctx.canvas, 0, currH);
|
||||||
|
|||||||
@ -67,6 +67,7 @@ utils.prototype.calValue = function (value, prefix, need, times) {
|
|||||||
value = value.replace(/item:([a-zA-Z0-9_]+)/g, "core.itemCount('$1')");
|
value = value.replace(/item:([a-zA-Z0-9_]+)/g, "core.itemCount('$1')");
|
||||||
value = value.replace(/flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getFlag('$1', 0)");
|
value = value.replace(/flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getFlag('$1', 0)");
|
||||||
value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
|
value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
|
||||||
|
value = value.replace(/global:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getGlobal('$1', 0)");
|
||||||
return eval(value);
|
return eval(value);
|
||||||
}
|
}
|
||||||
if (value instanceof Function) {
|
if (value instanceof Function) {
|
||||||
@ -246,6 +247,31 @@ utils.prototype.removeLocalForage = function (key, successCallback, errorCallbac
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils.prototype.setGlobal = function (key, value) {
|
||||||
|
if (core.isReplaying()) return;
|
||||||
|
core.setLocalStorage(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
utils.prototype.getGlobal = function (key, defaultValue) {
|
||||||
|
var value;
|
||||||
|
if (core.isReplaying()) {
|
||||||
|
// 不考虑key不一致的情况
|
||||||
|
var action = core.status.replay.toReplay.shift();
|
||||||
|
if (action.indexOf("input2:") == 0) {
|
||||||
|
value = JSON.parse(core.decodeBase64(action.substring(7)));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.control._replay_error(action);
|
||||||
|
return core.getLocalStorage(key, defaultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
value = core.getLocalStorage(key, defaultValue);
|
||||||
|
}
|
||||||
|
core.status.route.push("input2:" + core.encodeBase64(JSON.stringify(value)));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
////// 深拷贝一个对象 //////
|
////// 深拷贝一个对象 //////
|
||||||
utils.prototype.clone = function (data, filter, recursion) {
|
utils.prototype.clone = function (data, filter, recursion) {
|
||||||
if (!core.isset(data)) return null;
|
if (!core.isset(data)) return null;
|
||||||
@ -686,9 +712,8 @@ utils.prototype.rand2 = function (num) {
|
|||||||
value = parseInt(action.substring(7));
|
value = parseInt(action.substring(7));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.stopReplay();
|
core.control._replay_error(action);
|
||||||
core.drawTip("录像文件出错");
|
return 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -973,6 +973,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
icon = core.getMappedName(icon);
|
icon = core.getMappedName(icon);
|
||||||
if (core.material.images.images[icon]) {
|
if (core.material.images.images[icon]) {
|
||||||
core.material.images.hero.src = core.material.images.images[icon].src;
|
core.material.images.hero.src = core.material.images.images[icon].src;
|
||||||
|
core.material.icons.hero.width = core.material.images.images[icon].width / 4;
|
||||||
core.material.icons.hero.height = core.material.images.images[icon].height / 4;
|
core.material.icons.hero.height = core.material.images.images[icon].height / 4;
|
||||||
}
|
}
|
||||||
// 刷新怪物数据
|
// 刷新怪物数据
|
||||||
|
|||||||
@ -25,6 +25,7 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
|
|||||||
"leftFoot": 1,
|
"leftFoot": 1,
|
||||||
"rightFoot": 3
|
"rightFoot": 3
|
||||||
},
|
},
|
||||||
|
"width": 32,
|
||||||
"height": 48
|
"height": 48
|
||||||
},
|
},
|
||||||
"terrains": {
|
"terrains": {
|
||||||
|
|||||||
@ -416,5 +416,5 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"yellowJewel": "true",
|
"yellowJewel": "true",
|
||||||
"skill1": "true"
|
"skill1": "true"
|
||||||
},
|
},
|
||||||
"canEquip": {}
|
"equipCondition": {}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user