@ -685,10 +685,6 @@ core.updateHeroIcon()
|
||||
更新状态栏上的勇士图标。
|
||||
|
||||
|
||||
core.updateGlobalAttribute()
|
||||
更新全局属性,例如状态栏的背景图等。
|
||||
|
||||
|
||||
core.setToolbarButton(useButtom)
|
||||
设置工具栏是否是拓展键盘。
|
||||
|
||||
@ -2146,10 +2142,6 @@ core.showWithAnimate(obj, speed, callback) / core.hideWithAnimate(obj, speed, ca
|
||||
动画淡入或淡出一个对象。
|
||||
|
||||
|
||||
core.hashCode(obj)
|
||||
计算一个对象的哈希值。
|
||||
|
||||
|
||||
core.same(a, b)
|
||||
判定a和b是否相同,包括类型相同和值相同。
|
||||
如果a和b都是数组,则会递归依次比较数组中的值;如果都是对象亦然。
|
||||
|
||||
@ -684,10 +684,6 @@ core.updateHeroIcon()
|
||||
更新状态栏上的勇士图标。
|
||||
|
||||
|
||||
core.updateGlobalAttribute()
|
||||
更新全局属性,例如状态栏的背景图等。
|
||||
|
||||
|
||||
core.setToolbarButton(useButtom)
|
||||
设置工具栏是否是拓展键盘。
|
||||
|
||||
@ -2146,10 +2142,6 @@ core.showWithAnimate(obj, speed, callback) / core.hideWithAnimate(obj, speed, ca
|
||||
动画淡入或淡出一个对象。
|
||||
|
||||
|
||||
core.hashCode(obj)
|
||||
计算一个对象的哈希值。
|
||||
|
||||
|
||||
core.same(a, b)
|
||||
判定a和b是否相同,包括类型相同和值相同。
|
||||
如果a和b都是数组,则会递归依次比较数组中的值;如果都是对象亦然。
|
||||
|
||||
@ -139,7 +139,7 @@ N连击怪物的special是6,且我们可以为它定义n代表实际连击数
|
||||
领域怪还可以设置`range`选项代表该领域怪的范围,不写则默认为1。
|
||||
<br>**将 `flags.no_zone` 设置为 `true` 可以免疫领域效果。**<br>
|
||||
阻击怪同样需要设置value,代表阻击伤害的数值。如果勇士生命值扣减到0,则直接死亡触发lose事件。
|
||||
<br>**将`flags.no_snipe`设置为true可以免疫阻击效果(包括伤害和移动!)。**<br>
|
||||
<br>**将`flags.no_repulse`设置为true可以免疫阻击效果(包括伤害和移动!)。**<br>
|
||||
!> 阻击怪后退的地点不能有任何事件存在,即使是已经被禁用的红绿事件或重生怪!(会导致此事件意外被重新启用)<br>
|
||||
激光怪同样需要设置value,代表激光伤害的数值。
|
||||
<br>请注意如果吸血、领域、阻击、生命光环中任何两个同时存在,则 `value` 会冲突。**因此请勿将吸血、领域、阻击或激光放置在同一个怪物身上。退化和攻防光环同理!<br>**
|
||||
|
||||
@ -81,8 +81,8 @@
|
||||
"一段普通文字",
|
||||
"\t[勇士,hero]这是一段勇士说的话",
|
||||
"\t[hero]如果使用勇士默认名称也可以直接简写hero",
|
||||
"\t[黑暗大法师,blackMagician]我是黑暗大法师",
|
||||
"\t[blackMagician]如果使用怪物的默认名称也可以简写怪物id",
|
||||
"\t[黑暗大法师,magicMaster]我是黑暗大法师",
|
||||
"\t[magicMaster]如果使用怪物的默认名称也可以简写怪物id",
|
||||
"\t[小妖精,fairy]这是一段小妖精说的话,使用仙子(fairy)的图标",
|
||||
"\t[你赢了]直接显示标题为【你赢了】",
|
||||
"\t[1.png]绘制1.png这个头像图",
|
||||
@ -383,7 +383,7 @@ value为必填项,代表要修改到的内容。对于修改名称的,必须
|
||||
{"type": "setFloor", "name": "title", "value": "'主塔 0 层'" } // 设置当前楼层的中文名为主塔0层
|
||||
{"type": "setFloor", "name": "canFlyTo", "floorId": "MT2", "value": "false" } // 设置MT2层不可飞行
|
||||
{"type": "setFloor", "name": "cannotViewMap", "floorId": "MT0", "value": "true" } // 设置MT0层不可被浏览地图
|
||||
{"type": "setFloor", "name": "item_ratio", "value": "5" } // 设置当前楼层的宝石血瓶属性加成为5
|
||||
{"type": "setFloor", "name": "ratio", "value": "5" } // 设置当前楼层的宝石血瓶属性加成为5
|
||||
{"type": "setFloor", "name": "images", "value": "[[0,0,'tree.png',2]]" } // 设置当前楼层的楼层贴图
|
||||
{"type": "setFloor", "name": "upFloor", "value": "[2,3]" } // 设置当前楼层的上楼梯
|
||||
{"type": "setFloor", "name": "bgm", "floorId": "MT10", "value": "'233.mp3'" } // 设置当前楼层的背景音乐
|
||||
@ -2174,7 +2174,7 @@ if (core.flags.enableAddPoint && point > 0) {
|
||||
``` json
|
||||
"shops": [{
|
||||
"id": "shop1",
|
||||
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
|
||||
"text": "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
|
||||
"textInList": "1F金币商店",
|
||||
"mustEnable": false,
|
||||
"disablePreview": false,
|
||||
|
||||
@ -236,7 +236,7 @@ ID必须由数字字母下划线组成,数字在1000以内,且均不能和
|
||||
|
||||
除此之外,额外素材在游戏中的使用和正式素材都是一致的,也能在前景或背景图层绘制。
|
||||
|
||||
额外素材可以使用“tileset贴图”的方式进行绘制,一次绘制一个矩形区域。
|
||||
额外素材可以使用“tileset平铺”的方式进行绘制,一次绘制一个矩形区域。
|
||||
|
||||
“辅助工具”中提供了“额外素材合并”,如果使用此功能,请不要对额外素材进行基于ID、索引和数字的判定和读写等操作,如确有此需求,可以创建一些玩家不可达也不可预览的隐藏样板层,然后用等量代换的办法去从样板层取用。
|
||||
## 自定义道具效果
|
||||
@ -249,21 +249,18 @@ ID必须由数字字母下划线组成,数字在1000以内,且均不能和
|
||||
|
||||
如果你想要同种宝石在不同层效果不同的话,可以进行如下操作:
|
||||
|
||||
1. 在楼层的item_ratio中定义宝石的比率(比如1-10的写1,11-20层写2等)
|
||||
1. 在楼层的ratio中定义宝石的比率(比如1-10的写1,11-20层写2等)
|
||||
2. 修改获得道具的itemEffect函数(编辑器中双击进行编辑)
|
||||
|
||||
``` js
|
||||
// ratio为楼层的item_ratio值,可以进行翻倍宝石属性
|
||||
core.status.hero.atk += core.values.redJewel * ratio
|
||||
core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio
|
||||
```
|
||||
|
||||
这里我们可以直接写ratio来取用该楼层中定义的`item_ratio`的值。
|
||||
|
||||
如果不是倍数增加(比如线性增加)也可以类似来写
|
||||
|
||||
``` js
|
||||
// 一个二倍线性增加的例子
|
||||
core.status.hero.atk += core.values.redJewel + 2*ratio
|
||||
core.status.hero.atk += core.values.redGem + 2*core.status.thisMap.ratio
|
||||
```
|
||||
|
||||
### 消耗类道具(cls: tools);永久类道具(cls: constants)
|
||||
@ -308,11 +305,11 @@ function (enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
|
||||
[ // 写在获得道具后事件
|
||||
// 设置不同的flag可以分别无视对应的阻激夹域效果
|
||||
{"type": "setValue", "name": "flag:no_zone", "value": "true"}, // 免疫领域
|
||||
{"type": "setValue", "name": "flag:no_snipe", "value": "true"}, // 免疫阻击
|
||||
{"type": "setValue", "name": "flag:no_repulse", "value": "true"}, // 免疫阻击
|
||||
{"type": "setValue", "name": "flag:no_laser", "value": "true"}, // 免疫激光
|
||||
{"type": "setValue", "name": "flag:no_betweenAttack", "value": "true"}, // 免疫夹击
|
||||
{"type": "setValue", "name": "flag:no_ambush", "value": "true"}, // 免疫捕捉
|
||||
{"type": "setValue", "name": "item:shoes", "value": "1"} // 免疫路障
|
||||
{"type": "setValue", "name": "item:amulet", "value": "1"} // 免疫路障
|
||||
]
|
||||
```
|
||||
4. 如果有更高的需求,例如想让吸血效果变成一半,则还是在上面这些地方进行对应的修改即可。
|
||||
@ -666,7 +663,7 @@ if (core.flags.statusBarItems.indexOf('enableSkill')>=0) {
|
||||
|
||||
- **`flag:hard`**: 当前的难度标志;此flag变量在setInitData中被定义,可以直接取用来判定当前难度分歧。上传成绩时将根据此flag来对不同难度进行排序。
|
||||
- **`flag:posion`**, **`flag:weak`**, **`flag:curse`**: 中毒、衰弱、诅咒状态。
|
||||
- **`flag:no_zone`**, **`flag:no_snipe`**, **`flag:no_laser`**, **`flag:no_betweenAttack`**: 是否分别免疫领域、阻击、激光、夹击效果。
|
||||
- **`flag:no_zone`**, **`flag:no_repulse`**, **`flag:no_laser`**, **`flag:no_betweenAttack`**: 是否分别免疫领域、阻击、激光、夹击效果。
|
||||
- **`flag:hatred`**: 当前的仇恨数值。
|
||||
- **`flag:commonTimes`**: 全局商店共用次数时的访问次数。
|
||||
- **`flag:input`**: 接受用户输入的事件后,存放用户输入的结果。
|
||||
|
||||
1396
_server/MotaActionParser.js
Normal file
2
_server/blockly/Converter.bundle.min.js
vendored
@ -1 +1 @@
|
||||
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample0","disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}
|
||||
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample0","disableBlocklyReplace":false,"disableBlocklyExpandCompare":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}
|
||||
@ -20,7 +20,7 @@ function editor() {
|
||||
chooseThis : document.getElementById('chooseThis'),
|
||||
chooseInRight : document.getElementById('chooseInRight'),
|
||||
copyLoc : document.getElementById('copyLoc'),
|
||||
moveLoc : document.getElementById('moveLoc'),
|
||||
pasteLoc : document.getElementById('pasteLoc'),
|
||||
clearEvent : document.getElementById('clearEvent'),
|
||||
clearLoc : document.getElementById('clearLoc'),
|
||||
brushMod:document.getElementById('brushMod'),
|
||||
@ -40,12 +40,12 @@ function editor() {
|
||||
layerMod3:document.getElementById('layerMod3'),
|
||||
viewportButtons:document.getElementById('viewportButtons'),
|
||||
appendPicCanvas : document.getElementById('appendPicCanvas'),
|
||||
bg : document.getElementById('appendPicCanvas').children[0],
|
||||
source : document.getElementById('appendPicCanvas').children[1],
|
||||
picClick : document.getElementById('appendPicCanvas').children[2],
|
||||
sprite : document.getElementById('appendPicCanvas').children[3],
|
||||
sourceCtx:document.getElementById('appendPicCanvas').children[1].getContext('2d'),
|
||||
spriteCtx:document.getElementById('appendPicCanvas').children[3].getContext('2d'),
|
||||
appendBgCtx : document.getElementById('appendPicCanvas').children[0].getContext('2d'),
|
||||
appendSource : document.getElementById('appendPicCanvas').children[1],
|
||||
appendPicClick : document.getElementById('appendPicCanvas').children[2],
|
||||
appendSprite : document.getElementById('appendPicCanvas').children[3],
|
||||
appendSourceCtx:document.getElementById('appendPicCanvas').children[1].getContext('2d'),
|
||||
appendSpriteCtx:document.getElementById('appendPicCanvas').children[3].getContext('2d'),
|
||||
appendPicSelection : document.getElementById('appendPicSelection'),
|
||||
selectAppend : document.getElementById('selectAppend'),
|
||||
selectFileBtn :document.getElementById('selectFileBtn'),
|
||||
@ -55,6 +55,7 @@ function editor() {
|
||||
editModeSelect :document.getElementById('editModeSelect'),
|
||||
mid2 : document.getElementById('mid2'),
|
||||
clearLastUsedBtn: document.getElementById('clearLastUsedBtn'),
|
||||
lastUsedTitle: document.getElementById('lastUsedTitle'),
|
||||
lastUsedDiv: document.getElementById('lastUsedDiv'),
|
||||
lastUsed: document.getElementById('lastUsed'),
|
||||
lastUsedCtx: document.getElementById('lastUsed').getContext('2d'),
|
||||
@ -68,6 +69,12 @@ function editor() {
|
||||
mouseOutCheck : 2,
|
||||
startPos:null,
|
||||
endPos:null,
|
||||
lastMoveE:{buttons:0,clientX:0,clientY:0},
|
||||
selectedArea: null,
|
||||
// 材料区拖动有关
|
||||
lastMoveMaterE:null,
|
||||
tileSize: [1,1],
|
||||
startLoc: null,
|
||||
// 撤销/恢复
|
||||
preMapData : [],
|
||||
preMapMax: 10,
|
||||
@ -79,13 +86,12 @@ function editor() {
|
||||
scrollBarHeight :0,
|
||||
folded:false,
|
||||
foldPerCol: 50,
|
||||
// 画图区菜单
|
||||
lastRightButtonPos:[{x:0,y:0},{x:0,y:0}],
|
||||
lastCopyedInfo : [null, null],
|
||||
//
|
||||
ratio : 1,
|
||||
// blockly转义
|
||||
disableBlocklyReplace: false,
|
||||
// blockly展开比较
|
||||
disableBlocklyExpandCompare: false,
|
||||
|
||||
// 绑定机关门事件相关
|
||||
bindSpecialDoor: {
|
||||
@ -101,10 +107,10 @@ function editor() {
|
||||
},
|
||||
|
||||
// tile
|
||||
tileSize: [1,1],
|
||||
lockMode: false,
|
||||
|
||||
// 最近使用的图块
|
||||
lastUsedType: null,
|
||||
lastUsed: [],
|
||||
};
|
||||
|
||||
@ -278,6 +284,7 @@ editor.prototype.changeFloor = function (floorId, callback) {
|
||||
editor.viewportLoc = editor.viewportLoc || {};
|
||||
var loc = editor.viewportLoc[floorId] || [], x = loc[0] || 0, y = loc[1] || 0;
|
||||
editor.setViewport(x, y);
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
|
||||
editor.config.set('editorLastFloorId', floorId, function() {
|
||||
if (callback) callback();
|
||||
@ -406,16 +413,35 @@ editor.prototype.updateMap = function () {
|
||||
this.updateLastUsedMap();
|
||||
}
|
||||
|
||||
editor.prototype.setLastUsedType = function (type) {
|
||||
if (type == editor.uivalues.lastUsedType) return;
|
||||
editor.uivalues.lastUsedType = type;
|
||||
var _buildHtml = function (type, text) {
|
||||
if (type == null) return "<b>" + text + "</b>";
|
||||
else return `<a href="javascript:editor.setLastUsedType('${type}')">${text}</a>`;
|
||||
}
|
||||
editor.dom.lastUsedTitle.innerHTML
|
||||
= type == 'frequent' ? (_buildHtml('recent', '最近使用') + " | " + _buildHtml(null, '最常使用'))
|
||||
: (_buildHtml(null, '最近使用') + " | " + _buildHtml('frequent', '最常使用'));
|
||||
this.updateLastUsedMap();
|
||||
}
|
||||
|
||||
editor.prototype.updateLastUsedMap = function () {
|
||||
var lastUsed = editor.uivalues.lastUsed.sort(function (a, b) {
|
||||
if ((a.istop || 0) != (b.istop || 0)) return (b.istop || 0) - (a.istop || 0);
|
||||
return (b[editor.uivalues.lastUsedType] || 0) - (a[editor.uivalues.lastUsedType] || 0);
|
||||
});
|
||||
|
||||
// 绘制最近使用事件
|
||||
var ctx = editor.dom.lastUsedCtx;
|
||||
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||
ctx.strokeStyle = 'rgba(255,128,0,0.85)';
|
||||
ctx.fillStyle = 'rgba(255,0,0,0.85)';
|
||||
ctx.lineWidth = 4;
|
||||
for (var i = 0; i < editor.uivalues.lastUsed.length; ++i) {
|
||||
for (var i = 0; i < lastUsed.length; ++i) {
|
||||
try {
|
||||
var x = i % core.__SIZE__, y = parseInt(i / core.__SIZE__);
|
||||
var info = editor.uivalues.lastUsed[i];
|
||||
var info = lastUsed[i];
|
||||
if (!info || !info.images) continue;
|
||||
if (info.isTile && core.material.images.tilesets[info.images]) {
|
||||
ctx.drawImage(core.material.images.tilesets[info.images], 32 * info.x, 32 * info.y, 32, 32, x*32, y*32, 32, 32);
|
||||
@ -425,6 +451,9 @@ editor.prototype.updateLastUsedMap = function () {
|
||||
var per_height = info.images.endsWith('48') ? 48 : 32;
|
||||
ctx.drawImage(core.material.images[info.images], 0, info.y * per_height, 32, per_height, x * 32, y * 32, 32, 32);
|
||||
}
|
||||
if (info.istop) {
|
||||
ctx.fillRect(32 * x, 32 * y + 24, 8, 8);
|
||||
}
|
||||
if (selectBox.isSelected() && editor.info.id == info.id) {
|
||||
ctx.strokeRect(32 * x + 2, 32 * y + 2, 28, 28);
|
||||
}
|
||||
@ -458,6 +487,7 @@ editor.prototype.drawInitData = function (icons) {
|
||||
// editor.uivalues.folded = true;
|
||||
editor.uivalues.foldPerCol = editor.config.get('foldPerCol', 50);
|
||||
// var imgNames = Object.keys(images); //还是固定顺序吧;
|
||||
editor.setLastUsedType(editor.config.get('lastUsedType', 'recent'));
|
||||
editor.uivalues.lastUsed = editor.config.get("lastUsed", []);
|
||||
var imgNames = ["terrains", "animates", "enemys", "enemy48", "items", "npcs", "npc48", "autotile"];
|
||||
|
||||
@ -655,6 +685,7 @@ editor.prototype.setSelectBoxFromInfo=function(thisevent, scrollTo){
|
||||
editor.dom.dataSelection.style.left = pos.x * 32 + 'px';
|
||||
editor.dom.dataSelection.style.top = pos.y * ysize + 'px';
|
||||
editor.dom.dataSelection.style.height = ysize - 6 + 'px';
|
||||
editor.dom.dataSelection.style.width = 32 - 6 + 'px';
|
||||
setTimeout(function(){
|
||||
selectBox.isSelected(true);
|
||||
editor.updateLastUsedMap();
|
||||
|
||||
@ -1,488 +1,6 @@
|
||||
editor_blockly = function () {
|
||||
|
||||
var editor_blockly = {};
|
||||
|
||||
/////////////////initscript start/////////////////////////////
|
||||
// do not use String.raw because of highlighting
|
||||
// Comment tagged templates
|
||||
// https://marketplace.visualstudio.com/items?itemName=bierner.comment-tagged-templates
|
||||
initscript = /* js */`
|
||||
(function(){
|
||||
var getCategory = function(name,custom){
|
||||
for(var node of document.getElementById('toolbox').children) {
|
||||
if(node.getAttribute('name')==name) return node;
|
||||
}
|
||||
var node = document.createElement('category');
|
||||
node.setAttribute('name',name);
|
||||
if(custom)node.setAttribute('custom',custom);
|
||||
document.getElementById('toolbox').appendChild(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
var toolboxObj = {
|
||||
'入口方块':[
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
"欢迎使用事件编辑器",
|
||||
"本事件触发一次后会消失",
|
||||
{"type": "hide", "time": 500},
|
||||
],'event'),
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
"condition": "flag:__door__==2",
|
||||
"currentFloor": true,
|
||||
"priority": 0,
|
||||
"delayExecute": false,
|
||||
"multiExecute": false,
|
||||
"data": [
|
||||
{"type": "openDoor", "loc": [10,5]}
|
||||
],
|
||||
},'autoEvent'),
|
||||
MotaActionBlocks['changeFloor_m'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parse([{
|
||||
"id": "shop1",
|
||||
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我\${20+2*flag:shop1}金币就可以:",
|
||||
"textInList": "1F金币商店",
|
||||
"choices": [
|
||||
{"text": "生命+800", "need": "status:money>=20+2*flag:shop1", "action": [
|
||||
{"type": "comment", "text": "新版商店中需要手动扣减金币和增加访问次数"},
|
||||
{"type": "setValue", "name": "status:money", "operator": "-=", "value": "20+2*flag:shop1"},
|
||||
{"type": "setValue", "name": "flag:shop1", "operator": "+=", "value": "1"},
|
||||
{"type": "setValue", "name": "status:hp", "operator": "+=", "value": "800"}
|
||||
]}
|
||||
]
|
||||
},{
|
||||
"id": "itemShop",
|
||||
"item": true,
|
||||
"textInList": "道具商店",
|
||||
"choices": [
|
||||
{"id": "yellowKey", "number": 10, "money": 10}
|
||||
]
|
||||
},{
|
||||
"id": "keyShop1",
|
||||
"textInList": "回收钥匙商店",
|
||||
"commonEvent": "回收钥匙商店",
|
||||
"args": ""
|
||||
}],'shop'),
|
||||
MotaActionBlocks['afterBattle_m'].xmlText(),
|
||||
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
||||
MotaActionBlocks['afterOpenDoor_m'].xmlText(),
|
||||
MotaActionBlocks['firstArrive_m'].xmlText(),
|
||||
MotaActionBlocks['eachArrive_m'].xmlText(),
|
||||
MotaActionBlocks['level_m'].xmlText(),
|
||||
MotaActionBlocks['commonEvent_m'].xmlText(),
|
||||
MotaActionBlocks['item_m'].xmlText(),
|
||||
],
|
||||
'显示文字':[
|
||||
MotaActionBlocks['text_0_s'].xmlText(),
|
||||
MotaActionBlocks['text_1_s'].xmlText(),
|
||||
MotaActionBlocks['comment_s'].xmlText(),
|
||||
MotaActionBlocks['autoText_s'].xmlText(),
|
||||
MotaActionBlocks['scrollText_s'].xmlText(),
|
||||
MotaActionBlocks['setText_s'].xmlText(),
|
||||
MotaActionBlocks['showImage_s'].xmlText(),
|
||||
MotaActionBlocks['showImage_1_s'].xmlText(),
|
||||
MotaActionBlocks['hideImage_s'].xmlText(),
|
||||
MotaActionBlocks['showTextImage_s'].xmlText(),
|
||||
MotaActionBlocks['moveImage_s'].xmlText(),
|
||||
MotaActionBlocks['showGif_s'].xmlText(),
|
||||
MotaActionBlocks['tip_s'].xmlText(),
|
||||
MotaActionBlocks['win_s'].xmlText(),
|
||||
MotaActionBlocks['lose_s'].xmlText(),
|
||||
MotaActionBlocks['restart_s'].xmlText(),
|
||||
MotaActionBlocks['confirm_s'].xmlText(),
|
||||
MotaActionBlocks['choices_s'].xmlText([
|
||||
'选择剑或者盾','流浪者','man',0,MotaActionBlocks['choicesContext'].xmlText([
|
||||
'剑','','',null,'',MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [3,3]}]),
|
||||
])
|
||||
]),
|
||||
],
|
||||
'数据相关':[
|
||||
MotaActionBlocks['setValue_s'].xmlText([
|
||||
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '=', '', false
|
||||
]),
|
||||
MotaActionBlocks['setEnemy_s'].xmlText(),
|
||||
MotaActionBlocks['setFloor_s'].xmlText(),
|
||||
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
|
||||
MotaActionBlocks['setGlobalValue_s'].xmlText(),
|
||||
MotaActionBlocks['setGlobalFlag_s'].xmlText(),
|
||||
MotaActionBlocks['input_s'].xmlText(),
|
||||
MotaActionBlocks['input2_s'].xmlText(),
|
||||
MotaActionBlocks['update_s'].xmlText(),
|
||||
MotaActionBlocks['moveAction_s'].xmlText(),
|
||||
MotaActionBlocks['moveHero_s'].xmlText(),
|
||||
MotaActionBlocks['jumpHero_s'].xmlText(),
|
||||
MotaActionBlocks['changeFloor_s'].xmlText(),
|
||||
MotaActionBlocks['changePos_s'].xmlText(),
|
||||
MotaActionBlocks['battle_s'].xmlText(),
|
||||
MotaActionBlocks['useItem_s'].xmlText(),
|
||||
MotaActionBlocks['loadEquip_s'].xmlText(),
|
||||
MotaActionBlocks['unloadEquip_s'].xmlText(),
|
||||
MotaActionBlocks['openShop_s'].xmlText(),
|
||||
MotaActionBlocks['disableShop_s'].xmlText(),
|
||||
MotaActionBlocks['setHeroIcon_s'].xmlText(),
|
||||
MotaActionBlocks['follow_s'].xmlText(),
|
||||
MotaActionBlocks['unfollow_s'].xmlText(),
|
||||
],
|
||||
'地图处理':[
|
||||
MotaActionBlocks['battle_1_s'].xmlText(),
|
||||
MotaActionBlocks['openDoor_s'].xmlText(),
|
||||
MotaActionBlocks['closeDoor_s'].xmlText(),
|
||||
MotaActionBlocks['show_s'].xmlText(),
|
||||
MotaActionBlocks['hide_s'].xmlText(),
|
||||
MotaActionBlocks['setBlock_s'].xmlText(),
|
||||
MotaActionBlocks['turnBlock_s'].xmlText(),
|
||||
MotaActionBlocks['move_s'].xmlText(),
|
||||
MotaActionBlocks['jump_s'].xmlText(),
|
||||
MotaActionBlocks['showBgFgMap_s'].xmlText(),
|
||||
MotaActionBlocks['hideBgFgMap_s'].xmlText(),
|
||||
MotaActionBlocks['setBgFgBlock_s'].xmlText(),
|
||||
MotaActionBlocks['showFloorImg_s'].xmlText(),
|
||||
MotaActionBlocks['hideFloorImg_s'].xmlText(),
|
||||
],
|
||||
'事件控制':[
|
||||
MotaActionBlocks['if_1_s'].xmlText(),
|
||||
MotaActionBlocks['if_s'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parseList({"type": "switch", "condition": "判别值", "caseList": [
|
||||
{"action": [{"type": "comment", "text": "当判别值是值的场合执行此事件"}]},
|
||||
{"case": "default", "action": [{"type": "comment", "text": "当没有符合的值的场合执行default事件"}]},
|
||||
]}),
|
||||
MotaActionFunctions.actionParser.parseList({"type": "for", "name": "temp:A", "from": "0", "to": "12", "step": "1", "data": []}),
|
||||
MotaActionFunctions.actionParser.parseList({"type": "forEach", "name": "temp:A", "list": ["status:atk","status:def"], "data": []}),
|
||||
MotaActionBlocks['while_s'].xmlText(),
|
||||
MotaActionBlocks['dowhile_s'].xmlText(),
|
||||
MotaActionBlocks['break_s'].xmlText(),
|
||||
MotaActionBlocks['continue_s'].xmlText(),
|
||||
MotaActionBlocks['exit_s'].xmlText(),
|
||||
MotaActionBlocks['trigger_s'].xmlText(),
|
||||
MotaActionBlocks['insert_1_s'].xmlText(),
|
||||
MotaActionBlocks['insert_2_s'].xmlText(),
|
||||
],
|
||||
'特效/声音':[
|
||||
MotaActionBlocks['sleep_s'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parseList({"type": "wait", "timeout": 0, "data": [
|
||||
{"case": "keyboard", "keycode": "13,32", "action": [{"type": "comment", "text": "当按下回车(keycode=13)或空格(keycode=32)时执行此事件"}]},
|
||||
{"case": "mouse", "px": [0,32], "py": [0,32], "action": [{"type": "comment", "text": "当点击地图左上角时执行此事件"}]},
|
||||
]}),
|
||||
MotaActionBlocks['waitAsync_s'].xmlText(),
|
||||
MotaActionBlocks['vibrate_s'].xmlText(),
|
||||
MotaActionBlocks['animate_s'].xmlText(),
|
||||
MotaActionBlocks['setViewport_s'].xmlText(),
|
||||
MotaActionBlocks['moveViewport_s'].xmlText(),
|
||||
MotaActionBlocks['showStatusBar_s'].xmlText(),
|
||||
MotaActionBlocks['hideStatusBar_s'].xmlText(),
|
||||
MotaActionBlocks['showHero_s'].xmlText(),
|
||||
MotaActionBlocks['hideHero_s'].xmlText(),
|
||||
MotaActionBlocks['setCurtain_0_s'].xmlText(),
|
||||
MotaActionBlocks['setCurtain_1_s'].xmlText(),
|
||||
MotaActionBlocks['screenFlash_s'].xmlText(),
|
||||
MotaActionBlocks['setWeather_s'].xmlText(),
|
||||
MotaActionBlocks['playBgm_s'].xmlText(),
|
||||
MotaActionBlocks['pauseBgm_s'].xmlText(),
|
||||
MotaActionBlocks['resumeBgm_s'].xmlText(),
|
||||
MotaActionBlocks['loadBgm_s'].xmlText(),
|
||||
MotaActionBlocks['freeBgm_s'].xmlText(),
|
||||
MotaActionBlocks['playSound_s'].xmlText(),
|
||||
MotaActionBlocks['stopSound_s'].xmlText(),
|
||||
MotaActionBlocks['setVolume_s'].xmlText(),
|
||||
MotaActionBlocks['callBook_s'].xmlText(),
|
||||
MotaActionBlocks['callSave_s'].xmlText(),
|
||||
MotaActionBlocks['autoSave_s'].xmlText(),
|
||||
MotaActionBlocks['callLoad_s'].xmlText(),
|
||||
],
|
||||
'UI绘制':[
|
||||
MotaActionBlocks['previewUI_s'].xmlText(),
|
||||
MotaActionBlocks['clearMap_s'].xmlText(),
|
||||
MotaActionBlocks['clearMap_1_s'].xmlText(),
|
||||
MotaActionBlocks['setAttribute_s'].xmlText(),
|
||||
MotaActionBlocks['fillText_s'].xmlText(),
|
||||
MotaActionBlocks['fillBoldText_s'].xmlText(),
|
||||
MotaActionBlocks['drawTextContent_s'].xmlText(),
|
||||
MotaActionBlocks['fillRect_s'].xmlText(),
|
||||
MotaActionBlocks['strokeRect_s'].xmlText(),
|
||||
MotaActionBlocks['drawLine_s'].xmlText(),
|
||||
MotaActionBlocks['drawArrow_s'].xmlText(),
|
||||
MotaActionBlocks['fillPolygon_s'].xmlText(),
|
||||
MotaActionBlocks['strokePolygon_s'].xmlText(),
|
||||
MotaActionBlocks['fillCircle_s'].xmlText(),
|
||||
MotaActionBlocks['strokeCircle_s'].xmlText(),
|
||||
MotaActionBlocks['drawImage_s'].xmlText(),
|
||||
MotaActionBlocks['drawImage_1_s'].xmlText(),
|
||||
MotaActionBlocks['drawIcon_s'].xmlText(),
|
||||
MotaActionBlocks['drawBackground_s'].xmlText(),
|
||||
MotaActionBlocks['drawSelector_s'].xmlText(),
|
||||
MotaActionBlocks['drawSelector_1_s'].xmlText(),
|
||||
],
|
||||
'原生脚本':[
|
||||
MotaActionBlocks['function_s'].xmlText(),
|
||||
MotaActionBlocks['unknown_s'].xmlText(),
|
||||
],
|
||||
'值块':[
|
||||
MotaActionBlocks['setValue_s'].xmlText([
|
||||
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '=', '', false
|
||||
]),
|
||||
MotaActionBlocks['expression_arithmetic_0'].xmlText(),
|
||||
MotaActionBlocks['evFlag_e'].xmlText(),
|
||||
MotaActionBlocks['evTemp_e'].xmlText(),
|
||||
MotaActionBlocks['negate_e'].xmlText(),
|
||||
MotaActionBlocks['bool_e'].xmlText(),
|
||||
MotaActionBlocks['idString_e'].xmlText(),
|
||||
MotaActionBlocks['idString_1_e'].xmlText(),
|
||||
MotaActionBlocks['idString_2_e'].xmlText(),
|
||||
MotaActionBlocks['idString_3_e'].xmlText(),
|
||||
MotaActionBlocks['idString_4_e'].xmlText(),
|
||||
MotaActionBlocks['idString_5_e'].xmlText(),
|
||||
MotaActionBlocks['idString_6_e'].xmlText(),
|
||||
MotaActionBlocks['evalString_e'].xmlText(),
|
||||
],
|
||||
'常见事件模板':[
|
||||
'<label text="检测音乐如果没有开启则系统提示开启"></label>',
|
||||
MotaActionFunctions.actionParser.parseList({"type": "if", "condition": "!core.musicStatus.bgmStatus",
|
||||
"true": [
|
||||
"\\t[系统提示]你当前音乐处于关闭状态,本塔开音乐游戏效果更佳"
|
||||
],
|
||||
"false": []
|
||||
}),
|
||||
'<label text="商店购买属性/钥匙"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
{"type": "while", "condition": "true", "data": [
|
||||
{"type": "choices", "text": "\\t[老人,man]少年,你需要钥匙吗?\\n我这里有大把的!",
|
||||
"choices": [
|
||||
{"text": "黄钥匙(\\\${9+flag:shop_times}金币)", "color": [255,255,0,1], "action": [
|
||||
{"type": "if", "condition": "status:money>=9+flag:shop_times",
|
||||
"true": [
|
||||
{"type": "setValue", "name": "status:money", "operator": "-=", "value": "9+flag:shop_times"},
|
||||
{"type": "setValue", "name": "item:yellowKey", "operator": "+=", "value": "1"},
|
||||
],
|
||||
"false": [
|
||||
"\\t[老人,man]你的金钱不足!",
|
||||
{"type": "continue"}
|
||||
]
|
||||
}
|
||||
]},
|
||||
{"text": "蓝钥匙(\\\${18+2*flag:shop_times}金币)", "color": [0,0,255,1], "action": [
|
||||
]},
|
||||
{"text": "离开", "action": [
|
||||
{"type": "break"}
|
||||
]}
|
||||
]
|
||||
},
|
||||
{"type": "setValue", "name": "flag:shop_times", "operator": "+=", "value": "1"}
|
||||
]}], 'event'),
|
||||
'<label text="战前剧情"></label>',
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
"trigger": "action",
|
||||
"displayDamage": true,
|
||||
"data": [
|
||||
' ... 战前剧情',
|
||||
{"type": "battle", "id": "greenSlime"},
|
||||
' ... 战后剧情;请注意上面的强制战斗不会使怪物消失',
|
||||
'需要下一句来调用{"type": "hide"}来隐藏事件',
|
||||
{"type": "hide"},
|
||||
]
|
||||
},'event'),
|
||||
'<label text="打怪掉落道具"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
'怪物变成了黄钥匙(黄钥匙idnum是21)',
|
||||
'打怪变成可对话的NPC: https://ckcz123.github.io/mota-js/#/event?id=%e6%89%93%e6%80%aa%e5%8f%98%e6%88%90%e5%8f%af%e5%af%b9%e8%af%9d%e7%9a%84npc%ef%bc%88%e6%80%aa%e7%89%a9-gtnpc%ef%bc%89',
|
||||
{"type": "setBlock", "number": 21}
|
||||
],'afterBattle'),
|
||||
'<label text="打怪开门"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
{"type": "setValue", "name": "flag:__door__", "operator": "+=", "value": "1"},
|
||||
{"type": "if", "condition": "flag:__door__==2",
|
||||
"true": [
|
||||
{"type": "openDoor", "loc": [10,5]}
|
||||
],
|
||||
"false": []
|
||||
},
|
||||
],'afterBattle'),
|
||||
'<label text="杀死魔龙后隐藏其余图块"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
{"type": "function", "function": "function(){var x=core.status.event.data.x,y=core.status.event.data.y;if(core.isset(x)&&core.isset(y)){core.insertAction([{type:'hide',loc:[[x-1,y-2],[x,y-2],[x+1,y-2],[x-1,y-1],[x,y-1],[x+1,y-1],[x-1,y],[x+1,y]]}]);}}"},
|
||||
],'afterBattle'),
|
||||
'<label text="获得圣水后变成墙"></label>',
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
"trigger": "action",
|
||||
"noPass": true,
|
||||
"data": [
|
||||
{"type": "if", "condition": "flag:hasSuperPotion",
|
||||
"true": [],
|
||||
"false": [
|
||||
{"type":"setValue", "name":"status:hp", "operator": "*=", "value": "2"},
|
||||
{"type":"setBlock", "number": 1},
|
||||
{"type":"setValue", "name":"flag:hasSuperPotion", "value": "true"}
|
||||
]
|
||||
}
|
||||
]
|
||||
},'event'),
|
||||
],
|
||||
'最近使用事件':[
|
||||
'<label text="此处只是占位符,实际定义在editor_blockly.searchBlockCategoryCallback中"></label>',
|
||||
]
|
||||
}
|
||||
var toolboxgap = '<sep gap="5"></sep>'
|
||||
//xml_text = MotaActionFunctions.actionParser.parse(obj,type||'event')
|
||||
//MotaActionBlocks['idString_e'].xmlText()
|
||||
|
||||
for (var name in toolboxObj){
|
||||
var custom = null;
|
||||
if(name=='最近使用事件')custom='searchBlockCategory';
|
||||
getCategory(name,custom).innerHTML = toolboxObj[name].join(toolboxgap);
|
||||
}
|
||||
|
||||
var blocklyArea = document.getElementById('blocklyArea');
|
||||
var blocklyDiv = document.getElementById('blocklyDiv');
|
||||
var workspace = Blockly.inject(blocklyDiv,{
|
||||
media: '_server/blockly/media/',
|
||||
toolbox: document.getElementById('toolbox'),
|
||||
zoom:{
|
||||
controls: true,
|
||||
wheel: false,//滚轮改为上下(shift:左右)翻滚
|
||||
startScale: 1.0,
|
||||
maxScale: 3,
|
||||
minScale: 0.3,
|
||||
scaleSpeed: 1.08
|
||||
},
|
||||
trashcan: false,
|
||||
});
|
||||
|
||||
editor_blockly.searchBlockCategoryCallback = function(workspace) {
|
||||
var xmlList = [];
|
||||
var labels = editor_blockly.searchBlock();
|
||||
for (var i = 0; i < labels.length; i++) {
|
||||
var blockText = '<xml>' +
|
||||
MotaActionBlocks[labels[i]].xmlText() +
|
||||
'</xml>';
|
||||
var block = Blockly.Xml.textToDom(blockText).firstChild;
|
||||
block.setAttribute("gap", 5);
|
||||
xmlList.push(block);
|
||||
}
|
||||
return xmlList;
|
||||
};
|
||||
|
||||
workspace.registerToolboxCategoryCallback(
|
||||
'searchBlockCategory', editor_blockly.searchBlockCategoryCallback);
|
||||
|
||||
var onresize = function(e) {
|
||||
blocklyDiv.style.width = blocklyArea.offsetWidth + 'px';
|
||||
blocklyDiv.style.height = blocklyArea.offsetHeight + 'px';
|
||||
Blockly.svgResize(workspace);
|
||||
};
|
||||
if(typeof editor !== "undefined" && !editor.isMobile)window.addEventListener('resize', onresize, false);
|
||||
onresize();
|
||||
//Blockly.svgResize(workspace);
|
||||
|
||||
//Blockly.bindEventWithChecks_(workspace.svgGroup_,"wheel",workspace,function(e){});
|
||||
document.getElementById('blocklyDiv').onmousewheel = function(e){
|
||||
//console.log(e);
|
||||
e.preventDefault();
|
||||
var hvScroll = e.shiftKey?'hScroll':'vScroll';
|
||||
var mousewheelOffsetValue=20/380*workspace.scrollbar[hvScroll].handleLength_*3;
|
||||
workspace.scrollbar[hvScroll].handlePosition_+=( ((e.deltaY||0)+(e.detail||0)) >0?mousewheelOffsetValue:-mousewheelOffsetValue);
|
||||
workspace.scrollbar[hvScroll].onScroll_();
|
||||
workspace.setScale(workspace.scale);
|
||||
}
|
||||
|
||||
var doubleClickCheck=[[0,'abc']];
|
||||
function omitedcheckUpdateFunction(event) {
|
||||
if(event.type==='create'){
|
||||
editor_blockly.addIntoLastUsedType(event.blockId);
|
||||
}
|
||||
if(event.type==='ui'){
|
||||
var newClick = [new Date().getTime(),event.blockId];
|
||||
var lastClick = doubleClickCheck.shift();
|
||||
doubleClickCheck.push(newClick);
|
||||
if(newClick[0]-lastClick[0]<500){
|
||||
if(newClick[1]===lastClick[1]){
|
||||
editor_blockly.doubleClickBlock(newClick[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(editor_blockly.workspace.topBlocks_.length>=2){
|
||||
codeAreaHL.setValue('入口方块只能有一个');
|
||||
return;
|
||||
}
|
||||
var eventType = document.getElementById('entryType').value;
|
||||
if(editor_blockly.workspace.topBlocks_.length==1){
|
||||
var blockType = editor_blockly.workspace.topBlocks_[0].type;
|
||||
if(blockType!==eventType+'_m'){
|
||||
codeAreaHL.setValue('入口方块类型错误');
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
var code = Blockly.JavaScript.workspaceToCode(workspace).replace(/\\\\(i|c|d|e|z)/g, '\\\\\\\\$1');
|
||||
codeAreaHL.setValue(code);
|
||||
} catch (error) {
|
||||
codeAreaHL.setValue(String(error));
|
||||
if (error instanceof OmitedError){
|
||||
var blockName = error.blockName;
|
||||
var varName = error.varName;
|
||||
var block = error.block;
|
||||
}
|
||||
// console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
workspace.addChangeListener(omitedcheckUpdateFunction);
|
||||
|
||||
workspace.addChangeListener(Blockly.Events.disableOrphans);
|
||||
|
||||
editor_blockly.workspace = workspace;
|
||||
|
||||
MotaActionFunctions.workspace = function(){
|
||||
return editor_blockly.workspace;
|
||||
}
|
||||
|
||||
// 因为在editor_blockly.parse里已经HTML转义过一次了,所以这里要覆盖掉以避免在注释中出现<等
|
||||
MotaActionFunctions.xmlText = function (ruleName,inputs,isShadow,comment) {
|
||||
var rule = MotaActionBlocks[ruleName];
|
||||
var blocktext = isShadow?'shadow':'block';
|
||||
var xmlText = [];
|
||||
xmlText.push('<'+blocktext+' type="'+ruleName+'">');
|
||||
if(!inputs)inputs=[];
|
||||
for (var ii=0,inputType;inputType=rule.argsType[ii];ii++) {
|
||||
var input = inputs[ii];
|
||||
var _input = '';
|
||||
var noinput = (input===null || input===undefined);
|
||||
if(noinput && inputType==='field') continue;
|
||||
if(noinput) input = '';
|
||||
if(inputType!=='field') {
|
||||
var subList = false;
|
||||
var subrulename = rule.args[ii];
|
||||
subrulename=subrulename.split('_').slice(0,-1).join('_');
|
||||
var subrule = MotaActionBlocks[subrulename];
|
||||
if (subrule instanceof Array) {
|
||||
subrulename=subrule[subrule.length-1];
|
||||
subrule = MotaActionBlocks[subrulename];
|
||||
subList = true;
|
||||
}
|
||||
_input = subrule.xmlText([],true);
|
||||
if(noinput && !subList && !isShadow) {
|
||||
//无输入的默认行为是: 如果语句块的备选方块只有一个,直接代入方块
|
||||
input = subrule.xmlText();
|
||||
}
|
||||
}
|
||||
xmlText.push('<'+inputType+' name="'+rule.args[ii]+'">');
|
||||
xmlText.push(_input+input);
|
||||
xmlText.push('</'+inputType+'>');
|
||||
}
|
||||
if(comment){
|
||||
xmlText.push('<comment>');
|
||||
xmlText.push(comment);
|
||||
xmlText.push('</comment>');
|
||||
}
|
||||
var next = inputs[rule.args.length];
|
||||
if (next) {//next
|
||||
xmlText.push('<next>');
|
||||
xmlText.push(next);
|
||||
xmlText.push('</next>');
|
||||
}
|
||||
xmlText.push('</'+blocktext+'>');
|
||||
return xmlText.join('');
|
||||
}
|
||||
})();
|
||||
`;
|
||||
/////////////////initscript end /////////////////////////////
|
||||
var editor_blockly = {entryType:'event'};
|
||||
|
||||
editor.uivalues.disableBlocklyReplace = editor.config.get("disableBlocklyReplace", false);
|
||||
var replaceCheckbox = document.getElementById('blocklyReplace');
|
||||
@ -495,6 +13,16 @@ function omitedcheckUpdateFunction(event) {
|
||||
alert("已" + (replaceCheckbox.checked ? "开启" : "关闭") + "中文变量名替换!\n关闭并重开事件编辑器以生效。");
|
||||
}
|
||||
|
||||
editor.uivalues.disableBlocklyExpandCompare = editor.config.get("disableBlocklyExpandCompare", false);
|
||||
var expandCompareCheckbox = document.getElementById('blocklyExpandCompare');
|
||||
expandCompareCheckbox.checked = !editor.uivalues.disableBlocklyExpandCompare;
|
||||
|
||||
editor_blockly.triggerExpandCompare = function () {
|
||||
editor.uivalues.disableBlocklyExpandCompare = !expandCompareCheckbox.checked;
|
||||
editor.config.set("disableBlocklyExpandCompare", !expandCompareCheckbox.checked);
|
||||
if (MotaActionFunctions) MotaActionFunctions.disableExpandCompare = !expandCompareCheckbox.checked;
|
||||
}
|
||||
|
||||
var input_ = '';
|
||||
editor_blockly.runOne = function () {
|
||||
//var printf = console.log;
|
||||
@ -511,8 +39,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
|
||||
|
||||
var script = document.createElement('script');
|
||||
//var initscript = document.getElementById('initscript').innerText;
|
||||
script.innerHTML = converter.mainFile[5] + initscript;
|
||||
script.innerHTML = converter.mainFile[5] + editor_blocklyconfig;
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
@ -525,17 +52,24 @@ function omitedcheckUpdateFunction(event) {
|
||||
input_ = xhr.responseText;
|
||||
editor_blockly.runOne();
|
||||
MotaActionFunctions.disableReplace = editor.uivalues.disableBlocklyReplace;
|
||||
MotaActionFunctions.disableExpandCompare = editor.uivalues.disableBlocklyExpandCompare;
|
||||
}
|
||||
xhr.open('GET', '_server/MotaAction.g4', true);
|
||||
xhr.send(null);
|
||||
|
||||
codeAreaHL = CodeMirror.fromTextArea(document.getElementById("codeArea"), {
|
||||
var codeAreaHL = CodeMirror.fromTextArea(document.getElementById("codeArea"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
lineWrapping: true,
|
||||
continueComments: "Enter",
|
||||
extraKeys: {"Ctrl-Q": "toggleComment"}
|
||||
extraKeys: {"Ctrl-Q": "toggleComment"},
|
||||
});
|
||||
codeAreaHL.on('changes', function () {
|
||||
editor_blockly.highlightParse(!changeFromBlockly);
|
||||
changeFromBlockly = false;
|
||||
});
|
||||
var changeFromBlockly = false;
|
||||
var shouldNotifyParse = false;
|
||||
|
||||
editor_blockly.showXML = function () {
|
||||
var xml = Blockly.Xml.workspaceToDom(editor_blockly.workspace);
|
||||
@ -561,12 +95,17 @@ function omitedcheckUpdateFunction(event) {
|
||||
}
|
||||
}
|
||||
|
||||
editor_blockly.setValue = function (value) {
|
||||
changeFromBlockly = true;
|
||||
codeAreaHL.setValue(value);
|
||||
}
|
||||
|
||||
editor_blockly.parse = function () {
|
||||
MotaActionFunctions.parse(
|
||||
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g, function (c) {
|
||||
return {'<': '<', '>': '>', '&': '&'}[c];
|
||||
}).replace(/\\(r|f|i|c|d|e|z)/g,'\\\\$1')),
|
||||
document.getElementById('entryType').value
|
||||
editor_blockly.entryType
|
||||
);
|
||||
}
|
||||
|
||||
@ -580,8 +119,8 @@ function omitedcheckUpdateFunction(event) {
|
||||
var type = args.type;
|
||||
if (!type) return false;
|
||||
editor_blockly.id = id_;
|
||||
codeAreaHL.setValue(input.value);
|
||||
document.getElementById('entryType').value = type;
|
||||
editor_blockly.setValue(input.value);
|
||||
editor_blockly.entryType = type;
|
||||
editor_blockly.parse();
|
||||
editor_blockly.show();
|
||||
return true;
|
||||
@ -604,6 +143,13 @@ function omitedcheckUpdateFunction(event) {
|
||||
}
|
||||
}
|
||||
|
||||
var blocklyParseBtn = document.getElementById('blocklyParse');
|
||||
editor_blockly.highlightParse = function (shouldHighLight) {
|
||||
if (shouldNotifyParse == shouldHighLight) return;
|
||||
shouldNotifyParse = shouldHighLight;
|
||||
blocklyParseBtn.style.background = shouldNotifyParse ? '#FFCCAA' : 'unset';
|
||||
}
|
||||
|
||||
editor_blockly.cancel = function () {
|
||||
editor_blockly.id = '';
|
||||
editor_blockly.hide();
|
||||
@ -614,15 +160,19 @@ function omitedcheckUpdateFunction(event) {
|
||||
editor_blockly.id = '';
|
||||
return;
|
||||
}
|
||||
if(editor_blockly.workspace.topBlocks_.length>=2){
|
||||
codeAreaHL.setValue('入口方块只能有一个');
|
||||
if (shouldNotifyParse) {
|
||||
alert('你尚未解析修改后的内容,请进行解析或放弃操作');
|
||||
return;
|
||||
}
|
||||
var eventType = document.getElementById('entryType').value;
|
||||
if(editor_blockly.workspace.topBlocks_.length>=2){
|
||||
editor_blockly.setValue('入口方块只能有一个');
|
||||
return;
|
||||
}
|
||||
var eventType = editor_blockly.entryType;
|
||||
if(editor_blockly.workspace.topBlocks_.length==1){
|
||||
var blockType = editor_blockly.workspace.topBlocks_[0].type;
|
||||
if(blockType!==eventType+'_m'){
|
||||
codeAreaHL.setValue('入口方块类型错误');
|
||||
editor_blockly.setValue('入口方块类型错误');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -681,14 +231,8 @@ function omitedcheckUpdateFunction(event) {
|
||||
}
|
||||
|
||||
var previewBlock = function (b) {
|
||||
var types = [
|
||||
"previewUI_s", "clearMap_s", "clearMap_1_s", "setAttribute_s", "fillText_s",
|
||||
"fillBoldText_s", "fillRect_s", "strokeRect_s", "drawLine_s",
|
||||
"drawArrow_s", "fillPolygon_s", "strokePolygon_s", "fillCircle_s", "strokeCircle_s",
|
||||
"drawImage_s", "drawImage_1_s", "drawIcon_s", "drawBackground_s", "drawSelector_s", "drawSelector_1_s",
|
||||
"waitContext_2"
|
||||
];
|
||||
if (b && types.indexOf(b.type)>=0) {
|
||||
|
||||
if (b && MotaActionBlocks[b.type].previewBlock) {
|
||||
try {
|
||||
var code = "[" + Blockly.JavaScript.blockToCode(b).replace(/\\(i|c|d|e|z)/g, '\\\\$1') + "]";
|
||||
eval("var obj="+code);
|
||||
@ -714,30 +258,17 @@ function omitedcheckUpdateFunction(event) {
|
||||
|
||||
if (previewBlock(b)) return;
|
||||
|
||||
if (b && b.type in selectPointBlocks) { // selectPoint
|
||||
if (b && MotaActionBlocks[b.type].selectPoint) { // selectPoint
|
||||
this.selectPoint();
|
||||
return;
|
||||
}
|
||||
|
||||
var textStringDict = {
|
||||
'text_0_s': 'EvalString_0',
|
||||
'text_1_s': 'EvalString_2',
|
||||
'autoText_s': 'EvalString_2',
|
||||
'scrollText_s': 'EvalString_0',
|
||||
'comment_s': 'EvalString_0',
|
||||
'choices_s': 'EvalString_0',
|
||||
'showTextImage_s': 'EvalString_0',
|
||||
'function_s': 'RawEvalString_0',
|
||||
'shopsub': 'EvalString_1',
|
||||
'confirm_s': 'EvalString_0',
|
||||
'drawTextContent_s': 'EvalString_0',
|
||||
}
|
||||
var f = b ? textStringDict[b.type] : null;
|
||||
var f = b ? MotaActionBlocks[b.type].doubleclicktext : null;
|
||||
if (f) {
|
||||
var value = b.getFieldValue(f);
|
||||
//多行编辑
|
||||
editor_multi.multiLineEdit(value, b, f, {'lint': f === 'RawEvalString_0'}, function (newvalue, b, f) {
|
||||
if (textStringDict[b.type] !== 'RawEvalString_0') {
|
||||
if (MotaActionBlocks[b.type].doubleclicktext !== 'RawEvalString_0') {
|
||||
}
|
||||
b.setFieldValue(newvalue.split('\n').join('\\n'), f);
|
||||
});
|
||||
@ -824,37 +355,11 @@ function omitedcheckUpdateFunction(event) {
|
||||
|
||||
// ------ select point ------
|
||||
|
||||
// id: [x, y, floorId, forceFloor]
|
||||
var selectPointBlocks = {
|
||||
"changeFloor_m": ["Number_0", "Number_1", "IdString_0", true],
|
||||
"jumpHero_s": ["PosString_0", "PosString_1"],
|
||||
"changeFloor_s": ["Number_0", "Number_1", "IdString_0", true],
|
||||
"changePos_s": ["PosString_0", "PosString_1"],
|
||||
"battle_1_s": ["PosString_0", "PosString_1"],
|
||||
"openDoor_s": ["PosString_0", "PosString_1", "IdString_0"],
|
||||
"closeDoor_s": ["PosString_0", "PosString_1"],
|
||||
"show_s": ["EvalString_0", "EvalString_1", "IdString_0"],
|
||||
"hide_s": ["EvalString_0", "EvalString_1", "IdString_0"],
|
||||
"setBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
|
||||
"turnBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
|
||||
"move_s": ["PosString_0", "PosString_1"],
|
||||
"jump_s": ["PosString_2", "PosString_3"], // 跳跃暂时只考虑终点
|
||||
"showBgFgMap_s": ["EvalString_0", "EvalString_1", "IdString_0"],
|
||||
"hideBgFgMap_s": ["EvalString_0", "EvalString_1", "IdString_0"],
|
||||
"setBgFgBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
|
||||
"showFloorImg_s": ["EvalString_0", "EvalString_1", "IdString_0"],
|
||||
"hideFloorImg_s": ["EvalString_0", "EvalString_1", "IdString_0"],
|
||||
"trigger_s": ["PosString_0", "PosString_1"],
|
||||
"insert_2_s": ["PosString_0", "PosString_1", "IdString_0"],
|
||||
"animate_s": ["EvalString_0", "EvalString_0"],
|
||||
"setViewport_s": ["PosString_0", "PosString_1"]
|
||||
}
|
||||
|
||||
editor_blockly.selectPoint = function () {
|
||||
var block = Blockly.selected, arr = null;
|
||||
var floorId = editor.currentFloorId, pos = editor.pos, x = pos.x, y = pos.y;
|
||||
if (block != null && block.type in selectPointBlocks) {
|
||||
arr = selectPointBlocks[block.type];
|
||||
if (block != null && MotaActionBlocks[block.type].selectPoint) {
|
||||
arr = eval(MotaActionBlocks[block.type].selectPoint);
|
||||
var xv = parseInt(block.getFieldValue(arr[0])), yv = parseInt(block.getFieldValue(arr[1]));
|
||||
if (block.type == 'animate_s') {
|
||||
var v = block.getFieldValue(arr[0]).split(",");
|
||||
@ -922,7 +427,13 @@ function omitedcheckUpdateFunction(event) {
|
||||
return one != token && one.startsWith(token);
|
||||
}).sort();
|
||||
} else if (before.endsWith("怪物") || (ch == ':' && before.endsWith("enemy"))) {
|
||||
return Object.keys(core.material.enemys).filter(function (one) {
|
||||
var list = Object.keys(core.material.enemys);
|
||||
if (before.endsWith("怪物") && MotaActionFunctions) {
|
||||
list = MotaActionFunctions.pattern.replaceEnemyList.map(function (v) {
|
||||
return v[1];
|
||||
}).concat(list);
|
||||
}
|
||||
return list.filter(function (one) {
|
||||
return one != token && one.startsWith(token);
|
||||
})
|
||||
} else {
|
||||
@ -933,7 +444,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
if (before.endsWith("怪物") || (ch == ':' && ch2 == ':' && before.endsWith("enemy"))) {
|
||||
var list = ["name", "hp", "atk", "def", "money", "exp", "point", "special"];
|
||||
if (before.endsWith("怪物") && MotaActionFunctions) {
|
||||
list = MotaActionFunctions.pattern.replaceEnemyList.map(function (v) {
|
||||
list = MotaActionFunctions.pattern.replaceEnemyValueList.map(function (v) {
|
||||
return v[1];
|
||||
}).concat(list);
|
||||
}
|
||||
@ -980,19 +491,32 @@ function omitedcheckUpdateFunction(event) {
|
||||
}).sort();
|
||||
}
|
||||
|
||||
var allIds = core.getAllIconIds();
|
||||
var allIconIds = allIds.concat(Object.keys(core.statusBar.icons).filter(function (x) {
|
||||
var namesObj={};
|
||||
|
||||
namesObj.allIds = ["this"].concat(core.getAllIconIds());
|
||||
namesObj.allIconIds = namesObj.allIds.concat(Object.keys(core.statusBar.icons).filter(function (x) {
|
||||
|
||||
return core.statusBar.icons[x] instanceof Image;
|
||||
}));
|
||||
var allImages = Object.keys(core.material.images.images);
|
||||
var allEnemys = Object.keys(core.material.enemys);
|
||||
var allItems = Object.keys(core.material.items);
|
||||
var allAnimates = Object.keys(core.material.animates);
|
||||
var allBgms = Object.keys(core.material.bgms);
|
||||
var allSounds = Object.keys(core.material.sounds);
|
||||
var allShops = Object.keys(core.status.shops);
|
||||
var allFloorIds = core.floorIds;
|
||||
var allColors = ["aqua(青色)", "black(黑色)", "blue(蓝色)", "fuchsia(品红色)", "gray(灰色)", "green(深绿色)", "lime(绿色)",
|
||||
namesObj.allImages = Object.keys(core.material.images.images);
|
||||
namesObj.allEnemys = Object.keys(core.material.enemys);
|
||||
if (MotaActionFunctions && !MotaActionFunctions.disableReplace) {
|
||||
namesObj.allEnemys = namesObj.allEnemys.concat(MotaActionFunctions.pattern.replaceEnemyList.map(function (x) {
|
||||
return x[1];
|
||||
}))
|
||||
}
|
||||
namesObj.allItems = Object.keys(core.material.items);
|
||||
if (MotaActionFunctions && !MotaActionFunctions.disableReplace) {
|
||||
namesObj.allItems = namesObj.allItems.concat(MotaActionFunctions.pattern.replaceItemList.map(function (x) {
|
||||
return x[1];
|
||||
}))
|
||||
}
|
||||
namesObj.allAnimates = Object.keys(core.material.animates);
|
||||
namesObj.allBgms = Object.keys(core.material.bgms);
|
||||
namesObj.allSounds = Object.keys(core.material.sounds);
|
||||
namesObj.allShops = Object.keys(core.status.shops);
|
||||
namesObj.allFloorIds = core.floorIds;
|
||||
namesObj.allColors = ["aqua(青色)", "black(黑色)", "blue(蓝色)", "fuchsia(品红色)", "gray(灰色)", "green(深绿色)", "lime(绿色)",
|
||||
"maroon(深红色)", "navy(深蓝色)", "gold(金色)", "olive(黄褐色)", "orange(橙色)", "purple(品红色)",
|
||||
"red(红色)", "silver(淡灰色)", "teal(深青色)", "white(白色)", "yellow(黄色)"];
|
||||
var filter = function (list, content) {
|
||||
@ -1002,56 +526,18 @@ function omitedcheckUpdateFunction(event) {
|
||||
}
|
||||
|
||||
// 对任意图块提供补全
|
||||
if ((type == 'text_1_s' && name == 'EvalString_1') || (type == 'autoText_s' && name == 'EvalString_1')
|
||||
|| (type == 'choices_s' && name == 'IdString_0') || (type == 'choicesContext' && name == 'IdString_0')
|
||||
|| (type == 'closeDoor_s' && name == 'IdString_0') || (type == 'setBlock_s' && name == 'EvalString_0')
|
||||
|| (type == 'setBgFgBlock_s' && name == 'EvalString_0') || (type == 'drawIcon_s' && name == 'IdString_0')
|
||||
|| (type == 'shopsub' && name == 'IdString_1') || (type == 'shopChoices' && name == 'IdString_0')) {
|
||||
return filter(allIds, content);
|
||||
}
|
||||
|
||||
// 对怪物ID提供补全
|
||||
if ((type == 'idString_3_e' || type == 'battle_s' || type == 'setEnemy_s') && name == 'IdString_0') {
|
||||
return filter(allEnemys, content);
|
||||
}
|
||||
|
||||
// 对道具ID进行补全
|
||||
if ((type == 'useItem_s' || type == 'loadEquip_s') && name == 'IdString_0') {
|
||||
return filter(allItems, content);
|
||||
}
|
||||
|
||||
// 对图片名进行补全
|
||||
if ((type == 'showImage_s' || type == 'showImage_1_s' || type == 'showGif_s' || type == 'setHeroIcon_s'
|
||||
|| type == 'follow_s' || type == 'unfollow_s' || type == 'drawImage_s' || type == 'drawImage_1_s') && name == 'EvalString_0') {
|
||||
return filter(allImages, content);
|
||||
}
|
||||
|
||||
// 对动画进行补全
|
||||
if (type == 'animate_s' && name == 'IdString_0') {
|
||||
return filter(allAnimates, content);
|
||||
}
|
||||
|
||||
// 对音乐进行补全
|
||||
if ((type == 'playBgm_s' || type == 'loadBgm_s' || type == 'freeBgm_s') && name == 'EvalString_0') {
|
||||
return filter(allBgms, content);
|
||||
}
|
||||
|
||||
// 对音效进行补全
|
||||
if (type == 'playSound_s' && name == 'EvalString_0') {
|
||||
return filter(allSounds, content);
|
||||
}
|
||||
|
||||
// 对全局商店进行补全
|
||||
if ((type == 'openShop_s' || type == 'disableShop_s') && name == 'IdString_0') {
|
||||
return filter(allShops, content);
|
||||
}
|
||||
|
||||
// 对楼层名进行补全
|
||||
if ((type == 'setFloor_s' || type == 'show_s' || type == 'hide_s' || type == 'insert_2_s'
|
||||
|| type == 'setBlock_s' || type == 'turnBlock_s' || type == 'showFloorImg_s' || type == 'hideFloorImg_s'
|
||||
|| type == 'showBgFgMap_s' || type == 'hideBgFgMap_s' || type == 'setBgFgBlock_s'
|
||||
|| type == 'openDoor_s' || type == 'changeFloor_m') && name == "IdString_0") {
|
||||
return filter(allFloorIds, content);
|
||||
for(var ii=0,names;names=['allIds','allEnemys','allItems','allImages','allAnimates','allBgms','allSounds','allShops','allFloorIds'][ii];ii++){
|
||||
if (MotaActionBlocks[type][names] && eval(MotaActionBlocks[type][names]).indexOf(name)!==-1) {
|
||||
return filter(namesObj[names], content);
|
||||
}
|
||||
}
|
||||
|
||||
// 对\f进行自动补全
|
||||
@ -1060,7 +546,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
if (content.charAt(index) == '\\') index++;
|
||||
var after = content.substring(index + 2);
|
||||
if (after.indexOf(",") < 0 && after.indexOf("]") < 0) {
|
||||
return filter(allImages, after);
|
||||
return filter(namesObj.allImages, after);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1069,7 +555,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
if (index >= 0) {
|
||||
var after = content.substring(index + 3);
|
||||
if (after.indexOf("]") < 0) {
|
||||
return filter(allIconIds, after);
|
||||
return filter(namesObj.allIconIds, after);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1079,7 +565,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
if (content.charAt(index) == '\\') index++;
|
||||
var after = content.substring(index + 2);
|
||||
if (after.indexOf("]") < 0) {
|
||||
return filter(allColors, after);
|
||||
return filter(namesObj.allColors, after);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1109,7 +595,7 @@ Blockly.FieldColour.prototype.createWidget_ = function() {
|
||||
var getValue=function(){
|
||||
// return self.getValue() // css颜色
|
||||
var f = pb.getFieldValue(targetf);
|
||||
if (/^(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)?$/.test(f)) {
|
||||
if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(f)) {
|
||||
return f;
|
||||
}
|
||||
return "";
|
||||
@ -1126,9 +612,8 @@ Blockly.FieldColour.prototype.createWidget_ = function() {
|
||||
|
||||
setTimeout(function () {
|
||||
document.getElementById("colorPicker").value = getValue();
|
||||
window.jsColorPicker.confirm = setValue;
|
||||
// 设置位置
|
||||
triggerColorPicker(Blockly.WidgetDiv.DIV.style.left, Blockly.WidgetDiv.DIV.style.top);
|
||||
openColorPicker(Blockly.WidgetDiv.DIV.style.left.replace(/[^\d.]/g, ''), Blockly.WidgetDiv.DIV.style.top.replace(/[^\d.]/g, ''), setValue);
|
||||
});
|
||||
|
||||
return document.createElement('table');
|
||||
@ -1171,7 +656,7 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) {
|
||||
// 给inputDom绑事件
|
||||
inputDom.oninput=function(){
|
||||
var value=inputDom.value
|
||||
if(/[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?/.test(value)){
|
||||
if(/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(value)){
|
||||
setValue('rgba('+value+')')
|
||||
}
|
||||
}
|
||||
|
||||
520
_server/editor_blocklyconfig.js
Normal file
@ -0,0 +1,520 @@
|
||||
editor_blocklyconfig=(function(){
|
||||
// start mark sfergsvae
|
||||
|
||||
|
||||
|
||||
(function(){
|
||||
var getCategory = function(name,custom){
|
||||
for(var node of document.getElementById('toolbox').children) {
|
||||
if(node.getAttribute('name')==name) return node;
|
||||
}
|
||||
var node = document.createElement('category');
|
||||
node.setAttribute('name',name);
|
||||
if(custom)node.setAttribute('custom',custom);
|
||||
document.getElementById('toolbox').appendChild(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
var toolboxObj = {
|
||||
'入口方块':[
|
||||
'<label text="入口方块会根据当前类型在此数组中筛选,具体控制在editor_blockly.entranceCategoryCallback中"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
"欢迎使用事件编辑器",
|
||||
"本事件触发一次后会消失",
|
||||
{"type": "hide", "time": 500},
|
||||
],'event'),
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
"condition": "flag:__door__==2",
|
||||
"currentFloor": true,
|
||||
"priority": 0,
|
||||
"delayExecute": false,
|
||||
"multiExecute": false,
|
||||
"data": [
|
||||
{"type": "openDoor", "loc": [10,5]}
|
||||
],
|
||||
},'autoEvent'),
|
||||
MotaActionBlocks['changeFloor_m'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parse([{
|
||||
"id": "shop1",
|
||||
"text": "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
|
||||
"textInList": "1F金币商店",
|
||||
"choices": [
|
||||
{"text": "生命+800", "need": "status:money>=20+2*flag:shop1", "action": [
|
||||
{"type": "comment", "text": "新版商店中需要手动扣减金币和增加访问次数"},
|
||||
{"type": "setValue", "name": "status:money", "operator": "-=", "value": "20+2*flag:shop1"},
|
||||
{"type": "setValue", "name": "flag:shop1", "operator": "+=", "value": "1"},
|
||||
{"type": "setValue", "name": "status:hp", "operator": "+=", "value": "800"}
|
||||
]}
|
||||
]
|
||||
},{
|
||||
"id": "itemShop",
|
||||
"item": true,
|
||||
"textInList": "道具商店",
|
||||
"choices": [
|
||||
{"id": "yellowKey", "number": 10, "money": 10}
|
||||
]
|
||||
},{
|
||||
"id": "keyShop1",
|
||||
"textInList": "回收钥匙商店",
|
||||
"commonEvent": "回收钥匙商店",
|
||||
"args": ""
|
||||
}],'shop'),
|
||||
MotaActionBlocks['afterBattle_m'].xmlText(),
|
||||
MotaActionBlocks['afterGetItem_m'].xmlText(),
|
||||
MotaActionBlocks['afterOpenDoor_m'].xmlText(),
|
||||
MotaActionBlocks['firstArrive_m'].xmlText(),
|
||||
MotaActionBlocks['eachArrive_m'].xmlText(),
|
||||
MotaActionBlocks['level_m'].xmlText(),
|
||||
MotaActionBlocks['commonEvent_m'].xmlText(),
|
||||
MotaActionBlocks['item_m'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
{"title":"简单", "name": "Easy", "hard": 1, "action": [
|
||||
{"type": "comment", "text": "在这里写该难度需执行的事件"}
|
||||
]}
|
||||
], 'levelChoose'),
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
"type": 0, "value": {"atk": 10}, "percentage": {"speed": 10},
|
||||
}, 'equip'),
|
||||
MotaActionFunctions.actionParser.parse([{
|
||||
"name": "bg.jpg", "x": 0, "y": 0, "canvas": "bg"
|
||||
}], 'floorImage'),
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
"time": 160, "openSound": "door.mp3", "closeSound": "door.mp3", "keys": {"yellowKey": 1, "orangeKey": 1}
|
||||
}, 'doorInfo'),
|
||||
MotaActionBlocks['faceIds_m'].xmlText(),
|
||||
MotaActionBlocks['mainStyle_m'].xmlText(),
|
||||
],
|
||||
'显示文字':[
|
||||
MotaActionBlocks['text_0_s'].xmlText(),
|
||||
MotaActionBlocks['text_1_s'].xmlText(),
|
||||
MotaActionBlocks['comment_s'].xmlText(),
|
||||
MotaActionBlocks['autoText_s'].xmlText(),
|
||||
MotaActionBlocks['scrollText_s'].xmlText(),
|
||||
MotaActionBlocks['setText_s'].xmlText(),
|
||||
MotaActionBlocks['showImage_s'].xmlText(),
|
||||
MotaActionBlocks['showImage_1_s'].xmlText(),
|
||||
MotaActionBlocks['hideImage_s'].xmlText(),
|
||||
MotaActionBlocks['showTextImage_s'].xmlText(),
|
||||
MotaActionBlocks['moveImage_s'].xmlText(),
|
||||
MotaActionBlocks['showGif_s'].xmlText(),
|
||||
MotaActionBlocks['tip_s'].xmlText(),
|
||||
MotaActionBlocks['win_s'].xmlText(),
|
||||
MotaActionBlocks['lose_s'].xmlText(),
|
||||
MotaActionBlocks['restart_s'].xmlText(),
|
||||
MotaActionBlocks['confirm_s'].xmlText(),
|
||||
MotaActionBlocks['choices_s'].xmlText([
|
||||
'选择剑或者盾','流浪者','man',0,MotaActionBlocks['choicesContext'].xmlText([
|
||||
'剑','','',null,'',MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [3,3]}]),
|
||||
])
|
||||
]),
|
||||
],
|
||||
'数据相关':[
|
||||
MotaActionBlocks['setValue_s'].xmlText([
|
||||
MotaActionBlocks['idIdList_e'].xmlText(['status','生命']), '=', '', false
|
||||
]),
|
||||
MotaActionBlocks['setEnemy_s'].xmlText(),
|
||||
MotaActionBlocks['setFloor_s'].xmlText(),
|
||||
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
|
||||
MotaActionBlocks['setGlobalValue_s'].xmlText(),
|
||||
MotaActionBlocks['setGlobalFlag_s'].xmlText(),
|
||||
MotaActionBlocks['input_s'].xmlText(),
|
||||
MotaActionBlocks['input2_s'].xmlText(),
|
||||
MotaActionBlocks['update_s'].xmlText(),
|
||||
MotaActionBlocks['moveAction_s'].xmlText(),
|
||||
MotaActionBlocks['moveHero_s'].xmlText(),
|
||||
MotaActionBlocks['jumpHero_s'].xmlText(),
|
||||
MotaActionBlocks['changeFloor_s'].xmlText(),
|
||||
MotaActionBlocks['changePos_s'].xmlText(),
|
||||
MotaActionBlocks['battle_s'].xmlText(),
|
||||
MotaActionBlocks['useItem_s'].xmlText(),
|
||||
MotaActionBlocks['loadEquip_s'].xmlText(),
|
||||
MotaActionBlocks['unloadEquip_s'].xmlText(),
|
||||
MotaActionBlocks['openShop_s'].xmlText(),
|
||||
MotaActionBlocks['disableShop_s'].xmlText(),
|
||||
MotaActionBlocks['setHeroIcon_s'].xmlText(),
|
||||
MotaActionBlocks['follow_s'].xmlText(),
|
||||
MotaActionBlocks['unfollow_s'].xmlText(),
|
||||
],
|
||||
'地图处理':[
|
||||
MotaActionBlocks['battle_1_s'].xmlText(),
|
||||
MotaActionBlocks['openDoor_s'].xmlText(),
|
||||
MotaActionBlocks['closeDoor_s'].xmlText(),
|
||||
MotaActionBlocks['show_s'].xmlText(),
|
||||
MotaActionBlocks['hide_s'].xmlText(),
|
||||
MotaActionBlocks['setBlock_s'].xmlText(),
|
||||
MotaActionBlocks['turnBlock_s'].xmlText(),
|
||||
MotaActionBlocks['move_s'].xmlText(),
|
||||
MotaActionBlocks['jump_s'].xmlText(),
|
||||
MotaActionBlocks['showBgFgMap_s'].xmlText(),
|
||||
MotaActionBlocks['hideBgFgMap_s'].xmlText(),
|
||||
MotaActionBlocks['setBgFgBlock_s'].xmlText(),
|
||||
MotaActionBlocks['showFloorImg_s'].xmlText(),
|
||||
MotaActionBlocks['hideFloorImg_s'].xmlText(),
|
||||
],
|
||||
'事件控制':[
|
||||
MotaActionBlocks['if_1_s'].xmlText(),
|
||||
MotaActionBlocks['if_s'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parseList({"type": "switch", "condition": "判别值", "caseList": [
|
||||
{"action": [{"type": "comment", "text": "当判别值是值的场合执行此事件"}]},
|
||||
{"case": "default", "action": [{"type": "comment", "text": "当没有符合的值的场合执行default事件"}]},
|
||||
]}),
|
||||
MotaActionFunctions.actionParser.parseList({"type": "for", "name": "temp:A", "from": "0", "to": "12", "step": "1", "data": []}),
|
||||
MotaActionFunctions.actionParser.parseList({"type": "forEach", "name": "temp:A", "list": ["status:atk","status:def"], "data": []}),
|
||||
MotaActionBlocks['while_s'].xmlText(),
|
||||
MotaActionBlocks['dowhile_s'].xmlText(),
|
||||
MotaActionBlocks['break_s'].xmlText(),
|
||||
MotaActionBlocks['continue_s'].xmlText(),
|
||||
MotaActionBlocks['exit_s'].xmlText(),
|
||||
MotaActionBlocks['trigger_s'].xmlText(),
|
||||
MotaActionBlocks['insert_1_s'].xmlText(),
|
||||
MotaActionBlocks['insert_2_s'].xmlText(),
|
||||
],
|
||||
'特效/声音':[
|
||||
MotaActionBlocks['sleep_s'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parseList({"type": "wait", "timeout": 0, "data": [
|
||||
{"case": "keyboard", "keycode": "13,32", "action": [{"type": "comment", "text": "当按下回车(keycode=13)或空格(keycode=32)时执行此事件"}]},
|
||||
{"case": "mouse", "px": [0,32], "py": [0,32], "action": [{"type": "comment", "text": "当点击地图左上角时执行此事件"}]},
|
||||
]}),
|
||||
MotaActionBlocks['waitAsync_s'].xmlText(),
|
||||
MotaActionBlocks['vibrate_s'].xmlText(),
|
||||
MotaActionBlocks['animate_s'].xmlText(),
|
||||
MotaActionBlocks['setViewport_s'].xmlText(),
|
||||
MotaActionBlocks['moveViewport_s'].xmlText(),
|
||||
MotaActionBlocks['showStatusBar_s'].xmlText(),
|
||||
MotaActionBlocks['hideStatusBar_s'].xmlText(),
|
||||
MotaActionBlocks['showHero_s'].xmlText(),
|
||||
MotaActionBlocks['hideHero_s'].xmlText(),
|
||||
MotaActionBlocks['setCurtain_0_s'].xmlText(),
|
||||
MotaActionBlocks['setCurtain_1_s'].xmlText(),
|
||||
MotaActionBlocks['screenFlash_s'].xmlText(),
|
||||
MotaActionBlocks['setWeather_s'].xmlText(),
|
||||
MotaActionBlocks['playBgm_s'].xmlText(),
|
||||
MotaActionBlocks['pauseBgm_s'].xmlText(),
|
||||
MotaActionBlocks['resumeBgm_s'].xmlText(),
|
||||
MotaActionBlocks['loadBgm_s'].xmlText(),
|
||||
MotaActionBlocks['freeBgm_s'].xmlText(),
|
||||
MotaActionBlocks['playSound_s'].xmlText(),
|
||||
MotaActionBlocks['stopSound_s'].xmlText(),
|
||||
MotaActionBlocks['setVolume_s'].xmlText(),
|
||||
MotaActionBlocks['callBook_s'].xmlText(),
|
||||
MotaActionBlocks['callSave_s'].xmlText(),
|
||||
MotaActionBlocks['autoSave_s'].xmlText(),
|
||||
MotaActionBlocks['callLoad_s'].xmlText(),
|
||||
],
|
||||
'UI绘制':[
|
||||
MotaActionBlocks['previewUI_s'].xmlText(),
|
||||
MotaActionBlocks['clearMap_s'].xmlText(),
|
||||
MotaActionBlocks['clearMap_1_s'].xmlText(),
|
||||
MotaActionBlocks['setAttribute_s'].xmlText(),
|
||||
MotaActionBlocks['fillText_s'].xmlText(),
|
||||
MotaActionBlocks['fillBoldText_s'].xmlText(),
|
||||
MotaActionBlocks['drawTextContent_s'].xmlText(),
|
||||
MotaActionBlocks['fillRect_s'].xmlText(),
|
||||
MotaActionBlocks['strokeRect_s'].xmlText(),
|
||||
MotaActionBlocks['drawLine_s'].xmlText(),
|
||||
MotaActionBlocks['drawArrow_s'].xmlText(),
|
||||
MotaActionBlocks['fillPolygon_s'].xmlText(),
|
||||
MotaActionBlocks['strokePolygon_s'].xmlText(),
|
||||
MotaActionBlocks['fillEllipse_s'].xmlText(),
|
||||
MotaActionBlocks['strokeEllipse_s'].xmlText(),
|
||||
MotaActionBlocks['fillArc_s'].xmlText(),
|
||||
MotaActionBlocks['strokeArc_s'].xmlText(),
|
||||
MotaActionBlocks['drawImage_s'].xmlText(),
|
||||
MotaActionBlocks['drawImage_1_s'].xmlText(),
|
||||
MotaActionBlocks['drawIcon_s'].xmlText(),
|
||||
MotaActionBlocks['drawBackground_s'].xmlText(),
|
||||
MotaActionBlocks['drawSelector_s'].xmlText(),
|
||||
MotaActionBlocks['drawSelector_1_s'].xmlText(),
|
||||
],
|
||||
'原生脚本':[
|
||||
MotaActionBlocks['function_s'].xmlText(),
|
||||
MotaActionBlocks['unknown_s'].xmlText(),
|
||||
],
|
||||
'值块':[
|
||||
MotaActionBlocks['setValue_s'].xmlText([
|
||||
MotaActionBlocks['idIdList_e'].xmlText(['status','生命']), '=', '', false
|
||||
]),
|
||||
MotaActionBlocks['expression_arithmetic_0'].xmlText(),
|
||||
MotaActionBlocks['idFlag_e'].xmlText(),
|
||||
MotaActionBlocks['idTemp_e'].xmlText(),
|
||||
MotaActionBlocks['negate_e'].xmlText(),
|
||||
MotaActionBlocks['bool_e'].xmlText(),
|
||||
MotaActionBlocks['idString_e'].xmlText(),
|
||||
MotaActionBlocks['idIdList_e'].xmlText(),
|
||||
MotaActionBlocks['idFixedList_e'].xmlText(),
|
||||
MotaActionBlocks['enemyattr_e'].xmlText(),
|
||||
MotaActionBlocks['blockId_e'].xmlText(),
|
||||
MotaActionBlocks['blockCls_e'].xmlText(),
|
||||
MotaActionBlocks['equip_e'].xmlText(),
|
||||
MotaActionBlocks['evalString_e'].xmlText(),
|
||||
],
|
||||
'常见事件模板':[
|
||||
'<label text="检测音乐如果没有开启则系统提示开启"></label>',
|
||||
MotaActionFunctions.actionParser.parseList({"type": "if", "condition": "!core.musicStatus.bgmStatus",
|
||||
"true": [
|
||||
"\t[系统提示]你当前音乐处于关闭状态,本塔开音乐游戏效果更佳"
|
||||
],
|
||||
"false": []
|
||||
}),
|
||||
'<label text="商店购买属性/钥匙"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
{"type": "while", "condition": "true", "data": [
|
||||
{"type": "choices", "text": "\t[老人,man]少年,你需要钥匙吗?\n我这里有大把的!",
|
||||
"choices": [
|
||||
{"text": "黄钥匙(${9+flag:shop_times}金币)", "color": [255,255,0,1], "action": [
|
||||
{"type": "if", "condition": "status:money>=9+flag:shop_times",
|
||||
"true": [
|
||||
{"type": "setValue", "name": "status:money", "operator": "-=", "value": "9+flag:shop_times"},
|
||||
{"type": "setValue", "name": "item:yellowKey", "operator": "+=", "value": "1"},
|
||||
],
|
||||
"false": [
|
||||
"\t[老人,man]你的金钱不足!",
|
||||
{"type": "continue"}
|
||||
]
|
||||
}
|
||||
]},
|
||||
{"text": "蓝钥匙(${18+2*flag:shop_times}金币)", "color": [0,0,255,1], "action": [
|
||||
]},
|
||||
{"text": "离开", "action": [
|
||||
{"type": "break"}
|
||||
]}
|
||||
]
|
||||
},
|
||||
{"type": "setValue", "name": "flag:shop_times", "operator": "+=", "value": "1"}
|
||||
]}], 'event'),
|
||||
'<label text="战前剧情"></label>',
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
"trigger": "action",
|
||||
"displayDamage": true,
|
||||
"data": [
|
||||
' ... 战前剧情',
|
||||
{"type": "battle", "id": "greenSlime"},
|
||||
' ... 战后剧情;请注意上面的强制战斗不会使怪物消失',
|
||||
'需要下一句来调用{"type": "hide"}来隐藏事件',
|
||||
{"type": "hide"},
|
||||
]
|
||||
},'event'),
|
||||
'<label text="打怪掉落道具"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
'怪物变成了黄钥匙(黄钥匙idnum是21)',
|
||||
'打怪变成可对话的NPC: https://ckcz123.github.io/mota-js/#/event?id=%e6%89%93%e6%80%aa%e5%8f%98%e6%88%90%e5%8f%af%e5%af%b9%e8%af%9d%e7%9a%84npc%ef%bc%88%e6%80%aa%e7%89%a9-gtnpc%ef%bc%89',
|
||||
{"type": "setBlock", "number": 21}
|
||||
],'afterBattle'),
|
||||
'<label text="打怪开门"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
{"type": "setValue", "name": "flag:__door__", "operator": "+=", "value": "1"},
|
||||
{"type": "if", "condition": "flag:__door__==2",
|
||||
"true": [
|
||||
{"type": "openDoor", "loc": [10,5]}
|
||||
],
|
||||
"false": []
|
||||
},
|
||||
],'afterBattle'),
|
||||
'<label text="杀死魔龙后隐藏其余图块"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
{"type": "function", "function": "function(){var x=core.status.event.data.x,y=core.status.event.data.y;if(core.isset(x)&&core.isset(y)){core.insertAction([{type:'hide',loc:[[x-1,y-2],[x,y-2],[x+1,y-2],[x-1,y-1],[x,y-1],[x+1,y-1],[x-1,y],[x+1,y]]}]);}}"},
|
||||
],'afterBattle'),
|
||||
'<label text="获得圣水后变成墙"></label>',
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
"trigger": "action",
|
||||
"noPass": true,
|
||||
"data": [
|
||||
{"type": "if", "condition": "flag:hasSuperPotion",
|
||||
"true": [],
|
||||
"false": [
|
||||
{"type":"setValue", "name":"status:hp", "operator": "*=", "value": "2"},
|
||||
{"type":"setBlock", "number": 1},
|
||||
{"type":"setValue", "name":"flag:hasSuperPotion", "value": "true"}
|
||||
]
|
||||
}
|
||||
]
|
||||
},'event'),
|
||||
],
|
||||
'最近使用事件':[
|
||||
'<label text="此处只是占位符,实际定义在editor_blockly.searchBlockCategoryCallback中"></label>',
|
||||
]
|
||||
}
|
||||
var toolboxgap = '<sep gap="5"></sep>'
|
||||
//xml_text = MotaActionFunctions.actionParser.parse(obj,type||'event')
|
||||
//MotaActionBlocks['idString_e'].xmlText()
|
||||
|
||||
for (var name in toolboxObj){
|
||||
var custom = null;
|
||||
if(name=='最近使用事件')custom='searchBlockCategory';
|
||||
if(name=='入口方块')custom='entranceCategory';
|
||||
getCategory(name,custom).innerHTML = toolboxObj[name].join(toolboxgap);
|
||||
}
|
||||
|
||||
var blocklyArea = document.getElementById('blocklyArea');
|
||||
var blocklyDiv = document.getElementById('blocklyDiv');
|
||||
var workspace = Blockly.inject(blocklyDiv,{
|
||||
media: '_server/blockly/media/',
|
||||
toolbox: document.getElementById('toolbox'),
|
||||
zoom:{
|
||||
controls: true,
|
||||
wheel: false,//滚轮改为上下(shift:左右)翻滚
|
||||
startScale: 1.0,
|
||||
maxScale: 3,
|
||||
minScale: 0.3,
|
||||
scaleSpeed: 1.08
|
||||
},
|
||||
trashcan: false,
|
||||
});
|
||||
|
||||
editor_blockly.entranceCategoryCallback = function(workspace) {
|
||||
var list=toolboxObj['入口方块']
|
||||
var xmlList = [];
|
||||
var eventType = editor_blockly.entryType+'_m';
|
||||
for(var ii=0,blockText;blockText=list[ii];ii++){
|
||||
if(new RegExp('<block type="'+eventType+'">').exec(blockText)){
|
||||
var block = Blockly.Xml.textToDom('<xml>'+blockText+'</xml>').firstChild;
|
||||
block.setAttribute("gap", 5);
|
||||
xmlList.push(block);
|
||||
}
|
||||
}
|
||||
return xmlList;
|
||||
}
|
||||
|
||||
workspace.registerToolboxCategoryCallback(
|
||||
'entranceCategory', editor_blockly.entranceCategoryCallback);
|
||||
|
||||
editor_blockly.searchBlockCategoryCallback = function(workspace) {
|
||||
var xmlList = [];
|
||||
var labels = editor_blockly.searchBlock();
|
||||
for (var i = 0; i < labels.length; i++) {
|
||||
var blockText = '<xml>' +
|
||||
MotaActionBlocks[labels[i]].xmlText() +
|
||||
'</xml>';
|
||||
var block = Blockly.Xml.textToDom(blockText).firstChild;
|
||||
block.setAttribute("gap", 5);
|
||||
xmlList.push(block);
|
||||
}
|
||||
return xmlList;
|
||||
};
|
||||
|
||||
workspace.registerToolboxCategoryCallback(
|
||||
'searchBlockCategory', editor_blockly.searchBlockCategoryCallback);
|
||||
|
||||
var onresize = function(e) {
|
||||
blocklyDiv.style.width = blocklyArea.offsetWidth + 'px';
|
||||
blocklyDiv.style.height = blocklyArea.offsetHeight + 'px';
|
||||
Blockly.svgResize(workspace);
|
||||
};
|
||||
if(typeof editor !== "undefined" && !editor.isMobile)window.addEventListener('resize', onresize, false);
|
||||
onresize();
|
||||
//Blockly.svgResize(workspace);
|
||||
|
||||
//Blockly.bindEventWithChecks_(workspace.svgGroup_,"wheel",workspace,function(e){});
|
||||
document.getElementById('blocklyDiv').onmousewheel = function(e){
|
||||
//console.log(e);
|
||||
e.preventDefault();
|
||||
var hvScroll = e.shiftKey?'hScroll':'vScroll';
|
||||
var mousewheelOffsetValue=20/380*workspace.scrollbar[hvScroll].handleLength_*3;
|
||||
workspace.scrollbar[hvScroll].handlePosition_+=( ((e.deltaY||0)+(e.detail||0)) >0?mousewheelOffsetValue:-mousewheelOffsetValue);
|
||||
workspace.scrollbar[hvScroll].onScroll_();
|
||||
workspace.setScale(workspace.scale);
|
||||
}
|
||||
|
||||
var doubleClickCheck=[[0,'abc']];
|
||||
function omitedcheckUpdateFunction(event) {
|
||||
if(event.type==='create'){
|
||||
editor_blockly.addIntoLastUsedType(event.blockId);
|
||||
}
|
||||
if(event.type==='ui'){
|
||||
var newClick = [new Date().getTime(),event.blockId];
|
||||
var lastClick = doubleClickCheck.shift();
|
||||
doubleClickCheck.push(newClick);
|
||||
if(newClick[0]-lastClick[0]<500){
|
||||
if(newClick[1]===lastClick[1]){
|
||||
editor_blockly.doubleClickBlock(newClick[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(editor_blockly.workspace.topBlocks_.length>=2){
|
||||
editor_blockly.setValue('入口方块只能有一个');
|
||||
return;
|
||||
}
|
||||
var eventType = editor_blockly.entryType;
|
||||
if(editor_blockly.workspace.topBlocks_.length==1){
|
||||
var blockType = editor_blockly.workspace.topBlocks_[0].type;
|
||||
if(blockType!==eventType+'_m'){
|
||||
editor_blockly.setValue('入口方块类型错误');
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
var code = Blockly.JavaScript.workspaceToCode(workspace).replace(/\\(i|c|d|e|z)/g, '\\\\$1');
|
||||
editor_blockly.setValue(code);
|
||||
} catch (error) {
|
||||
editor_blockly.setValue(String(error));
|
||||
if (error instanceof OmitedError){
|
||||
var blockName = error.blockName;
|
||||
var varName = error.varName;
|
||||
var block = error.block;
|
||||
}
|
||||
// console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
workspace.addChangeListener(omitedcheckUpdateFunction);
|
||||
|
||||
workspace.addChangeListener(Blockly.Events.disableOrphans);
|
||||
|
||||
editor_blockly.workspace = workspace;
|
||||
|
||||
MotaActionFunctions.workspace = function(){
|
||||
return editor_blockly.workspace;
|
||||
}
|
||||
|
||||
// 因为在editor_blockly.parse里已经HTML转义过一次了,所以这里要覆盖掉以避免在注释中出现<等
|
||||
MotaActionFunctions.xmlText = function (ruleName,inputs,isShadow,comment) {
|
||||
var rule = MotaActionBlocks[ruleName];
|
||||
var blocktext = isShadow?'shadow':'block';
|
||||
var xmlText = [];
|
||||
xmlText.push('<'+blocktext+' type="'+ruleName+'">');
|
||||
if(!inputs)inputs=[];
|
||||
for (var ii=0,inputType;inputType=rule.argsType[ii];ii++) {
|
||||
var input = inputs[ii];
|
||||
var _input = '';
|
||||
var noinput = (input===null || input===undefined);
|
||||
if(noinput && inputType==='field') continue;
|
||||
if(noinput) input = '';
|
||||
if(inputType!=='field') {
|
||||
var subList = false;
|
||||
var subrulename = rule.argsGrammarName[ii];
|
||||
var subrule = MotaActionBlocks[subrulename];
|
||||
if (subrule instanceof Array) {
|
||||
subrulename=subrule[subrule.length-1];
|
||||
subrule = MotaActionBlocks[subrulename];
|
||||
subList = true;
|
||||
}
|
||||
_input = subrule.xmlText([],true);
|
||||
if(noinput && !subList && !isShadow) {
|
||||
//无输入的默认行为是: 如果语句块的备选方块只有一个,直接代入方块
|
||||
input = subrule.xmlText();
|
||||
}
|
||||
}
|
||||
xmlText.push('<'+inputType+' name="'+rule.args[ii]+'">');
|
||||
xmlText.push(_input+input);
|
||||
xmlText.push('</'+inputType+'>');
|
||||
}
|
||||
if(comment){
|
||||
xmlText.push('<comment>');
|
||||
xmlText.push(comment);
|
||||
xmlText.push('</comment>');
|
||||
}
|
||||
var next = inputs[rule.args.length];
|
||||
if (next) {//next
|
||||
xmlText.push('<next>');
|
||||
xmlText.push(next);
|
||||
xmlText.push('</next>');
|
||||
}
|
||||
xmlText.push('</'+blocktext+'>');
|
||||
return xmlText.join('');
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
|
||||
// end mark sfergsvae
|
||||
}).toString().split('// start mark sfergsvae')[1].split('// end mark sfergsvae')[0]
|
||||
@ -388,6 +388,10 @@ editor_datapanel_wrapper = function (editor) {
|
||||
printe('不合法的id,请使用字母、数字或下划线,且不能以数字开头')
|
||||
return;
|
||||
}
|
||||
if (id == 'hero' || id == 'this' || id == 'none' || id == 'airwall') {
|
||||
printe('不得使用保留关键字作为id!');
|
||||
return;
|
||||
}
|
||||
editor.file.changeIdAndIdnum(id, null, editor_mode.info, function (err) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
@ -621,7 +625,7 @@ editor_datapanel_wrapper = function (editor) {
|
||||
|
||||
|
||||
editor.uifunctions.fixCtx_func = function () {
|
||||
[editor.dom.sourceCtx, editor.dom.spriteCtx].forEach(function (ctx) {
|
||||
[editor.dom.appendSourceCtx, editor.dom.appendSpriteCtx].forEach(function (ctx) {
|
||||
ctx.mozImageSmoothingEnabled = false;
|
||||
ctx.webkitImageSmoothingEnabled = false;
|
||||
ctx.msImageSmoothingEnabled = false;
|
||||
@ -644,10 +648,10 @@ editor_datapanel_wrapper = function (editor) {
|
||||
editor_mode.appendPic.imageName = 'autotile';
|
||||
for (var jj = 0; jj < 4; jj++) editor.dom.appendPicSelection.children[jj].style = 'display:none';
|
||||
if (editor_mode.appendPic.img) {
|
||||
editor.dom.sprite.style.width = (editor.dom.sprite.width = editor_mode.appendPic.img.width) / editor.uivalues.ratio + 'px';
|
||||
editor.dom.sprite.style.height = (editor.dom.sprite.height = editor_mode.appendPic.img.height) / editor.uivalues.ratio + 'px';
|
||||
editor.dom.spriteCtx.clearRect(0, 0, editor.dom.sprite.width, editor.dom.sprite.height);
|
||||
editor.dom.spriteCtx.drawImage(editor_mode.appendPic.img, 0, 0);
|
||||
editor.dom.appendSprite.style.width = (editor.dom.appendSprite.width = editor_mode.appendPic.img.width) / editor.uivalues.ratio + 'px';
|
||||
editor.dom.appendSprite.style.height = (editor.dom.appendSprite.height = editor_mode.appendPic.img.height) / editor.uivalues.ratio + 'px';
|
||||
editor.dom.appendSpriteCtx.clearRect(0, 0, editor.dom.appendSprite.width, editor.dom.appendSprite.height);
|
||||
editor.dom.appendSpriteCtx.drawImage(editor_mode.appendPic.img, 0, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -668,9 +672,9 @@ editor_datapanel_wrapper = function (editor) {
|
||||
for (var jj = num; jj < 4; jj++) {
|
||||
editor.dom.appendPicSelection.children[jj].style = 'display:none';
|
||||
}
|
||||
editor.dom.sprite.style.width = (editor.dom.sprite.width = img.width) / editor.uivalues.ratio + 'px';
|
||||
editor.dom.sprite.style.height = (editor.dom.sprite.height = img.height + ysize) / editor.uivalues.ratio + 'px';
|
||||
editor.dom.spriteCtx.drawImage(img, 0, 0);
|
||||
editor.dom.appendSprite.style.width = (editor.dom.appendSprite.width = img.width) / editor.uivalues.ratio + 'px';
|
||||
editor.dom.appendSprite.style.height = (editor.dom.appendSprite.height = img.height + ysize) / editor.uivalues.ratio + 'px';
|
||||
editor.dom.appendSpriteCtx.drawImage(img, 0, 0);
|
||||
}
|
||||
editor.dom.selectAppend.onchange();
|
||||
}
|
||||
@ -787,8 +791,8 @@ editor_datapanel_wrapper = function (editor) {
|
||||
newsprite.style.width = (newsprite.width = image.width) / editor.uivalues.ratio + 'px';
|
||||
newsprite.style.height = (newsprite.height = image.height) / editor.uivalues.ratio + 'px';
|
||||
}
|
||||
editor.dom.spriteCtx.clearRect(0, 0, editor.dom.sprite.width, editor.dom.sprite.height);
|
||||
editor.dom.spriteCtx.drawImage(image, 0, 0);
|
||||
editor.dom.appendSpriteCtx.clearRect(0, 0, editor.dom.appendSprite.width, editor.dom.appendSprite.height);
|
||||
editor.dom.appendSpriteCtx.drawImage(image, 0, 0);
|
||||
}
|
||||
else {
|
||||
var ysize = editor.dom.selectAppend.value.endsWith('48') ? 48 : 32;
|
||||
@ -800,7 +804,7 @@ editor_datapanel_wrapper = function (editor) {
|
||||
}
|
||||
|
||||
//画灰白相间的格子
|
||||
var bgc = editor.dom.bgCtx;
|
||||
var bgc = editor.dom.appendBgCtx;
|
||||
var colorA = ["#f8f8f8", "#cccccc"];
|
||||
var colorIndex;
|
||||
var sratio = 4;
|
||||
@ -814,8 +818,8 @@ editor_datapanel_wrapper = function (editor) {
|
||||
}
|
||||
|
||||
//把导入的图片画出
|
||||
editor.dom.sourceCtx.drawImage(image, 0, 0);
|
||||
editor_mode.appendPic.sourceImageData = editor.dom.sourceCtx.getImageData(0, 0, image.width, image.height);
|
||||
editor.dom.appendSourceCtx.drawImage(image, 0, 0);
|
||||
editor_mode.appendPic.sourceImageData = editor.dom.appendSourceCtx.getImageData(0, 0, image.width, image.height);
|
||||
|
||||
//重置临时变量
|
||||
editor.dom.selectAppend.onchange();
|
||||
@ -851,8 +855,8 @@ editor_datapanel_wrapper = function (editor) {
|
||||
editor.util.setPixel(nimgData, x, y, convert(editor.util.getPixel(imgData, x, y), delta))
|
||||
}
|
||||
}
|
||||
editor.dom.sourceCtx.clearRect(0, 0, imgData.width, imgData.height);
|
||||
editor.dom.sourceCtx.putImageData(nimgData, 0, 0);
|
||||
editor.dom.appendSourceCtx.clearRect(0, 0, imgData.width, imgData.height);
|
||||
editor.dom.appendSourceCtx.putImageData(nimgData, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -877,7 +881,7 @@ editor_datapanel_wrapper = function (editor) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
editor.dom.picClick.onclick = function (e) {
|
||||
editor.dom.appendPicClick.onclick = function (e) {
|
||||
var loc = eToLoc(e);
|
||||
var pos = locToPos(loc);
|
||||
//console.log(e,loc,pos);
|
||||
@ -907,12 +911,12 @@ editor_datapanel_wrapper = function (editor) {
|
||||
printe("不合法的Autotile图片!");
|
||||
return;
|
||||
}
|
||||
var imgData = editor.dom.sourceCtx.getImageData(0, 0, image.width, image.height);
|
||||
editor.dom.spriteCtx.putImageData(imgData, 0, 0);
|
||||
var imgbase64 = editor.dom.sprite.toDataURL().split(',')[1];
|
||||
var imgData = editor.dom.appendSourceCtx.getImageData(0, 0, image.width, image.height);
|
||||
editor.dom.appendSpriteCtx.putImageData(imgData, 0, 0);
|
||||
var imgbase64 = editor.dom.appendSprite.toDataURL().split(',')[1];
|
||||
|
||||
// Step 1: List文件名
|
||||
fs.readdir('./project/images', function (err, data) {
|
||||
fs.readdir('./project/autotiles', function (err, data) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw (err);
|
||||
@ -926,7 +930,7 @@ editor_datapanel_wrapper = function (editor) {
|
||||
}
|
||||
|
||||
// Step 3: 写入文件
|
||||
fs.writeFile('./project/images/' + filename + ".png", imgbase64, 'base64', function (err, data) {
|
||||
fs.writeFile('./project/autotiles/' + filename + ".png", imgbase64, 'base64', function (err, data) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw (err);
|
||||
@ -953,23 +957,23 @@ editor_datapanel_wrapper = function (editor) {
|
||||
|
||||
var ysize = editor.dom.selectAppend.value.endsWith('48') ? 48 : 32;
|
||||
for (var ii = 0, v; v = editor_mode.appendPic.selectPos[ii]; ii++) {
|
||||
// var imgData = editor.dom.sourceCtx.getImageData(v.x * 32, v.y * ysize, 32, ysize);
|
||||
// editor.dom.spriteCtx.putImageData(imgData, ii * 32, editor.dom.sprite.height - ysize);
|
||||
// editor.dom.spriteCtx.drawImage(editor_mode.appendPic.img, v.x * 32, v.y * ysize, 32, ysize, ii * 32, height, 32, ysize)
|
||||
// var imgData = editor.dom.appendSourceCtx.getImageData(v.x * 32, v.y * ysize, 32, ysize);
|
||||
// editor.dom.appendSpriteCtx.putImageData(imgData, ii * 32, editor.dom.appendSprite.height - ysize);
|
||||
// editor.dom.appendSpriteCtx.drawImage(editor_mode.appendPic.img, v.x * 32, v.y * ysize, 32, ysize, ii * 32, height, 32, ysize)
|
||||
|
||||
editor.dom.spriteCtx.drawImage(editor.dom.sourceCtx.canvas, v.x * 32, v.y * ysize, 32, ysize, 32 * ii, editor.dom.sprite.height - ysize, 32, ysize);
|
||||
editor.dom.appendSpriteCtx.drawImage(editor.dom.appendSourceCtx.canvas, v.x * 32, v.y * ysize, 32, ysize, 32 * ii, editor.dom.appendSprite.height - ysize, 32, ysize);
|
||||
}
|
||||
var dt = editor.dom.spriteCtx.getImageData(0, 0, editor.dom.sprite.width, editor.dom.sprite.height);
|
||||
var imgbase64 = editor.dom.sprite.toDataURL('image/png');
|
||||
var dt = editor.dom.appendSpriteCtx.getImageData(0, 0, editor.dom.appendSprite.width, editor.dom.appendSprite.height);
|
||||
var imgbase64 = editor.dom.appendSprite.toDataURL('image/png');
|
||||
var imgName = editor_mode.appendPic.imageName;
|
||||
fs.writeFile('./project/images/' + imgName + '.png', imgbase64.split(',')[1], 'base64', function (err, data) {
|
||||
fs.writeFile('./project/materials/' + imgName + '.png', imgbase64.split(',')[1], 'base64', function (err, data) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw (err)
|
||||
}
|
||||
var currHeight = editor.dom.sprite.height;
|
||||
editor.dom.sprite.style.height = (editor.dom.sprite.height = (currHeight + ysize)) + "px";
|
||||
editor.dom.spriteCtx.putImageData(dt, 0, 0);
|
||||
var currHeight = editor.dom.appendSprite.height;
|
||||
editor.dom.appendSprite.style.height = (editor.dom.appendSprite.height = (currHeight + ysize)) + "px";
|
||||
editor.dom.appendSpriteCtx.putImageData(dt, 0, 0);
|
||||
core.material.images[imgName].src = imgbase64;
|
||||
editor.widthsX[imgName][3] = currHeight;
|
||||
if (appendRegister && appendRegister.checked) {
|
||||
@ -992,29 +996,29 @@ editor_datapanel_wrapper = function (editor) {
|
||||
if (value != 'enemys' && value != 'enemy48' && value != 'npcs' && value != 'npc48')
|
||||
return printe("只有怪物或NPC才能快速导入!");
|
||||
var ysize = value.endsWith('48') ? 48 : 32;
|
||||
if (editor.dom.sourceCtx.canvas.width != 128 || editor.dom.sourceCtx.canvas.height != 4 * ysize)
|
||||
if (editor.dom.appendSourceCtx.canvas.width != 128 || editor.dom.appendSourceCtx.canvas.height != 4 * ysize)
|
||||
return printe("只有 4*4 的素材图片才可以快速导入!");
|
||||
|
||||
var dt = editor.dom.spriteCtx.getImageData(0, 0, editor.dom.sprite.width, editor.dom.sprite.height);
|
||||
editor.dom.sprite.style.height = (editor.dom.sprite.height = (editor.dom.sprite.height + 3 * ysize)) + "px";
|
||||
editor.dom.spriteCtx.putImageData(dt, 0, 0);
|
||||
if (editor.dom.sprite.width == 64) { // 两帧
|
||||
editor.dom.spriteCtx.drawImage(editor.dom.sourceCtx.canvas, 32, 0, 64, 4 * ysize, 0, editor.dom.sprite.height - 4 * ysize, 64, 4 * ysize);
|
||||
var dt = editor.dom.appendSpriteCtx.getImageData(0, 0, editor.dom.appendSprite.width, editor.dom.appendSprite.height);
|
||||
editor.dom.appendSprite.style.height = (editor.dom.appendSprite.height = (editor.dom.appendSprite.height + 3 * ysize)) + "px";
|
||||
editor.dom.appendSpriteCtx.putImageData(dt, 0, 0);
|
||||
if (editor.dom.appendSprite.width == 64) { // 两帧
|
||||
editor.dom.appendSpriteCtx.drawImage(editor.dom.appendSourceCtx.canvas, 32, 0, 64, 4 * ysize, 0, editor.dom.appendSprite.height - 4 * ysize, 64, 4 * ysize);
|
||||
} else { // 四帧
|
||||
editor.dom.spriteCtx.drawImage(editor.dom.sourceCtx.canvas, 0, 0, 128, 4 * ysize, 0, editor.dom.sprite.height - 4 * ysize, 128, 4 * ysize);
|
||||
editor.dom.appendSpriteCtx.drawImage(editor.dom.appendSourceCtx.canvas, 0, 0, 128, 4 * ysize, 0, editor.dom.appendSprite.height - 4 * ysize, 128, 4 * ysize);
|
||||
}
|
||||
|
||||
dt = editor.dom.spriteCtx.getImageData(0, 0, editor.dom.sprite.width, editor.dom.sprite.height);
|
||||
var imgbase64 = editor.dom.sprite.toDataURL('image/png');
|
||||
dt = editor.dom.appendSpriteCtx.getImageData(0, 0, editor.dom.appendSprite.width, editor.dom.appendSprite.height);
|
||||
var imgbase64 = editor.dom.appendSprite.toDataURL('image/png');
|
||||
var imgName = editor_mode.appendPic.imageName;
|
||||
fs.writeFile('./project/images/' + imgName + '.png', imgbase64.split(',')[1], 'base64', function (err, data) {
|
||||
fs.writeFile('./project/materials/' + imgName + '.png', imgbase64.split(',')[1], 'base64', function (err, data) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw (err)
|
||||
}
|
||||
var currHeight = editor.dom.sprite.height;
|
||||
editor.dom.sprite.style.height = (editor.dom.sprite.height = (currHeight + ysize)) + "px";
|
||||
editor.dom.spriteCtx.putImageData(dt, 0, 0);
|
||||
var currHeight = editor.dom.appendSprite.height;
|
||||
editor.dom.appendSprite.style.height = (editor.dom.appendSprite.height = (currHeight + ysize)) + "px";
|
||||
editor.dom.appendSpriteCtx.putImageData(dt, 0, 0);
|
||||
core.material.images[imgName].src = imgbase64;
|
||||
editor.widthsX[imgName][3] = currHeight;
|
||||
if (appendRegister && appendRegister.checked) {
|
||||
|
||||
@ -212,7 +212,7 @@ editor_file = function (editor, callback) {
|
||||
canUseQuickShop: currData.canUseQuickShop,
|
||||
cannotViewMap: currData.cannotViewMap,
|
||||
cannotMoveDirectly: currData.cannotMoveDirectly,
|
||||
item_ratio: currData.item_ratio,
|
||||
ratio: currData.ratio,
|
||||
defaultGround: currData.defaultGround,
|
||||
bgm: currData.bgm,
|
||||
color: currData.color,
|
||||
@ -260,7 +260,7 @@ editor_file = function (editor, callback) {
|
||||
canUseQuickShop: currData.canUseQuickShop,
|
||||
cannotViewMap: currData.cannotViewMap,
|
||||
cannotMoveDirectly: currData.cannotMoveDirectly,
|
||||
item_ratio: currData.item_ratio,
|
||||
ratio: currData.ratio,
|
||||
defaultGround: currData.defaultGround,
|
||||
bgm: currData.bgm,
|
||||
color: currData.color,
|
||||
@ -347,7 +347,7 @@ editor_file = function (editor, callback) {
|
||||
mapActions.push(["add", "['" + idnum + "']", {'cls': image, 'id': id}]);
|
||||
faceIds.push({idnum: idnum, id: id});
|
||||
if (image=='items')
|
||||
templateActions.push(["add", "['items']['" + id + "']", editor.file.comment._data.items_template]);
|
||||
templateActions.push(["add", "['" + id + "']", editor.file.comment._data.items_template]);
|
||||
else if (image.indexOf('enemy')==0)
|
||||
templateActions.push(["add", "['" + id + "']", editor.file.comment._data.enemys_template]);
|
||||
idnum++;
|
||||
@ -449,7 +449,7 @@ editor_file = function (editor, callback) {
|
||||
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) {
|
||||
saveSetting('items', [["add", "['" + id + "']", editor.file.comment._data.items_template]], function (err) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw(err)
|
||||
@ -479,7 +479,7 @@ editor_file = function (editor, callback) {
|
||||
|
||||
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}]
|
||||
var arr=[icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1,{items: items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a},{enemys: enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80}]
|
||||
arr.forEach(function (obj) {
|
||||
for(var jj in obj){
|
||||
var ii=obj[jj]
|
||||
@ -497,17 +497,16 @@ editor_file = function (editor, callback) {
|
||||
//callback(err:String)
|
||||
editor.file.editItem = function (id, actionList, callback) {
|
||||
/*actionList:[
|
||||
["change","['items']['name']","红宝石的新名字"],
|
||||
["add","['items']['新的和name同级的属性']",123],
|
||||
["change","['itemEffectTip']","',攻击力+'+editor.core.values.redJewel"],
|
||||
["change","['name']","红宝石的新名字"],
|
||||
["add","['新的和name同级的属性']",123],
|
||||
["change","['itemEffectTip']","',攻击力+'+editor.core.values.redGem"],
|
||||
]
|
||||
为[]时只查询不修改
|
||||
*/
|
||||
checkCallback(callback);
|
||||
if (isset(actionList) && actionList.length > 0) {
|
||||
actionList.forEach(function (value) {
|
||||
var tempindex = value[1].indexOf(']') + 1;
|
||||
value[1] = [value[1].slice(0, tempindex), "['" + id + "']", value[1].slice(tempindex)].join('');
|
||||
value[1] = "['" + id + "']" + value[1];
|
||||
});
|
||||
saveSetting('items', actionList, function (err) {
|
||||
callback([err]);
|
||||
@ -515,22 +514,12 @@ editor_file = function (editor, callback) {
|
||||
} else {
|
||||
callback([
|
||||
(function () {
|
||||
var locObj_ = {};
|
||||
var locObj = Object.assign({}, editor.core.items.items[id]);
|
||||
Object.keys(editor.file.comment._data.items._data).forEach(function (v) {
|
||||
if (isset(editor.core.items[v][id]) && v !== 'items')
|
||||
locObj_[v] = editor.core.items[v][id];
|
||||
else
|
||||
locObj_[v] = null;
|
||||
if (!isset(editor.core.items.items[id][v]))
|
||||
locObj[v] = null;
|
||||
});
|
||||
locObj_['items'] = (function () {
|
||||
var locObj = Object.assign({}, editor.core.items.items[id]);
|
||||
Object.keys(editor.file.comment._data.items._data.items._data).forEach(function (v) {
|
||||
if (!isset(editor.core.items.items[id][v]))
|
||||
locObj[v] = null;
|
||||
});
|
||||
return locObj;
|
||||
})();
|
||||
return locObj_;
|
||||
return locObj;
|
||||
})(),
|
||||
editor.file.comment._data.items,
|
||||
null]);
|
||||
@ -574,7 +563,7 @@ editor_file = function (editor, callback) {
|
||||
|
||||
editor.file.editMapBlocksInfo = function (idnum, actionList, callback) {
|
||||
/*actionList:[
|
||||
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值,可参见样板中初级巫师的写法。"]],
|
||||
["change","['events']",["\t[老人,wizard]领域、夹击。\n请注意领域怪需要设置value为伤害数值,可参见样板中初级巫师的写法。"]],
|
||||
["change","['afterBattle']",null],
|
||||
]
|
||||
为[]时只查询不修改
|
||||
@ -618,7 +607,7 @@ editor_file = function (editor, callback) {
|
||||
|
||||
editor.file.editLoc = function (x, y, actionList, callback) {
|
||||
/*actionList:[
|
||||
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值,可参见样板中初级巫师的写法。"]],
|
||||
["change","['events']",["\t[老人,wizard]领域、夹击。\n请注意领域怪需要设置value为伤害数值,可参见样板中初级巫师的写法。"]],
|
||||
["change","['afterBattle']",null],
|
||||
]
|
||||
为[]时只查询不修改
|
||||
@ -930,7 +919,10 @@ editor_file = function (editor, callback) {
|
||||
eval("items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a" + value[1] + '=' + JSON.stringify(value[2]));
|
||||
});
|
||||
var datastr = 'var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = \n';
|
||||
datastr += JSON.stringify(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a, null, '\t');
|
||||
datastr += JSON.stringify(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a, function (k, v) {
|
||||
if (v.id != null) delete v.id;
|
||||
return v;
|
||||
}, '\t');
|
||||
fs.writeFile('project/items.js', encode(datastr), 'base64', function (err, data) {
|
||||
callback(err);
|
||||
});
|
||||
@ -944,6 +936,7 @@ editor_file = function (editor, callback) {
|
||||
var emap = {};
|
||||
var estr = JSON.stringify(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80, function (k, v) {
|
||||
if (v.hp != null) {
|
||||
delete v.id;
|
||||
var id_ = editor.util.guid();
|
||||
emap[id_] = JSON.stringify(v);
|
||||
return id_;
|
||||
|
||||
@ -135,7 +135,7 @@ editor_game_wrapper = function (editor, main, core) {
|
||||
|
||||
// 获取当前地图
|
||||
editor_game.prototype.fetchMapFromCore = function () {
|
||||
var mapArray = core.maps.saveMap(core.status.floorId);
|
||||
var mapArray = core.getMapArray(core.status.floorId, true);
|
||||
editor.map = mapArray.map(function (v) {
|
||||
return v.map(function (v) {
|
||||
var x = parseInt(v), y = editor.indexs[x];
|
||||
|
||||
@ -24,17 +24,20 @@ editor_listen_wrapper = function (editor) {
|
||||
editor.dom.iconExpandBtn.onclick = editor.uifunctions.fold_material_click
|
||||
|
||||
editor.dom.iconLib.onmousedown = editor.uifunctions.material_ondown
|
||||
editor.dom.iconLib.onmousemove = editor.uifunctions.material_onmove
|
||||
editor.dom.iconLib.onmouseup = editor.uifunctions.material_onup
|
||||
editor.dom.iconLib.oncontextmenu = function (e) { e.preventDefault() }
|
||||
|
||||
editor.dom.extraEvent.onmousedown = editor.uifunctions.extraEvent_click
|
||||
editor.dom.chooseThis.onmousedown = editor.uifunctions.chooseThis_click
|
||||
editor.dom.chooseInRight.onmousedown = editor.uifunctions.chooseInRight_click
|
||||
editor.dom.copyLoc.onmousedown = editor.uifunctions.copyLoc_click
|
||||
editor.dom.moveLoc.onmousedown = editor.uifunctions.moveLoc_click
|
||||
editor.dom.pasteLoc.onmousedown = editor.uifunctions.pasteLoc_click
|
||||
editor.dom.clearEvent.onmousedown = editor.uifunctions.clearEvent_click
|
||||
editor.dom.clearLoc.onmousedown = editor.uifunctions.clearLoc_click
|
||||
|
||||
editor.dom.lastUsed.onmousedown = editor.uifunctions.lastUsed_click;
|
||||
editor.dom.lastUsed.oncontextmenu = function (e) { e.preventDefault(); }
|
||||
editor.dom.clearLastUsedBtn.onclick = editor.uifunctions.clearLastUsedBtn_click;
|
||||
editor.dom.lockMode.onchange = editor.uifunctions.lockMode_onchange;
|
||||
|
||||
@ -127,10 +130,18 @@ editor_listen_wrapper = function (editor) {
|
||||
editor.dom.chooseInRight.onmousedown = null
|
||||
editor.dom.copyLoc.ontouchstart = editor.dom.copyLoc.onmousedown
|
||||
editor.dom.copyLoc.onmousedown = null
|
||||
editor.dom.moveLoc.ontouchstart = editor.dom.moveLoc.onmousedown
|
||||
editor.dom.moveLoc.onmousedown = null
|
||||
editor.dom.pasteLoc.ontouchstart = editor.dom.pasteLoc.onmousedown
|
||||
editor.dom.pasteLoc.onmousedown = null
|
||||
editor.dom.clearLoc.ontouchstart = editor.dom.clearLoc.onmousedown
|
||||
editor.dom.clearLoc.onmousedown = null
|
||||
|
||||
// 不使用以下6语句, 会使得素材区手机无法拖动, 手机的框选素材只能放弃, 要通过弹框实现框选
|
||||
// editor.dom.iconLib.ontouchstart = editor.dom.iconLib.onmousedown
|
||||
// editor.dom.iconLib.onmousedown = null
|
||||
// editor.dom.iconLib.ontouchmove = editor.dom.iconLib.onmousemove
|
||||
// editor.dom.iconLib.onmousemove = null
|
||||
// editor.dom.iconLib.ontouchend = editor.dom.iconLib.onmouseup
|
||||
// editor.dom.iconLib.onmouseup = null
|
||||
}
|
||||
|
||||
editor.constructor.prototype.mode_listen = function (callback) {
|
||||
|
||||
@ -75,6 +75,8 @@ editor_mappanel_wrapper = function (editor) {
|
||||
* + 绘图时画个矩形在那个位置
|
||||
*/
|
||||
editor.uifunctions.map_ondown = function (e) {
|
||||
editor.uivalues.selectedArea = null;
|
||||
editor.uivalues.lastMoveE=e;
|
||||
var loc = editor.uifunctions.eToLoc(e);
|
||||
var pos = editor.uifunctions.locToPos(loc, true);
|
||||
if (editor.uivalues.bindSpecialDoor.loc != null) {
|
||||
@ -89,10 +91,10 @@ editor_mappanel_wrapper = function (editor) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (e.button == 2) {
|
||||
editor.uifunctions.showMidMenu(e.clientX, e.clientY);
|
||||
return false;
|
||||
}
|
||||
// if (e.buttons == 2) { // 挪到onup
|
||||
// editor.uifunctions.showMidMenu(e.clientX, e.clientY);
|
||||
// return false;
|
||||
// }
|
||||
if (!selectBox.isSelected()) {
|
||||
editor_mode.onmode('nextChange');
|
||||
editor_mode.onmode('loc');
|
||||
@ -122,6 +124,7 @@ editor_mappanel_wrapper = function (editor) {
|
||||
* + 绘图模式时找到与队列尾相邻的鼠标方向的点画个矩形
|
||||
*/
|
||||
editor.uifunctions.map_onmove = function (e) {
|
||||
editor.uivalues.lastMoveE=e;
|
||||
if (!selectBox.isSelected()) {
|
||||
if (editor.uivalues.startPos == null) return;
|
||||
//tip.whichShow(1);
|
||||
@ -136,9 +139,25 @@ editor_mappanel_wrapper = function (editor) {
|
||||
editor.uivalues.endPos = pos;
|
||||
if (editor.uivalues.startPos != null) {
|
||||
if (editor.uivalues.startPos.x != editor.uivalues.endPos.x || editor.uivalues.startPos.y != editor.uivalues.endPos.y) {
|
||||
core.drawArrow('eui',
|
||||
32 * editor.uivalues.startPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.startPos.y + 16 - core.bigmap.offsetY,
|
||||
32 * editor.uivalues.endPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.endPos.y + 16 - core.bigmap.offsetY);
|
||||
if (e.buttons == 2) {
|
||||
// 右键拖拽: 画选的区域
|
||||
var x0 = editor.uivalues.startPos.x;
|
||||
var y0 = editor.uivalues.startPos.y;
|
||||
var x1 = editor.uivalues.endPos.x;
|
||||
var y1 = editor.uivalues.endPos.y;
|
||||
if (x0 > x1) { x0 ^= x1; x1 ^= x0; x0 ^= x1; }//swap
|
||||
if (y0 > y1) { y0 ^= y1; y1 ^= y0; y0 ^= y1; }//swap
|
||||
// draw rect
|
||||
editor.dom.euiCtx.clearRect(0, 0, editor.dom.euiCtx.canvas.width, editor.dom.euiCtx.canvas.height);
|
||||
editor.dom.euiCtx.fillStyle = 'rgba(0, 127, 255, 0.4)';
|
||||
editor.dom.euiCtx.fillRect(32 * x0 - core.bigmap.offsetX, 32 * y0 - core.bigmap.offsetY,
|
||||
32 * (x1 - x0) + 32, 32 * (y1 - y0) + 32);
|
||||
}else{
|
||||
// 左键拖拽: 画箭头
|
||||
core.drawArrow('eui',
|
||||
32 * editor.uivalues.startPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.startPos.y + 16 - core.bigmap.offsetY,
|
||||
32 * editor.uivalues.endPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.endPos.y + 16 - core.bigmap.offsetY);
|
||||
}
|
||||
}
|
||||
}
|
||||
// editor_mode.onmode('nextChange');
|
||||
@ -192,16 +211,32 @@ editor_mappanel_wrapper = function (editor) {
|
||||
* + 非绘图模式时, 交换首末点的内容
|
||||
* + 绘图模式时, 根据画线/画矩形/画tileset 做对应的绘制
|
||||
*/
|
||||
editor.uifunctions.map_onup = function (e) {
|
||||
editor.uifunctions.map_onup = function (ee) {
|
||||
editor.uivalues.selectedArea = null;
|
||||
ee.preventDefault();
|
||||
ee.stopPropagation();
|
||||
var e=editor.uivalues.lastMoveE;
|
||||
if (!selectBox.isSelected()) {
|
||||
//tip.whichShow(1);
|
||||
// editor.movePos(editor.uivalues.startPos, editor.uivalues.endPos);
|
||||
if (editor.layerMod == 'map')
|
||||
if (e.buttons == 2) {
|
||||
if (editor.uivalues.endPos==null || (editor.uivalues.startPos.x == editor.uivalues.endPos.x && editor.uivalues.startPos.y == editor.uivalues.endPos.y)) {
|
||||
// 右键点击: 弹菜单
|
||||
editor.uifunctions.showMidMenu(e.clientX, e.clientY);
|
||||
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
|
||||
} else {
|
||||
// 右键拖拽: 选中区域
|
||||
printf('已经选中该区域')
|
||||
editor.uivalues.selectedArea = Object.assign({}, editor.uivalues.startPos, {x1: editor.uivalues.endPos.x, y1: editor.uivalues.endPos.y});
|
||||
// 后续的处理
|
||||
}
|
||||
} else {
|
||||
// 左键拖拽: 交换
|
||||
//tip.whichShow(1);
|
||||
// editor.movePos(editor.uivalues.startPos, editor.uivalues.endPos);
|
||||
editor.exchangePos(editor.uivalues.startPos, editor.uivalues.endPos);
|
||||
else
|
||||
editor.exchangeBgFg(editor.uivalues.startPos, editor.uivalues.endPos, editor.layerMod);
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
|
||||
}
|
||||
editor.uivalues.startPos = editor.uivalues.endPos = null;
|
||||
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
|
||||
return false;
|
||||
}
|
||||
editor.uivalues.holdingPath = 0;
|
||||
@ -239,12 +274,11 @@ editor_mappanel_wrapper = function (editor) {
|
||||
var x0 = editor.uivalues.stepPostfix[0].x;
|
||||
var y0 = editor.uivalues.stepPostfix[0].y;
|
||||
var idnum = editor.info.idnum;
|
||||
var pmod=function(a,b){return (a%b+b)%b;}
|
||||
for (var ii = 0; ii < editor.uivalues.stepPostfix.length; ii++) {
|
||||
if (editor.uivalues.stepPostfix[ii].y != y0) {
|
||||
y0++;
|
||||
idnum += imgWidth;
|
||||
}
|
||||
editor[editor.layerMod][editor.uivalues.stepPostfix[ii].y][editor.uivalues.stepPostfix[ii].x] = editor.ids[editor.indexs[idnum + editor.uivalues.stepPostfix[ii].x - x0]];
|
||||
var dx=pmod(editor.uivalues.stepPostfix[ii].x-x0,editor.uivalues.tileSize[0]);
|
||||
var dy=pmod(editor.uivalues.stepPostfix[ii].y-y0,editor.uivalues.tileSize[1]);
|
||||
editor[editor.layerMod][editor.uivalues.stepPostfix[ii].y][editor.uivalues.stepPostfix[ii].x] = editor.ids[editor.indexs[idnum + dx+dy*imgWidth]];
|
||||
}
|
||||
} else {
|
||||
// 检测是否是填充模式
|
||||
@ -257,13 +291,24 @@ editor_mappanel_wrapper = function (editor) {
|
||||
}
|
||||
// console.log(editor.map);
|
||||
if (editor.info.y != null) {
|
||||
editor.uivalues.lastUsed = [editor.info].concat(editor.uivalues.lastUsed.filter(function (e) { return e.id != editor.info.id}));
|
||||
var found = false;
|
||||
editor.uivalues.lastUsed.forEach(function (one) {
|
||||
if (one.id == editor.info.id) {
|
||||
found = true;
|
||||
one.recent = new Date().getTime();
|
||||
one.frequent = (one.frequent || 0) + 1;
|
||||
}
|
||||
})
|
||||
if (!found) {
|
||||
editor.uivalues.lastUsed.push(Object.assign({}, editor.info, {recent: new Date().getTime(), frequent: 1}));
|
||||
}
|
||||
editor.config.set("lastUsed", editor.uivalues.lastUsed);
|
||||
}
|
||||
editor.updateMap();
|
||||
editor.uivalues.holdingPath = 0;
|
||||
editor.uivalues.stepPostfix = [];
|
||||
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
|
||||
editor.uifunctions.highlightSaveFloorButton();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -331,12 +376,7 @@ editor_mappanel_wrapper = function (editor) {
|
||||
* 显示右键菜单
|
||||
*/
|
||||
editor.uifunctions.showMidMenu = function (x, y) {
|
||||
editor.uivalues.lastRightButtonPos = JSON.parse(JSON.stringify(
|
||||
[editor.pos, editor.uivalues.lastRightButtonPos[0]]
|
||||
));
|
||||
// --- copy
|
||||
editor.uivalues.lastCopyedInfo = [editor.copyFromPos(), editor.uivalues.lastCopyedInfo[0]];
|
||||
var locStr = '(' + editor.uivalues.lastRightButtonPos[1].x + ',' + editor.uivalues.lastRightButtonPos[1].y + ')';
|
||||
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
||||
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
|
||||
@ -375,8 +415,8 @@ editor_mappanel_wrapper = function (editor) {
|
||||
else editor.dom.extraEvent.style.display = 'none';
|
||||
|
||||
editor.dom.chooseThis.children[0].innerHTML = '选中此点' + '(' + editor.pos.x + ',' + editor.pos.y + ')'
|
||||
editor.dom.copyLoc.children[0].innerHTML = '复制事件' + locStr + '到此处';
|
||||
editor.dom.moveLoc.children[0].innerHTML = '交换事件' + locStr + '与此事件的位置';
|
||||
editor.dom.copyLoc.children[0].innerHTML = '复制此事件';
|
||||
editor.dom.pasteLoc.children[0].innerHTML = '粘贴到此事件';
|
||||
editor.dom.midMenu.style = 'top:' + (y + scrollTop) + 'px;left:' + (x + scrollLeft) + 'px;';
|
||||
}
|
||||
|
||||
@ -455,6 +495,7 @@ editor_mappanel_wrapper = function (editor) {
|
||||
editor.drawEventBlock();
|
||||
editor_mode.showMode('loc');
|
||||
printf('添加楼梯事件成功');
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@ -515,6 +556,7 @@ editor_mappanel_wrapper = function (editor) {
|
||||
editor.drawPosSelection();
|
||||
editor_mode.showMode('loc');
|
||||
printf('绑定机关门事件成功');
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
});
|
||||
bindSpecialDoor.loc = null;
|
||||
bindSpecialDoor.enemys = [];
|
||||
@ -555,32 +597,39 @@ editor_mappanel_wrapper = function (editor) {
|
||||
editor.uifunctions.copyLoc_click = function (e) {
|
||||
editor.uifunctions.hideMidMenu();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
editor_mode.onmode('');
|
||||
editor.uivalues.copyedInfo = editor.copyFromPos();
|
||||
printf('该点事件已复制');
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* editor.dom.pasteLoc.onmousedown
|
||||
* 菜单 移动此事件
|
||||
*/
|
||||
editor.uifunctions.pasteLoc_click = function (e) {
|
||||
editor.uifunctions.hideMidMenu();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
if (!editor.uivalues.copyedInfo) {
|
||||
printe("没有复制的事件");
|
||||
return;
|
||||
}
|
||||
editor.savePreMap();
|
||||
editor_mode.onmode('');
|
||||
var now = editor.pos, last = editor.uivalues.lastRightButtonPos[1];
|
||||
if (now.x == last.x && now.y == last.y) return;
|
||||
editor.pasteToPos(editor.uivalues.lastCopyedInfo[1]);
|
||||
editor.pasteToPos(editor.uivalues.copyedInfo);
|
||||
editor.updateMap();
|
||||
editor.file.saveFloorFile(function (err) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw (err)
|
||||
}
|
||||
; printf('复制事件成功');
|
||||
; printf('粘贴到事件成功');
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
editor.drawPosSelection();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* editor.dom.moveLoc.onmousedown
|
||||
* 菜单 移动此事件
|
||||
*/
|
||||
editor.uifunctions.moveLoc_click = function (e) {
|
||||
editor.uifunctions.hideMidMenu();
|
||||
e.stopPropagation();
|
||||
editor.savePreMap();
|
||||
editor_mode.onmode('');
|
||||
editor.exchangePos(editor.pos, editor.uivalues.lastRightButtonPos[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -590,6 +639,7 @@ editor_mappanel_wrapper = function (editor) {
|
||||
editor.uifunctions.clearEvent_click = function (e) {
|
||||
e.stopPropagation();
|
||||
editor.clearPos(false);
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -599,6 +649,7 @@ editor_mappanel_wrapper = function (editor) {
|
||||
editor.uifunctions.clearLoc_click = function (e) {
|
||||
e.stopPropagation();
|
||||
editor.clearPos(true);
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -637,13 +688,13 @@ editor_mappanel_wrapper = function (editor) {
|
||||
* 切换画笔模式
|
||||
*/
|
||||
editor.uifunctions.brushMod3_onchange = function () {
|
||||
if (!editor.config.get('alertTileMode') &&
|
||||
!confirm("从V2.6.6开始,tileset贴图模式已被废弃。\n请右键额外素材,并输入所需要绘制的宽高,然后单击地图以绘制一个区域。\n\n点取消将不再显示此提示。")) {
|
||||
editor.config.set('alertTileMode', true);
|
||||
if (!editor.config.get('alertTileModeV2.7') &&
|
||||
!confirm("从V2.7开始,请直接素材区拖框进行绘制区域。\n\n点取消将不再显示此提示。")) {
|
||||
editor.config.set('alertTileModeV2.7', true);
|
||||
}
|
||||
// tip.showHelp(5)
|
||||
tip.isSelectedBlock(false)
|
||||
tip.msgs[11] = String('tileset贴图模式下可以按选中tileset素材,并在地图上拖动来一次绘制一个区域');
|
||||
tip.msgs[11] = String('tileset平铺模式下可以按选中tileset素材,并在地图上拖动来一次绘制一个区域');
|
||||
tip.whichShow(12);
|
||||
editor.brushMod = editor.dom.brushMod3.value;
|
||||
}
|
||||
@ -755,6 +806,15 @@ editor_mappanel_wrapper = function (editor) {
|
||||
});
|
||||
}
|
||||
|
||||
editor.uifunctions.highlightSaveFloorButton=function(){
|
||||
var saveFloor = document.getElementById('saveFloor');
|
||||
saveFloor.style.background='#FFCCAA';
|
||||
}
|
||||
|
||||
editor.uifunctions.unhighlightSaveFloorButton=function(){
|
||||
var saveFloor = document.getElementById('saveFloor');
|
||||
saveFloor.style.background='';
|
||||
}
|
||||
|
||||
editor.uifunctions.saveFloor_func = function () {
|
||||
var saveFloor = document.getElementById('saveFloor');
|
||||
@ -766,6 +826,7 @@ editor_mappanel_wrapper = function (editor) {
|
||||
throw (err)
|
||||
}
|
||||
; printf('保存成功');
|
||||
editor.uifunctions.unhighlightSaveFloorButton()
|
||||
});
|
||||
}
|
||||
saveFloor.onclick = editor_mode.saveFloor;
|
||||
@ -781,16 +842,34 @@ editor_mappanel_wrapper = function (editor) {
|
||||
var x = parseInt(px / 32), y = parseInt(py / 32);
|
||||
var index = x + core.__SIZE__ * y;
|
||||
if (index >= editor.uivalues.lastUsed.length) return;
|
||||
editor.setSelectBoxFromInfo(editor.uivalues.lastUsed[index]);
|
||||
return;
|
||||
var lastUsed = editor.uivalues.lastUsed.sort(function (a, b) {
|
||||
if ((a.istop || 0) != (b.istop || 0)) return (b.istop || 0) - (a.istop || 0);
|
||||
return (b[editor.uivalues.lastUsedType] || 0) - (a[editor.uivalues.lastUsedType] || 0);
|
||||
});
|
||||
|
||||
if (e.button == 2) {
|
||||
lastUsed[index].istop = lastUsed[index].istop ? 0 : 1;
|
||||
printf("已"+(lastUsed[index].istop ? '置顶' : '取消置顶')+"该图块");
|
||||
editor.config.set('lastUsed', editor.uivalues.lastUsed);
|
||||
editor.updateLastUsedMap();
|
||||
return false;
|
||||
}
|
||||
var one = Object.assign({}, lastUsed[index]);
|
||||
delete one['recent'];
|
||||
delete one['frequent'];
|
||||
delete one['istop'];
|
||||
editor.setSelectBoxFromInfo(one);
|
||||
return false;
|
||||
}
|
||||
|
||||
editor.uifunctions.clearLastUsedBtn_click = function () {
|
||||
if (editor.isMobile) return;
|
||||
|
||||
editor.uivalues.lastUsed = [];
|
||||
editor.config.set('lastUsed', []);
|
||||
editor.updateLastUsedMap();
|
||||
if (confirm("你确定要清理全部最近使用图块么?\n所有最近使用和最常使用图块(含置顶图块)都将被清除;此过程不可逆!")) {
|
||||
editor.uivalues.lastUsed = [];
|
||||
editor.config.set('lastUsed', []);
|
||||
editor.updateLastUsedMap();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -799,30 +878,51 @@ editor_mappanel_wrapper = function (editor) {
|
||||
editor.constructor.prototype.copyFromPos = function (pos) {
|
||||
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
|
||||
pos = pos || editor.pos;
|
||||
var map = core.clone(editor.map[pos.y][pos.x]);
|
||||
var events = {};
|
||||
fields.forEach(function(v){
|
||||
events[v] = core.clone(editor.currentFloorData[v][pos.x+','+pos.y]);
|
||||
})
|
||||
return {map: map, events: events};
|
||||
var x0 = pos.x, y0 = pos.y, x1 = pos.x1, y1 = pos.y1;
|
||||
if (x1 == null) x1 = x0;
|
||||
if (y1 == null) y1 = y0;
|
||||
if (x0 > x1) { x0 ^= x1; x1 ^= x0; x0 ^= x1; }//swap
|
||||
if (y0 > y1) { y0 ^= y1; y1 ^= y0; y0 ^= y1; }//swap
|
||||
var result = {w: x1 - x0 + 1, h: y1 - y0 + 1, layer: editor.layerMod, data: []};
|
||||
for (var i = x0; i <= x1; ++i) {
|
||||
for (var j = y0; j<= y1; ++j) {
|
||||
var map = core.clone(editor[editor.layerMod][j][i]);
|
||||
var events = {};
|
||||
fields.forEach(function(v){
|
||||
events[v] = core.clone(editor.currentFloorData[v][i+','+j]);
|
||||
})
|
||||
result.data.push({map: map, events: events});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
editor.constructor.prototype.pasteToPos = function (info, pos) {
|
||||
if (info == null) return;
|
||||
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
|
||||
pos = pos || editor.pos;
|
||||
editor.map[pos.y][pos.x] = core.clone(info.map);
|
||||
fields.forEach(function(v){
|
||||
if (info.events[v] == null) delete editor.currentFloorData[v][pos.x+","+pos.y];
|
||||
else editor.currentFloorData[v][pos.x+","+pos.y] = core.clone(info.events[v]);
|
||||
});
|
||||
var w = info.w || 1, h = info.h || 1, layer = info.layer || 'map';
|
||||
var data = core.clone(info.data || []);
|
||||
for (var i = pos.x; i < pos.x+w; ++i) {
|
||||
for (var j = pos.y; j < pos.y+h; ++j) {
|
||||
var one = data.shift();
|
||||
if (j >= editor[editor.layerMod].length || i >= editor[editor.layerMod][0].length) continue;
|
||||
editor[editor.layerMod][j][i] = core.clone(one.map);
|
||||
if (layer == 'map' && editor.layerMod == 'map') {
|
||||
fields.forEach(function(v){
|
||||
if (one.events[v] == null) delete editor.currentFloorData[v][i+","+j];
|
||||
else editor.currentFloorData[v][i+","+j] = core.clone(one.events[v]);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editor.constructor.prototype.movePos = function (startPos, endPos, callback) {
|
||||
if (!startPos || !endPos) return;
|
||||
if (startPos.x == endPos.x && startPos.y == endPos.y) return;
|
||||
var copyed = editor.copyFromPos(startPos);
|
||||
editor.pasteToPos({map:0, events: {}}, startPos);
|
||||
editor.pasteToPos({w: 1, h: 1, layer: 'map', data: [{map:0, events: {}}]}, startPos);
|
||||
editor.pasteToPos(copyed, endPos);
|
||||
editor.updateMap();
|
||||
editor.file.saveFloorFile(function (err) {
|
||||
@ -870,55 +970,31 @@ editor_mappanel_wrapper = function (editor) {
|
||||
}
|
||||
}
|
||||
|
||||
editor.constructor.prototype.moveBgFg = function (startPos, endPos, name, callback) {
|
||||
if (!startPos || !endPos || ["bgmap","fgmap"].indexOf(name)<0) return;
|
||||
if (startPos.x == endPos.x && startPos.y == endPos.y) return;
|
||||
editor[name][endPos.y][endPos.x] = editor[name][startPos.y][startPos.x];
|
||||
editor[name][startPos.y][startPos.x] = 0;
|
||||
editor.updateMap();
|
||||
editor.file.saveFloorFile(function (err) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw(err)
|
||||
}
|
||||
;printf('移动图块成功');
|
||||
editor.drawPosSelection();
|
||||
if (callback) callback();
|
||||
});
|
||||
}
|
||||
|
||||
editor.constructor.prototype.exchangeBgFg = function (startPos, endPos, name, callback) {
|
||||
if (!startPos || !endPos || ["bgmap","fgmap"].indexOf(name)<0) return;
|
||||
if (startPos.x == endPos.x && startPos.y == endPos.y) return;
|
||||
var value = editor[name][endPos.y][endPos.x];
|
||||
editor[name][endPos.y][endPos.x] = editor[name][startPos.y][startPos.x];
|
||||
editor[name][startPos.y][startPos.x] = value;
|
||||
editor.updateMap();
|
||||
editor.file.saveFloorFile(function (err) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw(err)
|
||||
}
|
||||
;printf('交换图块成功');
|
||||
editor.drawPosSelection();
|
||||
if (callback) callback();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
editor.constructor.prototype.clearPos = function (clearPos, pos, callback) {
|
||||
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
|
||||
pos = pos || editor.pos;
|
||||
var x0 = pos.x, y0 = pos.y, x1 = pos.x1, y1 = pos.y1;
|
||||
if (x1 == null) x1 = x0;
|
||||
if (y1 == null) y1 = y0;
|
||||
if (x0 > x1) { x0 ^= x1; x1 ^= x0; x0 ^= x1; }//swap
|
||||
if (y0 > y1) { y0 ^= y1; y1 ^= y0; y0 ^= y1; }//swap
|
||||
editor.uifunctions.hideMidMenu();
|
||||
editor.savePreMap();
|
||||
editor.info = 0;
|
||||
editor_mode.onmode('');
|
||||
if (clearPos)
|
||||
editor.map[pos.y][pos.x]=editor.info;
|
||||
for (var i = x0; i <= x1; ++i) {
|
||||
for (var j = y0; j <= y1; ++j) {
|
||||
if (j >= editor[editor.layerMod].length || i >= editor[editor.layerMod][0].length) continue;
|
||||
if (clearPos)
|
||||
editor[editor.layerMod][j][i] = 0;
|
||||
if (editor.layerMod == 'map') {
|
||||
fields.forEach(function(v){
|
||||
delete editor.currentFloorData[v][i+","+j];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
editor.updateMap();
|
||||
fields.forEach(function(v){
|
||||
delete editor.currentFloorData[v][pos.x+','+pos.y];
|
||||
})
|
||||
editor.file.saveFloorFile(function (err) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
|
||||
@ -64,11 +64,51 @@ editor_materialpanel_wrapper = function (editor) {
|
||||
|
||||
/**
|
||||
* editor.dom.iconLib.onmousedown
|
||||
* 素材区的单击事件
|
||||
* 素材区的单击/拖拽事件
|
||||
*/
|
||||
editor.uifunctions.material_ondown = function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
editor.uivalues.lastMoveMaterE=e;
|
||||
if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return;
|
||||
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
||||
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
editor.uivalues.startLoc={
|
||||
'x': scrollLeft + e.clientX + editor.dom.iconLib.scrollLeft - right.offsetLeft - editor.dom.iconLib.offsetLeft,
|
||||
'y': scrollTop + e.clientY + editor.dom.iconLib.scrollTop - right.offsetTop - editor.dom.iconLib.offsetTop,
|
||||
'px': e.clientX,
|
||||
'py': e.clientY,
|
||||
'size': 32
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* editor.dom.iconLib.onmousemove
|
||||
* 素材区的单击/拖拽事件
|
||||
*/
|
||||
editor.uifunctions.material_onmove = function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
editor.uivalues.lastMoveMaterE=e;
|
||||
if (!editor.uivalues.startLoc) return;
|
||||
var pos0 = editor.uifunctions.locToPos(editor.uivalues.startLoc);
|
||||
|
||||
editor.dom.dataSelection.style.left = 32 * pos0.x + 'px';
|
||||
editor.dom.dataSelection.style.top = 32 * pos0.y + 'px';
|
||||
editor.dom.dataSelection.style.width = e.clientX - editor.uivalues.startLoc.px + 'px';
|
||||
editor.dom.dataSelection.style.height = e.clientY - editor.uivalues.startLoc.py + 'px';
|
||||
editor.dom.dataSelection.style.display = 'block';
|
||||
}
|
||||
|
||||
/**
|
||||
* editor.dom.iconLib.onmouseup
|
||||
* 素材区的单击/拖拽事件
|
||||
*/
|
||||
editor.uifunctions.material_onup = function (ee) {
|
||||
var startLoc = editor.uivalues.startLoc;
|
||||
editor.uivalues.startLoc = null;
|
||||
|
||||
var e=editor.uivalues.lastMoveMaterE;
|
||||
if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return;
|
||||
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
||||
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
@ -79,6 +119,7 @@ editor_materialpanel_wrapper = function (editor) {
|
||||
};
|
||||
editor.loc = loc;
|
||||
editor.uivalues.tileSize = [1,1];
|
||||
var pos0 = editor.uifunctions.locToPos(startLoc);
|
||||
var pos = editor.uifunctions.locToPos(loc);
|
||||
for (var spriter in editor.widthsX) {
|
||||
if (pos.x >= editor.widthsX[spriter][1] && pos.x < editor.widthsX[spriter][2]) {
|
||||
@ -115,6 +156,7 @@ editor_materialpanel_wrapper = function (editor) {
|
||||
editor.dom.dataSelection.style.left = pos.x * 32 + 'px';
|
||||
editor.dom.dataSelection.style.top = pos.y * ysize + 'px';
|
||||
editor.dom.dataSelection.style.height = ysize - 6 + 'px';
|
||||
editor.dom.dataSelection.style.width = 32 - 6 + 'px';
|
||||
|
||||
if (pos.x == 0 && pos.y == 0) {
|
||||
// editor.info={idnum:0, id:'empty','images':'清除块', 'y':0};
|
||||
@ -133,21 +175,24 @@ editor_materialpanel_wrapper = function (editor) {
|
||||
editor.info = { 'images': pos.images, 'y': y }
|
||||
}
|
||||
|
||||
for (var ii = 0; ii < editor.ids.length; ii++) {
|
||||
if ((core.tilesets.indexOf(pos.images) != -1 && editor.info.images == editor.ids[ii].images
|
||||
&& editor.info.y == editor.ids[ii].y && editor.info.x == editor.ids[ii].x)
|
||||
|| (Object.prototype.hasOwnProperty.call(autotiles, pos.images) && editor.info.images == editor.ids[ii].id
|
||||
&& editor.info.y == editor.ids[ii].y)
|
||||
|| (core.tilesets.indexOf(pos.images) == -1 && editor.info.images == editor.ids[ii].images
|
||||
&& editor.info.y == editor.ids[ii].y)
|
||||
for (var idindex = 0; idindex < editor.ids.length; idindex++) {
|
||||
if ((core.tilesets.indexOf(pos.images) != -1 && editor.info.images == editor.ids[idindex].images
|
||||
&& editor.info.y == editor.ids[idindex].y && editor.info.x == editor.ids[idindex].x)
|
||||
|| (Object.prototype.hasOwnProperty.call(autotiles, pos.images) && editor.info.images == editor.ids[idindex].id
|
||||
&& editor.info.y == editor.ids[idindex].y)
|
||||
|| (core.tilesets.indexOf(pos.images) == -1 && editor.info.images == editor.ids[idindex].images
|
||||
&& editor.info.y == editor.ids[idindex].y)
|
||||
) {
|
||||
|
||||
editor.info = editor.ids[ii];
|
||||
editor.info = editor.ids[idindex];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (editor.info.isTile && e.button == 2) {
|
||||
if (editor.info.isTile && e.button == 2) { //这段改一改之类的应该能给手机用,就不删了
|
||||
// 废弃好了
|
||||
alert('V2.7后右键已被废弃,请直接素材区拖框选中区域。');
|
||||
/*
|
||||
var v = prompt("请输入该额外素材区域绑定宽高,以逗号分隔", "1,1");
|
||||
if (v != null && /^\d+,\d+$/.test(v)) {
|
||||
v = v.split(",");
|
||||
@ -157,8 +202,31 @@ editor_materialpanel_wrapper = function (editor) {
|
||||
alert("不合法的输入范围,已经越界");
|
||||
} else {
|
||||
editor.uivalues.tileSize = [x, y];
|
||||
editor.dom.dataSelection.style.left = pos.x * 32 + 'px';
|
||||
editor.dom.dataSelection.style.top = pos.y * ysize + 'px';
|
||||
editor.dom.dataSelection.style.height = ysize*y - 6 + 'px';
|
||||
editor.dom.dataSelection.style.width = 32*x - 6 + 'px';
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
if (editor.info.isTile && e.button != 2) { //左键拖拽框选
|
||||
|
||||
var x = pos.x-pos0.x+1, y = pos.y-pos0.y+1;
|
||||
var widthX = editor.widthsX[editor.info.images];
|
||||
// 懒得仔细处理了, 只允许左上往右下拉
|
||||
if (x <= 0 || y <= 0 || pos0.x < widthX[1]){
|
||||
|
||||
} else {
|
||||
editor.info = editor.ids[idindex-(x-1)-(y-1)*(widthX[2]-widthX[1])];
|
||||
editor.uifunctions.locToPos(startLoc); //重置editor.pos
|
||||
editor.uivalues.tileSize = [x, y];
|
||||
editor.dom.dataSelection.style.left = pos0.x * 32 + 'px';
|
||||
editor.dom.dataSelection.style.top = pos0.y * ysize + 'px';
|
||||
editor.dom.dataSelection.style.height = ysize*y - 6 + 'px';
|
||||
editor.dom.dataSelection.style.width = 32*x - 6 + 'px';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -97,14 +97,12 @@ editor_mode = function (editor) {
|
||||
}
|
||||
|
||||
editor_mode.prototype.onmode = function (mode, callback) {
|
||||
setTimeout(function(){
|
||||
if (editor_mode.mode != mode) {
|
||||
if (mode === 'save') editor_mode.doActionList(editor_mode.mode, editor_mode.actionList, callback);
|
||||
if (editor_mode.mode === 'nextChange' && mode) editor_mode.showMode(mode);
|
||||
if (mode !== 'save') editor_mode.mode = mode;
|
||||
editor_mode.actionList = [];
|
||||
}
|
||||
})
|
||||
if (editor_mode.mode != mode) {
|
||||
if (mode === 'save') editor_mode.doActionList(editor_mode.mode, editor_mode.actionList, callback);
|
||||
if (editor_mode.mode === 'nextChange' && mode) editor_mode.showMode(mode);
|
||||
if (mode !== 'save') editor_mode.mode = mode;
|
||||
editor_mode.actionList = [];
|
||||
}
|
||||
}
|
||||
|
||||
editor_mode.prototype.showMode = function (mode) {
|
||||
@ -169,9 +167,10 @@ editor_mode = function (editor) {
|
||||
return true
|
||||
}
|
||||
|
||||
editor_mode.prototype.checkImages = function (thiseval) {
|
||||
editor_mode.prototype.checkImages = function (thiseval, directory) {
|
||||
if (!directory) return true;
|
||||
if (!editor_mode.checkUnique(thiseval)) return false;
|
||||
fs.readdir('project/images', function (err, data) {
|
||||
fs.readdir(directory, function (err, data) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw Error(err);
|
||||
|
||||
@ -99,7 +99,6 @@ editor_multi = function () {
|
||||
editor_multi.isString = false;
|
||||
editor_multi.lintAutocomplete = false;
|
||||
if (args.lint === true) editor_multi.lintAutocomplete = true;
|
||||
if (field.indexOf('Effect') !== -1) editor_multi.lintAutocomplete = true;
|
||||
if ((!input.value || input.value == 'null') && editor_mode.mode == 'plugins')
|
||||
input.value = '"function () {\\n\\t// 在此增加新插件\\n\\t\\n}"';
|
||||
if (input.value.slice(0, 1) === '"' || args.string) {
|
||||
|
||||
@ -8,14 +8,14 @@ editor_table_wrapper = function (editor) {
|
||||
// HTML模板
|
||||
|
||||
editor_table.prototype.select = function (value, values) {
|
||||
var content = editor.table.option(value) +
|
||||
values.map(function (v) {
|
||||
return editor.table.option(v)
|
||||
if (values.indexOf(value) < 0) values = [value].concat(values);
|
||||
var content = values.map(function (v) {
|
||||
return editor.table.option(v, v == value)
|
||||
}).join('')
|
||||
return /* html */`<select>\n${content}</select>\n`
|
||||
}
|
||||
editor_table.prototype.option = function (value) {
|
||||
return /* html */`<option value='${JSON.stringify(value)}'>${JSON.stringify(value)}</option>\n`
|
||||
editor_table.prototype.option = function (value, selected) {
|
||||
return /* html */`<option value='${JSON.stringify(value)}' ${selected ? 'selected' : ''}>${JSON.stringify(value)}</option>\n`
|
||||
}
|
||||
editor_table.prototype.text = function (value) {
|
||||
return /* html */`<input type='text' spellcheck='false' value='${JSON.stringify(value)}'/>\n`
|
||||
@ -23,11 +23,12 @@ editor_table_wrapper = function (editor) {
|
||||
editor_table.prototype.checkbox = function (value) {
|
||||
return /* html */`<input type='checkbox' class='checkbox' ${(value ? 'checked ' : '')}/>\n`
|
||||
}
|
||||
editor_table.prototype.textarea = function (value, indent) {
|
||||
return /* html */`<textarea spellcheck='false'>${JSON.stringify(value, null, indent || 0)}</textarea>\n`
|
||||
editor_table.prototype.textarea = function (value, indent, disable) {
|
||||
return /* html */`<textarea spellcheck='false' ${disable ? 'disabled readonly' : ''}>${JSON.stringify(value, null, indent || 0)}</textarea>\n`
|
||||
}
|
||||
editor_table.prototype.checkboxSet = function (value, keys, prefixStrings) {
|
||||
if (!(value instanceof Array)) value = [];
|
||||
if (value == null) value = [];
|
||||
if (!(value instanceof Array)) value = [value];
|
||||
keys=Array.from(keys)
|
||||
prefixStrings=Array.from(prefixStrings)
|
||||
for (var index = 0; index < value.length; index++) {
|
||||
@ -75,7 +76,7 @@ editor_table_wrapper = function (editor) {
|
||||
<td title="${field}">${shortField}</td>
|
||||
<td title="${commentHTMLescape}" cobj="${cobjstr}">${shortComment || commentHTMLescape}</td>
|
||||
<td><div class="etableInputDiv ${type}">${tdstr}</div></td>
|
||||
<td>${editor.table.editGrid(shortComment, type != 'select' && type != 'checkbox' && type != 'checkboxSet')}</td>
|
||||
<td>${editor.table.editGrid(shortComment, type != 'select' && type != 'checkbox' && type != 'checkboxSet' && type != 'disable')}</td>
|
||||
</tr>\n`
|
||||
}
|
||||
|
||||
@ -224,8 +225,10 @@ editor_table_wrapper = function (editor) {
|
||||
|
||||
var listen = function (guids) {
|
||||
// 每个叶节点的事件绑定
|
||||
var tableid = editor.util.guid();
|
||||
editor.mode.currentTable=tableid;
|
||||
guids.forEach(function (guid) {
|
||||
editor.table.guidListen(guid, obj, commentObj)
|
||||
editor.table.guidListen(guid, tableid, obj, commentObj)
|
||||
});
|
||||
}
|
||||
return { "HTML": outstr.join(''), "guids": guids, "listen": listen };
|
||||
@ -280,7 +283,7 @@ editor_table_wrapper = function (editor) {
|
||||
case 'checkboxSet':
|
||||
return editor.table.checkboxSet(thiseval, cobj._checkboxSet.key, cobj._checkboxSet.prefix);
|
||||
default:
|
||||
return editor.table.textarea(thiseval, cobj.indent || 0);
|
||||
return editor.table.textarea(thiseval, cobj.indent || 0, cobj._type == 'disable');
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,7 +312,7 @@ editor_table_wrapper = function (editor) {
|
||||
* 监听一个guid对应的表格项
|
||||
* @param {String} guid
|
||||
*/
|
||||
editor_table.prototype.guidListen = function (guid, obj, commentObj) {
|
||||
editor_table.prototype.guidListen = function (guid, tableid, obj, commentObj) {
|
||||
// tr>td[title=field]
|
||||
// >td[title=comment,cobj=cobj:json]
|
||||
// >td>div>input[value=thiseval]
|
||||
@ -318,6 +321,7 @@ editor_table_wrapper = function (editor) {
|
||||
var field = thisTr.children[0].getAttribute('title');
|
||||
var cobj = JSON.parse(thisTr.children[1].getAttribute('cobj'));
|
||||
var modeNode = thisTr.parentNode;
|
||||
thisTr.setAttribute('tableid',tableid)
|
||||
while (!editor_mode._ids.hasOwnProperty(modeNode.getAttribute('id'))) {
|
||||
modeNode = modeNode.parentNode;
|
||||
}
|
||||
@ -341,6 +345,7 @@ editor_table_wrapper = function (editor) {
|
||||
*/
|
||||
editor_table.prototype.onchange = function (guid, obj, commentObj, thisTr, input, field, cobj, modeNode) {
|
||||
editor_mode.onmode(editor_mode._ids[modeNode.getAttribute('id')]);
|
||||
if (editor.mode.currentTable!=thisTr.getAttribute('tableid')) return;
|
||||
var thiseval = null;
|
||||
if (input.checked != null) input.value = input.checked;
|
||||
try {
|
||||
@ -362,7 +367,7 @@ editor_table_wrapper = function (editor) {
|
||||
var tokenstyle = document.createElement("style");
|
||||
document.body.appendChild(tokenstyle);
|
||||
|
||||
tokenPoolRender = function() {
|
||||
var tokenPoolRender = function() {
|
||||
var content = "";
|
||||
Object.keys(tokenPool).forEach(function(k) {
|
||||
content += /* CSS */`[data-field|=${k}]{ display: none }`;
|
||||
@ -407,6 +412,7 @@ editor_table_wrapper = function (editor) {
|
||||
if (cobj._type === 'event') editor_blockly.import(guid, { type: cobj._event });
|
||||
if (cobj._type === 'textarea') editor_multi.import(guid, { lint: cobj._lint, string: cobj._string });
|
||||
if (cobj._type === 'material') editor.table.selectMaterial(input, cobj);
|
||||
if (cobj._type === 'color') editor.table.selectColor(input);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -421,6 +427,7 @@ editor_table_wrapper = function (editor) {
|
||||
if (cobj._type === 'event') editor_blockly.import(guid, { type: cobj._event });
|
||||
if (cobj._type === 'textarea') editor_multi.import(guid, { lint: cobj._lint, string: cobj._string });
|
||||
if (cobj._type === 'material') editor.table.selectMaterial(input, cobj);
|
||||
if (cobj._type === 'color') editor.table.selectColor(input);
|
||||
} else if (editor_mode.doubleClickMode === 'add') {
|
||||
editor_mode.doubleClickMode = 'change';
|
||||
editor.table.addfunc(guid, obj, commentObj, thisTr, input, field, cobj, modeNode)
|
||||
@ -441,6 +448,21 @@ editor_table_wrapper = function (editor) {
|
||||
})
|
||||
}
|
||||
|
||||
editor_table.prototype.selectColor = function (input) {
|
||||
if (input.value != null) {
|
||||
var str = input.value.toString().replace(/[^\d.,]/g, '');
|
||||
if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(str)) {
|
||||
document.getElementById('colorPicker').value = str;
|
||||
}
|
||||
}
|
||||
var boundingBox = input.getBoundingClientRect();
|
||||
openColorPicker(boundingBox.x, boundingBox.y + boundingBox.height, function (value) {
|
||||
value = value.replace(/[^\d.,]/g, '');
|
||||
input.value = '[' + value +']';
|
||||
input.onchange();
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除表格项
|
||||
*/
|
||||
|
||||
@ -30,8 +30,8 @@ editor_ui_wrapper = function (editor) {
|
||||
'双击事件编辑器的图块可以进行长文本编辑/脚本编辑/地图选点/UI绘制预览等操作',
|
||||
'ESC或点击空白处可以自动保存当前修改',
|
||||
'H键可以打开操作帮助哦',
|
||||
'tileset贴图模式可以在地图上拖动来一次绘制一个区域;右键额外素材也可以绑定宽高',
|
||||
'可以拖动地图上的图块和事件,或按Ctrl+C, Ctrl+X和Ctrl+V进行复制,剪切和粘贴,Delete删除',
|
||||
'tileset平铺模式可以在地图上拖动来平铺框选的图形',
|
||||
'可以拖动地图上的图块和事件;或按Ctrl+C, Ctrl+X和Ctrl+V进行复制,剪切和粘贴,Delete删除;右键也可以拉框选择区域',
|
||||
'Alt+数字键保存图块,数字键读取保存的图块',
|
||||
];
|
||||
if (value == null) value = Math.floor(Math.random() * tips.length);
|
||||
@ -236,6 +236,7 @@ editor_ui_wrapper = function (editor) {
|
||||
throw (err)
|
||||
}
|
||||
; printf('地图保存成功');
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
});
|
||||
}
|
||||
selectBox.isSelected(false);
|
||||
@ -318,6 +319,7 @@ editor_ui_wrapper = function (editor) {
|
||||
editor.bgmap = JSON.parse(JSON.stringify(data.bgmap));
|
||||
editor.updateMap();
|
||||
editor.uivalues.postMapData.push(data);
|
||||
editor.uifunctions.highlightSaveFloorButton();
|
||||
printf("已撤销此操作,你可能需要重新保存地图。");
|
||||
}
|
||||
return;
|
||||
@ -332,6 +334,7 @@ editor_ui_wrapper = function (editor) {
|
||||
editor.bgmap = JSON.parse(JSON.stringify(data.bgmap));
|
||||
editor.updateMap();
|
||||
editor.uivalues.preMapData.push(data);
|
||||
editor.uifunctions.highlightSaveFloorButton();
|
||||
printf("已重做此操作,你可能需要重新保存地图。");
|
||||
}
|
||||
return;
|
||||
@ -340,15 +343,16 @@ editor_ui_wrapper = function (editor) {
|
||||
// Ctrl+C, Ctrl+X, Ctrl+V
|
||||
if (e.ctrlKey && e.keyCode == 67 && !selectBox.isSelected()) {
|
||||
e.preventDefault();
|
||||
editor.uivalues.copyedInfo = editor.copyFromPos();
|
||||
printf('该点事件已复制');
|
||||
editor.uivalues.copyedInfo = editor.copyFromPos(editor.uivalues.selectedArea);
|
||||
printf('该点事件已复制;请注意右键地图拉框可以复制一个区域;若有时复制失灵请多点几下空白处');
|
||||
return;
|
||||
}
|
||||
if (e.ctrlKey && e.keyCode == 88 && !selectBox.isSelected()) {
|
||||
e.preventDefault();
|
||||
editor.uivalues.copyedInfo = editor.copyFromPos();
|
||||
editor.clearPos(true, null, function () {
|
||||
printf('该点事件已剪切');
|
||||
editor.uivalues.copyedInfo = editor.copyFromPos(editor.uivalues.selectedArea);
|
||||
editor.clearPos(true, editor.uivalues.selectedArea, function () {
|
||||
printf('该点事件已剪切;请注意右键地图拉框可以剪切一个区域;若有时剪切失灵请多点几下空白处');
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
})
|
||||
return;
|
||||
}
|
||||
@ -365,14 +369,18 @@ editor_ui_wrapper = function (editor) {
|
||||
printe(err);
|
||||
throw (err)
|
||||
}
|
||||
; printf('粘贴事件成功');
|
||||
; printf('粘贴事件成功;若有时粘贴失灵请多点几下空白处');
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
editor.drawPosSelection();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// DELETE
|
||||
if (e.keyCode == 46 && !selectBox.isSelected()) {
|
||||
editor.clearPos(true);
|
||||
editor.clearPos(true, editor.uivalues.selectedArea, function () {
|
||||
printf('该点事件已删除;请注意右键地图拉框可以删除一个区域;;若有时删除失灵请多点几下空白处');
|
||||
editor.uifunctions.unhighlightSaveFloorButton();
|
||||
})
|
||||
return;
|
||||
}
|
||||
// ESC
|
||||
@ -792,8 +800,10 @@ editor_ui_wrapper = function (editor) {
|
||||
}
|
||||
// 试听音频
|
||||
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || one.endsWith('.wav')) {
|
||||
html += "<button onclick='editor.uievent._previewMaterialAudio(this)' style='margin-left: 10px'>试听</button>";
|
||||
html += '<br style="display:none"/><audio controls preload="none" src="'+directory+one+'" style="display:none; max-width: 100%"></audio>';
|
||||
html += "<button onclick='editor.uievent._previewMaterialAudio(this)' style='margin-left: 10px'>播放</button>";
|
||||
html += `<small style='display:none; margin-left: 15px'>0:00 / 0:00</small><br style="display:none"/>
|
||||
<audio preload="none" src="${directory+one}" ontimeupdate="editor.uievent._previewMaterialAudio_onTimeUpdate(this)"></audio>
|
||||
<progress value="0" max="1" style="display:none; width:100%" onclick="editor.uievent._previewMaterialAudio_seek(this, event)"></progress>`;
|
||||
}
|
||||
html += '<br/>';
|
||||
});
|
||||
@ -824,19 +834,41 @@ editor_ui_wrapper = function (editor) {
|
||||
}
|
||||
|
||||
uievent._previewMaterialAudio = function (button) {
|
||||
var br = button.nextElementSibling;
|
||||
var span = button.nextElementSibling;
|
||||
var br = span.nextElementSibling;
|
||||
var audio = br.nextElementSibling;
|
||||
var progress = audio.nextElementSibling;
|
||||
if (br.style.display == 'none') {
|
||||
button.innerText = '折叠';
|
||||
button.innerText = '暂停';
|
||||
br.style.display = 'block';
|
||||
audio.style.display = 'block';
|
||||
progress.style.display = 'block';
|
||||
span.style.display = 'inline';
|
||||
audio.play();
|
||||
} else {
|
||||
button.innerText = '试听';
|
||||
button.innerText = '播放';
|
||||
br.style.display = 'none';
|
||||
audio.style.display = 'none';
|
||||
progress.style.display='none';
|
||||
span.style.display = 'none';
|
||||
audio.pause();
|
||||
}
|
||||
}
|
||||
|
||||
uievent._previewMaterialAudio_onTimeUpdate = function (audio) {
|
||||
var _format = function (time) { return parseInt(time/60) + ":" + core.setTwoDigits(parseInt(time) % 60); }
|
||||
if (audio.duration > 0) {
|
||||
audio.previousElementSibling.previousElementSibling.innerText = _format(audio.currentTime) + " / " + _format(audio.duration);
|
||||
audio.nextElementSibling.setAttribute('value', audio.currentTime / audio.duration);
|
||||
}
|
||||
}
|
||||
|
||||
uievent._previewMaterialAudio_seek = function (element, event) {
|
||||
var audio = element.previousElementSibling;
|
||||
var value = event.offsetX * element.max / element.offsetWidth;
|
||||
element.setAttribute("value", value);
|
||||
audio.currentTime = audio.duration * value;
|
||||
if (audio.paused) audio.play();
|
||||
}
|
||||
|
||||
editor.constructor.prototype.uievent=uievent;
|
||||
|
||||
}
|
||||
@ -56,7 +56,8 @@
|
||||
callback(null, data);
|
||||
}
|
||||
}, function (e) {
|
||||
main.log(e);
|
||||
if (window.main != null && main.log) main.log(e);
|
||||
else console.log(e);
|
||||
callback(e+":请检查启动服务是否处于正常运行状态。");
|
||||
}, "text/plain; charset=x-user-defined");
|
||||
}
|
||||
@ -142,4 +143,44 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} path 支持"/"做分隔符
|
||||
* @param {() => {err: string, data}} callback
|
||||
*/
|
||||
fs.mkdir = function (path, callback) {
|
||||
//callback:function(err, data)
|
||||
if (typeof(path) != typeof(''))
|
||||
throw 'Type Error in fs.readdir';
|
||||
var data = '';
|
||||
data += 'name=' + path;
|
||||
postsomething(data, '/makeDir', callback);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} path 支持"/"做分隔符, 不以"/"结尾
|
||||
* @param {() => {err: string, data}} callback
|
||||
*/
|
||||
fs.moveFile = function (src, dest, callback) {
|
||||
if (typeof(src) != typeof('') || typeof(dest) != typeof(''))
|
||||
throw 'Type Error in fs.readdir';
|
||||
var data = '';
|
||||
data += 'src=' + src + "&dest=" + dest;
|
||||
postsomething(data, '/moveFile', callback);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} path 支持"/"做分隔符, 不以"/"结尾
|
||||
* @param {() => {err: string, data}} callback
|
||||
*/
|
||||
fs.deleteFile = function (path, callback) {
|
||||
if (typeof(path) != typeof(''))
|
||||
throw 'Type Error in fs.readdir';
|
||||
var data = '';
|
||||
data += 'name=' + path;
|
||||
postsomething(data, '/deleteFile', callback);
|
||||
return;
|
||||
}
|
||||
})();
|
||||
@ -7,40 +7,63 @@
|
||||
<script src="./fs.js"></script>
|
||||
<script>
|
||||
fs.writeFile('_test.txt', '123中a文bc', 'utf-8', function (e, d) {
|
||||
console.log(e);
|
||||
console.log(d);
|
||||
console.log(e, d);
|
||||
})
|
||||
setTimeout(function () {
|
||||
fs.writeFile('_test_bin.txt', 'abc=', 'base64', function (e, d) {
|
||||
console.log(e);
|
||||
console.log(d);
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 1000);
|
||||
setTimeout(function () {
|
||||
fs.readFile('_test.txt', 'utf-8', function (e, d) {
|
||||
console.log(e);
|
||||
console.log(d);
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 2000);
|
||||
setTimeout(function () {
|
||||
fs.readFile('_test_bin.txt', 'base64', function (e, d) {
|
||||
console.log(e);
|
||||
console.log(d);
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 3000);
|
||||
setTimeout(function () {
|
||||
fs.readdir('.', function (e, d) {
|
||||
console.log(e);
|
||||
console.log(d);
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 4000);
|
||||
setTimeout(function () {
|
||||
fs.writeMultiFiles(['_test.txt','_test_multi.txt'], ['abc=','abe='], function (e, d) {
|
||||
console.log(e);
|
||||
console.log(d);
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 5000);
|
||||
|
||||
setTimeout(function () {
|
||||
fs.mkdir('__test__', function (e, d) {
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 6000);
|
||||
setTimeout(function () {
|
||||
fs.moveFile('_test_bin.txt', '__test__/_test_bin.txt', function (e, d) {
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 7000);
|
||||
setTimeout(function () {
|
||||
fs.moveFile('_test.txt', '__test__/_test.txt', function (e, d) {
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 8000);
|
||||
setTimeout(function () {
|
||||
fs.moveFile('_test_multi.txt', '__test__/_test.txt', function (e, d) {
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 8000);
|
||||
setTimeout(function () {
|
||||
fs.deleteFile('__test__/_test_bin.txt', function (e, d) {
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 9000);
|
||||
setTimeout(function () {
|
||||
fs.deleteFile('__test__', function (e, d) {
|
||||
console.log(e, d);
|
||||
})
|
||||
}, 10000);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@ -11,55 +11,55 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"items": {
|
||||
"_type": "object",
|
||||
"_data": {
|
||||
"items": {
|
||||
"_type": "object",
|
||||
"_data": {
|
||||
"cls": {
|
||||
"_leaf": true,
|
||||
"_type": "select",
|
||||
"_select": {
|
||||
"values": [
|
||||
"items",
|
||||
"constants",
|
||||
"tools",
|
||||
"equips"
|
||||
]
|
||||
},
|
||||
"_docs": "道具类别",
|
||||
"_data": "只能取items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
|
||||
},
|
||||
"name": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_data": "道具名称"
|
||||
},
|
||||
"text": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "道具描述",
|
||||
"_data": "道具在道具栏中显示的描述"
|
||||
},
|
||||
"hideInToolbox": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "道具栏中隐藏",
|
||||
"_data": "是否不显示在道具栏中"
|
||||
},
|
||||
"equip": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "道具的装备属性",
|
||||
"_data": "装备属性设置,仅对cls为equips有效。\n如果此项不为null,需要是一个对象,里面可含\"type\",\"atk\",\"def\",\"mdef\",\"animate\"五项,分别对应装备部位、攻防护盾和动画。\n具体详见文档(元件说明-装备)和已有的几个装备的写法。"
|
||||
},
|
||||
"hideInReplay": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "回放不绘制道具栏",
|
||||
"_data": "是否回放时不绘制道具栏。\n如果此项为true,则在回放录像时使用本道具将不会绘制道具栏页面,而是直接使用。\n此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)"
|
||||
}
|
||||
}
|
||||
"id": {
|
||||
"_leaf": true,
|
||||
"_type": "disable",
|
||||
"_docs": "道具ID",
|
||||
"_data": "道具ID,可于页面底部修改"
|
||||
},
|
||||
"cls": {
|
||||
"_leaf": true,
|
||||
"_type": "select",
|
||||
"_select": {
|
||||
"values": [
|
||||
"items",
|
||||
"constants",
|
||||
"tools",
|
||||
"equips"
|
||||
]
|
||||
},
|
||||
"_docs": "道具类别",
|
||||
"_data": "items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
|
||||
},
|
||||
"name": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_data": "道具名称"
|
||||
},
|
||||
"text": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "道具描述",
|
||||
"_data": "道具在道具栏中显示的描述"
|
||||
},
|
||||
"hideInToolbox": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "不显示在道具栏",
|
||||
},
|
||||
"equip": {
|
||||
"_leaf": true,
|
||||
"_type": "event",
|
||||
"_event": "equip",
|
||||
"_docs": "道具的装备属性"
|
||||
},
|
||||
"hideInReplay": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "回放不绘制道具栏",
|
||||
"_data": "此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)"
|
||||
},
|
||||
"itemEffect": {
|
||||
"_leaf": true,
|
||||
@ -73,7 +73,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_lint": true,
|
||||
"_docs": "即捡即用提示",
|
||||
"_data": "即捡即用类物品在获得时提示的文字,仅对cls为items有效。"
|
||||
},
|
||||
@ -82,7 +81,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_type": "event",
|
||||
"_event": "item",
|
||||
"_docs": "碰触或使用事件",
|
||||
"_data": "碰触或使用本道具所执行的事件"
|
||||
"_data": "碰触或使用本道具所执行的事件,对所有cls有效"
|
||||
},
|
||||
"useItemEffect": {
|
||||
"_leaf": true,
|
||||
@ -97,7 +96,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_lint": true,
|
||||
"_docs": "能否使用条件",
|
||||
"_docs": "能否使用",
|
||||
"_data": "当前能否使用该道具,仅对cls为tools或constants有效。"
|
||||
},
|
||||
"equipCondition": {
|
||||
@ -105,18 +104,24 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_lint": true,
|
||||
"_docs": "能否装备条件",
|
||||
"_docs": "能否装备",
|
||||
"_data": "能装备某个装备的条件,仅对cls为equips有效。\n与canUseItemEffect不同,这里null代表可以装备。"
|
||||
}
|
||||
}
|
||||
},
|
||||
"items_template": { 'cls': 'items', 'name': '新物品', 'canPass': true },
|
||||
"items_template": { 'cls': 'items', 'name': '新物品' },
|
||||
|
||||
|
||||
// --------------------------- 【怪物】相关的表格配置 --------------------------- //
|
||||
"enemys": {
|
||||
"_type": "object",
|
||||
"_data": {
|
||||
"id": {
|
||||
"_leaf": true,
|
||||
"_type": "disable",
|
||||
"_docs": "怪物ID",
|
||||
"_data": "怪物ID,可于页面底部修改"
|
||||
},
|
||||
"name": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
@ -128,7 +133,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "手册映射ID",
|
||||
"_data": "在怪物手册中映射到的怪物ID。如果此项不为null,则在怪物手册中,将用目标ID来替换该怪物原本的ID。\n此项应被运用在同一个怪物的多朝向上。\n例如,如果想定义同一个怪物的向下和向左的行走图,则需要建立两个属性完全相同的怪物。\n但是这样会导致在怪物手册中同时存在向下和向左的两种怪物的显示。\n可以将朝向左的怪物的displayIdInBook项指定为朝向下的怪物ID,这样在怪物手册中则会归一化,只显示一个。"
|
||||
"_data": "在怪物手册中映射到的怪物ID。如果此项不为null,则在怪物手册中,将用目标ID来替换该怪物原本的ID。常被运用在同一个怪物的多朝向上。"
|
||||
},
|
||||
"hp": {
|
||||
"_leaf": true,
|
||||
@ -182,7 +187,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"value": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "特殊属性值",
|
||||
"_docs": "特殊属性数值",
|
||||
"_data": "特殊属性的数值\n如:领域/阻激/激光怪的伤害值;吸血怪的吸血比例;光环怪增加生命的比例"
|
||||
},
|
||||
"zoneSquare": {
|
||||
@ -201,7 +206,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"notBomb": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "是否不可炸",
|
||||
"_docs": "不可炸",
|
||||
"_data": "该怪物不可被炸"
|
||||
},
|
||||
"n": {
|
||||
@ -214,21 +219,21 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"add": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "吸血加自身",
|
||||
"_docs": "吸血加到自身",
|
||||
"_data": "吸血后是否加到自身;光环是否叠加"
|
||||
},
|
||||
"atkValue": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval==~~thiseval||thiseval==null",
|
||||
"_docs": "退化扣攻击",
|
||||
"_docs": "退化扣除攻击",
|
||||
"_data": "退化时勇士下降的攻击力点数;光环怪增加攻击的比例"
|
||||
},
|
||||
"defValue": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval==~~thiseval||thiseval==null",
|
||||
"_docs": "退化扣防御",
|
||||
"_docs": "退化扣除防御",
|
||||
"_data": "退化时勇士下降的防御力点数;光环怪增加防御的比例"
|
||||
},
|
||||
"damage": {
|
||||
@ -249,20 +254,20 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_data": {
|
||||
"id": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "disable",
|
||||
"_range": "false",
|
||||
"_docs": "图块ID",
|
||||
"_data": "图块唯一ID,可在页面底部修改"
|
||||
},
|
||||
"idnum": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "disable",
|
||||
"_range": "false",
|
||||
"_data": "图块数字"
|
||||
},
|
||||
"cls": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "disable",
|
||||
"_range": "false",
|
||||
"_data": "图块类别"
|
||||
},
|
||||
@ -291,7 +296,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "可通行性",
|
||||
"_data": "该图块是否可以通行;true代表可以通行,false代表不可通行"
|
||||
},
|
||||
"script": {
|
||||
"_leaf": true,
|
||||
@ -309,7 +313,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"key":["up","down","left","right"]
|
||||
},
|
||||
"_docs": "不可出方向",
|
||||
"_data": "该图块的不可出方向\n可以在这里定义在该图块时不能前往哪个方向,可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表在该图块时不能往上和左走\n此值对背景层、事件层、前景层上的图块均有效"
|
||||
"_data": "该图块的不可出方向\n对背景层、事件层、前景层上的图块均有效"
|
||||
},
|
||||
"cannotIn": {
|
||||
"_leaf": true,
|
||||
@ -319,7 +323,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"key":["up","down","left","right"]
|
||||
},
|
||||
"_docs": "不可入方向",
|
||||
"_data": "该图块的不可入方向\n可以在这里定义不能朝哪个方向进入该图块,可以达到悬崖之类的效果\n例如 [\"down\"] 代表不能从该图块的上方点朝向下进入此图块\n此值对背景层、事件层、前景层上的图块均有效"
|
||||
"_data": "该图块的不可入方向\n对背景层、事件层、前景层上的图块均有效"
|
||||
},
|
||||
"canBreak": {
|
||||
"_leaf": true,
|
||||
@ -329,22 +333,26 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
},
|
||||
"animate": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval==~~thiseval||thiseval==null",
|
||||
"_type": "select",
|
||||
"_select": {
|
||||
"values": [null,1,2,3,4],
|
||||
},
|
||||
"_docs": "动画帧数",
|
||||
"_data": "该图块的全局动画帧数。\n如果此项为null,则对于除了npc48外,使用素材默认帧数;npc48默认是1帧(即静止)。"
|
||||
"_data": "null代表素材默认帧数"
|
||||
},
|
||||
"doorInfo": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "event",
|
||||
"_event": "doorInfo",
|
||||
"_docs": "门信息",
|
||||
"_data": "该图块的门信息,是一个三元数组。\n第一项为所需要的钥匙信息,第二项为开此门时的音效,第三项为关此门时的音效。仅对animates生效。"
|
||||
"_data": "该图块的门信息,仅对animates和npc48生效。"
|
||||
},
|
||||
"faceIds": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "event",
|
||||
"_event": "faceIds",
|
||||
"_docs": "行走图朝向",
|
||||
"_data": "行走图朝向,仅对NPC有效。可以在这里定义同一个NPC的多个朝向行走图。\n比如 {\"up\":\"N333\",\"down\":\"N334\",\"left\":\"N335\",\"right\":\"N336\"} 就将该素材的上下左右朝向分别绑定到N333,N334,N335和N336四个图块。\n在勇士撞上NPC时,或NPC在移动时,会自动选择最合适的朝向图块(如果存在定义)来进行绘制。"
|
||||
"_data": "行走图朝向,仅对npc48有效。在勇士撞上NPC时,或NPC在移动时,会自动选择最合适的朝向图块(如果存在定义)来进行绘制。"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -359,15 +367,15 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_data": {
|
||||
"floorId": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "disable",
|
||||
"_range": "false",
|
||||
"_docs": "楼层ID",
|
||||
"_data": "文件名和floorId需要保持完全一致,可在页面底部修改 \n楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 \n推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等"
|
||||
"_data": "文件名和floorId需要保持完全一致,可在页面底部修改"
|
||||
},
|
||||
"title": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "楼层中文名",
|
||||
"_docs": "楼层名",
|
||||
"_data": "楼层中文名,将在切换楼层和浏览地图时显示"
|
||||
},
|
||||
"name": {
|
||||
@ -378,22 +386,22 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
},
|
||||
"width": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "disable",
|
||||
"_range": "false",
|
||||
"_docs": "宽度",
|
||||
"_data": "地图x方向大小,请在表格最下方修改,null视为13"
|
||||
"_data": "地图x方向大小,请在表格最下方修改"
|
||||
},
|
||||
"height": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "disable",
|
||||
"_range": "false",
|
||||
"_docs": "高度",
|
||||
"_data": "地图y方向大小,请在表格最下方修改,null视为13"
|
||||
"_data": "地图y方向大小,请在表格最下方修改"
|
||||
},
|
||||
"canFlyTo": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "可飞",
|
||||
"_docs": "可楼传",
|
||||
"_data": "该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)"
|
||||
},
|
||||
"canUseQuickShop": {
|
||||
@ -458,13 +466,13 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
},
|
||||
"images": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "楼层贴图",
|
||||
"_data": "背景/前景图;你可以选择若干张图片来作为背景/前景素材。详细用法请参见文档“自定义素材”中的说明。"
|
||||
"_type": "event",
|
||||
"_event": "floorImage",
|
||||
"_docs": "楼层贴图"
|
||||
},
|
||||
"color": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "color",
|
||||
"_docs": "色调",
|
||||
"_data": "该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组如[255,0,0,0.3]"
|
||||
},
|
||||
@ -481,9 +489,9 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"values": [null].concat(Object.keys(editor.core.material.bgms))
|
||||
},
|
||||
"_docs": "背景音乐",
|
||||
"_data": "到达该层后默认播放的BGM。本项可忽略,或者为一个定义过的背景音乐如\"bgm.mp3\"。"
|
||||
"_data": "到达该层后默认播放的BGM"
|
||||
},
|
||||
"item_ratio": {
|
||||
"ratio": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "(thiseval==~~thiseval && thiseval>=0)||thiseval==null",
|
||||
@ -580,7 +588,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"cannotViewMap": false,
|
||||
"cannotMoveDirectly": false,
|
||||
"images": [],
|
||||
"item_ratio": 1,
|
||||
"ratio": 1,
|
||||
"defaultGround": "ground",
|
||||
"bgm": null,
|
||||
"upFloor": null,
|
||||
|
||||
@ -20,21 +20,21 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"images": {
|
||||
"_leaf": true,
|
||||
"_type": "material",
|
||||
"_range": "editor.mode.checkImages(thiseval)",
|
||||
"_range": "editor.mode.checkImages(thiseval, './project/images/')",
|
||||
"_directory": "./project/images/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || end.endsWith('.gif'))
|
||||
if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif'))
|
||||
return one;
|
||||
return null;
|
||||
}).toString(),
|
||||
"_docs": "本塔使用图片",
|
||||
"_docs": "使用图片",
|
||||
"_data": "在此存放所有可能使用的图片(tilesets除外) \n图片可以被作为背景图(的一部分),也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加",
|
||||
},
|
||||
"tilesets": {
|
||||
"_leaf": true,
|
||||
"_type": "material",
|
||||
"_range": "editor.mode.checkImages(thiseval)",
|
||||
"_directory": "./project/images/",
|
||||
"_range": "editor.mode.checkImages(thiseval, './project/tilesets/')",
|
||||
"_directory": "./project/tilesets/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith('.png'))
|
||||
return one;
|
||||
@ -50,7 +50,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
return j >= 0 ? 1 : -1;
|
||||
});
|
||||
}).toString(),
|
||||
"_docs": "本塔额外素材",
|
||||
"_docs": "额外素材",
|
||||
"_data": "在此存放额外素材的图片名, \n可以自定导入任意张素材图片,无需PS,无需注册,即可直接在游戏中使用 \n 形式如[\"1.png\", \"2.png\"] ,将需要的素材图片放在images目录下 \n 素材的宽高必须都是32的倍数,且图片上的总图块数不超过1000(即最多有1000个32*32的图块在该图片上)"
|
||||
},
|
||||
"animates": {
|
||||
@ -62,20 +62,20 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
if (one.endsWith(".animate")) return one.substring(0, one.lastIndexOf('.'));
|
||||
return null;
|
||||
}).toString(),
|
||||
"_docs": "本塔使用动画",
|
||||
"_docs": "使用动画",
|
||||
"_data": "在此存放所有可能使用的动画,必须是animate格式,在这里不写后缀名 \n动画必须放在animates目录下;文件名不能使用中文,不能带空格或特殊字符 \n \"jianji\", \"thunder\" 根据需求自行添加"
|
||||
},
|
||||
"bgms": {
|
||||
"_leaf": true,
|
||||
"_type": "material",
|
||||
"_range": "editor.mode.checkUnique(thiseval)",
|
||||
"_directory": "./project/sounds/",
|
||||
"_directory": "./project/bgms/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || end.endsWith('.wav'))
|
||||
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || one.endsWith('.wav'))
|
||||
return one;
|
||||
return null;
|
||||
}).toString(),
|
||||
"_docs": "本塔使用音乐",
|
||||
"_docs": "使用音乐",
|
||||
"_data": "在此存放所有的bgm,和文件名一致。 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||
},
|
||||
"sounds": {
|
||||
@ -84,46 +84,37 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_range": "editor.mode.checkUnique(thiseval)",
|
||||
"_directory": "./project/sounds/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || end.endsWith('.wav'))
|
||||
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || one.endsWith('.wav'))
|
||||
return one;
|
||||
return null;
|
||||
}).toString(),
|
||||
"_docs": "本塔使用音效",
|
||||
"_docs": "使用音效",
|
||||
"_data": "在此存放所有的SE,和文件名一致 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||
},
|
||||
"fonts": {
|
||||
"_leaf": true,
|
||||
"_type": "material",
|
||||
"_range": "editor.mode.checkUnique(thiseval)",
|
||||
"_directory": "./project/fonts/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith(".ttf")) return one.substring(0, one.lastIndexOf('.'));
|
||||
return null;
|
||||
}).toString(),
|
||||
"_docs": "使用字体",
|
||||
"_data": "在此存放所有可能使用的字体 \n 字体名不能使用中文,不能带空格或特殊字符"
|
||||
},
|
||||
"nameMap": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "文件名映射",
|
||||
"_docs": "文件映射",
|
||||
"_data": "文件名映射,目前仅对images, animates, bgms, sounds有效。\n例如定义 {\"精灵石.mp3\":\"jinglingshi.mp3\"} 就可以使用\ncore.playBgm(\"精灵石.mp3\") 或对应的事件来播放该bgm。"
|
||||
},
|
||||
"startBackground": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "标题背景",
|
||||
"_data": "标题界面的背景,建议使用jpg格式以压缩背景图空间"
|
||||
},
|
||||
"startLogoStyle": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "标题样式",
|
||||
"_data": "标题样式:可以改变颜色,也可以写\"display: none\"来隐藏标题"
|
||||
},
|
||||
"startButtonsStyle": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "标题按钮样式",
|
||||
"_data": "标题界面按钮的样式;caret-color指的是当前选中项的边框颜色"
|
||||
},
|
||||
"levelChoose": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval instanceof Array && thiseval.length>=1 && thiseval[0] instanceof Array && thiseval[0].length==2",
|
||||
"_type": "event",
|
||||
"_event": "levelChoose",
|
||||
"_docs": "难度分歧",
|
||||
"_data": "难度选择:每个数组的第一个是其在标题界面显示的难度,第二个是在游戏内部传输的字符串,会显示在状态栏,修改此处后需要在project/functions中作相应更改。\n如果需直接开始游戏将下面的startDirectly开关打开即可。"
|
||||
"_data": "难度分歧定义和对应的事件;此处留空数组表示将直接开始游戏"
|
||||
},
|
||||
"equipName": {
|
||||
"_leaf": true,
|
||||
@ -141,68 +132,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_docs": "标题音乐",
|
||||
"_data": "在标题界面应该播放的bgm内容"
|
||||
},
|
||||
"statusLeftBackground": {
|
||||
"styles": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "横屏状态栏",
|
||||
"_data": "横屏时左侧状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图,推荐写法:\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
|
||||
},
|
||||
"statusTopBackground": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "竖屏状态栏",
|
||||
"_data": "竖屏时上方状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图,推荐写法:\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
|
||||
},
|
||||
"toolsBackground": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "竖屏工具栏",
|
||||
"_data": "竖屏时下方工具栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图,推荐写法:\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
|
||||
},
|
||||
"borderColor": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "边框色",
|
||||
"_data": "边框颜色,包括游戏边界的边框和对话框边框等。"
|
||||
},
|
||||
"statusBarColor": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "状态栏文字色",
|
||||
"_data": "状态栏的文字颜色,默认是白色"
|
||||
},
|
||||
"hardLabelColor": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "难度标签色",
|
||||
"_data": "难度显示的颜色,默认是红色"
|
||||
},
|
||||
"floorChangingBackground": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "转场背景色",
|
||||
"_data": "楼层转换界面的背景样式;可以使用纯色(默认值black),也可以使用图片(参见状态栏的图片写法)"
|
||||
},
|
||||
"floorChangingTextColor": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "转场文字色",
|
||||
"_data": "楼层转换界面的文字颜色,默认是白色"
|
||||
},
|
||||
"font": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_docs": "全局字体",
|
||||
"_data": "游戏中使用的字体,默认是Verdana"
|
||||
"_type": "event",
|
||||
"_event": "mainStyle",
|
||||
"_docs": "主样式",
|
||||
"_data": "主要样式设置,包括标题、按钮、状态栏等的背景色等"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -248,9 +183,17 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_leaf": true,
|
||||
"_type": "select",
|
||||
"_select": {
|
||||
"values": [null].concat(Object.keys(editor.core.material.images))
|
||||
"values": [null].concat(Object.keys(editor.core.material.images.images).filter(function (name) {
|
||||
return name.endsWith('.png');
|
||||
}))
|
||||
},
|
||||
"_data": "勇士行走图"
|
||||
"_data": "行走图"
|
||||
},
|
||||
"animate": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "帧动画",
|
||||
"_data": "是否开启停止状态和对话框的帧动画"
|
||||
},
|
||||
"name": {
|
||||
"_leaf": true,
|
||||
@ -337,7 +280,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
|
||||
"_docs": "初始装备个数",
|
||||
"_docs": "初始拥有装备个数",
|
||||
"_data": "初始装备个数,例如初始送铁剑可以写 {\"sword1\": 1}"
|
||||
}
|
||||
}
|
||||
@ -378,13 +321,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
},
|
||||
"followers": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval instanceof Array",
|
||||
"_data": "跟随者列表"
|
||||
"_type": "disable",
|
||||
"_data": "跟随者"
|
||||
},
|
||||
"steps": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "disable",
|
||||
"_data": "行走步数"
|
||||
}
|
||||
}
|
||||
@ -394,7 +336,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_type": "event",
|
||||
"_event": "firstArrive",
|
||||
"_range": "thiseval==null || thiseval instanceof Array",
|
||||
"_docs": "标题事件化",
|
||||
"_docs": "标题事件",
|
||||
"_data": "标题界面事件化,可以使用事件流的形式来绘制开始界面等。\n需要开启startUsingCanvas这个开关。\n详见文档-个性化-标题界面事件化。"
|
||||
},
|
||||
"startText": {
|
||||
@ -442,46 +384,46 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_docs": "衰弱效果",
|
||||
"_data": "衰弱状态下攻防减少的数值\n如果此项不小于1,则作为实际下降的数值(比如10就是攻防各下降10)\n如果在0到1之间则为下降的比例(比如0.3就是下降30%的攻防)"
|
||||
},
|
||||
"redJewel": {
|
||||
"redGem": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "红宝石效果",
|
||||
"_docs": "红宝石值",
|
||||
"_data": "红宝石加攻击的数值"
|
||||
},
|
||||
"blueJewel": {
|
||||
"blueGem": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "蓝宝石效果",
|
||||
"_docs": "蓝宝石值",
|
||||
"_data": "蓝宝石加防御的数值"
|
||||
},
|
||||
"greenJewel": {
|
||||
"greenGem": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "绿宝石效果",
|
||||
"_docs": "绿宝石值",
|
||||
"_data": "绿宝石加护盾的数值"
|
||||
},
|
||||
"redPotion": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "红血瓶效果",
|
||||
"_docs": "红血瓶值",
|
||||
"_data": "红血瓶加血数值"
|
||||
},
|
||||
"bluePotion": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "蓝血瓶效果",
|
||||
"_docs": "蓝血瓶值",
|
||||
"_data": "蓝血瓶加血数值"
|
||||
},
|
||||
"yellowPotion": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "黄血瓶效果",
|
||||
"_docs": "黄血瓶值",
|
||||
"_data": "黄血瓶加血数值"
|
||||
},
|
||||
"greenPotion": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "绿血瓶效果",
|
||||
"_docs": "绿血瓶值",
|
||||
"_data": "绿血瓶加血数值"
|
||||
},
|
||||
"breakArmor": {
|
||||
@ -511,14 +453,16 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"animateSpeed": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_docs": "全局动画时间",
|
||||
"_data": "全局动画时间,即怪物振动频率,一般300比较合适"
|
||||
"_docs": "全局帧动画时间",
|
||||
"_data": "全局帧动画时间,即怪物振动频率,一般300比较合适"
|
||||
},
|
||||
"statusCanvasRowsOnMobile": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval==null || (thiseval>0 && thiseval<=4)",
|
||||
"_docs": "竖屏自绘行数",
|
||||
"_type": "select",
|
||||
"_select": {
|
||||
"values": [1,2,3,4]
|
||||
},
|
||||
"_docs": "竖状态栏自绘行数",
|
||||
"_data": "竖屏模式下,顶端状态栏canvas化后的行数。\n此项将决定竖屏的状态栏高度,如果设置则不小于1且不大于4。\n仅在statusCanvas开启时才有效"
|
||||
},
|
||||
}
|
||||
@ -571,36 +515,36 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"enableSkill"
|
||||
]
|
||||
},
|
||||
"_data": "状态栏显示"
|
||||
"_data": "状态栏显示项"
|
||||
},
|
||||
"flyNearStair": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "楼传楼梯边",
|
||||
"_docs": "楼传需在楼梯边",
|
||||
"_data": "传送器是否需要在楼梯边使用;如果flyRecordPosition开启,则此项对箭头也有效。"
|
||||
},
|
||||
"flyRecordPosition": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "楼传平面模式",
|
||||
"_docs": "楼传开平面模式",
|
||||
"_data": "传送器平面塔模式;此模式下楼层传送器将飞到上次离开该楼层的位置。"
|
||||
},
|
||||
"steelDoorWithoutKey": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "铁门不消耗",
|
||||
"_docs": "铁门不消耗钥匙",
|
||||
"_data": "铁门是否不需要钥匙开启。如果此项为true,则无需钥匙也可以开铁门。"
|
||||
},
|
||||
"itemFirstText": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "首次道具提示",
|
||||
"_docs": "首次道具进行提示",
|
||||
"_data": "首次获得道具是否提示"
|
||||
},
|
||||
"equipboxButton": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "状态栏装备",
|
||||
"_docs": "状态栏装备按钮",
|
||||
"_data": "状态栏的装备按钮。若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮"
|
||||
},
|
||||
"enableAddPoint": {
|
||||
@ -618,7 +562,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"betweenAttackMax": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "夹击不超伤害",
|
||||
"_docs": "夹击不超伤害值",
|
||||
"_data": "夹击伤害是否不超过怪物伤害值。"
|
||||
},
|
||||
"useLoop": {
|
||||
@ -630,19 +574,13 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"startUsingCanvas": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "标题事件化",
|
||||
"_docs": "标题开启事件化",
|
||||
"_data": "是否开始菜单canvas化;如果此项为true,则将使用canvas来绘制开始菜单"
|
||||
},
|
||||
"startDirectly": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "不选择难度",
|
||||
"_data": "点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面"
|
||||
},
|
||||
"statusCanvas": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "自绘状态栏",
|
||||
"_docs": "开启自绘状态栏",
|
||||
"_data": "是否状态栏canvas化,即手动自定义绘制状态栏。\n如果此项开启,则可在脚本编辑的drawStatusBar中自定义绘制菜单栏。"
|
||||
},
|
||||
"displayEnemyDamage": {
|
||||
|
||||
@ -26,6 +26,12 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_range": "typeof(thiseval)=='string' || thiseval==null",
|
||||
"_data": "灯光效果"
|
||||
},
|
||||
"removeMap": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "typeof(thiseval)=='string' || thiseval==null",
|
||||
"_data": "砍层插件"
|
||||
},
|
||||
"itemShop": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
|
||||
36
_server/thirdparty/jsColor.js
vendored
@ -121,7 +121,7 @@
|
||||
colorPickers.current = colorPickers[index];
|
||||
}
|
||||
},
|
||||
createListener = function(e) {
|
||||
createListener = function() {
|
||||
elm = document.getElementById("colorPicker");
|
||||
var input = elm,
|
||||
position = window.ColorPicker.getOrigin(input),
|
||||
@ -268,9 +268,19 @@ jsColorPicker('input.color', {
|
||||
size: 1,
|
||||
});
|
||||
|
||||
function openColorFromButton() {
|
||||
delete window.jsColorPicker.confirm;
|
||||
triggerColorPicker('414px', '53px');
|
||||
function openColorPicker(px, py, callback) {
|
||||
window.jsColorPicker.confirm = callback;
|
||||
var colorPanel = document.getElementById('colorPanel');
|
||||
if (colorPanel.style.display=='none' && px != null && py != null) {
|
||||
colorPanel.style.display = "inline-block";
|
||||
colorPanel.style.left = px + 'px';
|
||||
colorPanel.style.top = py + 'px';
|
||||
window.jsColorPicker.create();
|
||||
}
|
||||
else {
|
||||
colorPanel.style.display = 'none';
|
||||
delete window.jsColorPicker.confirm;
|
||||
}
|
||||
}
|
||||
|
||||
function confirmColor() {
|
||||
@ -287,22 +297,8 @@ function confirmColor() {
|
||||
colorPicker.select();
|
||||
document.execCommand("Copy");
|
||||
}
|
||||
|
||||
triggerColorPicker();
|
||||
}
|
||||
|
||||
function triggerColorPicker(left, top) {
|
||||
var colorPanel = document.getElementById('colorPanel');
|
||||
if (colorPanel.style.display=='none' && left && top) {
|
||||
colorPanel.style.display = "inline-block";
|
||||
colorPanel.style.left = left;
|
||||
colorPanel.style.top = top;
|
||||
window.jsColorPicker.create();
|
||||
}
|
||||
else {
|
||||
colorPanel.style.display = 'none';
|
||||
delete window.jsColorPicker.confirm;
|
||||
}
|
||||
colorPanel.style.display = 'none';
|
||||
delete window.jsColorPicker.confirm;
|
||||
}
|
||||
|
||||
// ------ AutoCompletion ------
|
||||
|
||||
@ -204,36 +204,20 @@
|
||||
<button onclick="editor_blockly.showXML()">Show XML</button>
|
||||
<button onclick="editor_blockly.runCode()">console.log(obj=code)</button>
|
||||
-->
|
||||
<select id="entryType" disabled="disabled" style="display: none">
|
||||
<option value="event">event</option>
|
||||
<option value="autoEvent">autoEvent</option>
|
||||
<option value="changeFloor">changeFloor</option>
|
||||
<option value="level">level</option>
|
||||
<option value="shop">shop</option>
|
||||
<option value="afterBattle">afterBattle</option>
|
||||
<option value="afterGetItem">afterGetItem</option>
|
||||
<option value="afterOpenDoor">afterOpenDoor</option>
|
||||
<option value="firstArrive">firstArrive</option>
|
||||
<option value="eachArrive">eachArrive</option>
|
||||
<option value="commonEvent">commonEvent</option>
|
||||
<option value="item">item</option>
|
||||
</select>
|
||||
<button onclick="editor_blockly.confirm()">确认</button>
|
||||
<button onclick="editor_blockly.parse()">解析</button>
|
||||
<button id='blocklyParse' onclick="editor_blockly.parse()">解析</button>
|
||||
<button onclick="editor_blockly.cancel()">取消</button>
|
||||
<!-- 手机端放不下,因此不显示搜索框 -->
|
||||
<div style="display: none">
|
||||
<div class="searchLogo"></div>
|
||||
<input type="text" id="searchBlock" placeholder="搜索图块"/>
|
||||
</div>
|
||||
<div id="colorPanel" class="cpPanel" style="display: none">
|
||||
<input class="color" id="colorPicker" value="255,215,0,1"/>
|
||||
<button onclick="confirmColor()">确定</button>
|
||||
</div>
|
||||
<button class="cpPanel" onclick="editor_blockly.selectPoint()">地图选点</button>
|
||||
<button class="cpPanel" onclick="editor.uievent.searchUsedFlags()" style="margin-left:5px">变量出现位置搜索</button>
|
||||
<input type="checkbox" class="cpPanel" id="blocklyReplace" onchange="editor_blockly.triggerReplace()" style="margin-left: 10px" />
|
||||
<span class="cpPanel" style="margin-left: -4px; font-size: 13px">开启中文名替换</span>
|
||||
<input type="checkbox" class="cpPanel" id="blocklyExpandCompare" onchange="editor_blockly.triggerExpandCompare()" style="margin-left: 10px" />
|
||||
<span class="cpPanel" style="margin-left: -4px; font-size: 13px">展开值块逻辑运算</span>
|
||||
<xml id="toolbox" style="display:none">
|
||||
</xml>
|
||||
</h3>
|
||||
@ -245,6 +229,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="colorPanel" class="cpPanel" style="display: none">
|
||||
<input class="color" id="colorPicker" value="255,215,0,1"/>
|
||||
<button onclick="confirmColor()">确定</button>
|
||||
</div>
|
||||
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
|
||||
<button onclick="editor_multi.confirm()">确认</button>
|
||||
<button onclick="editor_multi.cancel()">取消</button>
|
||||
@ -320,7 +308,7 @@
|
||||
|
||||
</div>
|
||||
<div id="mid2" style="display: none">
|
||||
<p style="margin: 10px">最近使用的图块列表: <button id='clearLastUsedBtn'>清除</button></p>
|
||||
<p style="margin: 10px"><span id='lastUsedTitle'></span> <button id='clearLastUsedBtn'>清除</button></p>
|
||||
<div class="map" style="height: 160px; margin-top: 25px" id="lastUsedDiv">
|
||||
<canvas class='gameCanvas' id='lastUsed' width='416' height='160'></canvas>
|
||||
</div>
|
||||
@ -363,7 +351,7 @@
|
||||
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
|
||||
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
||||
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
||||
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
|
||||
<div id='pasteLoc' class="menuitem"><div class="menuitem-content">粘贴到此事件</div></div>
|
||||
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
|
||||
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
||||
</div>
|
||||
@ -383,7 +371,7 @@
|
||||
<select id="brushMod" style="clear:right">
|
||||
<option value="line">画线</option>
|
||||
<option value="rectangle">画矩形</option>
|
||||
<option value="tileset">tileset贴图</option>
|
||||
<option value="tileset">tileset平铺</option>
|
||||
<option value="fill">填充模式</option>
|
||||
</select>
|
||||
<select id="layerMod" style="float:left;margin-right:3px">
|
||||
@ -626,6 +614,8 @@
|
||||
<script src="_server/blockly/blocks_compressed.js"></script>
|
||||
<script src="_server/blockly/javascript_compressed.js"></script>
|
||||
<script src="_server/blockly/zh-hans.js"></script>
|
||||
<script src='_server/MotaActionParser.js'></script>
|
||||
<script src='_server/editor_blocklyconfig.js'></script>
|
||||
<script src='_server/editor_blockly.js'></script>
|
||||
<!-- codemirror -->
|
||||
<script src="_server/CodeMirror/codeMirror.bundle.min.js"></script>
|
||||
|
||||
34
editor.html
@ -200,35 +200,19 @@
|
||||
<button onclick="editor_blockly.showXML()">Show XML</button>
|
||||
<button onclick="editor_blockly.runCode()">console.log(obj=code)</button>
|
||||
-->
|
||||
<select id="entryType" disabled="disabled" style="display: none">
|
||||
<option value="event">event</option>
|
||||
<option value="autoEvent">autoEvent</option>
|
||||
<option value="changeFloor">changeFloor</option>
|
||||
<option value="level">level</option>
|
||||
<option value="shop">shop</option>
|
||||
<option value="afterBattle">afterBattle</option>
|
||||
<option value="afterGetItem">afterGetItem</option>
|
||||
<option value="afterOpenDoor">afterOpenDoor</option>
|
||||
<option value="firstArrive">firstArrive</option>
|
||||
<option value="eachArrive">eachArrive</option>
|
||||
<option value="commonEvent">commonEvent</option>
|
||||
<option value="item">item</option>
|
||||
</select>
|
||||
<button onclick="editor_blockly.confirm()">确认</button>
|
||||
<button onclick="editor_blockly.parse()">解析</button>
|
||||
<button id='blocklyParse' onclick="editor_blockly.parse()">解析</button>
|
||||
<button onclick="editor_blockly.cancel()">取消</button>
|
||||
<div style="position: relative; display: inline-block; margin-left: 10px">
|
||||
<div class="searchLogo"></div>
|
||||
<input type="text" id="searchBlock" placeholder="搜索图块"/>
|
||||
</div>
|
||||
<div id="colorPanel" class="cpPanel" style="display: none">
|
||||
<input class="color" id="colorPicker" value="255,215,0,1"/>
|
||||
<button onclick="confirmColor()">确定</button>
|
||||
</div>
|
||||
<button class="cpPanel" onclick="editor_blockly.selectPoint()" style="margin-left:5px">地图选点</button>
|
||||
<button class="cpPanel" onclick="editor.uievent.searchUsedFlags()" style="margin-left:5px">变量出现位置搜索</button>
|
||||
<input type="checkbox" class="cpPanel" id="blocklyReplace" onchange="editor_blockly.triggerReplace()" style="margin-left: 10px" />
|
||||
<span class="cpPanel" style="margin-left: -4px; font-size: 13px">开启中文名替换</span>
|
||||
<input type="checkbox" class="cpPanel" id="blocklyExpandCompare" onchange="editor_blockly.triggerExpandCompare()" style="margin-left: 10px" />
|
||||
<span class="cpPanel" style="margin-left: -4px; font-size: 13px">展开值块逻辑运算</span>
|
||||
<xml id="toolbox" style="display:none">
|
||||
</xml>
|
||||
</h3>
|
||||
@ -240,6 +224,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="colorPanel" class="cpPanel" style="display: none">
|
||||
<input class="color" id="colorPicker" value="255,215,0,1"/>
|
||||
<button onclick="confirmColor()">确定</button>
|
||||
</div>
|
||||
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
|
||||
<button onclick="editor_multi.confirm()">确认</button>
|
||||
<button onclick="editor_multi.cancel()">取消</button>
|
||||
@ -343,7 +331,7 @@
|
||||
<span style="font-size: 12px;">
|
||||
<input type="radio" id="brushMod" name="brushMod" value="line" checked="checked" />线
|
||||
<input type="radio" id="brushMod2" name="brushMod" value="rectangle" />矩形
|
||||
<input type="radio" id="brushMod3" name="brushMod" value="tileset" />tileset贴图
|
||||
<input type="radio" id="brushMod3" name="brushMod" value="tileset" />tileset平铺
|
||||
<input type="radio" id="brushMod4" name="brushMod" value="fill" />填充
|
||||
|
||||
</span>
|
||||
@ -366,7 +354,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="mid2">
|
||||
<p style="margin: 10px">最近使用的图块列表(Ctrl+滚轮放缩) <button id='clearLastUsedBtn'>清除</button></p>
|
||||
<p style="margin: 10px"><span id='lastUsedTitle'></span><small>(Ctrl+滚轮放缩,右键置顶)</small> <button id='clearLastUsedBtn'>清除</button></p>
|
||||
<div class="map" id="lastUsedDiv">
|
||||
<canvas id='lastUsed' width='416' height='416' style="overflow: hidden"></canvas>
|
||||
</div>
|
||||
@ -386,7 +374,7 @@
|
||||
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
|
||||
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
||||
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
||||
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
|
||||
<div id='pasteLoc' class="menuitem"><div class="menuitem-content">粘贴到此事件</div></div>
|
||||
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
|
||||
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
||||
</div>
|
||||
@ -610,6 +598,8 @@
|
||||
<script src="_server/blockly/blocks_compressed.js"></script>
|
||||
<script src="_server/blockly/javascript_compressed.js"></script>
|
||||
<script src="_server/blockly/zh-hans.js"></script>
|
||||
<script src='_server/MotaActionParser.js'></script>
|
||||
<script src='_server/editor_blocklyconfig.js'></script>
|
||||
<script src='_server/editor_blockly.js'></script>
|
||||
<!-- codemirror -->
|
||||
<script src="_server/CodeMirror/codeMirror.bundle.min.js"></script>
|
||||
|
||||
@ -8,7 +8,7 @@ function dynamicMapEditor() {
|
||||
// 所有显示的ID
|
||||
this.displayIds = [
|
||||
'none', 'yellowWall', 'blueWall', 'whiteWall', 'yellowDoor', 'blueDoor', 'redDoor', 'star', 'lava', 'lavaNet',
|
||||
'yellowKey', 'blueKey', 'redKey', 'redJewel', 'blueJewel', 'greenJewel', 'yellowJewel',
|
||||
'yellowKey', 'blueKey', 'redKey', 'redGem', 'blueGem', 'greenGem', 'yellowGem',
|
||||
'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'pickaxe', 'bomb', 'centerFly',
|
||||
'cls:autotile', 'cls:enemys', 'cls:enemy48'
|
||||
];
|
||||
|
||||
@ -1919,7 +1919,7 @@ actions.prototype._clickSwitchs = function (x, y) {
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
var selection = y - topIndex;
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) {
|
||||
if (selection != 2 && selection != 3 && selection != 4) return;
|
||||
if (selection != 1 && selection != 2 && selection != 3 && selection != 4) return;
|
||||
}
|
||||
var width = choices[selection].width;
|
||||
var leftPos = (core.__PIXELS__ - width) / 2, rightPos = (core.__PIXELS__ + width) / 2;
|
||||
@ -1928,32 +1928,32 @@ actions.prototype._clickSwitchs = function (x, y) {
|
||||
core.status.event.selection = selection;
|
||||
switch (selection) {
|
||||
case 0:
|
||||
return this._clickSwitchs_bgm();
|
||||
return this._clickSwitchs_bgmSound();
|
||||
case 1:
|
||||
return this._clickSwitchs_sound();
|
||||
case 2:
|
||||
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_userVolume(-1);
|
||||
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_userVolume(1);
|
||||
return;
|
||||
case 3:
|
||||
case 2:
|
||||
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_moveSpeed(-10);
|
||||
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_moveSpeed(10);
|
||||
return;
|
||||
case 4:
|
||||
case 3:
|
||||
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_floorChangeTime(-100);
|
||||
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_floorChangeTime(100);
|
||||
return;
|
||||
case 4:
|
||||
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_setSize(-1);
|
||||
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_setSize(1);
|
||||
return;
|
||||
case 5:
|
||||
return this._clickSwitchs_displayEnemyDamage();
|
||||
case 6:
|
||||
return this._clickSwitchs_displayCritical();
|
||||
return this._clickSwitchs_displayCriticalExtra();
|
||||
case 7:
|
||||
return this._clickSwitchs_displayExtraDamage();
|
||||
case 8:
|
||||
return this._clickSwitchs_potionNoRouting();
|
||||
case 9:
|
||||
case 8:
|
||||
return this._clickSwitchs_clickMove();
|
||||
case 10:
|
||||
case 9:
|
||||
core.status.event.selection = 0;
|
||||
core.ui.drawSettings();
|
||||
break;
|
||||
@ -1961,13 +1961,23 @@ actions.prototype._clickSwitchs = function (x, y) {
|
||||
}
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_bgm = function () {
|
||||
core.triggerBgm();
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_sound = function () {
|
||||
core.musicStatus.soundStatus = !core.musicStatus.soundStatus;
|
||||
actions.prototype._clickSwitchs_bgmSound = function () {
|
||||
var bgm = core.musicStatus.bgmStatus;
|
||||
var sound = core.musicStatus.soundStatus;
|
||||
if (bgm && sound) {
|
||||
sound = false;
|
||||
} else if (bgm && !sound) {
|
||||
bgm = false;
|
||||
sound = true;
|
||||
} else if (!bgm && sound) {
|
||||
sound = false;
|
||||
} else {
|
||||
bgm = true;
|
||||
sound = true;
|
||||
}
|
||||
if (bgm != core.musicStatus.bgmStatus)
|
||||
core.triggerBgm();
|
||||
core.musicStatus.soundStatus = sound;
|
||||
core.setLocalStorage('soundStatus', core.musicStatus.soundStatus);
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
@ -1995,6 +2005,17 @@ actions.prototype._clickSwitchs_floorChangeTime = function (delta) {
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_setSize = function (delta) {
|
||||
var index = core.domStyle.availableScale.indexOf(core.domStyle.scale);
|
||||
if (index < 0) return;
|
||||
index += delta;
|
||||
if (index < 0 || index >= core.domStyle.availableScale.length);
|
||||
core.domStyle.scale = core.domStyle.availableScale[index];
|
||||
core.setLocalStorage('scale', core.domStyle.scale);
|
||||
core.resize();
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_displayEnemyDamage = function () {
|
||||
core.flags.displayEnemyDamage = !core.flags.displayEnemyDamage;
|
||||
core.updateDamage();
|
||||
@ -2002,16 +2023,26 @@ actions.prototype._clickSwitchs_displayEnemyDamage = function () {
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_displayCritical = function () {
|
||||
core.flags.displayCritical = !core.flags.displayCritical;
|
||||
actions.prototype._clickSwitchs_displayCriticalExtra = function () {
|
||||
var critical = core.flags.displayCritical;
|
||||
var extra = core.flags.displayExtraDamage;
|
||||
if (critical && extra) {
|
||||
extra = false;
|
||||
} else if (critical && !extra) {
|
||||
critical = false;
|
||||
extra = true;
|
||||
} else if (!critical && extra) {
|
||||
critical = false;
|
||||
extra = false;
|
||||
} else {
|
||||
critical = true;
|
||||
extra = true;
|
||||
}
|
||||
|
||||
core.flags.displayCritical = critical;
|
||||
core.flags.displayExtraDamage = extra;
|
||||
core.updateDamage();
|
||||
core.setLocalStorage('critical', core.flags.displayCritical);
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_displayExtraDamage = function () {
|
||||
core.flags.displayExtraDamage = !core.flags.displayExtraDamage;
|
||||
core.updateDamage();
|
||||
core.setLocalStorage('extraDamage', core.flags.displayExtraDamage);
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
@ -2037,15 +2068,17 @@ actions.prototype._keyUpSwitchs = function (keycode) {
|
||||
}
|
||||
if (keycode == 37) {
|
||||
switch (core.status.event.selection) {
|
||||
case 2: return this._clickSwitchs_userVolume(-1);
|
||||
case 3: return this._clickSwitchs_moveSpeed(-10);
|
||||
case 4: this._clickSwitchs_floorChangeTime(-100);
|
||||
case 1: return this._clickSwitchs_userVolume(-1);
|
||||
case 2: return this._clickSwitchs_moveSpeed(-10);
|
||||
case 3: return this._clickSwitchs_floorChangeTime(-100);
|
||||
case 4: return this._clickSwitchs_setSize(-1);
|
||||
}
|
||||
} else if (keycode == 39) {
|
||||
switch (core.status.event.selection) {
|
||||
case 2: return this._clickSwitchs_userVolume(1);
|
||||
case 3: return this._clickSwitchs_moveSpeed(10);
|
||||
case 4: this._clickSwitchs_floorChangeTime(100);
|
||||
case 1: return this._clickSwitchs_userVolume(1);
|
||||
case 2: return this._clickSwitchs_moveSpeed(10);
|
||||
case 3: return this._clickSwitchs_floorChangeTime(100);
|
||||
case 4: return this._clickSwitchs_setSize(1);
|
||||
}
|
||||
}
|
||||
this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs);
|
||||
|
||||
223
libs/control.js
@ -146,6 +146,11 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) {
|
||||
core.status.autotileAnimateObjs.blocks.forEach(function (block) {
|
||||
core.maps._drawAutotileAnimate(block, core.status.globalAnimateStatus);
|
||||
});
|
||||
|
||||
// Global hero animate
|
||||
if ((core.status.hero || {}).animate && core.status.heroMoving == 0) {
|
||||
core.drawHero('stop', null, core.status.globalAnimateStatus);
|
||||
}
|
||||
}
|
||||
// Box animate
|
||||
core.drawBoxAnimate();
|
||||
@ -260,7 +265,7 @@ control.prototype._animationFrame_weather_fog = function () {
|
||||
var w = core.__PIXELS__, h = core.__PIXELS__;
|
||||
core.setAlpha('weather', 0.5);
|
||||
core.animateFrame.weather.nodes.forEach(function (p) {
|
||||
ctx.drawImage(core.animateFrame.weather.fog, p.x - ox, p.y - oy, w, h);
|
||||
core.drawImage(ctx, core.animateFrame.weather.fog, p.x - ox, p.y - oy, w, h);
|
||||
p.x += p.xs;
|
||||
p.y += p.ys;
|
||||
if (p.x > core.bigmap.width*32 - w/2) {
|
||||
@ -725,7 +730,7 @@ control.prototype.waitHeroToStop = function(callback) {
|
||||
core.setHeroLoc('direction', lastDirection);
|
||||
core.drawHero();
|
||||
callback();
|
||||
}, core.status.replay.speed == 24 ? 0 : 30);
|
||||
}, core.status.replay.speed == 24 ? 1 : 30);
|
||||
}
|
||||
}
|
||||
|
||||
@ -768,7 +773,7 @@ control.prototype.tryMoveDirectly = function (destX, destY) {
|
||||
}
|
||||
|
||||
////// 绘制勇士 //////
|
||||
control.prototype.drawHero = function (status, offset) {
|
||||
control.prototype.drawHero = function (status, offset, frame) {
|
||||
if (!core.isPlaying() || !core.status.floorId || core.status.gameOver) return;
|
||||
var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), direction = core.getHeroLoc('direction');
|
||||
status = status || 'stop';
|
||||
@ -783,17 +788,65 @@ control.prototype.drawHero = function (status, offset) {
|
||||
core.status.heroCenter.py = 32 * y + offsetY + 32 - core.material.icons.hero.height / 2;
|
||||
|
||||
if (!core.hasFlag('hideHero')) {
|
||||
this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
|
||||
core.drawImage('hero', block.img, block.heroIcon[block.status]*block.width,
|
||||
block.heroIcon.loc * block.height, block.width, block.height,
|
||||
block.posx+(32-block.width)/2, block.posy+32-block.height, block.width, block.height);
|
||||
});
|
||||
this._drawHero_draw(direction, x, y, status, offset, frame);
|
||||
}
|
||||
|
||||
this._drawHero_updateViewport();
|
||||
}
|
||||
|
||||
control.prototype._drawHero_updateViewport = function () {
|
||||
core.control.updateViewport();
|
||||
core.setGameCanvasTranslate('hero', 0, 0);
|
||||
}
|
||||
|
||||
control.prototype._drawHero_draw = function (direction, x, y, status, offset, frame) {
|
||||
this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
|
||||
core.drawImage('hero', block.img, (block.heroIcon[block.status] + (frame || 0))%4*block.width,
|
||||
block.heroIcon.loc * block.height, block.width, block.height,
|
||||
block.posx+(32-block.width)/2, block.posy+32-block.height, block.width, block.height);
|
||||
});
|
||||
}
|
||||
|
||||
control.prototype.triggerHero = function (type, time, callback) {
|
||||
if (type == null) {
|
||||
type = core.hasFlag('hideHero') ? 'show' : 'hide';
|
||||
}
|
||||
if ((core.hasFlag('hideHero') && type != 'show') || (!core.hasFlag('hideHero') && type != 'hide')) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
if (type == 'show') core.removeFlag('hideHero');
|
||||
else core.setFlag('hideHero', true);
|
||||
|
||||
time = time || 0;
|
||||
if (time == 0) {
|
||||
core.drawHero();
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
time /= Math.max(core.status.replay.speed, 1)
|
||||
this._triggerHero_animate(type, 10 / time, callback);
|
||||
}
|
||||
|
||||
control.prototype._triggerHero_animate = function (type, delta, callback) {
|
||||
var opacity = type != 'show' ? 1 : 0;
|
||||
var animate = setInterval(function () {
|
||||
opacity += type != 'show' ? -delta : delta;
|
||||
core.clearMap('hero');
|
||||
core.setAlpha('hero', opacity);
|
||||
core.control._drawHero_draw(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop', 0);
|
||||
core.setAlpha('hero', 1);
|
||||
if (opacity >= 1 || opacity <= 0) {
|
||||
delete core.animateFrame.asyncId[animate];
|
||||
clearInterval(animate);
|
||||
core.drawHero();
|
||||
if (callback) callback();
|
||||
}
|
||||
}, 10);
|
||||
|
||||
core.animateFrame.asyncId[animate] = true;
|
||||
}
|
||||
|
||||
control.prototype._drawHero_getDrawObjs = function (direction, x, y, status, offset) {
|
||||
var heroIconArr = core.material.icons.hero, drawObjs = [], index = 0;
|
||||
drawObjs.push({
|
||||
@ -984,7 +1037,7 @@ control.prototype.checkBlock = function () {
|
||||
core.updateStatusBar();
|
||||
}
|
||||
}
|
||||
this._checkBlock_snipe(core.status.checkBlock.snipe[loc]);
|
||||
this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
|
||||
this._checkBlock_ambush(core.status.checkBlock.ambush[loc]);
|
||||
}
|
||||
|
||||
@ -998,10 +1051,10 @@ control.prototype._checkBlock_disableQuickShop = function () {
|
||||
}
|
||||
|
||||
////// 阻击 //////
|
||||
control.prototype._checkBlock_snipe = function (snipe) {
|
||||
if (!snipe || snipe.length == 0) return;
|
||||
control.prototype._checkBlock_repulse = function (repulse) {
|
||||
if (!repulse || repulse.length == 0) return;
|
||||
var actions = [];
|
||||
snipe.forEach(function (t) {
|
||||
repulse.forEach(function (t) {
|
||||
actions.push({"type": "move", "loc": [t[0],t[1]], "steps": [t[3]], "time": 250, "keep": true, "async": true});
|
||||
});
|
||||
actions.push({"type": "waitAsync"});
|
||||
@ -1047,6 +1100,7 @@ control.prototype.updateDamage = function (floorId, ctx) {
|
||||
|
||||
control.prototype._updateDamage_damage = function (floorId, ctx) {
|
||||
core.setTextAlign(ctx, 'left');
|
||||
core.extractBlocks(floorId);
|
||||
core.status.maps[floorId].blocks.forEach(function (block) {
|
||||
var x = block.x, y = block.y;
|
||||
if (!block.disable && block.event.cls.indexOf('enemy') == 0 && block.event.displayDamage !== false) {
|
||||
@ -1526,10 +1580,12 @@ control.prototype._replayAction_getNext = function (action) {
|
||||
control.prototype._replayAction_moveDirectly = function (action) {
|
||||
if (action.indexOf("move:")!=0) return false;
|
||||
// 忽略连续的瞬移事件
|
||||
while (core.status.replay.toReplay.length>0 &&
|
||||
core.status.replay.toReplay[0].indexOf('move:')==0) {
|
||||
core.status.route.push(action);
|
||||
action = core.status.replay.toReplay.shift();
|
||||
if (!core.hasFlag('poison')) {
|
||||
while (core.status.replay.toReplay.length>0 &&
|
||||
core.status.replay.toReplay[0].indexOf('move:')==0) {
|
||||
core.status.route.push(action);
|
||||
action = core.status.replay.toReplay.shift();
|
||||
}
|
||||
}
|
||||
|
||||
var pos=action.substring(5).split(":");
|
||||
@ -1704,8 +1760,6 @@ control.prototype._doSL_replayLoad_afterGet = function (id, data) {
|
||||
if (!data) return core.drawTip("无效的存档");
|
||||
if (data.version != core.firstData.version) return core.drawTip("存档版本不匹配");
|
||||
if (data.hard != core.status.hard) core.drawTip("游戏难度不匹配!");
|
||||
if (data.hashCode != null && data.hashCode != core.utils.hashCode(data.hero))
|
||||
return alert("存档校验失败,请勿修改存档文件!");
|
||||
var route = core.subarray(core.status.route, core.decodeRoute(data.route));
|
||||
if (route == null || data.hero.flags.__seed__ != core.getFlag('__seed__'))
|
||||
return core.drawTip("无法从此存档回放录像");
|
||||
@ -2008,12 +2062,17 @@ control.prototype.getRealStatusOrDefault = function (status, name) {
|
||||
|
||||
////// 设置某个属性的增幅值 //////
|
||||
control.prototype.setBuff = function (name, value) {
|
||||
// 仅保留三位有效buff值
|
||||
value = parseFloat(value.toFixed(3));
|
||||
this.setFlag('__'+name+'_buff__', value);
|
||||
}
|
||||
|
||||
////// 加减某个属性的增幅值 //////
|
||||
control.prototype.addBuff = function (name, value) {
|
||||
this.setFlag('__'+name+'_buff__', this.getBuff(name) + value);
|
||||
var buff = this.getBuff(name) + value;
|
||||
// 仅保留三位有效buff值
|
||||
buff = parseFloat(buff.toFixed(3));
|
||||
this.setFlag('__'+name+'_buff__', buff);
|
||||
}
|
||||
|
||||
////// 获得某个属性的增幅值 //////
|
||||
@ -2467,72 +2526,14 @@ control.prototype.updateHeroIcon = function (name) {
|
||||
var ratio = Math.min(w / h, 1), width = 32 * ratio, left = 16 - width/2;
|
||||
|
||||
var canvas = document.createElement("canvas");
|
||||
var context = canvas.getContext("2d");
|
||||
var ctx = canvas.getContext("2d");
|
||||
canvas.width = 32;
|
||||
canvas.height = 32;
|
||||
context.drawImage(image, 0, 0, w, h, left, 0, width, 32);
|
||||
core.drawImage(ctx, image, 0, 0, w, h, left, 0, width, 32);
|
||||
|
||||
core.statusBar.image.name.src = canvas.toDataURL("image/png");
|
||||
}
|
||||
|
||||
control.prototype.updateGlobalAttribute = function (name) {
|
||||
if (name == null) name = Object.keys(core.status.globalAttribute);
|
||||
if (name instanceof Array) {
|
||||
name.forEach(function (t) {
|
||||
core.control.updateGlobalAttribute(t);
|
||||
});
|
||||
return;
|
||||
}
|
||||
var attribute = core.status.globalAttribute || core.initStatus.globalAttribute;
|
||||
if (attribute == null) return;
|
||||
switch (name) {
|
||||
case 'statusLeftBackground':
|
||||
if (!core.domStyle.isVertical) {
|
||||
core.dom.statusBar.style.background = attribute[name];
|
||||
}
|
||||
break;
|
||||
case 'statusTopBackground':
|
||||
if (core.domStyle.isVertical) {
|
||||
core.dom.statusBar.style.background = attribute[name];
|
||||
}
|
||||
break;
|
||||
case 'toolsBackground':
|
||||
if (core.domStyle.isVertical) {
|
||||
core.dom.toolBar.style.background = attribute[name];
|
||||
}
|
||||
break;
|
||||
case 'borderColor':
|
||||
{
|
||||
var border = '3px ' + attribute[name] + ' solid';
|
||||
core.dom.statusBar.style.borderTop = border;
|
||||
core.dom.statusBar.style.borderLeft = border;
|
||||
core.dom.statusBar.style.borderRight = core.domStyle.isVertical?border:'';
|
||||
core.dom.statusBar.style.borderBottom = core.domStyle.isVertical?'':border;
|
||||
core.dom.gameDraw.style.border = border;
|
||||
core.dom.toolBar.style.borderLeft = border;
|
||||
core.dom.toolBar.style.borderRight = core.domStyle.isVertical?border:'';
|
||||
core.dom.toolBar.style.borderBottom = core.domStyle.isVertical?border:'';
|
||||
break;
|
||||
}
|
||||
case 'statusBarColor':
|
||||
{
|
||||
var texts = core.dom.statusTexts;
|
||||
for (var i=0;i<texts.length;i++)
|
||||
texts[i].style.color = attribute[name];
|
||||
break;
|
||||
}
|
||||
case 'hardLabelColor':
|
||||
core.dom.hard.style.color = attribute[name];
|
||||
break;
|
||||
case 'floorChangingBackground':
|
||||
core.dom.floorMsgGroup.style.background = attribute[name];
|
||||
break;
|
||||
case 'floorChangingTextColor':
|
||||
core.dom.floorMsgGroup.style.color = attribute[name];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////// 改变工具栏为按钮1-8 //////
|
||||
control.prototype.setToolbarButton = function (useButton) {
|
||||
if (!core.domStyle.showStatusBar) {
|
||||
@ -2638,17 +2639,28 @@ control.prototype._doResize = function (obj) {
|
||||
control.prototype.resize = function() {
|
||||
if (main.mode=='editor')return;
|
||||
var clientWidth = main.dom.body.clientWidth, clientHeight = main.dom.body.clientHeight;
|
||||
var CANVAS_WIDTH = core.__PIXELS__ + 6, BAR_WIDTH = Math.round(core.__PIXELS__ * 0.31) + 3;
|
||||
var CANVAS_WIDTH = core.__PIXELS__, BAR_WIDTH = Math.round(core.__PIXELS__ * 0.31);
|
||||
var BORDER = 3;
|
||||
|
||||
if (clientWidth >= CANVAS_WIDTH + BAR_WIDTH || (clientWidth > clientHeight && clientHeight < CANVAS_WIDTH)) {
|
||||
if (clientWidth - 3 * BORDER >= CANVAS_WIDTH + BAR_WIDTH || (clientWidth > clientHeight && clientHeight - 2 * BORDER < CANVAS_WIDTH)) {
|
||||
// 横屏
|
||||
core.domStyle.isVertical = false;
|
||||
core.domStyle.scale = Math.min(1, clientHeight / CANVAS_WIDTH);
|
||||
|
||||
core.domStyle.availableScale = [];
|
||||
[1, 1.25, 1.5, 1.75, 2].forEach(function (v) {
|
||||
if (clientWidth - 3 * BORDER >= v*(CANVAS_WIDTH + BAR_WIDTH) && clientHeight - 2 * BORDER >= v * CANVAS_WIDTH) {
|
||||
core.domStyle.availableScale.push(v); // 64x64
|
||||
}
|
||||
});
|
||||
if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) {
|
||||
core.domStyle.scale = Math.min(1, (clientHeight - 2 * BORDER) / CANVAS_WIDTH);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 竖屏
|
||||
core.domStyle.isVertical = true;
|
||||
core.domStyle.scale = Math.min(1, clientWidth / CANVAS_WIDTH);
|
||||
core.domStyle.scale = Math.min(1, (clientWidth - 2 * BORDER) / CANVAS_WIDTH);
|
||||
core.domStyle.availableScale = [];
|
||||
}
|
||||
|
||||
var statusDisplayArr = this._shouldDisplayStatus(), count = statusDisplayArr.length;
|
||||
@ -2664,15 +2676,16 @@ control.prototype.resize = function() {
|
||||
clientWidth: clientWidth,
|
||||
clientHeight: clientHeight,
|
||||
CANVAS_WIDTH: CANVAS_WIDTH,
|
||||
BORDER: BORDER,
|
||||
BAR_WIDTH: BAR_WIDTH,
|
||||
outerSize: CANVAS_WIDTH * core.domStyle.scale,
|
||||
outerSize: CANVAS_WIDTH * core.domStyle.scale + 2 * BORDER,
|
||||
globalAttribute: globalAttribute,
|
||||
border: '3px ' + globalAttribute.borderColor + ' solid',
|
||||
border: '3px ' + core.arrayToRGBA(globalAttribute.borderColor) + ' solid',
|
||||
statusDisplayArr: statusDisplayArr,
|
||||
count: count,
|
||||
col: col,
|
||||
statusBarHeightInVertical: core.domStyle.isVertical ? (32 * col + 6) * core.domStyle.scale + 6 : 0,
|
||||
toolbarHeightInVertical: core.domStyle.isVertical ? 44 * core.domStyle.scale + 6 : 0,
|
||||
statusBarHeightInVertical: core.domStyle.isVertical ? (32 * col + 6) * core.domStyle.scale + 2 * BORDER : 0,
|
||||
toolbarHeightInVertical: core.domStyle.isVertical ? 44 * core.domStyle.scale + 2 * BORDER : 0,
|
||||
is15x15: core.__SIZE__ == 15
|
||||
};
|
||||
|
||||
@ -2689,7 +2702,7 @@ control.prototype._resize_gameGroup = function (obj) {
|
||||
totalHeight = obj.outerSize + obj.statusBarHeightInVertical + obj.toolbarHeightInVertical
|
||||
}
|
||||
else {
|
||||
totalWidth = (obj.CANVAS_WIDTH + obj.BAR_WIDTH) * core.domStyle.scale;
|
||||
totalWidth = obj.outerSize + obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER;
|
||||
totalHeight = obj.outerSize;
|
||||
}
|
||||
gameGroup.style.width = totalWidth + "px";
|
||||
@ -2698,10 +2711,9 @@ control.prototype._resize_gameGroup = function (obj) {
|
||||
gameGroup.style.top = (obj.clientHeight - totalHeight) / 2 + "px";
|
||||
// floorMsgGroup
|
||||
var floorMsgGroup = core.dom.floorMsgGroup;
|
||||
floorMsgGroup.style.width = obj.outerSize - 6 + "px";
|
||||
floorMsgGroup.style.height = totalHeight - 6 + "px";
|
||||
floorMsgGroup.style.background = obj.globalAttribute.floorChangingBackground;
|
||||
floorMsgGroup.style.color = obj.globalAttribute.floorChangingTextColor;
|
||||
floorMsgGroup.style = obj.globalAttribute.floorChangingStyle;
|
||||
floorMsgGroup.style.width = obj.outerSize - 2 * obj.BORDER + "px";
|
||||
floorMsgGroup.style.height = totalHeight - 2 * obj.BORDER + "px";
|
||||
// musicBtn
|
||||
if (core.domStyle.isVertical || core.domStyle.scale < 1) {
|
||||
core.dom.musicBtn.style.right = core.dom.musicBtn.style.bottom = "3px";
|
||||
@ -2713,7 +2725,7 @@ control.prototype._resize_gameGroup = function (obj) {
|
||||
}
|
||||
|
||||
control.prototype._resize_canvas = function (obj) {
|
||||
var innerSize = (obj.outerSize - 6) + "px";
|
||||
var innerSize = (obj.CANVAS_WIDTH * core.domStyle.scale) + "px";
|
||||
for (var i = 0; i < core.dom.gameCanvas.length; ++i)
|
||||
core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[i].style.height = innerSize;
|
||||
core.dom.gif.style.width = core.dom.gif.style.height = innerSize;
|
||||
@ -2738,8 +2750,6 @@ control.prototype._resize_canvas = function (obj) {
|
||||
// resize next
|
||||
main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
|
||||
main.dom.next.style.borderBottomWidth = main.dom.next.style.borderRightWidth = 4 * core.domStyle.scale + "px";
|
||||
|
||||
|
||||
}
|
||||
|
||||
control.prototype._resize_statusBar = function (obj) {
|
||||
@ -2752,7 +2762,7 @@ control.prototype._resize_statusBar = function (obj) {
|
||||
statusBar.style.fontSize = 16 * core.domStyle.scale + "px";
|
||||
}
|
||||
else {
|
||||
statusBar.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
|
||||
statusBar.style.width = (obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER) + "px";
|
||||
statusBar.style.height = obj.outerSize + "px";
|
||||
statusBar.style.background = obj.globalAttribute.statusLeftBackground;
|
||||
// --- 计算文字大小
|
||||
@ -2764,22 +2774,22 @@ control.prototype._resize_statusBar = function (obj) {
|
||||
statusBar.style.borderBottom = core.domStyle.isVertical ? '' : obj.border;
|
||||
// 自绘状态栏
|
||||
if (core.domStyle.isVertical) {
|
||||
core.dom.statusCanvas.style.width = obj.outerSize - 6 + "px";
|
||||
core.dom.statusCanvas.width = core.__PIXELS__;
|
||||
core.dom.statusCanvas.style.width = obj.CANVAS_WIDTH + "px";
|
||||
core.dom.statusCanvas.width = obj.CANVAS_WIDTH;
|
||||
core.dom.statusCanvas.style.height = obj.statusBarHeightInVertical - 3 + "px";
|
||||
core.dom.statusCanvas.height = obj.col * 32 + 9;
|
||||
}
|
||||
else {
|
||||
core.dom.statusCanvas.style.width = obj.BAR_WIDTH * core.domStyle.scale - 3 + "px";
|
||||
core.dom.statusCanvas.width = obj.BAR_WIDTH - 3;
|
||||
core.dom.statusCanvas.style.height = obj.outerSize - 6 + "px";
|
||||
core.dom.statusCanvas.height = core.__PIXELS__;
|
||||
core.dom.statusCanvas.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
|
||||
core.dom.statusCanvas.width = obj.BAR_WIDTH;
|
||||
core.dom.statusCanvas.style.height = obj.outerSize - 2 * obj.BORDER + "px";
|
||||
core.dom.statusCanvas.height = obj.CANVAS_WIDTH;
|
||||
}
|
||||
core.dom.statusCanvas.style.display = core.flags.statusCanvas ? "block" : "none";
|
||||
}
|
||||
|
||||
control.prototype._resize_status = function (obj) {
|
||||
var statusHeight = (core.domStyle.isVertical ? 1 : (core.__HALF_SIZE__ + 3) / obj.count) * 32 * core.domStyle.scale * 0.8;
|
||||
var statusHeight = (core.domStyle.isVertical ? 1 : (core.__HALF_SIZE__ + obj.BORDER) / obj.count) * 32 * core.domStyle.scale * 0.8;
|
||||
// status
|
||||
for (var i = 0; i < core.dom.status.length; ++i) {
|
||||
var id = core.dom.status[i].id, style = core.dom.status[i].style;
|
||||
@ -2787,7 +2797,7 @@ control.prototype._resize_status = function (obj) {
|
||||
style.display = core.flags.statusCanvas || obj.statusDisplayArr.indexOf(id) < 0 ? 'none': 'block';
|
||||
style.margin = 3 * core.domStyle.scale + "px";
|
||||
style.height = statusHeight + "px";
|
||||
style.maxWidth = obj.BAR_WIDTH * core.domStyle.scale * (core.domStyle.isVertical ? 0.95 : 1) + "px";
|
||||
style.maxWidth = obj.BAR_WIDTH * core.domStyle.scale * (core.domStyle.isVertical ? 0.95 : 1) + obj.BORDER + "px";
|
||||
if (obj.is15x15 && !core.domStyle.isVertical)
|
||||
style.marginLeft = 11 * core.domStyle.scale + "px";
|
||||
}
|
||||
@ -2797,7 +2807,7 @@ control.prototype._resize_status = function (obj) {
|
||||
core.dom.statusLabels[i].style.marginLeft = 6 * core.domStyle.scale + "px";
|
||||
}
|
||||
for (var i = 0; i < core.dom.statusTexts.length; ++i) {
|
||||
core.dom.statusTexts[i].style.color = obj.globalAttribute.statusBarColor;
|
||||
core.dom.statusTexts[i].style.color = core.arrayToRGBA(obj.globalAttribute.statusBarColor);
|
||||
}
|
||||
// keys
|
||||
if (core.flags.statusBarItems.indexOf('enableGreenKey')>=0) {
|
||||
@ -2819,7 +2829,7 @@ control.prototype._resize_toolBar = function (obj) {
|
||||
toolBar.style.background = obj.globalAttribute.toolsBackground;
|
||||
}
|
||||
else {
|
||||
toolBar.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
|
||||
toolBar.style.width = obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER + "px";
|
||||
toolBar.style.top = 0.718 * obj.outerSize + "px";
|
||||
toolBar.style.height = 0.281 * obj.outerSize + "px";
|
||||
toolBar.style.background = 'transparent';
|
||||
@ -2844,7 +2854,6 @@ control.prototype._resize_tools = function (obj) {
|
||||
style.marginTop = 6 * core.domStyle.scale + "px"
|
||||
}
|
||||
core.dom.hard.style.lineHeight = toolsHeight + "px";
|
||||
core.dom.hard.style.color = obj.globalAttribute.hardLabelColor;
|
||||
if (core.domStyle.isVertical) {
|
||||
core.dom.hard.style.width = obj.outerSize - 9 * toolsMarginLeft - 8.5 * toolsHeight - 12 + "px";
|
||||
}
|
||||
|
||||
23
libs/core.js
@ -84,6 +84,7 @@ function core() {
|
||||
// 样式
|
||||
this.domStyle = {
|
||||
scale: 1.0,
|
||||
availableScale: [],
|
||||
isVertical: false,
|
||||
showStatusBar: true,
|
||||
toolbarBtn: false,
|
||||
@ -190,15 +191,13 @@ function core() {
|
||||
},
|
||||
"globalAttribute": {
|
||||
'equipName': main.equipName || [],
|
||||
"statusLeftBackground": main.statusLeftBackground || "url(project/materials/ground.png) repeat",
|
||||
"statusTopBackground": main.statusTopBackground || "url(project/materials/ground.png) repeat",
|
||||
"toolsBackground": main.toolsBackground || "url(project/images/materials.png) repeat",
|
||||
"borderColor": main.borderColor || "white",
|
||||
"statusBarColor": main.statusBarColor || "white",
|
||||
"hardLabelColor": main.hardLabelColor || "red",
|
||||
"floorChangingBackground": main.floorChangingBackground || "black",
|
||||
"floorChangingTextColor": main.floorChangingTextColor || "white",
|
||||
"font": main.font || "Verdana"
|
||||
"statusLeftBackground": main.styles.statusLeftBackground || "url(project/materials/ground.png) repeat",
|
||||
"statusTopBackground": main.styles.statusTopBackground || "url(project/materials/ground.png) repeat",
|
||||
"toolsBackground": main.styles.toolsBackground || "url(project/materials/ground.png) repeat",
|
||||
"borderColor": main.styles.borderColor || [204,204,204,1],
|
||||
"statusBarColor": main.styles.statusBarColor || [255,255,255,1],
|
||||
"floorChangingStyle": main.styles.floorChangingStyle || "background-color: black; color: white",
|
||||
"font": main.styles.font || "Verdana"
|
||||
},
|
||||
'curtainColor': null,
|
||||
'openingDoor': null,
|
||||
@ -292,6 +291,12 @@ core.prototype._init_sys_flags = function () {
|
||||
// 行走速度
|
||||
core.values.moveSpeed = core.getLocalStorage('moveSpeed', 100);
|
||||
core.values.floorChangeTime = core.getLocalStorage('floorChangeTime', 500);
|
||||
if (main.mode != 'editor') {
|
||||
core.domStyle.scale = core.getLocalStorage('scale', 1);
|
||||
if (core.domStyle.scale != 1) {
|
||||
core.resize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
core.prototype._init_platform = function () {
|
||||
|
||||
@ -10,13 +10,13 @@ function enemys() {
|
||||
enemys.prototype._init = function () {
|
||||
this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
|
||||
this.enemydata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys;
|
||||
for (var enemyId in this.enemys) {
|
||||
this.enemys[enemyId].id = enemyId;
|
||||
}
|
||||
if (main.mode == 'play') {
|
||||
this.enemydata.hasSpecial = function (a, b) {
|
||||
return core.enemys.hasSpecial(a, b)
|
||||
};
|
||||
for (var enemyId in this.enemys) {
|
||||
this.enemys[enemyId].id = enemyId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,6 +299,7 @@ enemys.prototype._getDamage = function (enemy, hero, x, y, floorId) {
|
||||
enemys.prototype.getCurrentEnemys = function (floorId) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
var enemys = [], used = {};
|
||||
core.extractBlocks(floorId);
|
||||
var mapBlocks = core.status.maps[floorId].blocks;
|
||||
for (var b = 0; b < mapBlocks.length; b++) {
|
||||
if (!mapBlocks[b].disable && mapBlocks[b].event.cls.indexOf('enemy') == 0) {
|
||||
@ -364,6 +365,7 @@ enemys.prototype.hasEnemyLeft = function (enemyId, floorId) {
|
||||
else if (enemyId) enemyMap[enemyId] = true;
|
||||
else enemyMap = null;
|
||||
for (var i = 0; i < floorId.length; i++) {
|
||||
core.extractBlocks(floorId[i]);
|
||||
var mapBlocks = core.status.maps[floorId[i]].blocks;
|
||||
for (var b = 0; b < mapBlocks.length; b++) {
|
||||
if (!mapBlocks[b].disable && mapBlocks[b].event.cls.indexOf('enemy') === 0) {
|
||||
|
||||
171
libs/events.js
@ -61,6 +61,7 @@ events.prototype._startGame_start = function (hard, seed, route, callback) {
|
||||
core.dom.musicBtn.style.display = 'block';
|
||||
core.push(todo, core.firstData.startCanvas);
|
||||
}
|
||||
core.push(todo, {"type": "function", "function": "function() { core.events._startGame_setHard(); }"})
|
||||
core.push(todo, core.firstData.startText);
|
||||
this.insertAction(todo, null, null, function () {
|
||||
core.events._startGame_afterStart(nowLoc, callback);
|
||||
@ -69,6 +70,22 @@ events.prototype._startGame_start = function (hard, seed, route, callback) {
|
||||
if (route != null) core.startReplay(route);
|
||||
}
|
||||
|
||||
events.prototype._startGame_setHard = function () {
|
||||
// 根据难度设置flag:hard
|
||||
// 这一段应当在startCanvas之后,startText之前做
|
||||
var hardValue = 0;
|
||||
var hardColor = 'red';
|
||||
main.levelChoose.forEach(function (one) {
|
||||
if (one.name == core.status.hard) {
|
||||
hardValue = one.hard;
|
||||
hardColor = core.arrayToRGBA(one.color || [255,0,0,1]);
|
||||
core.insertAction(one.action);
|
||||
}
|
||||
});
|
||||
core.setFlag('hard', 0);
|
||||
core.setFlag('__hardColor__', hardColor);
|
||||
}
|
||||
|
||||
events.prototype._startGame_afterStart = function (nowLoc, callback) {
|
||||
core.ui.closePanel();
|
||||
this._startGame_statusBar();
|
||||
@ -427,7 +444,8 @@ events.prototype.openDoor = function (x, y, needKey, callback) {
|
||||
core.removeBlock(x, y);
|
||||
setTimeout(function () {
|
||||
core.status.replay.animate = false;
|
||||
core.events.afterOpenDoor(id, x, y, callback);
|
||||
core.events.afterOpenDoor(id, x, y);
|
||||
if (callback) callback();
|
||||
}, 1); // +1是为了录像检测系统
|
||||
} else {
|
||||
this._openDoor_animate(id, x, y, callback);
|
||||
@ -441,7 +459,7 @@ events.prototype._openDoor_check = function (id, x, y, needKey) {
|
||||
}
|
||||
|
||||
// 是否存在门或暗墙
|
||||
if (core.material.icons.animates[id] == null) {
|
||||
if (core.material.icons.animates[id] == null && core.material.icons.npc48[id] == null) {
|
||||
return clearAndReturn();
|
||||
}
|
||||
|
||||
@ -452,13 +470,14 @@ events.prototype._openDoor_check = function (id, x, y, needKey) {
|
||||
return clearAndReturn();
|
||||
doorInfo = doorInfo.doorInfo;
|
||||
// Check all keys
|
||||
var keyInfo = doorInfo[0];
|
||||
var keyInfo = doorInfo.keys || {};
|
||||
if (needKey) {
|
||||
if (keyInfo == null) {
|
||||
core.drawTip("无法开启此门");
|
||||
return clearAndReturn();
|
||||
}
|
||||
for (var keyName in keyInfo) {
|
||||
// --- 如果是一个不存在的道具,则直接认为无法开启
|
||||
if (!core.material.items[keyName]) {
|
||||
core.drawTip("无法开启此门");
|
||||
return clearAndReturn();
|
||||
}
|
||||
var keyValue = keyInfo[keyName];
|
||||
if (core.itemCount(keyName) < keyValue) {
|
||||
core.drawTip("你没有" + ((core.material.items[keyName] || {}).name || "钥匙"), null, true);
|
||||
@ -470,22 +489,28 @@ events.prototype._openDoor_check = function (id, x, y, needKey) {
|
||||
core.removeItem(keyName, keyInfo[keyName]);
|
||||
}
|
||||
}
|
||||
core.playSound(doorInfo[1] || 'door.mp3');
|
||||
core.playSound(doorInfo.openSound);
|
||||
return true;
|
||||
}
|
||||
|
||||
events.prototype._openDoor_animate = function (id, x, y, callback) {
|
||||
var door = core.material.icons.animates[id];
|
||||
var speed = 40;
|
||||
var blockInfo = core.getBlockInfo(id);
|
||||
var image = blockInfo.image, posY = blockInfo.posY, height = blockInfo.height;
|
||||
|
||||
var speed = (core.getBlockById(id).event.doorInfo.time || 160) / 4;
|
||||
|
||||
var locked = core.status.lockControl;
|
||||
core.lockControl();
|
||||
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);
|
||||
core.drawImage('event', image, 0, posY * height + height - 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||
if (height > 32)
|
||||
core.drawImage('event2', image, 0, posY * height, 32, height - 32, x * 32, y * 32 + 32 - height, 32, height - 32);
|
||||
var state = 0;
|
||||
var animate = window.setInterval(function () {
|
||||
core.clearMap('event', 32 * x, 32 * y, 32, 32);
|
||||
if (height > 32)
|
||||
core.clearMap('event2', x * 32, y * 32 + 32 - height, 32, height - 32)
|
||||
state++;
|
||||
if (state == 4) {
|
||||
clearInterval(animate);
|
||||
@ -496,7 +521,9 @@ events.prototype._openDoor_animate = function (id, x, y, callback) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
core.drawImage('event', core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||
core.drawImage('event', image, 32 * state, posY * height + height - 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||
if (height > 32)
|
||||
core.drawImage('event2', image, 32 * state, posY * height, 32, height - 32, x * 32, y * 32 + 32 - height, 32, height - 32);
|
||||
}, core.status.replay.speed == 24 ? 1 : speed / Math.max(core.status.replay.speed, 1));
|
||||
core.animateFrame.asyncId[animate] = true;
|
||||
}
|
||||
@ -661,6 +688,7 @@ events.prototype._changeFloor_getHeroLoc = function (floorId, stair, heroLoc) {
|
||||
heroLoc.y = core.status.maps[floorId][stair][1];
|
||||
}
|
||||
else {
|
||||
core.extractBlocks(floorId);
|
||||
var blocks = core.status.maps[floorId].blocks;
|
||||
for (var i in blocks) {
|
||||
if (!blocks[i].disable && blocks[i].event.id === stair) {
|
||||
@ -903,6 +931,8 @@ events.prototype.doAction = function (keepUI) {
|
||||
}
|
||||
|
||||
events.prototype._doAction_finishEvents = function () {
|
||||
if (core.status.gameOver) return true;
|
||||
|
||||
// 事件处理完毕
|
||||
if (core.status.event.data.list.length == 0) {
|
||||
// 检测并执行延迟自动事件
|
||||
@ -937,13 +967,6 @@ events.prototype._popEvents = function (current, prefix) {
|
||||
events.prototype.insertAction = function (action, x, y, callback, addToLast) {
|
||||
if (core.hasFlag("__statistics__")) return;
|
||||
if (core.status.gameOver) return;
|
||||
|
||||
// ------ 判定commonEvent
|
||||
var commonEvent = this.getCommonEvent(action);
|
||||
if (commonEvent instanceof Array) {
|
||||
// 将公共事件视为一个do-while事件插入执行,可被break跳出
|
||||
action = [{"type": "dowhile", "condition": "false", "data": commonEvent}];
|
||||
}
|
||||
if (!action) return;
|
||||
|
||||
action = this.precompile(action);
|
||||
@ -960,6 +983,16 @@ events.prototype.insertAction = function (action, x, y, callback, addToLast) {
|
||||
}
|
||||
}
|
||||
|
||||
////// 往当前事件列表之前或之后添加一个公共事件 //////
|
||||
events.prototype.insertCommonEvent = function (name, x, y, callback, addToLast) {
|
||||
var commonEvent = this.getCommonEvent(name);
|
||||
if (!commonEvent) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
this.insertAction({"type": "dowhile", "condition": "false", "data": commonEvent}, x, y, callback, addToLast);
|
||||
}
|
||||
|
||||
////// 获得一个公共事件 //////
|
||||
events.prototype.getCommonEvent = function (name) {
|
||||
if (!name || typeof name !== 'string') return null;
|
||||
@ -1119,11 +1152,14 @@ events.prototype.__precompile_getArray = function () {
|
||||
"setValue", "setEnemy", "setFloor", "setGlobalValue",
|
||||
];
|
||||
var uievents = [
|
||||
"clearMap", "fillText", "fillBoldText", "fillRect", "strokeRect", "strokeCircle",
|
||||
"drawIcon", "drawSelector", "drawBackground",
|
||||
"clearMap", "fillText", "fillBoldText", "fillRect", "strokeRect", "fillEllipse", "strokeEllipse",
|
||||
"fillArc", "strokeArc", "drawIcon", "drawSelector", "drawBackground",
|
||||
];
|
||||
var others = {
|
||||
"strokeCircle": ["r"],
|
||||
"fillEllipse": ["a", "b"],
|
||||
"strokeEllipse": ["a", "b"],
|
||||
"fillArc": ["r", "start", "end"],
|
||||
"strokeArc": ["r", "start", "end"],
|
||||
"drawLine": ["x1", "y1", "x2", "y2"],
|
||||
"drawArrow": ["x1", "y1", "x2", "y2"],
|
||||
"drawImage": ["x", "y", "w", "h", "x1", "y1", "w1", "h1"],
|
||||
@ -1275,10 +1311,16 @@ events.prototype._action_hide = function (data, x, y, prefix) {
|
||||
|
||||
events.prototype._action_setBlock = function (data, x, y, prefix) {
|
||||
data.loc = this.__action_getLoc2D(data.loc, x, y, prefix);
|
||||
data.loc.forEach(function (t) {
|
||||
core.setBlock(data.number, t[0], t[1], data.floorId);
|
||||
});
|
||||
core.doAction();
|
||||
data.time = data.time || 0;
|
||||
data.floorId = data.floorId || core.status.floorId;
|
||||
if (data.time > 0 && data.floorId == core.status.floorId) {
|
||||
this.__action_doAsyncFunc(data.async, core.animateSetBlocks, data.number, data.loc, data.floorId, data.time);
|
||||
} else {
|
||||
data.loc.forEach(function (loc) {
|
||||
core.setBlock(data.number, loc[0], loc[1], data.floorId);
|
||||
});
|
||||
core.doAction();
|
||||
}
|
||||
}
|
||||
|
||||
events.prototype._action_turnBlock = function (data, x, y, prefix) {
|
||||
@ -1418,7 +1460,7 @@ events.prototype._action_changePos = function (data, x, y, prefix) {
|
||||
events.prototype._action_showImage = function (data, x, y, prefix) {
|
||||
if (core.isReplaying()) data.time = 0;
|
||||
this.__action_doAsyncFunc(data.async || data.time == 0, core.showImage,
|
||||
data.code, data.image, data.sloc, data.loc, data.opacity, data.time);
|
||||
data.code, data.image + (data.reverse || ''), data.sloc, data.loc, data.opacity, data.time);
|
||||
}
|
||||
|
||||
events.prototype._precompile_showImage = function (data) {
|
||||
@ -1562,7 +1604,7 @@ events.prototype._action_insert = function (data, x, y, prefix) {
|
||||
}
|
||||
if (data.name) { // 公共事件
|
||||
core.setFlag('arg0', data.name);
|
||||
core.insertAction(data.name);
|
||||
core.insertCommonEvent(data.name);
|
||||
}
|
||||
else {
|
||||
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
||||
@ -1632,6 +1674,11 @@ events.prototype._action_setValue = function (data, x, y, prefix) {
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
events.prototype._action_addValue = function (data, x, y, prefix) {
|
||||
data.operator = '+=';
|
||||
this._action_setValue(data, x, y, prefix);
|
||||
}
|
||||
|
||||
events.prototype._action_setEnemy = function (data, x, y, prefix) {
|
||||
this.setEnemy(data.id, data.name, data.value, prefix);
|
||||
core.doAction();
|
||||
@ -1969,15 +2016,25 @@ events.prototype._action_hideStatusBar = function (data, x, y, prefix) {
|
||||
}
|
||||
|
||||
events.prototype._action_showHero = function (data, x, y, prefix) {
|
||||
core.removeFlag('hideHero');
|
||||
core.drawHero();
|
||||
core.doAction();
|
||||
data.time = data.time || 0;
|
||||
if (data.time > 0) {
|
||||
this.__action_doAsyncFunc(data.async, core.triggerHero, 'show', data.time);
|
||||
} else {
|
||||
core.removeFlag('hideHero');
|
||||
core.drawHero();
|
||||
core.doAction();
|
||||
}
|
||||
}
|
||||
|
||||
events.prototype._action_hideHero = function (data, x, y, prefix) {
|
||||
core.setFlag('hideHero', true);
|
||||
core.drawHero();
|
||||
core.doAction();
|
||||
data.time = data.time || 0;
|
||||
if (data.time > 0) {
|
||||
this.__action_doAsyncFunc(data.async, core.triggerHero, 'hide', data.time);
|
||||
} else {
|
||||
core.setFlag('hideHero', true);
|
||||
core.drawHero();
|
||||
core.doAction();
|
||||
}
|
||||
}
|
||||
|
||||
events.prototype._action_vibrate = function (data, x, y, prefix) {
|
||||
@ -2015,7 +2072,7 @@ events.prototype._action_wait = function (data, x, y, prefix) {
|
||||
} else if (data.timeout) {
|
||||
core.status.event.interval = setTimeout(function() {
|
||||
core.status.route.push("input:none");
|
||||
core.removeFlag("type");
|
||||
core.setFlag("type", -1);
|
||||
core.doAction();
|
||||
}, data.timeout);
|
||||
}
|
||||
@ -2205,11 +2262,19 @@ events.prototype._precompile_strokePolygon = function (data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
events.prototype._action_fillCircle = function (data, x, y, prefix) {
|
||||
events.prototype._action_fillEllipse = function (data, x, y, prefix) {
|
||||
this.__action_doUIEvent(data);
|
||||
}
|
||||
|
||||
events.prototype._action_strokeCircle = function (data, x, y, prefix) {
|
||||
events.prototype._action_strokeEllipse = function (data, x, y, prefix) {
|
||||
this.__action_doUIEvent(data);
|
||||
}
|
||||
|
||||
events.prototype._action_fillArc = function (data, x, y, prefix) {
|
||||
this.__action_doUIEvent(data);
|
||||
}
|
||||
|
||||
events.prototype._action_strokeArc = function (data, x, y, prefix) {
|
||||
this.__action_doUIEvent(data);
|
||||
}
|
||||
|
||||
@ -2516,7 +2581,7 @@ events.prototype.setEnemy = function (id, name, value, prefix) {
|
||||
////// 设置楼层属性 //////
|
||||
events.prototype.setFloorInfo = function (name, value, floorId, prefix) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
core.status.maps[floorId][name] = core.calValue(value, prefix);
|
||||
core.status.maps[floorId][name] = value;
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
@ -2529,10 +2594,14 @@ events.prototype.setGlobalAttribute = function (name, value) {
|
||||
// --- 检查 []
|
||||
if (value.charAt(0) == '[' && value.charAt(value.length - 1) == ']')
|
||||
value = eval(value);
|
||||
// --- 检查颜色
|
||||
if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(value)) {
|
||||
value = 'rgba(' + value + ')';
|
||||
}
|
||||
}
|
||||
core.status.globalAttribute[name] = value;
|
||||
core.updateGlobalAttribute(name);
|
||||
core.setFlag('globalAttribute', core.status.globalAttribute);
|
||||
core.resize();
|
||||
}
|
||||
|
||||
////// 设置全局开关 //////
|
||||
@ -2555,7 +2624,8 @@ events.prototype.setGlobalFlag = function (name, value) {
|
||||
|
||||
events.prototype.closeDoor = function (x, y, id, callback) {
|
||||
id = id || "";
|
||||
if (core.material.icons.animates[id] == null || core.getBlock(x, y) != null) {
|
||||
if ((core.material.icons.animates[id] == null && core.material.icons.npc48[id] == null)
|
||||
|| core.getBlock(x, y) != null) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
@ -2566,27 +2636,36 @@ events.prototype.closeDoor = function (x, y, id, callback) {
|
||||
}
|
||||
|
||||
// 关门动画
|
||||
core.playSound(doorInfo[2] || 'door.mp3');
|
||||
var door = core.material.icons.animates[id];
|
||||
var speed = 40, state = 0;
|
||||
core.playSound(doorInfo.closeDoor);
|
||||
var blockInfo = core.getBlockInfo(id);
|
||||
var image = blockInfo.image, posY = blockInfo.posY, height = blockInfo.height;
|
||||
|
||||
var speed = (doorInfo.time || 160) / 4, state = 0;
|
||||
var animate = window.setInterval(function () {
|
||||
state++;
|
||||
if (state == 4) {
|
||||
clearInterval(animate);
|
||||
delete core.animateFrame.asyncId[animate];
|
||||
core.setBlock(core.getNumberById(id), x, y);
|
||||
core.setBlock(id, x, y);
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
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', image, 32 * (4-state), posY * height + height - 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||
if (height > 32)
|
||||
core.drawImage('event2', image, 32 * (4-state), posY * height, 32, height - 32, x * 32, y * 32 + 32 - height, 32, height - 32);
|
||||
}, core.status.replay.speed == 24 ? 1 : speed / Math.max(core.status.replay.speed, 1));
|
||||
core.animateFrame.asyncId[animate] = true;
|
||||
}
|
||||
|
||||
////// 显示图片 //////
|
||||
events.prototype.showImage = function (code, image, sloc, loc, opacityVal, time, callback) {
|
||||
var imageName = null;
|
||||
if (typeof image == 'string') {
|
||||
imageName = image;
|
||||
if (image.endsWith(':x') || image.endsWith(':y') || image.endsWith(':o')) {
|
||||
image = image.substring(0, image.length - 2);
|
||||
}
|
||||
image = core.getMappedName(image);
|
||||
image = core.material.images.images[image];
|
||||
}
|
||||
@ -2608,7 +2687,7 @@ events.prototype.showImage = function (code, image, sloc, loc, opacityVal, time,
|
||||
time = time || 0;
|
||||
var name = "image" + zIndex;
|
||||
var ctx = core.createCanvas(name, x, y, w, h, zIndex);
|
||||
ctx.drawImage(image, sx, sy, sw, sh, 0, 0, w, h);
|
||||
core.drawImage(ctx, imageName == null ? image : imageName, sx, sy, sw, sh, 0, 0, w, h);
|
||||
if (time == 0) {
|
||||
core.setOpacity(name, opacityVal);
|
||||
if (callback) callback();
|
||||
|
||||
@ -36,16 +36,13 @@ icons.prototype.getAllIconIds = function () {
|
||||
return this.allIconIds;
|
||||
}
|
||||
|
||||
icons.prototype._getAnimateFrames = function (cls, useOriginValue) {
|
||||
icons.prototype._getAnimateFrames = function (cls) {
|
||||
if (cls == 'enemys' || cls == 'npcs') {
|
||||
return 2;
|
||||
}
|
||||
if (cls == 'animates' || cls == 'enemy48') {
|
||||
if (cls == 'animates' || cls == 'enemy48' || cls == 'npc48') {
|
||||
return 4;
|
||||
}
|
||||
if (cls == 'npc48') {
|
||||
return useOriginValue ? 4 : 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -53,6 +50,7 @@ icons.prototype._getAnimateFrames = function (cls, useOriginValue) {
|
||||
icons.prototype.getTilesetOffset = function (id) {
|
||||
|
||||
if (typeof id == 'string') {
|
||||
id = core.getIdOfThis(id);
|
||||
// Tileset的ID必须是 X+数字 的形式
|
||||
if (!/^X\d+$/.test(id)) return null;
|
||||
id = parseInt(id.substring(1));
|
||||
|
||||
@ -8,17 +8,10 @@ function items() {
|
||||
|
||||
////// 初始化 //////
|
||||
items.prototype._init = function () {
|
||||
this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items;
|
||||
this.itemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect;
|
||||
this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;
|
||||
this.useItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEffect;
|
||||
this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect;
|
||||
if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition)
|
||||
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition = {};
|
||||
if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEvent)
|
||||
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEvent = {};
|
||||
this.equipCondition = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition;
|
||||
this.useItemEvent = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEvent;
|
||||
this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a;
|
||||
for (var itemId in this.items) {
|
||||
this.items[itemId].id = itemId;
|
||||
}
|
||||
}
|
||||
|
||||
////// 获得所有道具 //////
|
||||
@ -31,12 +24,12 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
// 消耗品
|
||||
if (itemCls === 'items') {
|
||||
var ratio = parseInt(core.status.thisMap.item_ratio) || 1;
|
||||
var curr_hp = core.status.hero.hp;
|
||||
if (itemId in this.itemEffect) {
|
||||
var itemEffect = core.material.items[itemId].itemEffect;
|
||||
if (itemEffect) {
|
||||
try {
|
||||
for (var i = 0; i < itemNum; ++i)
|
||||
eval(this.itemEffect[itemId]);
|
||||
eval(itemEffect);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
@ -44,9 +37,10 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
|
||||
}
|
||||
core.status.hero.statistics.hp += core.status.hero.hp - curr_hp;
|
||||
|
||||
if (this.useItemEvent[itemId]) {
|
||||
var useItemEvent = core.material.items[itemId].useItemEvent;
|
||||
if (useItemEvent) {
|
||||
try {
|
||||
core.insertAction(this.useItemEvent[itemId]);
|
||||
core.insertAction(useItemEvent);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
@ -64,10 +58,10 @@ items.prototype.getItemEffectTip = function (itemId) {
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
// 消耗品
|
||||
if (itemCls === 'items') {
|
||||
var ratio = parseInt(core.status.thisMap.item_ratio) || 1;
|
||||
if (itemId in this.itemEffectTip) {
|
||||
var itemEffectTip = core.material.items[itemId].itemEffectTip;
|
||||
if (itemEffectTip) {
|
||||
try {
|
||||
return eval(this.itemEffectTip[itemId]) || "";
|
||||
return core.replaceText(itemEffectTip) || "";
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
return "";
|
||||
@ -93,18 +87,19 @@ items.prototype.useItem = function (itemId, noRoute, callback) {
|
||||
}
|
||||
|
||||
items.prototype._useItemEffect = function (itemId) {
|
||||
if (itemId in this.useItemEffect) {
|
||||
var useItemEffect = core.material.items[itemId].useItemEffect;
|
||||
if (useItemEffect) {
|
||||
try {
|
||||
var ratio = parseInt(core.status.thisMap.item_ratio) || 1;
|
||||
eval(this.useItemEffect[itemId]);
|
||||
eval(useItemEffect);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
}
|
||||
}
|
||||
if (this.useItemEvent[itemId]) {
|
||||
var useItemEvent = core.material.items[itemId].useItemEvent;
|
||||
if (useItemEvent) {
|
||||
try {
|
||||
core.insertAction(this.useItemEvent[itemId]);
|
||||
core.insertAction(useItemEvent);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
@ -127,9 +122,10 @@ items.prototype.canUseItem = function (itemId) {
|
||||
// 没有道具
|
||||
if (!core.hasItem(itemId)) return false;
|
||||
|
||||
if (itemId in this.canUseItemEffect) {
|
||||
var canUseItemEffect = core.material.items[itemId].canUseItemEffect;
|
||||
if (canUseItemEffect) {
|
||||
try {
|
||||
return eval(this.canUseItemEffect[itemId]);
|
||||
return eval(canUseItemEffect);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
@ -246,10 +242,10 @@ items.prototype.canEquip = function (equipId, hint) {
|
||||
}
|
||||
|
||||
// 可装备条件
|
||||
var condition = this.equipCondition[equipId];
|
||||
if (condition) {
|
||||
var equipCondition = core.material.items[equipId].equipCondition;
|
||||
if (equipCondition) {
|
||||
try {
|
||||
if (!eval(condition)) {
|
||||
if (!eval(equipCondition)) {
|
||||
if (hint) core.drawTip("当前不可换上" + equip.name);
|
||||
return false;
|
||||
}
|
||||
@ -292,53 +288,41 @@ items.prototype.unloadEquip = function (equipType, callback) {
|
||||
}
|
||||
|
||||
items.prototype.compareEquipment = function (compareEquipId, beComparedEquipId) {
|
||||
var result = {};
|
||||
var result = {"value": {}, "percentage": {}};
|
||||
var first = core.material.items[compareEquipId], second = core.material.items[beComparedEquipId];
|
||||
for (var name in core.status.hero) {
|
||||
if (typeof core.status.hero[name] == 'number') {
|
||||
var ans = 0;
|
||||
if (first) ans += (first.equip || {})[name] || 0;
|
||||
if (second) ans -= (second.equip || {})[name] || 0;
|
||||
if (ans != 0) result[name] = ans;
|
||||
for (var one in result) {
|
||||
for (var name in core.status.hero) {
|
||||
if (typeof core.status.hero[name] == 'number') {
|
||||
var ans = 0;
|
||||
if (first) ans += ((first.equip || {})[one] || {})[name] || 0;
|
||||
if (second) ans -= ((second.equip || {})[one] || {})[name] || 0;
|
||||
if (ans != 0) result[one][name] = ans;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////// 实际换装的效果 //////
|
||||
items.prototype._loadEquipEffect = function (equipId, unloadEquipId, isPercentage) {
|
||||
items.prototype._loadEquipEffect = function (equipId, unloadEquipId) {
|
||||
// 比较能力值
|
||||
var result = core.compareEquipment(equipId, unloadEquipId);
|
||||
|
||||
if (isPercentage) {
|
||||
for (var name in result)
|
||||
core.addBuff(name, result[name] / 100);
|
||||
}
|
||||
else {
|
||||
for (var name in result)
|
||||
core.status.hero[name] += result[name];
|
||||
}
|
||||
for (var name in result.percentage)
|
||||
core.addBuff(name, result.percentage[name] / 100);
|
||||
|
||||
for (var name in result.value)
|
||||
core.status.hero[name] += result.value[name];
|
||||
}
|
||||
|
||||
items.prototype._realLoadEquip = function (type, loadId, unloadId, callback) {
|
||||
var loadEquip = core.material.items[loadId] || {}, unloadEquip = core.material.items[unloadId] || {};
|
||||
loadEquip.equip = loadEquip.equip || {};
|
||||
unloadEquip.equip = unloadEquip.equip || {}
|
||||
|
||||
var loadPercentage = loadEquip.equip.percentage, unloadPercentage = unloadEquip.equip.percentage;
|
||||
|
||||
if (loadId && unloadId && (loadPercentage || false) != (unloadPercentage || false)) {
|
||||
this.unloadEquip(type);
|
||||
this.loadEquip(loadId);
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
|
||||
// --- 音效
|
||||
this._realLoadEquip_playSound();
|
||||
|
||||
// --- 实际换装
|
||||
this._loadEquipEffect(loadId, unloadId, loadPercentage == null ? unloadPercentage : loadPercentage);
|
||||
this._loadEquipEffect(loadId, unloadId);
|
||||
|
||||
// --- 加减
|
||||
if (loadId) core.removeItem(loadId);
|
||||
|
||||
407
libs/loader.js
@ -25,115 +25,199 @@ loader.prototype._setStartLoadTipText = function (text) {
|
||||
}
|
||||
|
||||
loader.prototype._load = function (callback) {
|
||||
this._loadIcons();
|
||||
this._loadAnimates();
|
||||
this._loadMusic();
|
||||
if (main.useCompress) {
|
||||
this._load_async(callback);
|
||||
} else {
|
||||
this._load_sync(callback);
|
||||
}
|
||||
}
|
||||
|
||||
core.loader._loadMaterialImages(function () {
|
||||
core.loader._loadExtraImages(function () {
|
||||
core.loader._loadAutotiles(function () {
|
||||
core.loader._loadTilesets(callback);
|
||||
loader.prototype._load_sync = function (callback) {
|
||||
this._loadAnimates_sync();
|
||||
this._loadMusic_sync();
|
||||
core.loader._loadMaterials_sync(function () {
|
||||
core.loader._loadExtraImages_sync(function () {
|
||||
core.loader._loadAutotiles_sync(function () {
|
||||
core.loader._loadTilesets_sync(callback);
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype._loadIcons = function () {
|
||||
this.loadImage("materials", "icons.png", function (id, image) {
|
||||
var images = core.splitImage(image);
|
||||
for (var key in core.statusBar.icons) {
|
||||
if (typeof core.statusBar.icons[key] == 'number') {
|
||||
core.statusBar.icons[key] = images[core.statusBar.icons[key]];
|
||||
if (core.statusBar.image[key] != null)
|
||||
core.statusBar.image[key].src = core.statusBar.icons[key].src;
|
||||
loader.prototype._load_async = function (callback) {
|
||||
core.loader._setStartLoadTipText('正在加载资源文件...');
|
||||
var all = {};
|
||||
|
||||
var _makeOnProgress = function (name) {
|
||||
if (!all[name]) all[name] = {loaded: 0, total: 0, finished: false};
|
||||
return function (loaded, total) {
|
||||
all[name].loaded = loaded;
|
||||
all[name].total = total;
|
||||
var allLoaded = 0, allTotal = 0;
|
||||
for (var one in all) {
|
||||
allLoaded += all[one].loaded;
|
||||
allTotal += all[one].total;
|
||||
}
|
||||
if (allTotal > 0) {
|
||||
if (allLoaded == allTotal) {
|
||||
core.loader._setStartLoadTipText("正在处理资源文件... 请稍后...");
|
||||
} else {
|
||||
core.loader._setStartLoadTipText('正在加载资源文件... ' +
|
||||
core.formatSize(allLoaded) + " / " + core.formatSize(allTotal) +
|
||||
" (" + (allLoaded / allTotal * 100).toFixed(2) + "%)");
|
||||
}
|
||||
core.loader._setStartProgressVal(allLoaded / allTotal * 100);
|
||||
}
|
||||
};
|
||||
}
|
||||
var _makeOnFinished = function (name) {
|
||||
return function () {
|
||||
setTimeout(function () {
|
||||
all[name].finished = true;
|
||||
for (var one in all) {
|
||||
if (!all[one].finished) return;
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this._loadAnimates_async(_makeOnProgress('animates'), _makeOnFinished('animates'));
|
||||
this._loadMusic_async(_makeOnProgress('sounds'), _makeOnFinished('sounds'));
|
||||
this._loadMaterials_async(_makeOnProgress('materials'), _makeOnFinished('materials'));
|
||||
this._loadExtraImages_async(_makeOnProgress('images'), _makeOnFinished('images'));
|
||||
this._loadAutotiles_async(_makeOnProgress('autotiles'), _makeOnFinished('autotiles'));
|
||||
this._loadTilesets_async(_makeOnProgress('tilesets'), _makeOnFinished('tilesets'));
|
||||
}
|
||||
|
||||
// ----- 加载资源文件 ------ //
|
||||
|
||||
loader.prototype._loadMaterials_sync = function (callback) {
|
||||
this._setStartLoadTipText("正在加载资源文件...");
|
||||
this.loadImages("materials", core.materials, core.material.images, function () {
|
||||
core.loader._loadMaterials_afterLoad();
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype._loadMaterialImages = function (callback) {
|
||||
this._setStartLoadTipText("正在加载资源文件...");
|
||||
if (main.useCompress) {
|
||||
this.loadImagesFromZip('project/materials/materials.h5data', core.materials, core.material.images, callback);
|
||||
} else {
|
||||
this.loadImages("materials", core.materials, core.material.images, callback);
|
||||
loader.prototype._loadMaterials_async = function (onprogress, onfinished) {
|
||||
this.loadImagesFromZip('project/materials/materials.h5data', core.materials, core.material.images, onprogress, function () {
|
||||
core.loader._loadMaterials_afterLoad();
|
||||
onfinished();
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype._loadMaterials_afterLoad = function () {
|
||||
var images = core.splitImage(core.material.images['icons']);
|
||||
for (var key in core.statusBar.icons) {
|
||||
if (typeof core.statusBar.icons[key] == 'number') {
|
||||
core.statusBar.icons[key] = images[core.statusBar.icons[key]];
|
||||
if (core.statusBar.image[key] != null)
|
||||
core.statusBar.image[key].src = core.statusBar.icons[key].src;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loader.prototype._loadExtraImages = function (callback) {
|
||||
// ------ 加载使用的图片 ------ //
|
||||
|
||||
loader.prototype._loadExtraImages_sync = function (callback) {
|
||||
core.material.images.images = {};
|
||||
|
||||
var images = core.clone(core.images);
|
||||
|
||||
this._setStartLoadTipText("正在加载图片文件...");
|
||||
if (main.useCompress) {
|
||||
// Check .gif
|
||||
var gifs = images.filter(function (name) {
|
||||
return name.toLowerCase().endsWith('.gif');
|
||||
});
|
||||
images = images.filter(function (name) {
|
||||
return !name.toLowerCase().endsWith('.gif');
|
||||
});
|
||||
|
||||
this.loadImagesFromZip('project/images/images.h5data', images, core.material.images.images, callback);
|
||||
gifs.forEach(function (gif) {
|
||||
this.loadImage("images", gif, function (id, image) {
|
||||
if (image != null) {
|
||||
core.material.images.images[gif] = image;
|
||||
}
|
||||
});
|
||||
}, this);
|
||||
} else {
|
||||
this.loadImages("images", images, core.material.images.images, callback);
|
||||
}
|
||||
core.loadImages("images", core.images, core.material.images.images, callback);
|
||||
}
|
||||
|
||||
loader.prototype._loadAutotiles = function (callback) {
|
||||
loader.prototype._loadExtraImages_async = function (onprogress, onfinished) {
|
||||
core.material.images.images = {};
|
||||
var images = core.images;
|
||||
|
||||
// Check .gif
|
||||
var gifs = images.filter(function (name) {
|
||||
return name.toLowerCase().endsWith('.gif');
|
||||
});
|
||||
images = images.filter(function (name) {
|
||||
return !name.toLowerCase().endsWith('.gif');
|
||||
});
|
||||
|
||||
this.loadImagesFromZip('project/images/images.h5data', images, core.material.images.images, onprogress, onfinished);
|
||||
// gif没有被压缩在zip中,延迟加载...
|
||||
gifs.forEach(function (gif) {
|
||||
this.loadImage("images", gif, function (id, image) {
|
||||
if (image != null) {
|
||||
core.material.images.images[gif] = image;
|
||||
}
|
||||
});
|
||||
}, this);
|
||||
}
|
||||
|
||||
// ------ 加载自动元件 ------ //
|
||||
|
||||
loader.prototype._loadAutotiles_sync = function (callback) {
|
||||
core.material.images.autotile = {};
|
||||
var keys = Object.keys(core.material.icons.autotile);
|
||||
var autotiles = {};
|
||||
var _callback = function () {
|
||||
keys.forEach(function (v) {
|
||||
core.material.images.autotile[v] = autotiles[v];
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
core.maps._makeAutotileEdges();
|
||||
});
|
||||
|
||||
callback();
|
||||
}
|
||||
this._setStartLoadTipText("正在加载自动元件...");
|
||||
if (main.useCompress) {
|
||||
this.loadImagesFromZip('project/autotiles/autotiles.h5data', keys, autotiles, _callback);
|
||||
} else {
|
||||
this.loadImages("autotiles", keys, autotiles, _callback);
|
||||
this.loadImages("autotiles", keys, autotiles, function () {
|
||||
core.loader._loadAutotiles_afterLoad(keys, autotiles);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype._loadAutotiles_async = function (onprogress, onfinished) {
|
||||
core.material.images.autotile = {};
|
||||
var keys = Object.keys(core.material.icons.autotile);
|
||||
var autotiles = {};
|
||||
|
||||
this.loadImagesFromZip('project/autotiles/autotiles.h5data', keys, autotiles, onprogress, function () {
|
||||
core.loader._loadAutotiles_afterLoad(keys, autotiles);
|
||||
onfinished();
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype._loadAutotiles_afterLoad = function (keys, autotiles) {
|
||||
// autotile需要保证顺序
|
||||
keys.forEach(function (v) {
|
||||
core.material.images.autotile[v] = autotiles[v];
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
core.maps._makeAutotileEdges();
|
||||
});
|
||||
}
|
||||
|
||||
// ------ 加载额外素材 ------ //
|
||||
|
||||
loader.prototype._loadTilesets_sync = function (callback) {
|
||||
core.material.images.tilesets = {};
|
||||
this._setStartLoadTipText("正在加载额外素材...");
|
||||
this.loadImages("tilesets", core.tilesets, core.material.images.tilesets, function () {
|
||||
core.loader._loadTilesets_afterLoad();
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype._loadTilesets_async = function (onprogress, onfinished) {
|
||||
core.material.images.tilesets = {};
|
||||
this.loadImagesFromZip('project/tilesets/tilesets.h5data', core.tilesets, core.material.images.tilesets, onprogress, function () {
|
||||
core.loader._loadTilesets_afterLoad();
|
||||
onfinished();
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype._loadTilesets_afterLoad = function () {
|
||||
// 检查宽高是32倍数,如果出错在控制台报错
|
||||
for (var imgName in core.material.images.tilesets) {
|
||||
var img = core.material.images.tilesets[imgName];
|
||||
if (img.width % 32 != 0 || img.height % 32 != 0) {
|
||||
console.warn("警告!" + imgName + "的宽或高不是32的倍数!");
|
||||
}
|
||||
if (img.width * img.height > 32 * 32 * 3000) {
|
||||
console.warn("警告!" + imgName + "上的图块素材个数大于3000!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loader.prototype._loadTilesets = function (callback) {
|
||||
core.material.images.tilesets = {};
|
||||
core.tilesets = core.tilesets || [];
|
||||
var _callback = function () {
|
||||
// 检查宽高是32倍数,如果出错在控制台报错
|
||||
for (var imgName in core.material.images.tilesets) {
|
||||
var img = core.material.images.tilesets[imgName];
|
||||
if (img.width % 32 != 0 || img.height % 32 != 0) {
|
||||
console.warn("警告!" + imgName + "的宽或高不是32的倍数!");
|
||||
}
|
||||
if (img.width * img.height > 32 * 32 * 3000) {
|
||||
console.warn("警告!" + imgName + "上的图块素材个数大于3000!");
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}
|
||||
this._setStartLoadTipText("正在加载额外素材...");
|
||||
if (main.useCompress) {
|
||||
this.loadImagesFromZip('project/tilesets/tilesets.h5data', core.tilesets, core.material.images.tilesets, _callback);
|
||||
} else {
|
||||
this.loadImages("tilesets", core.tilesets, core.material.images.tilesets, _callback);
|
||||
}
|
||||
}
|
||||
// ------ 实际加载一系列图片 ------ //
|
||||
|
||||
loader.prototype.loadImages = function (dir, names, toSave, callback) {
|
||||
if (!names || names.length == 0) {
|
||||
@ -159,37 +243,6 @@ loader.prototype.loadImages = function (dir, names, toSave, callback) {
|
||||
}
|
||||
}
|
||||
|
||||
loader.prototype.loadImagesFromZip = function (url, names, toSave, callback) {
|
||||
if (!names || names.length == 0) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
|
||||
core.unzip(url + "?v=" + main.version, function (data) {
|
||||
var cnt = 1;
|
||||
names.forEach(function (name) {
|
||||
var imgName = name;
|
||||
if (imgName.indexOf('.') < 0) imgName += '.png';
|
||||
if (imgName in data) {
|
||||
var img = new Image();
|
||||
var url = URL.createObjectURL(data[imgName]);
|
||||
cnt++;
|
||||
img.onload = function () {
|
||||
cnt--;
|
||||
URL.revokeObjectURL(url);
|
||||
if (cnt == 0 && callback) callback();
|
||||
}
|
||||
img.src = url;
|
||||
toSave[name] = img;
|
||||
}
|
||||
});
|
||||
cnt--;
|
||||
if (cnt == 0 && callback) callback();
|
||||
}, null, false, function (percentage) {
|
||||
core.loader._setStartProgressVal(percentage * 100);
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype.loadImage = function (dir, imgName, callback) {
|
||||
try {
|
||||
var name = imgName;
|
||||
@ -211,28 +264,63 @@ loader.prototype.loadImage = function (dir, imgName, callback) {
|
||||
}
|
||||
}
|
||||
|
||||
loader.prototype._loadAnimates = function () {
|
||||
this._setStartLoadTipText("正在加载动画文件...");
|
||||
if (main.useCompress) {
|
||||
core.unzip('project/animates/animates.h5data?v=' + main.version, function (animates) {
|
||||
for (var name in animates) {
|
||||
if (name.endsWith(".animate")) {
|
||||
var t = name.substring(0, name.length - 8);
|
||||
if (core.animates.indexOf(t) >= 0)
|
||||
core.loader._loadAnimate(t, animates[name]);
|
||||
}
|
||||
}
|
||||
}, null, true);
|
||||
} else {
|
||||
core.animates.forEach(function (t) {
|
||||
core.http('GET', 'project/animates/' + t + ".animate?v=" + main.version, null, function (content) {
|
||||
core.loader._loadAnimate(t, content);
|
||||
}, function (e) {
|
||||
main.log(e);
|
||||
core.material.animates[t] = null;
|
||||
}, "text/plain; charset=x-user-defined")
|
||||
})
|
||||
// ------ 从zip中加载一系列图片 ------ //
|
||||
|
||||
loader.prototype.loadImagesFromZip = function (url, names, toSave, onprogress, onfinished) {
|
||||
if (!names || names.length == 0) {
|
||||
if (onfinished) onfinished();
|
||||
return;
|
||||
}
|
||||
|
||||
core.unzip(url + "?v=" + main.version, function (data) {
|
||||
var cnt = 1;
|
||||
names.forEach(function (name) {
|
||||
var imgName = name;
|
||||
if (imgName.indexOf('.') < 0) imgName += '.png';
|
||||
if (imgName in data) {
|
||||
var img = new Image();
|
||||
var url = URL.createObjectURL(data[imgName]);
|
||||
cnt++;
|
||||
img.onload = function () {
|
||||
cnt--;
|
||||
URL.revokeObjectURL(url);
|
||||
if (cnt == 0 && onfinished) onfinished();
|
||||
}
|
||||
img.src = url;
|
||||
toSave[name] = img;
|
||||
}
|
||||
});
|
||||
cnt--;
|
||||
if (cnt == 0 && onfinished) onfinished();
|
||||
}, null, false, onprogress);
|
||||
}
|
||||
|
||||
// ------ 加载动画文件 ------ //
|
||||
|
||||
loader.prototype._loadAnimates_sync = function () {
|
||||
this._setStartLoadTipText("正在加载动画文件...");
|
||||
|
||||
core.animates.forEach(function (t) {
|
||||
core.http('GET', 'project/animates/' + t + ".animate?v=" + main.version, null, function (content) {
|
||||
core.loader._loadAnimate(t, content);
|
||||
}, function (e) {
|
||||
main.log(e);
|
||||
core.material.animates[t] = null;
|
||||
}, "text/plain; charset=x-user-defined")
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype._loadAnimates_async = function (onprogress, onfinished) {
|
||||
core.unzip('project/animates/animates.h5data?v=' + main.version, function (animates) {
|
||||
for (var name in animates) {
|
||||
if (name.endsWith(".animate")) {
|
||||
var t = name.substring(0, name.length - 8);
|
||||
if (core.animates.indexOf(t) >= 0)
|
||||
core.loader._loadAnimate(t, animates[name]);
|
||||
}
|
||||
}
|
||||
onfinished();
|
||||
}, null, true, onprogress);
|
||||
}
|
||||
|
||||
loader.prototype._loadAnimate = function (name, content) {
|
||||
@ -283,26 +371,36 @@ loader.prototype._loadAnimate = function (name, content) {
|
||||
}
|
||||
}
|
||||
|
||||
////// 加载音频 //////
|
||||
loader.prototype._loadMusic = function () {
|
||||
// ------ 加载音乐和音效 ------ //
|
||||
|
||||
loader.prototype._loadMusic_sync = function () {
|
||||
this._setStartLoadTipText("正在加载音效文件...");
|
||||
core.bgms.forEach(function (t) {
|
||||
core.loader.loadOneMusic(t);
|
||||
});
|
||||
core.sounds.forEach(function (t) {
|
||||
core.loader.loadOneSound(t);
|
||||
});
|
||||
// 直接开始播放
|
||||
core.playBgm(main.startBgm);
|
||||
}
|
||||
|
||||
this._setStartLoadTipText("正在加载音效文件...");
|
||||
if (main.useCompress && core.musicStatus.audioContext) {
|
||||
core.unzip('project/sounds/sounds.h5data?v=' + main.version, function (data) {
|
||||
loader.prototype._loadMusic_async = function (onprogress, onfinished) {
|
||||
core.bgms.forEach(function (t) {
|
||||
core.loader.loadOneMusic(t);
|
||||
});
|
||||
core.unzip('project/sounds/sounds.h5data?v=' + main.version, function (data) {
|
||||
// 延迟解析
|
||||
setTimeout(function () {
|
||||
for (var name in data) {
|
||||
if (core.sounds.indexOf(name) >= 0) {
|
||||
core.loader._loadOneSound_decodeData(name, data[name]);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
core.sounds.forEach(function (t) {
|
||||
core.loader.loadOneSound(t);
|
||||
});
|
||||
}
|
||||
onfinished();
|
||||
}, null, false, onprogress);
|
||||
|
||||
// 直接开始播放
|
||||
core.playBgm(main.startBgm);
|
||||
}
|
||||
@ -317,19 +415,12 @@ loader.prototype.loadOneMusic = function (name) {
|
||||
}
|
||||
|
||||
loader.prototype.loadOneSound = function (name) {
|
||||
if (core.musicStatus.audioContext != null) {
|
||||
core.http('GET', 'project/sounds/' + name + "?v=" + main.version, null, function (data) {
|
||||
core.loader._loadOneSound_decodeData(name, data);
|
||||
}, function (e) {
|
||||
main.log(e);
|
||||
core.material.sounds[name] = null;
|
||||
}, null, 'arraybuffer');
|
||||
}
|
||||
else {
|
||||
var music = new Audio();
|
||||
music.src = 'project/sounds/' + name;
|
||||
core.material.sounds[name] = music;
|
||||
}
|
||||
core.http('GET', 'project/sounds/' + name + "?v=" + main.version, null, function (data) {
|
||||
core.loader._loadOneSound_decodeData(name, data);
|
||||
}, function (e) {
|
||||
main.log(e);
|
||||
core.material.sounds[name] = null;
|
||||
}, null, 'arraybuffer');
|
||||
}
|
||||
|
||||
loader.prototype._loadOneSound_decodeData = function (name, data) {
|
||||
|
||||
303
libs/maps.js
@ -22,6 +22,17 @@ maps.prototype._setFloorSize = function (floorId) {
|
||||
core.floors[floorId].height = core.floors[floorId].height || core.__SIZE__;
|
||||
}
|
||||
|
||||
maps.prototype._resetFloorImages = function () {
|
||||
for (var floorId in core.status.maps) {
|
||||
(core.status.maps[floorId].images || []).forEach(function (one) {
|
||||
var flag = "__floorImg__" + floorId + "_" + one.x + "_" + one.y;
|
||||
if (core.getFlag(flag) == null) {
|
||||
if (one.disabled) core.setFlag(flag, true);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// ------ 加载地图与地图的存档读档(压缩与解压缩) ------ //
|
||||
|
||||
////// 加载某个楼层(从剧本或存档中) //////
|
||||
@ -42,12 +53,27 @@ maps.prototype.loadFloor = function (floorId, map) {
|
||||
if (notCopy.indexOf(name) == -1 && map[name] != null)
|
||||
content[name] = core.clone(map[name]);
|
||||
}
|
||||
map = this.decompressMap(map.map, floorId);
|
||||
// 事件处理
|
||||
content['blocks'] = this._mapIntoBlocks(map, floor, floorId);
|
||||
content.map = map.map;
|
||||
if (main.mode == 'editor') {
|
||||
this.extractBlocks(content);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
/// 根据需求解析出blocks
|
||||
maps.prototype.extractBlocks = function (map) {
|
||||
map = map || core.status.floorId;
|
||||
if (typeof map == 'string') map = (core.status.maps||{})[map];
|
||||
if (!map) return;
|
||||
if (map.blocks) return;
|
||||
if (map.deleted) {
|
||||
map.blocks = [];
|
||||
return;
|
||||
}
|
||||
var floorId = map.floorId;
|
||||
map.blocks = this._mapIntoBlocks(this.decompressMap(map.map, floorId), core.floors[floorId], floorId);
|
||||
}
|
||||
|
||||
maps.prototype._mapIntoBlocks = function (map, floor, floorId) {
|
||||
var blocks = [];
|
||||
var mw = core.floors[floorId].width;
|
||||
@ -64,6 +90,7 @@ maps.prototype._mapIntoBlocks = function (map, floor, floorId) {
|
||||
|
||||
////// 从ID获得数字 //////
|
||||
maps.prototype.getNumberById = function (id) {
|
||||
id = this.getIdOfThis(id);
|
||||
core.status.id2number = core.status.id2number || {};
|
||||
if (core.status.id2number[id] != null) return core.status.id2number[id];
|
||||
return core.status.id2number[id] = this._getNumberById(id);
|
||||
@ -94,6 +121,13 @@ maps.prototype.getBlockById = function (id) {
|
||||
return this.getBlockByNumber(this.getNumberById(id));
|
||||
}
|
||||
|
||||
maps.prototype.getIdOfThis = function (id) {
|
||||
if (id != 'this') return id;
|
||||
if (core.status.event.id != 'action') return id;
|
||||
if (!core.status.event.data || core.status.event.data.x == null || core.status.event.data.y == null) return id;
|
||||
return core.getBlockId(core.status.event.data.x, core.status.event.data.y) || id;
|
||||
}
|
||||
|
||||
////// 数字和ID的对应关系 //////
|
||||
maps.prototype.initBlock = function (x, y, id, addInfo, eventFloor) {
|
||||
var disable = null;
|
||||
@ -137,7 +171,7 @@ maps.prototype._addInfo = function (block) {
|
||||
block.event.trigger = 'getItem';
|
||||
}
|
||||
if (block.event.animate == null) {
|
||||
block.event.animate = core.icons._getAnimateFrames(block.event.cls, false);
|
||||
block.event.animate = core.icons._getAnimateFrames(block.event.cls);
|
||||
}
|
||||
block.event.height = 32;
|
||||
if (block.event.cls == 'enemy48' || block.event.cls == 'npc48')
|
||||
@ -266,17 +300,16 @@ maps.prototype.saveMap = function (floorId) {
|
||||
return map;
|
||||
}
|
||||
// 砍层状态:直接返回
|
||||
if (main.mode == 'play' && (flags.__removed__ || []).indexOf(floorId) >= 0) {
|
||||
return { canFlyTo: false, cannotViewMap: true };
|
||||
if ((flags.__removed__ || []).indexOf(floorId) >= 0) {
|
||||
return { deleted: true, canFlyTo: false, cannotViewMap: true };
|
||||
}
|
||||
|
||||
var map = maps[floorId], floor = core.floors[floorId];
|
||||
var blocks = this._getMapArrayFromBlocks(map.blocks, floor.width, floor.height, true);
|
||||
if (main.mode == 'editor') return blocks;
|
||||
|
||||
var thisFloor = this._compressFloorData(map, floor);
|
||||
var mapArr = this.compressMap(blocks, floorId);
|
||||
if (mapArr != null) thisFloor.map = mapArr;
|
||||
var map = maps[floorId];
|
||||
var thisFloor = this._compressFloorData(map, core.floors[floorId]);
|
||||
if (map.blocks) {
|
||||
var mapArr = this.compressMap(this._getMapArrayFromBlocks(map.blocks, map.width, map.height, true), floorId);
|
||||
if (mapArr != null) thisFloor.map = mapArr;
|
||||
}
|
||||
return thisFloor;
|
||||
}
|
||||
|
||||
@ -305,23 +338,6 @@ maps.prototype.loadMap = function (data, floorId) {
|
||||
return this.loadFloor(floorId, data[floorId]);
|
||||
}
|
||||
|
||||
////// 删除地图,不计入存档 //////
|
||||
maps.prototype.removeMaps = function (fromId, toId) {
|
||||
if (!core.isPlaying()) return;
|
||||
toId = toId || fromId;
|
||||
var fromIndex = core.floorIds.indexOf(fromId),
|
||||
toIndex = core.floorIds.indexOf(toId);
|
||||
if (toIndex < 0) toIndex = core.floorIds.length - 1;
|
||||
flags.__removed__ = flags.__removed__ || [];
|
||||
for (var i = fromIndex; i <= toIndex; ++i) {
|
||||
var floorId = core.floorIds[i];
|
||||
delete flags.__visited__[floorId];
|
||||
flags.__removed__.push(floorId);
|
||||
core.status.maps[floorId].canFlyTo = false;
|
||||
core.status.maps[floorId].cannotViewMap = true;
|
||||
}
|
||||
}
|
||||
|
||||
////// 更改地图画布的尺寸
|
||||
maps.prototype.resizeMap = function (floorId) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
@ -345,18 +361,12 @@ maps.prototype.resizeMap = function (floorId) {
|
||||
////// 将当前地图重新变成二维数组形式 //////
|
||||
maps.prototype.getMapArray = function (floorId, showDisable) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
return this._getMapArrayFromBlocks(core.status.maps[floorId].blocks,
|
||||
core.floors[floorId].width, core.floors[floorId].height, showDisable);
|
||||
var map = core.status.maps[floorId];
|
||||
if (!map.blocks) return map.map;
|
||||
return this._getMapArrayFromBlocks(map.blocks, map.width, map.height, showDisable);
|
||||
}
|
||||
|
||||
maps.prototype._getMapArrayFromBlocks = function (blockArray, width, height, showDisable) {
|
||||
if (typeof blockArray == 'string') {
|
||||
var floorId = blockArray;
|
||||
blockArray = core.status.maps[floorId].blocks;
|
||||
width = core.floors[floorId].width;
|
||||
height = core.floors[floorId].height;
|
||||
}
|
||||
|
||||
var blocks = [];
|
||||
var allzero = [];
|
||||
for (var y = 0; y < width; y++) allzero.push(0);
|
||||
@ -380,6 +390,7 @@ maps.prototype._getMapArrayFromBlocks = function (blockArray, width, height, sho
|
||||
maps.prototype.getMapBlocksObj = function (floorId, showDisable) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
var obj = {};
|
||||
core.extractBlocks(floorId);
|
||||
core.status.maps[floorId].blocks.forEach(function (block) {
|
||||
if (!block.disable || showDisable)
|
||||
obj[block.x + "," + block.y] = block;
|
||||
@ -564,8 +575,6 @@ maps.prototype._canMoveDirectly_checkGlobal = function () {
|
||||
if (core.status.thisMap.cannotMoveDirectly) return false;
|
||||
// flag:cannotMoveDirectly为true:不能
|
||||
if (core.hasFlag('cannotMoveDirectly')) return false;
|
||||
// 中毒状态:不能
|
||||
if (core.hasFlag('poison')) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -688,7 +697,7 @@ maps.prototype._automaticRoute_deepAdd = function (x, y) {
|
||||
// 绕过路障
|
||||
if (id.endsWith("Net")) deepAdd += 100;
|
||||
// 绕过血瓶和绿宝石
|
||||
if (core.hasFlag('__potionNoRouting__') && (id.endsWith("Potion") || id == 'greenJewel')) deepAdd += 100;
|
||||
if (core.hasFlag('__potionNoRouting__') && (id.endsWith("Potion") || id == 'greenGem')) deepAdd += 100;
|
||||
// 绕过传送点
|
||||
// if (block.block.event.trigger == 'changeFloor') deepAdd+=10;
|
||||
}
|
||||
@ -771,6 +780,7 @@ maps.prototype.drawMap = function (floorId, callback) {
|
||||
core.clearMap('all');
|
||||
this.generateGroundPattern(floorId);
|
||||
core.status.floorId = floorId;
|
||||
core.extractBlocks(floorId);
|
||||
core.status.thisMap = core.status.maps[floorId];
|
||||
|
||||
this._drawMap_drawAll();
|
||||
@ -828,7 +838,7 @@ maps.prototype._drawBg_drawBackground = function (floorId, ctx) {
|
||||
if (groundInfo != null) {
|
||||
for (var i = 0; i < width; i++) {
|
||||
for (var j = 0; j < height; j++) {
|
||||
ctx.drawImage(groundInfo.image, 32 * groundInfo.posX, groundInfo.height * groundInfo.posY, 32, 32, i * 32, j * 32, 32, 32);
|
||||
core.drawImage(ctx, groundInfo.image, 32 * groundInfo.posX, groundInfo.height * groundInfo.posY, 32, 32, i * 32, j * 32, 32, 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -837,6 +847,7 @@ maps.prototype._drawBg_drawBackground = function (floorId, ctx) {
|
||||
////// 绘制事件层 //////
|
||||
maps.prototype.drawEvents = function (floorId, blocks, ctx) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
core.extractBlocks(floorId);
|
||||
if (!blocks) blocks = core.status.maps[floorId].blocks;
|
||||
var arr = this._getMapArrayFromBlocks(blocks, core.floors[floorId].width, core.floors[floorId].height);
|
||||
var onMap = ctx == null;
|
||||
@ -909,36 +920,25 @@ maps.prototype._drawFloorImages = function (floorId, ctx, name, images, currStat
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!images) images = this._getFloorImages(floorId);
|
||||
var redraw = currStatus != null;
|
||||
images.forEach(function (t) {
|
||||
if (typeof t == 'string') t = [0, 0, t];
|
||||
var dx = parseInt(t[0]), dy = parseInt(t[1]), imageName = t[2], frame = core.clamp(parseInt(t[4]), 1, 8);
|
||||
imageName = core.getMappedName(imageName);
|
||||
var image = core.material.images.images[imageName];
|
||||
images.forEach(function (one) {
|
||||
var image = core.material.images.images[core.getMappedName(one.name)];
|
||||
var frame = one.frame || 1;
|
||||
if (!image) return;
|
||||
var flag = "__floorImg__" + floorId + "_" + one.x + "_" + one.y;
|
||||
if (core.hasFlag(flag)) return;
|
||||
if (redraw && frame == 1) return; // 不重绘
|
||||
|
||||
if (core.isset(dx) && core.isset(dy) && image &&
|
||||
!core.hasFlag("__floorImg__" + floorId + "_" + dx + "_" + dy)) {
|
||||
var width = parseInt(image.width / frame), offsetX = (currStatus || 0) % frame * width;
|
||||
if (/.*\.gif/i.test(imageName) && main.mode == 'play') {
|
||||
if (redraw) return; // 忽略gif
|
||||
this._drawFloorImages_gif(image, dx, dy);
|
||||
return;
|
||||
}
|
||||
core.maps._drawFloorImage(ctx, name, t[3], image, offsetX, width, dx, dy, redraw);
|
||||
if (/.*\.gif/i.test(one.name)) {
|
||||
if (redraw) return;
|
||||
this._drawFloorImages_gif(image, one.x, one.y);
|
||||
return;
|
||||
}
|
||||
});
|
||||
this._drawFloorImage(ctx, name, one, image, currStatus);
|
||||
}, this);
|
||||
}
|
||||
|
||||
maps.prototype._getFloorImages = function (floorId) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
var images = [];
|
||||
if ((core.status.maps || core.floors)[floorId].images) {
|
||||
images = (core.status.maps || core.floors)[floorId].images;
|
||||
if (typeof images == 'string') {
|
||||
images = [[0, 0, images]];
|
||||
}
|
||||
}
|
||||
return images;
|
||||
return ((core.status.maps || core.floors)[floorId || core.status.floorId] || {}).images || [];
|
||||
}
|
||||
|
||||
maps.prototype._drawFloorImages_gif = function (image, dx, dy) {
|
||||
@ -954,30 +954,26 @@ maps.prototype._drawFloorImages_gif = function (image, dx, dy) {
|
||||
return;
|
||||
}
|
||||
|
||||
maps.prototype._drawFloorImage = function (ctx, name, type, image, offsetX, width, dx, dy, redraw) {
|
||||
maps.prototype._drawFloorImage = function (ctx, name, one, image, currStatus) {
|
||||
var height = image.height;
|
||||
var _draw = function () {
|
||||
if (redraw) core.clearMap(ctx, dx, dy, width, height);
|
||||
core.drawImage(ctx, image, offsetX, 0, width, height, dx, dy, width, height);
|
||||
}
|
||||
if (!type) {
|
||||
if (name != 'bg') return;
|
||||
return _draw();
|
||||
}
|
||||
if (type == 1) {
|
||||
if (name != 'fg') return;
|
||||
return _draw();
|
||||
}
|
||||
if (type == 2) {
|
||||
var imageName = one.name + (one.reverse||'');
|
||||
var width = parseInt((one.w == null ? image.width : one.w) / (one.frame || 1));
|
||||
var height = one.h == null ? image.height : one.h;
|
||||
var sx = (one.sx || 0) + (currStatus || 0) % (one.frame || 1) * width;
|
||||
var sy = one.sy || 0;
|
||||
|
||||
if (one.canvas != 'auto' && one.canvas != name) return;
|
||||
if (one.canvas != 'auto') {
|
||||
if (currStatus != null) core.clearMap(ctx, one.x, one.y, width, height);
|
||||
core.drawImage(ctx, imageName, sx, sy, width, height, one.x, one.y, width, height);
|
||||
} else {
|
||||
if (name == 'bg') {
|
||||
if (redraw) core.clearMap(ctx, dx, dy + height - 32, width, 32);
|
||||
core.drawImage('bg', image, offsetX, height - 32, width, 32, dx, dy + height - 32, width, 32);
|
||||
if (currStatus != null) core.clearMap(ctx, one.x, one.y + height - 32, width, 32);
|
||||
core.drawImage(ctx, imageName, sx, sy + height - 32, width, 32, one.x, one.y+height - 32, width, 32);
|
||||
} else if (name == 'fg') {
|
||||
if (currStatus != null) core.clearMap(ctx, one.x, one.y, width, height - 32);
|
||||
core.drawImage(ctx, imageName, sx, sy, width, height - 32, one.x, one.y, width, height - 32);
|
||||
}
|
||||
else if (name == 'fg') {
|
||||
if (redraw) core.clearMap(ctx, dx, dy, width, height - 32);
|
||||
core.drawImage('fg', image, offsetX, 0, width, height - 32, dx, dy, width, height - 32);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1048,7 +1044,7 @@ maps.prototype._drawAutotile_render = function(canvas, x, y, size, autotile, sta
|
||||
];
|
||||
var data = indexData[index];
|
||||
if(index>=16){ // 拐角直接绘制
|
||||
canvas.drawImage(autotile, data[0][0], data[0][1], data[0][2], data[0][3], data[0][4], data[0][5], size/2, size/2);
|
||||
core.drawImage(canvas, autotile, data[0][0], data[0][1], data[0][2], data[0][3], data[0][4], data[0][5], size/2, size/2);
|
||||
}else{ // 非拐角要根据是否已经绘制进行切分后绘制
|
||||
this._drawAutotile_renderCut(canvas, autotile, x, y, size, data, done);
|
||||
}
|
||||
@ -1089,7 +1085,7 @@ maps.prototype._drawAutotile_renderCut = function(canvas, autotile, x, y, size,
|
||||
}
|
||||
for(var i = 0; i<4; i++){
|
||||
var dt = drawData[i];if(!dt)continue;
|
||||
canvas.drawImage(autotile, dt[0], dt[1], 16, 16, x + (i % 2) * size / 2, y + parseInt(i / 2) * size / 2, size/2, size/2);
|
||||
core.drawImage(canvas, autotile, dt[0], dt[1], 16, 16, x + (i % 2) * size / 2, y + parseInt(i / 2) * size / 2, size/2, size/2);
|
||||
};
|
||||
}
|
||||
|
||||
@ -1099,7 +1095,7 @@ maps.prototype._drawAutotile_drawBlockByIndex = function (ctx, dx, dy, autotileI
|
||||
var sx = 16 * ((index - 1) % 6), sy = 16 * (~~((index - 1) / 6));
|
||||
status = status || 0;
|
||||
status %= parseInt(autotileImg.width / 96);
|
||||
ctx.drawImage(autotileImg, sx + 96 * status, sy, 16, 16, dx, dy, size / 2, size / 2);
|
||||
core.drawImage(ctx, autotileImg, sx + 96 * status, sy, 16, 16, dx, dy, size / 2, size / 2);
|
||||
}
|
||||
|
||||
maps.prototype._drawAutotile_getAutotileAroundId = function (currId, x, y, mapArr) {
|
||||
@ -1170,16 +1166,16 @@ maps.prototype._makeAutotileEdges = function () {
|
||||
var n = core.maps.getNumberById(t);
|
||||
core.material.autotileEdges[n] = [n];
|
||||
|
||||
ctx.clearRect(0, 0, 32, 32);
|
||||
ctx.drawImage(core.material.images.autotile[t], 0, 0, 32, 32, 0, 0, 32, 32);
|
||||
core.clearMap(ctx, 0, 0, 32, 32);
|
||||
core.drawImage(ctx, core.material.images.autotile[t], 0, 0, 32, 32, 0, 0, 32, 32);
|
||||
var data = canvas.toDataURL("image/png");
|
||||
|
||||
autotileIds.forEach(function (t2) {
|
||||
if (t == t2) return;
|
||||
var n2 = core.maps.getNumberById(t2);
|
||||
|
||||
ctx.clearRect(0, 0, 32, 32);
|
||||
ctx.drawImage(core.material.images.autotile[t2], 32, 0, 32, 32, 0, 0, 32, 32);
|
||||
core.clearMap(ctx, 0, 0, 32, 32);
|
||||
core.drawImage(ctx, core.material.images.autotile[t2], 32, 0, 32, 32, 0, 0, 32, 32);
|
||||
if (data == canvas.toDataURL("image/png")) {
|
||||
core.material.autotileEdges[n].push(n2);
|
||||
}
|
||||
@ -1204,6 +1200,7 @@ maps.prototype.drawThumbnail = function (floorId, blocks, options, toDraw) {
|
||||
}
|
||||
|
||||
maps.prototype._drawThumbnail_drawTempCanvas = function (floorId, blocks, options) {
|
||||
core.extractBlocks(floorId);
|
||||
blocks = blocks || core.status.maps[floorId].blocks;
|
||||
options = options || {}
|
||||
|
||||
@ -1238,11 +1235,11 @@ maps.prototype._drawThumbnail_realDrawTempCanvas = function (floorId, blocks, op
|
||||
this.drawEvents(floorId, blocks, tempCanvas);
|
||||
// 缩略图:勇士
|
||||
if (options.heroLoc) {
|
||||
options.heroIcon = options.heroIcon || core.status.hero.image;
|
||||
options.heroIcon = options.heroIcon || core.status.hero.image || 'hero.png';
|
||||
options.heroIcon = core.getMappedName(options.heroIcon);
|
||||
var icon = core.material.icons.hero[options.heroLoc.direction];
|
||||
var height = core.material.images.images[options.heroIcon].height / 4;
|
||||
tempCanvas.drawImage(core.material.images.images[options.heroIcon], icon.stop * 32, icon.loc * height, 32, height,
|
||||
core.drawImage(tempCanvas, core.material.images.images[options.heroIcon], icon.stop * 32, icon.loc * height, 32, height,
|
||||
32 * options.heroLoc.x, 32 * options.heroLoc.y + 32 - height, 32, height);
|
||||
}
|
||||
// 缩略图:前景
|
||||
@ -1272,21 +1269,21 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, toDraw) {
|
||||
var side = (size - realWidth) / 2;
|
||||
core.fillRect(ctx, x, y, side, realHeight, '#000000');
|
||||
core.fillRect(ctx, x + size - side, y, side, realHeight);
|
||||
ctx.drawImage(tempCanvas.canvas, 0, 0, tempWidth, tempHeight, x + side, y, realWidth, realHeight);
|
||||
core.drawImage(ctx, tempCanvas.canvas, 0, 0, tempWidth, tempHeight, x + side, y, realWidth, realHeight);
|
||||
}
|
||||
else {
|
||||
var realWidth = size, realHeight = realWidth * tempHeight / tempWidth;
|
||||
var side = (size - realHeight) / 2;
|
||||
core.fillRect(ctx, x, y, realWidth, side, '#000000');
|
||||
core.fillRect(ctx, x, y + size - side, realWidth, side);
|
||||
ctx.drawImage(tempCanvas.canvas, 0, 0, tempWidth, tempHeight, x, y + side, realWidth, realHeight);
|
||||
core.drawImage(ctx, tempCanvas.canvas, 0, 0, tempWidth, tempHeight, x, y + side, realWidth, realHeight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 只绘制可见窗口
|
||||
var offsetX = core.clamp(centerX - core.__HALF_SIZE__, 0, width - core.__SIZE__),
|
||||
offsetY = core.clamp(centerY - core.__HALF_SIZE__, 0, height - core.__SIZE__);
|
||||
ctx.drawImage(tempCanvas.canvas, offsetX * 32, offsetY * 32, core.__PIXELS__, core.__PIXELS__, x, y, size, size);
|
||||
core.drawImage(ctx, tempCanvas.canvas, offsetX * 32, offsetY * 32, core.__PIXELS__, core.__PIXELS__, x, y, size, size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1340,6 +1337,7 @@ maps.prototype.enemyExists = function (x, y, id, floorId) {
|
||||
maps.prototype.getBlock = function (x, y, floorId, showDisable) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!floorId) return null;
|
||||
core.extractBlocks(floorId);
|
||||
var blocks = core.status.maps[floorId].blocks;
|
||||
for (var n = 0; n < blocks.length; n++) {
|
||||
if (blocks[n].x == x && blocks[n].y == y) {
|
||||
@ -1417,6 +1415,7 @@ maps.prototype.searchBlock = function (id, floorId, showDisable) {
|
||||
});
|
||||
return result;
|
||||
}
|
||||
core.extractBlocks(floorId);
|
||||
for (var i = 0; i < core.status.maps[floorId].blocks.length; ++i) {
|
||||
var block = core.status.maps[floorId].blocks[i];
|
||||
if ((showDisable || !block.disable) && (core.matchWildcard(id, block.event.id) || core.matchRegex(id, block.event.id))) {
|
||||
@ -1472,7 +1471,7 @@ maps.prototype.hideBlock = function (x, y, floorId) {
|
||||
maps.prototype.hideBlockByIndex = function (index, floorId) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!floorId) return;
|
||||
|
||||
core.extractBlocks(floorId);
|
||||
var blocks = core.status.maps[floorId].blocks, block = blocks[index];
|
||||
block.disable = true;
|
||||
}
|
||||
@ -1512,7 +1511,7 @@ maps.prototype.removeBlock = function (x, y, floorId) {
|
||||
maps.prototype.removeBlockByIndex = function (index, floorId) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!floorId) return;
|
||||
|
||||
core.extractBlocks(floorId);
|
||||
var blocks = core.status.maps[floorId].blocks, block = blocks[index];
|
||||
blocks.splice(index, 1);
|
||||
}
|
||||
@ -1638,6 +1637,103 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
|
||||
}
|
||||
}
|
||||
|
||||
maps.prototype.animateSetBlock = function (number, x, y, floorId, time, callback) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
time = time || 0;
|
||||
if (floorId != core.status.floorId || time == 0) {
|
||||
// 不在当前楼层,直接忽略
|
||||
this.setBlock(number, x, y, floorId);
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
if (typeof number == 'string') {
|
||||
if (/^\d+$/.test(number)) number = parseInt(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]);
|
||||
|
||||
// 如果原本是启用的
|
||||
if (originBlock != null && !originBlock.block.disable) {
|
||||
return this._animateSetBlock_originEnabled(block, number, x, y, floorId, time, callback);
|
||||
}
|
||||
|
||||
// 如果原本不存在
|
||||
if (originBlock == null) {
|
||||
return this._animateSetBlock_originNotExists(block, number, x, y, floorId, time, callback);
|
||||
}
|
||||
|
||||
// 如果原本存在且禁用;应当直接设置,没有动画
|
||||
if (originBlock != null && originBlock.block.disable) {
|
||||
return this._animateSetBlock_originDisabled(number, x, y, floorId, callback);
|
||||
}
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
maps.prototype._animateSetBlock_originEnabled = function (block, number, x, y, floorId, time, callback) {
|
||||
// 情况1:设置到0
|
||||
if (block.id == 0) {
|
||||
// 如果该点红点没有事件 - 直接删除
|
||||
if (!block.event.trigger) {
|
||||
return this.animateBlock([x, y], 'remove', time, callback);
|
||||
} else {
|
||||
// 如果该点红点有事件;则设置到0,但是需启用
|
||||
return this.animateBlock([x, y], 'hide', time, function () {
|
||||
core.setBlock(0, x, y, floorId);
|
||||
core.showBlock(x, y, floorId);
|
||||
if (callback) callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
// 情况2:设置到非0
|
||||
else {
|
||||
return this.animateBlock([x, y], 'hide', time / 2, function () {
|
||||
core.setBlock(number, x, y, floorId);
|
||||
core.animateBlock([x, y], 'show', time / 2, callback);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
maps.prototype._animateSetBlock_originNotExists = function (block, number, x, y, floorId, time, callback) {
|
||||
// 情况1:设置到0;没有动画效果
|
||||
if (block.id == 0) {
|
||||
core.setBlock(number, x, y, floorId);
|
||||
if (callback) callback();
|
||||
}
|
||||
else {
|
||||
// 情况2:设置到非0,有淡入动画
|
||||
core.setBlock(number, x, y, floorId);
|
||||
core.hideBlock(x, y, floorId);
|
||||
core.animateBlock([x, y], 'show', time, callback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
maps.prototype._animateSetBlock_originDisabled = function (number, x, y, floorId, callback) {
|
||||
core.setBlock(number, x, y, floorId);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
maps.prototype.animateSetBlocks = function (number, locs, floorId, time, callback) {
|
||||
if (!(locs instanceof Array)) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
if (typeof locs[0] == 'number' && typeof locs[1] == 'number')
|
||||
locs = [locs];
|
||||
|
||||
var count = locs.length;
|
||||
var _afterSet = function () {
|
||||
count--;
|
||||
if (count == 0) {
|
||||
if (callback) callback();
|
||||
}
|
||||
}
|
||||
locs.forEach(function (loc) {
|
||||
core.animateSetBlock(number, loc[0], loc[1], floorId, time, _afterSet);
|
||||
});
|
||||
}
|
||||
|
||||
////// 事件转向 //////
|
||||
maps.prototype.turnBlock = function (direction, x, y, floorId) {
|
||||
var id = core.getBlockId(x, y, floorId, true);
|
||||
@ -1668,6 +1764,7 @@ maps.prototype.replaceBlock = function (fromNumber, toNumber, floorId) {
|
||||
return;
|
||||
}
|
||||
var toBlock = this.getBlockByNumber(toNumber, true);
|
||||
core.extractBlocks(floorId);
|
||||
core.status.maps[floorId].blocks.forEach(function (block) {
|
||||
if (block.id == fromNumber) {
|
||||
block.id = toNumber;
|
||||
@ -1817,7 +1914,7 @@ maps.prototype.moveBlock = function (x, y, steps, time, keep, callback) {
|
||||
}
|
||||
|
||||
maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, callback) {
|
||||
var animateTotal = core.icons._getAnimateFrames(blockInfo.cls, true), animateTime = 0;
|
||||
var animateTotal = core.icons._getAnimateFrames(blockInfo.cls), animateTime = 0;
|
||||
var animate = window.setInterval(function () {
|
||||
if (blockInfo.cls != 'tileset') {
|
||||
animateTime += moveInfo.per_time;
|
||||
|
||||
29
libs/thirdparty/LICENSE.md
vendored
@ -229,35 +229,6 @@ localforage
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
mid
|
||||
============
|
||||
|
||||
Copyright (c) 2010, Matt Westcott & Ben Firshman
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* The names of its contributors may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
zip
|
||||
============
|
||||
|
||||
|
||||
701
libs/thirdparty/mid.js
vendored
@ -1,701 +0,0 @@
|
||||
var sampleRate = 44100; /* hard-coded in Flash player */
|
||||
|
||||
function AudioPlayer(context, generator, loop) {
|
||||
|
||||
// Uses Webkit Web Audio API if available
|
||||
sampleRate = context.sampleRate;
|
||||
|
||||
var channelCount = 2;
|
||||
var bufferSize = 4096*4; // Higher for less gitches, lower for less latency
|
||||
|
||||
var node = context.createScriptProcessor(bufferSize, 0, channelCount);
|
||||
|
||||
node.onaudioprocess = function(e) { process(e) };
|
||||
|
||||
function process(e) {
|
||||
if (generator.finished) {
|
||||
if (loop) {
|
||||
generator.reset();
|
||||
generator.finished = false;
|
||||
}
|
||||
else {
|
||||
node.disconnect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var dataLeft = e.outputBuffer.getChannelData(0);
|
||||
var dataRight = e.outputBuffer.getChannelData(1);
|
||||
|
||||
var generate = generator.generate(bufferSize);
|
||||
|
||||
for (var i = 0; i < bufferSize; ++i) {
|
||||
dataLeft[i] = generate[i*2];
|
||||
dataRight[i] = generate[i*2+1];
|
||||
}
|
||||
}
|
||||
|
||||
// start
|
||||
// node.connect(context.destination);
|
||||
|
||||
return {
|
||||
'play': function () {
|
||||
node.connect(context.destination);
|
||||
},
|
||||
'pause': function() {
|
||||
node.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
class to parse the .mid file format
|
||||
(depends on stream.js)
|
||||
*/
|
||||
function MidiFile(data) {
|
||||
function readChunk(stream) {
|
||||
var id = stream.read(4);
|
||||
var length = stream.readInt32();
|
||||
return {
|
||||
'id': id,
|
||||
'length': length,
|
||||
'data': stream.read(length)
|
||||
};
|
||||
}
|
||||
|
||||
var lastEventTypeByte;
|
||||
|
||||
function readEvent(stream) {
|
||||
var event = {};
|
||||
event.deltaTime = stream.readVarInt();
|
||||
var eventTypeByte = stream.readInt8();
|
||||
if ((eventTypeByte & 0xf0) == 0xf0) {
|
||||
/* system / meta event */
|
||||
if (eventTypeByte == 0xff) {
|
||||
/* meta event */
|
||||
event.type = 'meta';
|
||||
var subtypeByte = stream.readInt8();
|
||||
var length = stream.readVarInt();
|
||||
switch(subtypeByte) {
|
||||
case 0x00:
|
||||
event.subtype = 'sequenceNumber';
|
||||
if (length != 2) throw "Expected length for sequenceNumber event is 2, got " + length;
|
||||
event.number = stream.readInt16();
|
||||
return event;
|
||||
case 0x01:
|
||||
event.subtype = 'text';
|
||||
event.text = stream.read(length);
|
||||
return event;
|
||||
case 0x02:
|
||||
event.subtype = 'copyrightNotice';
|
||||
event.text = stream.read(length);
|
||||
return event;
|
||||
case 0x03:
|
||||
event.subtype = 'trackName';
|
||||
event.text = stream.read(length);
|
||||
return event;
|
||||
case 0x04:
|
||||
event.subtype = 'instrumentName';
|
||||
event.text = stream.read(length);
|
||||
return event;
|
||||
case 0x05:
|
||||
event.subtype = 'lyrics';
|
||||
event.text = stream.read(length);
|
||||
return event;
|
||||
case 0x06:
|
||||
event.subtype = 'marker';
|
||||
event.text = stream.read(length);
|
||||
return event;
|
||||
case 0x07:
|
||||
event.subtype = 'cuePoint';
|
||||
event.text = stream.read(length);
|
||||
return event;
|
||||
case 0x20:
|
||||
event.subtype = 'midiChannelPrefix';
|
||||
if (length != 1) throw "Expected length for midiChannelPrefix event is 1, got " + length;
|
||||
event.channel = stream.readInt8();
|
||||
return event;
|
||||
case 0x2f:
|
||||
event.subtype = 'endOfTrack';
|
||||
if (length != 0) throw "Expected length for endOfTrack event is 0, got " + length;
|
||||
return event;
|
||||
case 0x51:
|
||||
event.subtype = 'setTempo';
|
||||
if (length != 3) throw "Expected length for setTempo event is 3, got " + length;
|
||||
event.microsecondsPerBeat = (
|
||||
(stream.readInt8() << 16)
|
||||
+ (stream.readInt8() << 8)
|
||||
+ stream.readInt8()
|
||||
)
|
||||
return event;
|
||||
case 0x54:
|
||||
event.subtype = 'smpteOffset';
|
||||
if (length != 5) throw "Expected length for smpteOffset event is 5, got " + length;
|
||||
var hourByte = stream.readInt8();
|
||||
event.frameRate = {
|
||||
0x00: 24, 0x20: 25, 0x40: 29, 0x60: 30
|
||||
}[hourByte & 0x60];
|
||||
event.hour = hourByte & 0x1f;
|
||||
event.min = stream.readInt8();
|
||||
event.sec = stream.readInt8();
|
||||
event.frame = stream.readInt8();
|
||||
event.subframe = stream.readInt8();
|
||||
return event;
|
||||
case 0x58:
|
||||
event.subtype = 'timeSignature';
|
||||
if (length != 4) throw "Expected length for timeSignature event is 4, got " + length;
|
||||
event.numerator = stream.readInt8();
|
||||
event.denominator = Math.pow(2, stream.readInt8());
|
||||
event.metronome = stream.readInt8();
|
||||
event.thirtyseconds = stream.readInt8();
|
||||
return event;
|
||||
case 0x59:
|
||||
event.subtype = 'keySignature';
|
||||
if (length != 2) throw "Expected length for keySignature event is 2, got " + length;
|
||||
event.key = stream.readInt8(true);
|
||||
event.scale = stream.readInt8();
|
||||
return event;
|
||||
case 0x7f:
|
||||
event.subtype = 'sequencerSpecific';
|
||||
event.data = stream.read(length);
|
||||
return event;
|
||||
default:
|
||||
// console.log("Unrecognised meta event subtype: " + subtypeByte);
|
||||
event.subtype = 'unknown'
|
||||
event.data = stream.read(length);
|
||||
return event;
|
||||
}
|
||||
event.data = stream.read(length);
|
||||
return event;
|
||||
} else if (eventTypeByte == 0xf0) {
|
||||
event.type = 'sysEx';
|
||||
var length = stream.readVarInt();
|
||||
event.data = stream.read(length);
|
||||
return event;
|
||||
} else if (eventTypeByte == 0xf7) {
|
||||
event.type = 'dividedSysEx';
|
||||
var length = stream.readVarInt();
|
||||
event.data = stream.read(length);
|
||||
return event;
|
||||
} else {
|
||||
throw "Unrecognised MIDI event type byte: " + eventTypeByte;
|
||||
}
|
||||
} else {
|
||||
/* channel event */
|
||||
var param1;
|
||||
if ((eventTypeByte & 0x80) == 0) {
|
||||
/* running status - reuse lastEventTypeByte as the event type.
|
||||
eventTypeByte is actually the first parameter
|
||||
*/
|
||||
param1 = eventTypeByte;
|
||||
eventTypeByte = lastEventTypeByte;
|
||||
} else {
|
||||
param1 = stream.readInt8();
|
||||
lastEventTypeByte = eventTypeByte;
|
||||
}
|
||||
var eventType = eventTypeByte >> 4;
|
||||
event.channel = eventTypeByte & 0x0f;
|
||||
event.type = 'channel';
|
||||
switch (eventType) {
|
||||
case 0x08:
|
||||
event.subtype = 'noteOff';
|
||||
event.noteNumber = param1;
|
||||
event.velocity = stream.readInt8();
|
||||
return event;
|
||||
case 0x09:
|
||||
event.noteNumber = param1;
|
||||
event.velocity = stream.readInt8();
|
||||
if (event.velocity == 0) {
|
||||
event.subtype = 'noteOff';
|
||||
} else {
|
||||
event.subtype = 'noteOn';
|
||||
}
|
||||
return event;
|
||||
case 0x0a:
|
||||
event.subtype = 'noteAftertouch';
|
||||
event.noteNumber = param1;
|
||||
event.amount = stream.readInt8();
|
||||
return event;
|
||||
case 0x0b:
|
||||
event.subtype = 'controller';
|
||||
event.controllerType = param1;
|
||||
event.value = stream.readInt8();
|
||||
return event;
|
||||
case 0x0c:
|
||||
event.subtype = 'programChange';
|
||||
event.programNumber = param1;
|
||||
return event;
|
||||
case 0x0d:
|
||||
event.subtype = 'channelAftertouch';
|
||||
event.amount = param1;
|
||||
return event;
|
||||
case 0x0e:
|
||||
event.subtype = 'pitchBend';
|
||||
event.value = param1 + (stream.readInt8() << 7);
|
||||
return event;
|
||||
default:
|
||||
throw "Unrecognised MIDI event type: " + eventType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stream = Stream(data);
|
||||
var headerChunk = readChunk(stream);
|
||||
if (headerChunk.id != 'MThd' || headerChunk.length != 6) {
|
||||
throw "Bad .mid file - header not found";
|
||||
}
|
||||
var headerStream = Stream(headerChunk.data);
|
||||
var formatType = headerStream.readInt16();
|
||||
var trackCount = headerStream.readInt16();
|
||||
var timeDivision = headerStream.readInt16();
|
||||
|
||||
if (timeDivision & 0x8000) {
|
||||
throw "Expressing time division in SMTPE frames is not supported yet"
|
||||
} else {
|
||||
ticksPerBeat = timeDivision;
|
||||
}
|
||||
|
||||
var header = {
|
||||
'formatType': formatType,
|
||||
'trackCount': trackCount,
|
||||
'ticksPerBeat': ticksPerBeat
|
||||
}
|
||||
var tracks = [];
|
||||
for (var i = 0; i < header.trackCount; i++) {
|
||||
tracks[i] = [];
|
||||
var trackChunk = readChunk(stream);
|
||||
if (trackChunk.id != 'MTrk') {
|
||||
throw "Unexpected chunk - expected MTrk, got "+ trackChunk.id;
|
||||
}
|
||||
var trackStream = Stream(trackChunk.data);
|
||||
while (!trackStream.eof()) {
|
||||
var event = readEvent(trackStream);
|
||||
tracks[i].push(event);
|
||||
//console.log(event);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'header': header,
|
||||
'tracks': tracks
|
||||
}
|
||||
}
|
||||
function Replayer(midiFile, synth) {
|
||||
var trackStates = [];
|
||||
var beatsPerMinute = 120;
|
||||
var ticksPerBeat = midiFile.header.ticksPerBeat;
|
||||
var channelCount = 16;
|
||||
var channels = [];
|
||||
var nextEventInfo;
|
||||
var samplesToNextEvent;
|
||||
|
||||
function Channel() {
|
||||
|
||||
var generatorsByNote = {};
|
||||
var currentProgram = PianoProgram;
|
||||
|
||||
function noteOn(note, velocity) {
|
||||
if (generatorsByNote[note] && !generatorsByNote[note].released) {
|
||||
/* playing same note before releasing the last one. BOO */
|
||||
generatorsByNote[note].noteOff(); /* TODO: check whether we ought to be passing a velocity in */
|
||||
}
|
||||
generator = currentProgram.createNote(note, velocity);
|
||||
synth.addGenerator(generator);
|
||||
generatorsByNote[note] = generator;
|
||||
}
|
||||
function noteOff(note, velocity) {
|
||||
if (generatorsByNote[note] && !generatorsByNote[note].released) {
|
||||
generatorsByNote[note].noteOff(velocity);
|
||||
}
|
||||
}
|
||||
function setProgram(programNumber) {
|
||||
currentProgram = PROGRAMS[programNumber] || PianoProgram;
|
||||
}
|
||||
|
||||
return {
|
||||
'noteOn': noteOn,
|
||||
'noteOff': noteOff,
|
||||
'setProgram': setProgram
|
||||
}
|
||||
}
|
||||
|
||||
function getNextEvent() {
|
||||
var ticksToNextEvent = null;
|
||||
var nextEventTrack = null;
|
||||
var nextEventIndex = null;
|
||||
|
||||
for (var i = 0; i < trackStates.length; i++) {
|
||||
if (
|
||||
trackStates[i].ticksToNextEvent != null
|
||||
&& (ticksToNextEvent == null || trackStates[i].ticksToNextEvent < ticksToNextEvent)
|
||||
) {
|
||||
ticksToNextEvent = trackStates[i].ticksToNextEvent;
|
||||
nextEventTrack = i;
|
||||
nextEventIndex = trackStates[i].nextEventIndex;
|
||||
}
|
||||
}
|
||||
if (nextEventTrack != null) {
|
||||
/* consume event from that track */
|
||||
var nextEvent = midiFile.tracks[nextEventTrack][nextEventIndex];
|
||||
if (midiFile.tracks[nextEventTrack][nextEventIndex + 1]) {
|
||||
trackStates[nextEventTrack].ticksToNextEvent += midiFile.tracks[nextEventTrack][nextEventIndex + 1].deltaTime;
|
||||
} else {
|
||||
trackStates[nextEventTrack].ticksToNextEvent = null;
|
||||
}
|
||||
trackStates[nextEventTrack].nextEventIndex += 1;
|
||||
/* advance timings on all tracks by ticksToNextEvent */
|
||||
for (var i = 0; i < trackStates.length; i++) {
|
||||
if (trackStates[i].ticksToNextEvent != null) {
|
||||
trackStates[i].ticksToNextEvent -= ticksToNextEvent
|
||||
}
|
||||
}
|
||||
nextEventInfo = {
|
||||
'ticksToEvent': ticksToNextEvent,
|
||||
'event': nextEvent,
|
||||
'track': nextEventTrack
|
||||
}
|
||||
var beatsToNextEvent = ticksToNextEvent / ticksPerBeat;
|
||||
var secondsToNextEvent = beatsToNextEvent / (beatsPerMinute / 60);
|
||||
samplesToNextEvent += secondsToNextEvent * synth.sampleRate;
|
||||
} else {
|
||||
nextEventInfo = null;
|
||||
samplesToNextEvent = null;
|
||||
self.finished = true;
|
||||
}
|
||||
}
|
||||
|
||||
function generate(samples) {
|
||||
var data = new Array(samples*2);
|
||||
var samplesRemaining = samples;
|
||||
var dataOffset = 0;
|
||||
|
||||
while (true) {
|
||||
if (samplesToNextEvent != null && samplesToNextEvent <= samplesRemaining) {
|
||||
/* generate samplesToNextEvent samples, process event and repeat */
|
||||
var samplesToGenerate = Math.ceil(samplesToNextEvent);
|
||||
if (samplesToGenerate > 0) {
|
||||
synth.generateIntoBuffer(samplesToGenerate, data, dataOffset);
|
||||
dataOffset += samplesToGenerate * 2;
|
||||
samplesRemaining -= samplesToGenerate;
|
||||
samplesToNextEvent -= samplesToGenerate;
|
||||
}
|
||||
|
||||
handleEvent();
|
||||
getNextEvent();
|
||||
} else {
|
||||
/* generate samples to end of buffer */
|
||||
if (samplesRemaining > 0) {
|
||||
synth.generateIntoBuffer(samplesRemaining, data, dataOffset);
|
||||
samplesToNextEvent -= samplesRemaining;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function handleEvent() {
|
||||
var event = nextEventInfo.event;
|
||||
switch (event.type) {
|
||||
case 'meta':
|
||||
switch (event.subtype) {
|
||||
case 'setTempo':
|
||||
beatsPerMinute = 60000000 / event.microsecondsPerBeat
|
||||
}
|
||||
break;
|
||||
case 'channel':
|
||||
switch (event.subtype) {
|
||||
case 'noteOn':
|
||||
channels[event.channel].noteOn(event.noteNumber, event.velocity);
|
||||
break;
|
||||
case 'noteOff':
|
||||
channels[event.channel].noteOff(event.noteNumber, event.velocity);
|
||||
break;
|
||||
case 'programChange':
|
||||
//console.log('program change to ' + event.programNumber);
|
||||
channels[event.channel].setProgram(event.programNumber);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function reset() {
|
||||
for (var i = 0; i < midiFile.tracks.length; i++) {
|
||||
trackStates[i] = {
|
||||
'nextEventIndex': 0,
|
||||
'ticksToNextEvent': (
|
||||
midiFile.tracks[i].length ?
|
||||
midiFile.tracks[i][0].deltaTime :
|
||||
null
|
||||
)
|
||||
};
|
||||
}
|
||||
for (var i = 0; i < channelCount; i++) {
|
||||
channels[i] = Channel();
|
||||
}
|
||||
samplesToNextEvent = 0;
|
||||
getNextEvent();
|
||||
}
|
||||
|
||||
reset();
|
||||
|
||||
var self = {
|
||||
'reset': reset,
|
||||
'generate': generate,
|
||||
'finished': false
|
||||
}
|
||||
return self;
|
||||
}
|
||||
/* Wrapper for accessing strings through sequential reads */
|
||||
function Stream(str) {
|
||||
var position = 0;
|
||||
|
||||
function read(length) {
|
||||
var result = str.substr(position, length);
|
||||
position += length;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* read a big-endian 32-bit integer */
|
||||
function readInt32() {
|
||||
var result = (
|
||||
(str.charCodeAt(position) << 24)
|
||||
+ (str.charCodeAt(position + 1) << 16)
|
||||
+ (str.charCodeAt(position + 2) << 8)
|
||||
+ str.charCodeAt(position + 3));
|
||||
position += 4;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* read a big-endian 16-bit integer */
|
||||
function readInt16() {
|
||||
var result = (
|
||||
(str.charCodeAt(position) << 8)
|
||||
+ str.charCodeAt(position + 1));
|
||||
position += 2;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* read an 8-bit integer */
|
||||
function readInt8(signed) {
|
||||
var result = str.charCodeAt(position);
|
||||
if (signed && result > 127) result -= 256;
|
||||
position += 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
function eof() {
|
||||
return position >= str.length;
|
||||
}
|
||||
|
||||
/* read a MIDI-style variable-length integer
|
||||
(big-endian value in groups of 7 bits,
|
||||
with top bit set to signify that another byte follows)
|
||||
*/
|
||||
function readVarInt() {
|
||||
var result = 0;
|
||||
while (true) {
|
||||
var b = readInt8();
|
||||
if (b & 0x80) {
|
||||
result += (b & 0x7f);
|
||||
result <<= 7;
|
||||
} else {
|
||||
/* b is the last byte */
|
||||
return result + b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'eof': eof,
|
||||
'read': read,
|
||||
'readInt32': readInt32,
|
||||
'readInt16': readInt16,
|
||||
'readInt8': readInt8,
|
||||
'readVarInt': readVarInt
|
||||
}
|
||||
}
|
||||
function SineGenerator(freq) {
|
||||
var self = {'alive': true};
|
||||
var period = sampleRate / freq;
|
||||
var t = 0;
|
||||
|
||||
self.generate = function(buf, offset, count) {
|
||||
for (; count; count--) {
|
||||
var phase = t / period;
|
||||
var result = Math.sin(phase * 2 * Math.PI);
|
||||
buf[offset++] += result;
|
||||
buf[offset++] += result;
|
||||
t++;
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
function SquareGenerator(freq, phase) {
|
||||
var self = {'alive': true};
|
||||
var period = sampleRate / freq;
|
||||
var t = 0;
|
||||
|
||||
self.generate = function(buf, offset, count) {
|
||||
for (; count; count--) {
|
||||
var result = ( (t / period) % 1 > phase ? 1 : -1);
|
||||
buf[offset++] += result;
|
||||
buf[offset++] += result;
|
||||
t++;
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
function ADSRGenerator(child, attackAmplitude, sustainAmplitude, attackTimeS, decayTimeS, releaseTimeS) {
|
||||
var self = {'alive': true}
|
||||
var attackTime = sampleRate * attackTimeS;
|
||||
var decayTime = sampleRate * (attackTimeS + decayTimeS);
|
||||
var decayRate = (attackAmplitude - sustainAmplitude) / (decayTime - attackTime);
|
||||
var releaseTime = null; /* not known yet */
|
||||
var endTime = null; /* not known yet */
|
||||
var releaseRate = sustainAmplitude / (sampleRate * releaseTimeS);
|
||||
var t = 0;
|
||||
|
||||
self.noteOff = function() {
|
||||
if (self.released) return;
|
||||
releaseTime = t;
|
||||
self.released = true;
|
||||
endTime = releaseTime + sampleRate * releaseTimeS;
|
||||
}
|
||||
|
||||
self.generate = function(buf, offset, count) {
|
||||
if (!self.alive) return;
|
||||
var input = new Array(count * 2);
|
||||
for (var i = 0; i < count*2; i++) {
|
||||
input[i] = 0;
|
||||
}
|
||||
child.generate(input, 0, count);
|
||||
|
||||
childOffset = 0;
|
||||
while(count) {
|
||||
if (releaseTime != null) {
|
||||
if (t < endTime) {
|
||||
/* release */
|
||||
while(count && t < endTime) {
|
||||
var ampl = sustainAmplitude - releaseRate * (t - releaseTime);
|
||||
buf[offset++] += input[childOffset++] * ampl;
|
||||
buf[offset++] += input[childOffset++] * ampl;
|
||||
t++;
|
||||
count--;
|
||||
}
|
||||
} else {
|
||||
/* dead */
|
||||
self.alive = false;
|
||||
return;
|
||||
}
|
||||
} else if (t < attackTime) {
|
||||
/* attack */
|
||||
while(count && t < attackTime) {
|
||||
var ampl = attackAmplitude * t / attackTime;
|
||||
buf[offset++] += input[childOffset++] * ampl;
|
||||
buf[offset++] += input[childOffset++] * ampl;
|
||||
t++;
|
||||
count--;
|
||||
}
|
||||
} else if (t < decayTime) {
|
||||
/* decay */
|
||||
while(count && t < decayTime) {
|
||||
var ampl = attackAmplitude - decayRate * (t - attackTime);
|
||||
buf[offset++] += input[childOffset++] * ampl;
|
||||
buf[offset++] += input[childOffset++] * ampl;
|
||||
t++;
|
||||
count--;
|
||||
}
|
||||
} else {
|
||||
/* sustain */
|
||||
while(count) {
|
||||
buf[offset++] += input[childOffset++] * sustainAmplitude;
|
||||
buf[offset++] += input[childOffset++] * sustainAmplitude;
|
||||
t++;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
function midiToFrequency(note) {
|
||||
return 440 * Math.pow(2, (note-69)/12);
|
||||
}
|
||||
|
||||
PianoProgram = {
|
||||
'attackAmplitude': 0.2,
|
||||
'sustainAmplitude': 0.1,
|
||||
'attackTime': 0.02,
|
||||
'decayTime': 0.3,
|
||||
'releaseTime': 0.02,
|
||||
'createNote': function(note, velocity) {
|
||||
var frequency = midiToFrequency(note);
|
||||
return ADSRGenerator(
|
||||
SineGenerator(frequency),
|
||||
this.attackAmplitude * (velocity / 128), this.sustainAmplitude * (velocity / 128),
|
||||
this.attackTime, this.decayTime, this.releaseTime
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
StringProgram = {
|
||||
'createNote': function(note, velocity) {
|
||||
var frequency = midiToFrequency(note);
|
||||
return ADSRGenerator(
|
||||
SineGenerator(frequency),
|
||||
0.5 * (velocity / 128), 0.2 * (velocity / 128),
|
||||
0.4, 0.8, 0.4
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PROGRAMS = {
|
||||
41: StringProgram,
|
||||
42: StringProgram,
|
||||
43: StringProgram,
|
||||
44: StringProgram,
|
||||
45: StringProgram,
|
||||
46: StringProgram,
|
||||
47: StringProgram,
|
||||
49: StringProgram,
|
||||
50: StringProgram
|
||||
};
|
||||
|
||||
function Synth(sampleRate) {
|
||||
|
||||
var generators = [];
|
||||
|
||||
function addGenerator(generator) {
|
||||
generators.push(generator);
|
||||
}
|
||||
|
||||
function generate(samples) {
|
||||
var data = new Array(samples*2);
|
||||
generateIntoBuffer(samples, data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
function generateIntoBuffer(samplesToGenerate, buffer, offset) {
|
||||
for (var i = offset; i < offset + samplesToGenerate * 2; i++) {
|
||||
buffer[i] = 0;
|
||||
}
|
||||
for (var i = generators.length - 1; i >= 0; i--) {
|
||||
generators[i].generate(buffer, offset, samplesToGenerate);
|
||||
if (!generators[i].alive) generators.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'sampleRate': sampleRate,
|
||||
'addGenerator': addGenerator,
|
||||
'generate': generate,
|
||||
'generateIntoBuffer': generateIntoBuffer
|
||||
}
|
||||
}
|
||||
1
libs/thirdparty/mid.min.js
vendored
366
libs/ui.js
@ -108,9 +108,9 @@ ui.prototype.fillBoldText = function (name, text, x, y, style, strokeStyle, font
|
||||
if (!ctx) return;
|
||||
if (font) ctx.font = font;
|
||||
if (!style) style = ctx.fillStyle;
|
||||
if (style instanceof Array) style = core.arrayToRGBA(style);
|
||||
style = core.arrayToRGBA(style);
|
||||
if (!strokeStyle) strokeStyle = '#000000';
|
||||
if (strokeStyle instanceof Array) strokeStyle = core.arrayToRGBA(strokeStyle);
|
||||
strokeStyle = core.arrayToRGBA(strokeStyle);
|
||||
ctx.fillStyle = strokeStyle;
|
||||
ctx.fillText(text, x-1, y-1);
|
||||
ctx.fillText(text, x-1, y+1);
|
||||
@ -134,7 +134,65 @@ ui.prototype.fillRect = function (name, x, y, width, height, style) {
|
||||
|
||||
ui.prototype._uievent_fillRect = function (data) {
|
||||
this._createUIEvent();
|
||||
this.fillRect('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.width), core.calValue(data.height), data.style);
|
||||
if (data.radius) {
|
||||
this.fillRoundRect('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.width), core.calValue(data.height), core.calValue(data.radius), data.style);
|
||||
} else {
|
||||
this.fillRect('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.width), core.calValue(data.height), data.style);
|
||||
}
|
||||
}
|
||||
|
||||
////// 在某个canvas上绘制一个矩形的边框 //////
|
||||
ui.prototype.strokeRect = function (name, x, y, width, height, style, lineWidth) {
|
||||
if (style) core.setStrokeStyle(name, style);
|
||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||
var ctx = this.getContextByName(name);
|
||||
if (ctx) ctx.strokeRect(x, y, width, height);
|
||||
}
|
||||
|
||||
ui.prototype._uievent_strokeRect = function (data) {
|
||||
this._createUIEvent();
|
||||
if (data.radius) {
|
||||
this.strokeRoundRect('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.width), core.calValue(data.height),
|
||||
core.calValue(data.radius), data.style, data.lineWidth);
|
||||
} else {
|
||||
this.strokeRect('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.width), core.calValue(data.height), data.style, data.lineWidth);
|
||||
}
|
||||
}
|
||||
|
||||
////// 在某个canvas上绘制一个圆角矩形 //////
|
||||
ui.prototype.fillRoundRect = function (name, x, y, width, height, radius, style) {
|
||||
if (style) core.setFillStyle(name, style);
|
||||
var ctx = this.getContextByName(name);
|
||||
if (ctx) {
|
||||
this._roundRect_buildPath(ctx, x, y, width, height, radius);
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
////// 在某个canvas上绘制一个圆角矩形的边框 //////
|
||||
ui.prototype.strokeRoundRect = function (name, x, y, width, height, radius, style, lineWidth) {
|
||||
if (style) core.setStrokeStyle(name, style);
|
||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||
var ctx = this.getContextByName(name);
|
||||
if (ctx) {
|
||||
this._roundRect_buildPath(ctx, x, y, width, height, radius);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ui.prototype._roundRect_buildPath = function (ctx, x, y, width, height, radius) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x + radius, y);
|
||||
ctx.lineTo(x + width - radius, y);
|
||||
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
|
||||
ctx.lineTo(x + width, y + height - radius);
|
||||
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
|
||||
ctx.lineTo(x + radius, y + height);
|
||||
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
|
||||
ctx.lineTo(x, y + radius);
|
||||
ctx.quadraticCurveTo(x, y, x + radius, y);
|
||||
ctx.closePath();
|
||||
}
|
||||
|
||||
////// 在某个canvas上绘制一个多边形 //////
|
||||
@ -158,19 +216,6 @@ ui.prototype._uievent_fillPolygon = function (data) {
|
||||
this.fillPolygon('uievent', data.nodes, data.style);
|
||||
}
|
||||
|
||||
////// 在某个canvas上绘制一个矩形的边框 //////
|
||||
ui.prototype.strokeRect = function (name, x, y, width, height, style, lineWidth) {
|
||||
if (style) core.setStrokeStyle(name, style);
|
||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||
var ctx = this.getContextByName(name);
|
||||
if (ctx) ctx.strokeRect(x, y, width, height);
|
||||
}
|
||||
|
||||
ui.prototype._uievent_strokeRect = function (data) {
|
||||
this._createUIEvent();
|
||||
this.strokeRect('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.width), core.calValue(data.height), data.style, data.lineWidth);
|
||||
}
|
||||
|
||||
////// 在某个canvas上绘制一个多边形的边框 //////
|
||||
ui.prototype.strokePolygon = function (name, nodes, style, lineWidth) {
|
||||
if (style) core.setStrokeStyle(name, style);
|
||||
@ -193,35 +238,78 @@ ui.prototype._uievent_strokePolygon = function (data) {
|
||||
this.strokePolygon('uievent', data.nodes, data.style, data.lineWidth);
|
||||
}
|
||||
|
||||
////// 在某个canvas上绘制一个圆 //////
|
||||
ui.prototype.fillCircle = function (name, x, y, r, style) {
|
||||
////// 在某个canvas上绘制一个椭圆 //////
|
||||
ui.prototype.fillEllipse = function (name, x, y, a, b, angle, style) {
|
||||
if (style) core.setFillStyle(name, style);
|
||||
var ctx = this.getContextByName(name);
|
||||
if (!ctx) return;
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, r, 0, 2*Math.PI);
|
||||
ctx.ellipse(x, y, a, b, angle, 0, 2*Math.PI);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
ui.prototype._uievent_fillCircle = function (data) {
|
||||
ui.prototype.fillCircle = function (name, x, y, r, style) {
|
||||
return this.fillEllipse(name, x, y, r, r, 0, style);
|
||||
}
|
||||
|
||||
ui.prototype._uievent_fillEllipse = function (data) {
|
||||
this._createUIEvent();
|
||||
this.fillCircle('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.r), data.style);
|
||||
this.fillEllipse('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.a),
|
||||
core.calValue(data.b), (core.calValue(data.angle) || 0) * Math.PI / 180, data.style);
|
||||
}
|
||||
|
||||
////// 在某个canvas上绘制一个圆的边框 //////
|
||||
ui.prototype.strokeCircle = function (name, x, y, r, style, lineWidth) {
|
||||
ui.prototype.strokeEllipse = function (name, x, y, a, b, angle, style, lineWidth) {
|
||||
if (style) core.setStrokeStyle(name, style);
|
||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||
var ctx = this.getContextByName(name);
|
||||
if (!ctx) return;
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, r, 0, 2*Math.PI);
|
||||
ctx.ellipse(x, y, a, b, angle, 0, 2*Math.PI);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
ui.prototype._uievent_strokeCircle = function (data) {
|
||||
ui.prototype.strokeCircle = function (name, x, y, r, style, lineWidth) {
|
||||
return this.strokeEllipse(name, x, y, r, r, 0, style, lineWidth);
|
||||
}
|
||||
|
||||
ui.prototype._uievent_strokeEllipse = function (data) {
|
||||
this._createUIEvent();
|
||||
this.strokeCircle('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.r), data.style, data.lineWidth);
|
||||
this.strokeEllipse('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.a),
|
||||
core.calValue(data.b), (core.calValue(data.angle) || 0) * Math.PI / 180, data.style, data.lineWidth);
|
||||
}
|
||||
|
||||
ui.prototype.fillArc = function (name, x, y, r, start, end, style) {
|
||||
if (style) core.setFillStyle(name, style);
|
||||
var ctx = this.getContextByName(name);
|
||||
if (!ctx) return;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, y);
|
||||
ctx.arc(x, y, r, start, end);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
ui.prototype._uievent_fillArc = function (data) {
|
||||
this._createUIEvent();
|
||||
this.fillArc('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.r),
|
||||
(core.calValue(data.start) || 0) * Math.PI / 180, (core.calValue(data.end) || 0) * Math.PI / 180, data.style);
|
||||
}
|
||||
|
||||
ui.prototype.strokeArc = function (name, x, y, r, start, end, style, lineWidth) {
|
||||
if (style) core.setStrokeStyle(name, style);
|
||||
if (lineWidth) core.setLineWidth(name, lineWidth);
|
||||
var ctx = this.getContextByName(name);
|
||||
if (!ctx) return;
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, r, start, end);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
ui.prototype._uievent_strokeArc = function (data) {
|
||||
this._createUIEvent();
|
||||
this.strokeArc('uievent', core.calValue(data.x), core.calValue(data.y), core.calValue(data.r),
|
||||
(core.calValue(data.start) || 0) * Math.PI / 180, (core.calValue(data.end) || 0) * Math.PI / 180, data.style, data.lineWidth);
|
||||
}
|
||||
|
||||
////// 在某个canvas上绘制一条线 //////
|
||||
@ -304,15 +392,13 @@ ui.prototype.setOpacity = function (name, opacity) {
|
||||
////// 设置某个canvas的绘制属性(如颜色等) //////
|
||||
ui.prototype.setFillStyle = function (name, style) {
|
||||
var ctx = this.getContextByName(name);
|
||||
if (style instanceof Array) style = core.arrayToRGBA(style);
|
||||
if (ctx) ctx.fillStyle = style;
|
||||
if (ctx) ctx.fillStyle = core.arrayToRGBA(style);
|
||||
}
|
||||
|
||||
////// 设置某个canvas边框属性 //////
|
||||
ui.prototype.setStrokeStyle = function (name, style) {
|
||||
var ctx = this.getContextByName(name);
|
||||
if (style instanceof Array) style = core.arrayToRGBA(style);
|
||||
if (ctx) ctx.strokeStyle = style;
|
||||
if (ctx) ctx.strokeStyle = core.arrayToRGBA(style);
|
||||
}
|
||||
|
||||
////// 设置某个canvas的对齐 //////
|
||||
@ -419,32 +505,61 @@ ui.prototype.splitLines = function (name, text, maxWidth, font) {
|
||||
|
||||
////// 绘制一张图片 //////
|
||||
ui.prototype.drawImage = function (name, image, x, y, w, h, x1, y1, w1, h1) {
|
||||
// 检测文件名以 :x, :y, :o 结尾,表示左右翻转,上下翻转和中心翻转
|
||||
var ctx = this.getContextByName(name);
|
||||
if (!ctx) return;
|
||||
var reverse = null;
|
||||
if (typeof image == 'string') {
|
||||
if (image.endsWith(':x') || image.endsWith(':y') || image.endsWith(':o')) {
|
||||
reverse = image.charAt(image.length - 1);
|
||||
image = image.substring(0, image.length - 2);
|
||||
}
|
||||
image = core.getMappedName(image);
|
||||
image = core.material.images.images[image];
|
||||
if (!image) return;
|
||||
if (!image || !(image instanceof Image)) return;
|
||||
}
|
||||
|
||||
var scale = {
|
||||
'x': [-1, 1],
|
||||
'y': [1, -1],
|
||||
'o': [-1, -1]
|
||||
};
|
||||
|
||||
// 只能接受2, 4, 8个参数
|
||||
if (x != null && y != null) {
|
||||
if (w != null && h != null) {
|
||||
if (x1 != null && y1 != null && w1 != null && h1 != null) {
|
||||
if (w == null || h == null) {
|
||||
// 两个参数变成四个参数
|
||||
w = image.width;
|
||||
h = image.height;
|
||||
}
|
||||
if (x1 != null && y1 != null && w1 != null && h1 != null) {
|
||||
if (reverse == null) {
|
||||
ctx.drawImage(image, x, y, w, h, x1, y1, w1, h1);
|
||||
return;
|
||||
} else {
|
||||
ctx.save();
|
||||
ctx.translate(x1 + w1 / 2, y1 + h1 / 2);
|
||||
ctx.scale(scale[reverse][0], scale[reverse][1]);
|
||||
ctx.drawImage(image, x, y, w, h, -w1 / 2, -h1 / 2, w1, h1);
|
||||
ctx.restore();
|
||||
}
|
||||
ctx.drawImage(image, x, y, w, h);
|
||||
return;
|
||||
}
|
||||
ctx.drawImage(image, x, y);
|
||||
if (reverse == null) {
|
||||
ctx.drawImage(image, x, y, w, h);
|
||||
} else {
|
||||
ctx.save();
|
||||
ctx.translate(x + w / 2, y + h / 2);
|
||||
ctx.scale(scale[reverse][0], scale[reverse][1]);
|
||||
ctx.drawImage(image, -w / 2, -h / 2, w, h);
|
||||
ctx.restore();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ui.prototype._uievent_drawImage = function (data) {
|
||||
this._createUIEvent();
|
||||
this.drawImage('uievent', data.image, core.calValue(data.x), core.calValue(data.y), core.calValue(data.w), core.calValue(data.h),
|
||||
this.drawImage('uievent', data.image + (data.reverse || ''), core.calValue(data.x), core.calValue(data.y), core.calValue(data.w), core.calValue(data.h),
|
||||
core.calValue(data.x1), core.calValue(data.y1), core.calValue(data.w1), core.calValue(data.h1));
|
||||
}
|
||||
|
||||
@ -459,7 +574,7 @@ ui.prototype.drawIcon = function (name, id, x, y, w, h, frame) {
|
||||
info = {image: core.statusBar.icons[id], posX: 0, posY: 0, height: 32};
|
||||
else return;
|
||||
}
|
||||
ctx.drawImage(info.image, 32 * (info.posX + frame), info.height * info.posY, 32, info.height, x, y, w || 32, h || info.height);
|
||||
core.drawImage(ctx, info.image, 32 * (info.posX + frame), info.height * info.posY, 32, info.height, x, y, w || 32, h || info.height);
|
||||
}
|
||||
|
||||
ui.prototype._uievent_drawIcon = function (data) {
|
||||
@ -479,7 +594,7 @@ ui.prototype.closePanel = function () {
|
||||
if (core.status.hero && core.status.hero.flags) {
|
||||
// 清除全部临时变量
|
||||
Object.keys(core.status.hero.flags).forEach(function (name) {
|
||||
if (name.startsWith("@temp@")) {
|
||||
if (name.startsWith("@temp@") || /^arg\d+$/.test(name)) {
|
||||
delete core.status.hero.flags[name];
|
||||
}
|
||||
});
|
||||
@ -635,7 +750,7 @@ ui.prototype._getPosition = function (content) {
|
||||
py = core.status.event.data.y;
|
||||
}
|
||||
content = content.replace("\b", "\\b")
|
||||
.replace(/\\b\[(up|center|down|hero|null)(,(hero|null|\d+,\d+|\d+))?]/g, function (s0, s1, s2, s3) {
|
||||
.replace(/\\b\[(up|center|down|hero|this)(,(hero|null|\d+,\d+|\d+))?]/g, function (s0, s1, s2, s3) {
|
||||
pos = s1;
|
||||
if (s3 == 'hero' || s1=='hero' && !s3) {
|
||||
px = core.status.hero.loc.x;
|
||||
@ -659,7 +774,7 @@ ui.prototype._getPosition = function (content) {
|
||||
noPeak = core.getBlockId(px, py) == null;
|
||||
}
|
||||
}
|
||||
if(pos=='hero' || pos=='null'){
|
||||
if(pos=='hero' || pos=='this'){
|
||||
pos = py==null?'center':(py>=core.__HALF_SIZE__? 'up':'down');
|
||||
}
|
||||
return "";
|
||||
@ -704,64 +819,53 @@ ui.prototype._clearUIEventSelector = function (codes) {
|
||||
ui.prototype._drawSelector = function (ctx, background, w, h, left, top) {
|
||||
left = left || 0;
|
||||
top = top || 0;
|
||||
ctx = this.getContextByName(ctx);
|
||||
if (!ctx) return;
|
||||
if (typeof background == 'string')
|
||||
background = core.material.images.images[background];
|
||||
if (!(background instanceof Image)) return;
|
||||
// back
|
||||
ctx.drawImage(background, 130, 66, 28, 28, left+2, top+2, w-4, h-4);
|
||||
core.drawImage(ctx, background, 130, 66, 28, 28, left+2, top+2, w-4, h-4);
|
||||
// corner
|
||||
ctx.drawImage(background, 128, 64, 2, 2, left, top, 2, 2);
|
||||
ctx.drawImage(background, 158, 64, 2, 2, left+w-2, top, 2, 2);
|
||||
ctx.drawImage(background, 128, 94, 2, 2, left, top+h-2, 2, 2);
|
||||
ctx.drawImage(background, 158, 94, 2, 2, left+w-2, top+h-2, 2, 2);
|
||||
core.drawImage(ctx, background, 128, 64, 2, 2, left, top, 2, 2);
|
||||
core.drawImage(ctx, background, 158, 64, 2, 2, left+w-2, top, 2, 2);
|
||||
core.drawImage(ctx, background, 128, 94, 2, 2, left, top+h-2, 2, 2);
|
||||
core.drawImage(ctx, background, 158, 94, 2, 2, left+w-2, top+h-2, 2, 2);
|
||||
// border
|
||||
ctx.drawImage(background, 130, 64, 28, 2, left+2, top, w-4, 2);
|
||||
ctx.drawImage(background, 130, 94, 28, 2, left+2, top+h-2, w-4, 2);
|
||||
ctx.drawImage(background, 128, 66, 2, 28, left, top+2, 2,h-4);
|
||||
ctx.drawImage(background, 158, 66, 2, 28, left+w-2, top+2, 2,h-4);
|
||||
core.drawImage(ctx, background, 130, 64, 28, 2, left+2, top, w-4, 2);
|
||||
core.drawImage(ctx, background, 130, 94, 28, 2, left+2, top+h-2, w-4, 2);
|
||||
core.drawImage(ctx, background, 128, 66, 2, 28, left, top+2, 2,h-4);
|
||||
core.drawImage(ctx, background, 158, 66, 2, 28, left+w-2, top+2, 2,h-4);
|
||||
}
|
||||
|
||||
////// 绘制 WindowSkin
|
||||
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窗口皮肤 ↓
|
||||
var dstImage = core.getContextByName(ctx);
|
||||
if (!dstImage) return;
|
||||
// 绘制背景
|
||||
dstImage.drawImage(background, 0, 0, 128, 128, x+2, y+2, w-4, h-4);
|
||||
core.drawImage(ctx, background, 0, 0, 128, 128, x+2, y+2, w-4, h-4);
|
||||
// 绘制边框
|
||||
// 上方
|
||||
dstImage.drawImage(background, 128, 0, 16, 16, x, y, 16, 16);
|
||||
core.drawImage(ctx, background, 128, 0, 16, 16, x, y, 16, 16);
|
||||
for (var dx = 0; dx < w - 64; dx += 32) {
|
||||
dstImage.drawImage(background, 144, 0, 32, 16,x+dx+16, y, 32, 16);
|
||||
dstImage.drawImage(background, 144,48, 32, 16,x+dx+16, y+h-16, 32, 16);
|
||||
core.drawImage(ctx, background, 144, 0, 32, 16,x+dx+16, y, 32, 16);
|
||||
core.drawImage(ctx, background, 144,48, 32, 16,x+dx+16, y+h-16, 32, 16);
|
||||
}
|
||||
dstImage.drawImage(background, 144, 0,w-dx-32, 16,x+dx+16, y,w-dx-32, 16);
|
||||
dstImage.drawImage(background, 144,48,w-dx-32, 16,x+dx+16, y+h-16,w-dx-32, 16);
|
||||
dstImage.drawImage(background, 176, 0, 16, 16, x+w-16, y, 16, 16);
|
||||
core.drawImage(ctx, background, 144, 0,w-dx-32, 16,x+dx+16, y,w-dx-32, 16);
|
||||
core.drawImage(ctx, background, 144,48,w-dx-32, 16,x+dx+16, y+h-16,w-dx-32, 16);
|
||||
core.drawImage(ctx, background, 176, 0, 16, 16, x+w-16, y, 16, 16);
|
||||
// 左右
|
||||
for (var dy = 0; dy < h - 64; dy += 32) {
|
||||
dstImage.drawImage(background, 128,16, 16, 32, x,y+dy+16, 16, 32);
|
||||
dstImage.drawImage(background, 176,16, 16, 32, x+w-16,y+dy+16, 16, 32);
|
||||
core.drawImage(ctx, background, 128,16, 16, 32, x,y+dy+16, 16, 32);
|
||||
core.drawImage(ctx, background, 176,16, 16, 32, x+w-16,y+dy+16, 16, 32);
|
||||
}
|
||||
dstImage.drawImage(background, 128,16, 16,h-dy-32, x,y+dy+16, 16,h-dy-32);
|
||||
dstImage.drawImage(background, 176,16, 16,h-dy-32, x+w-16,y+dy+16, 16,h-dy-32);
|
||||
core.drawImage(ctx, background, 128,16, 16,h-dy-32, x,y+dy+16, 16,h-dy-32);
|
||||
core.drawImage(ctx, background, 176,16, 16,h-dy-32, x+w-16,y+dy+16, 16,h-dy-32);
|
||||
// 下方
|
||||
dstImage.drawImage(background, 128,48, 16, 16, x, y+h-16, 16, 16);
|
||||
dstImage.drawImage(background, 176,48, 16, 16, x+w-16, y+h-16, 16, 16);
|
||||
core.drawImage(ctx, background, 128,48, 16, 16, x, y+h-16, 16, 16);
|
||||
core.drawImage(ctx, background, 176,48, 16, 16, x+w-16, y+h-16, 16, 16);
|
||||
|
||||
// arrow
|
||||
if(px != null && py != null){
|
||||
if(direction == 'up'){
|
||||
dstImage.drawImage(background,128,96,32,32,px,y+h-3,32,32);
|
||||
core.drawImage(ctx, background,128,96,32,32,px,y+h-3,32,32);
|
||||
}else if(direction == 'down') {
|
||||
dstImage.drawImage(background,160,96,32,32,px,y-29,32,32);
|
||||
core.drawImage(ctx, background,160,96,32,32,px,y-29,32,32);
|
||||
}
|
||||
}
|
||||
// 仿RM窗口皮肤 ↑
|
||||
@ -815,7 +919,7 @@ ui.prototype._drawBackground_drawWindowSkin = function (background, left, top, r
|
||||
ui.prototype._drawBackground_drawColor = function (background, left, top, right, bottom, position, px, py, xoffset, yoffset) {
|
||||
var alpha = background[3];
|
||||
core.setAlpha('ui', alpha);
|
||||
core.setStrokeStyle('ui', core.status.globalAttribute.borderColor);
|
||||
core.setStrokeStyle('ui', core.arrayToRGBA(core.status.globalAttribute.borderColor));
|
||||
core.setFillStyle('ui', core.arrayToRGB(background));
|
||||
core.setLineWidth('ui', 2);
|
||||
// 绘制
|
||||
@ -868,6 +972,7 @@ ui.prototype._getDrawableIconInfo = function (id) {
|
||||
if (id && id.indexOf('flag:') === 0) {
|
||||
id = core.getFlag(id.substring(5), id);
|
||||
}
|
||||
id = core.getIdOfThis(id);
|
||||
var image = null, icon = null;
|
||||
["terrains","animates","items","npcs","enemys"].forEach(function (v) {
|
||||
if (core.material.icons[v][id] != null) {
|
||||
@ -903,8 +1008,7 @@ ui.prototype.drawTextContent = function (ctx, content, config) {
|
||||
config.left = config.left || 0;
|
||||
config.right = config.left + (config.maxWidth == null ? (ctx != null ? ctx.canvas.width : core.__PIXELS__) : config.maxWidth)
|
||||
config.top = config.top || 0;
|
||||
config.color = config.color || textAttribute.text;
|
||||
if (config.color instanceof Array) config.color = core.arrayToRGBA(config.color);
|
||||
config.color = core.arrayToRGBA(config.color || textAttribute.text);
|
||||
if (config.bold == null) config.bold = textAttribute.bold;
|
||||
config.italic = false;
|
||||
config.align = config.align || textAttribute.align || "left";
|
||||
@ -957,7 +1061,7 @@ ui.prototype._drawTextContent_draw = function (ctx, tempCtx, content, config) {
|
||||
if (config.index >= config.blocks.length) return false;
|
||||
var block = config.blocks[config.index++];
|
||||
if (block != null) {
|
||||
ctx.drawImage(tempCtx.canvas, block.left, block.top, block.width, block.height,
|
||||
core.drawImage(ctx, tempCtx.canvas, block.left, block.top, block.width, block.height,
|
||||
config.left + block.left + block.marginLeft, config.top + block.top + block.marginTop,
|
||||
block.width, block.height);
|
||||
}
|
||||
@ -1195,18 +1299,14 @@ ui.prototype.drawTextBox = function(content, showAll) {
|
||||
ui.prototype._drawTextBox_drawImages = function (content) {
|
||||
return content.replace(/(\f|\\f)\[(.*?)]/g, function (text, sympol, str) {
|
||||
var ss = str.split(",");
|
||||
if (ss.length!=3 && ss.length!=5 && ss.length!=9) return "";
|
||||
ss[0] = core.getMappedName(ss[0]);
|
||||
var img = core.material.images.images[ss[0]];
|
||||
if (!img) return "";
|
||||
// 绘制
|
||||
if (ss.length==3)
|
||||
core.drawImage('ui', img, parseFloat(ss[1]), parseFloat(ss[2]));
|
||||
core.drawImage('ui', ss[0], parseFloat(ss[1]), parseFloat(ss[2]));
|
||||
else if (ss.length==5)
|
||||
core.drawImage('ui', img, 0, 0, img.width, img.height, parseFloat(ss[1]), parseFloat(ss[2]), parseFloat(ss[3]), parseFloat(ss[4]));
|
||||
core.drawImage('ui', ss[0], parseFloat(ss[1]), parseFloat(ss[2]), parseFloat(ss[3]), parseFloat(ss[4]));
|
||||
else if (ss.length==9 || ss.length==10) {
|
||||
if (ss.length==10) core.setAlpha('ui', parseFloat(ss[9]));
|
||||
core.drawImage('ui', img, parseFloat(ss[1]), parseFloat(ss[2]), parseFloat(ss[3]), parseFloat(ss[4]), parseFloat(ss[5]), parseFloat(ss[6]), parseFloat(ss[7]), parseFloat(ss[8]));
|
||||
core.drawImage('ui', ss[0], parseFloat(ss[1]), parseFloat(ss[2]), parseFloat(ss[3]), parseFloat(ss[4]), parseFloat(ss[5]), parseFloat(ss[6]), parseFloat(ss[7]), parseFloat(ss[8]));
|
||||
core.setAlpha('ui', 1);
|
||||
}
|
||||
return "";
|
||||
@ -1298,10 +1398,20 @@ ui.prototype._drawTextBox_drawTitleAndIcon = function (titleInfo, hPos, vPos, al
|
||||
core.status.boxAnimateObjs = [];
|
||||
// --- 勇士
|
||||
if (titleInfo.image == core.material.images.hero) {
|
||||
core.clearMap('ui', hPos.left + 15, image_top, 32, 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);
|
||||
if (core.status.hero.animate) {
|
||||
var direction = core.getHeroLoc('direction');
|
||||
if (direction == 'up') direction = 'down';
|
||||
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': 4,
|
||||
'image': titleInfo.image, 'pos': core.material.icons.hero[direction].loc * titleInfo.height
|
||||
})
|
||||
} else {
|
||||
core.clearMap('ui', hPos.left + 15, image_top, 32, 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({
|
||||
@ -1472,8 +1582,7 @@ ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, v
|
||||
core.setTextAlign('ui', 'center');
|
||||
core.setFont('ui', this._buildFont(17, true));
|
||||
for (var i = 0; i < choices.length; i++) {
|
||||
var color = choices[i].color || core.status.textAttribute.text;
|
||||
if (color instanceof Array) color = core.arrayToRGBA(color);
|
||||
var color = core.arrayToRGBA(choices[i].color || core.status.textAttribute.text);
|
||||
core.setFillStyle('ui', color);
|
||||
var offset = this.HPIXEL;
|
||||
if (choices[i].icon) {
|
||||
@ -1496,8 +1605,8 @@ ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, v
|
||||
this.drawWindowSelector(core.status.textAttribute.background,
|
||||
this.HPIXEL - len/2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20, len + 10, 28);
|
||||
else
|
||||
core.strokeRect('ui', this.HPIXEL - len/2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20,
|
||||
len+10, 28, "#FFD700", 2);
|
||||
core.strokeRoundRect('ui', this.HPIXEL - len/2 - 5, vPos.choice_top + 32 * core.status.event.selection - 20,
|
||||
len+10, 28, 6, "#FFD700", 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1536,7 +1645,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
||||
if (isWindowSkin)
|
||||
this.drawWindowSelector(core.status.textAttribute.background, strokeLeft, rect.bottom-35-20, len+10, 28);
|
||||
else
|
||||
core.strokeRect('ui', strokeLeft, rect.bottom-35-20, len+10, 28, "#FFD700", 2);
|
||||
core.strokeRoundRect('ui', strokeLeft, rect.bottom-35-20, len+10, 28, 6, "#FFD700", 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1567,16 +1676,15 @@ ui.prototype.drawWaiting = function(text) {
|
||||
ui.prototype.drawSwitchs = function() {
|
||||
core.status.event.id = 'switchs';
|
||||
var choices = [
|
||||
"背景音乐: "+(core.musicStatus.bgmStatus ? "[ON]" : "[OFF]"),
|
||||
"背景音效: "+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
|
||||
"音乐/音效: "+(core.musicStatus.bgmStatus ? "[ON]" : "[OFF]") + " "+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
|
||||
//显示为 0~10 十挡
|
||||
" < 音量:" + Math.round(Math.sqrt(100 * core.musicStatus.userVolume)) + " > ",
|
||||
//数值越大耗时越长
|
||||
" < 步时:" + core.values.moveSpeed + " > ",
|
||||
" < 转场:" + core.values.floorChangeTime + " > ",
|
||||
" < 放缩:" + Math.max(core.domStyle.scale, 1) + "x > ",
|
||||
"怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
|
||||
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
|
||||
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
|
||||
"临界/领域: "+(core.flags.displayCritical ? "[ON]" : "[OFF]")+" "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
|
||||
"血瓶绕路: "+(core.hasFlag('__potionNoRouting__') ? "[ON]":"[OFF]"),
|
||||
"单击瞬移: "+(!core.hasFlag("__noClickMove__") ? "[ON]":"[OFF]"),
|
||||
"返回主菜单"
|
||||
@ -1750,7 +1858,7 @@ ui.prototype._drawBook_drawOne = function (floorId, index, enemy, pageinfo, sele
|
||||
this._drawBook_drawName(index, enemy, top, left, name_width);
|
||||
this._drawBook_drawContent(index, enemy, top, left + name_width);
|
||||
if (selected)
|
||||
core.strokeRect('ui', 10, top + 1, this.PIXEL - 10 * 2, pageinfo.per_height, '#FFD700');
|
||||
core.strokeRoundRect('ui', 10, top + 1, this.PIXEL - 10 * 2, pageinfo.per_height, 10, '#FFD700');
|
||||
}
|
||||
|
||||
ui.prototype._drawBook_drawBox = function (index, enemy, top, pageinfo) {
|
||||
@ -1882,7 +1990,7 @@ ui.prototype.drawBookDetail = function (index) {
|
||||
core.fillRect('data', left, top, width, height, '#000000');
|
||||
core.setAlpha('data', 1);
|
||||
core.strokeRect('data', left - 1, top - 1, width + 1, height + 1,
|
||||
core.status.globalAttribute.borderColor, 2);
|
||||
core.arrayToRGBA(core.status.globalAttribute.borderColor), 2);
|
||||
|
||||
this._drawBookDetail_drawContent(enemy, content, {top: top, content_left: content_left, bottom: bottom, validWidth: validWidth});
|
||||
}
|
||||
@ -2273,7 +2381,7 @@ ui.prototype._drawToolbox_drawContent = function (info, line, items, page, drawC
|
||||
if (drawCount)
|
||||
core.fillText('ui', core.itemCount(item), 64 * (i % this.HSIZE) + 56, yoffset + 33, '#FFFFFF', this._buildFont(14, true));
|
||||
if (info.selectId == item)
|
||||
core.strokeRect('ui', 64 * (i % this.HSIZE) + 17, yoffset - 4, 40, 40, '#FFD700');
|
||||
core.strokeRoundRect('ui', 64 * (i % this.HSIZE) + 17, yoffset - 4, 40, 40, 6, '#FFD700');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2372,23 +2480,17 @@ ui.prototype._drawEquipbox_description = function (info, max_height) {
|
||||
}
|
||||
|
||||
ui.prototype._drawEquipbox_getStatusChanged = function (info, equip, equipType, y) {
|
||||
var compare, differentMode = null;
|
||||
if (info.index < this.LAST) compare = core.compareEquipment(null, info.selectId);
|
||||
else {
|
||||
if (equipType<0) differentMode = '<当前没有该装备的空位,请先卸下装备>';
|
||||
else {
|
||||
var last = core.material.items[info.equipEquipment[equipType]]||{};
|
||||
if (last.equip && (last.equip.percentage || false) != (equip.equip.percentage || false))
|
||||
differentMode = '<数值和比例模式之间的切换不显示属性变化>';
|
||||
else
|
||||
compare = core.compareEquipment(info.selectId, info.equipEquipment[equipType]);
|
||||
}
|
||||
if (info.index < this.LAST) {
|
||||
// 光标在装备栏上:查询卸下装备属性
|
||||
return core.compareEquipment(null, info.selectId);
|
||||
}
|
||||
if (differentMode != null) {
|
||||
core.fillText('ui', differentMode, 10, y, '#CCCCCC', this._buildFont(14, false));
|
||||
return;
|
||||
if (equipType < 0) {
|
||||
// 没有空位
|
||||
core.fillText('ui', '<当前没有该装备的空位,请先卸下装备>', 10, y, '#CCCCCC', this._buildFont(14, false));
|
||||
return null;
|
||||
}
|
||||
return compare;
|
||||
// 光标在装备上:查询装上后的属性变化
|
||||
return core.compareEquipment(info.selectId, info.equipEquipment[equipType]);
|
||||
}
|
||||
|
||||
ui.prototype._drawEquipbox_drawStatusChanged = function (info, y, equip, equipType) {
|
||||
@ -2398,19 +2500,19 @@ ui.prototype._drawEquipbox_drawStatusChanged = function (info, y, equip, equipTy
|
||||
|
||||
// --- 变化值...
|
||||
core.setFont('ui', this._buildFont(14, true));
|
||||
for (var name in compare) {
|
||||
for (var name in core.status.hero) {
|
||||
if (typeof core.status.hero[name] != 'number') continue;
|
||||
var nowValue = core.getRealStatus(name);
|
||||
// 查询新值
|
||||
var newValue = (core.getStatus(name) + (compare.value[name] || 0))
|
||||
* (core.getBuff(name) + (compare.percentage[name] || 0) / 100);
|
||||
if (nowValue == newValue) continue;
|
||||
var text = this._drawEquipbox_getStatusName(name);
|
||||
this._drawEquipbox_drawStatusChanged_draw(text + " ", '#CCCCCC', obj);
|
||||
var nowValue = core.getStatus(name) * core.getBuff(name), newValue = (core.getStatus(name) + compare[name]) * core.getBuff(name);
|
||||
if (equip.equip.percentage) {
|
||||
var nowBuff = core.getBuff(name), newBuff = nowBuff + compare[name] / 100;
|
||||
nowValue = Math.floor(nowBuff * core.getStatus(name));
|
||||
newValue = Math.floor(newBuff * core.getStatus(name));
|
||||
}
|
||||
nowValue = core.formatBigNumber(nowValue);
|
||||
newValue = core.formatBigNumber(newValue);
|
||||
this._drawEquipbox_drawStatusChanged_draw(nowValue+"->", '#CCCCCC', obj);
|
||||
this._drawEquipbox_drawStatusChanged_draw(newValue, compare[name]>0?'#00FF00':'#FF0000', obj);
|
||||
this._drawEquipbox_drawStatusChanged_draw(newValue, newValue>nowValue?'#00FF00':'#FF0000', obj);
|
||||
obj.drawOffset += 8;
|
||||
}
|
||||
}
|
||||
@ -2448,7 +2550,7 @@ ui.prototype._drawEquipbox_drawEquiped = function (info, line) {
|
||||
core.drawImage('ui', core.material.images.items, 0, 32 * icon, 32, 32, offset_image, y, 32, 32);
|
||||
}
|
||||
core.fillText('ui', info.allEquips[i] || "未知", offset_text, y + 27, '#FFFFFF', this._buildFont(16, true))
|
||||
core.strokeRect('ui', offset_image - 4, y - 4, 40, 40, info.index==i?'#FFD700':"#FFFFFF");
|
||||
core.strokeRoundRect('ui', offset_image - 4, y - 4, 40, 40, 6, info.index==i?'#FFD700':"#FFFFFF");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2541,14 +2643,16 @@ ui.prototype._drawSLPanel_drawRecord = function(title, data, x, y, size, cho, hi
|
||||
core.fillText('ui', title, x, y, highLight?'#FFD700':'#FFFFFF', this._buildFont(17, true));
|
||||
core.strokeRect('ui', x-size/2, y+15, size, size, cho?strokeColor:'#FFFFFF', cho?6:2);
|
||||
if (data && data.floorId) {
|
||||
core.drawThumbnail(data.floorId, core.maps.loadMap(data.maps, data.floorId).blocks, {
|
||||
var map = core.maps.loadMap(data.maps, data.floorId);
|
||||
core.extractBlocks(map);
|
||||
core.drawThumbnail(data.floorId, map.blocks, {
|
||||
heroLoc: data.hero.loc, heroIcon: data.hero.image, flags: data.hero.flags
|
||||
}, {
|
||||
ctx: 'ui', x: x-size/2, y: y+15, size: size, centerX: data.hero.loc.x, centerY: data.hero.loc.y
|
||||
});
|
||||
if (core.isPlaying() && core.getFlag("hard") != data.hero.flags.hard) {
|
||||
core.fillRect('ui', x-size/2, y+15, size, size, [0, 0, 0, 0.4], 2);
|
||||
core.fillText('ui', data.hard, x, parseInt(y+22+size/2), core.dom.hard.style.color, this._buildFont(30,true));
|
||||
core.fillText('ui', data.hard, x, parseInt(y+22+size/2), data.hero.flags.__hardColor__ || 'red', this._buildFont(30,true));
|
||||
}
|
||||
var v = core.formatBigNumber(data.hero.hp,true)+"/"+core.formatBigNumber(data.hero.atk,true)+"/"+core.formatBigNumber(data.hero.def,true);
|
||||
var v2 = "/"+core.formatBigNumber(data.hero.mdef,true);
|
||||
@ -2631,7 +2735,7 @@ ui.prototype.drawKeyBoard = function () {
|
||||
if (isWindowSkin)
|
||||
this.drawWindowSelector(core.status.textAttribute.background, this.HPIXEL + 92, offset - 22, 72, 27);
|
||||
else
|
||||
core.strokeRect('ui', this.HPIXEL + 92, offset - 22, 72, 27, "#FFD700", 2);
|
||||
core.strokeRoundRect('ui', this.HPIXEL + 92, offset - 22, 72, 27, 6, "#FFD700", 2);
|
||||
}
|
||||
|
||||
////// 绘制状态栏 /////
|
||||
@ -2711,6 +2815,7 @@ ui.prototype._drawStatistics_add = function (floorId, obj, x1, x2, value) {
|
||||
}
|
||||
|
||||
ui.prototype._drawStatistics_floorId = function (floorId, obj) {
|
||||
core.extractBlocks(floorId);
|
||||
var floor = core.status.maps[floorId], blocks = floor.blocks;
|
||||
// 隐藏层不给看
|
||||
if (floor.cannotViewMap && floorId!=core.status.floorId) return;
|
||||
@ -2741,8 +2846,7 @@ ui.prototype._drawStatistics_items = function (floorId, floor, id, obj) {
|
||||
if (obj.cls[id]=='items' && id!='superPotion') {
|
||||
var temp = core.clone(core.status.hero);
|
||||
core.setFlag("__statistics__", true);
|
||||
var ratio = floor.item_ratio||1;
|
||||
try { eval(core.items.itemEffect[id]); }
|
||||
try { eval(core.material.items[id].itemEffect); }
|
||||
catch (e) {}
|
||||
hp = core.status.hero.hp - temp.hp;
|
||||
atk = core.status.hero.atk - temp.atk;
|
||||
|
||||
@ -352,13 +352,13 @@ utils.prototype.splitImage = function (image, width, height) {
|
||||
width = width || 32;
|
||||
height = height || width;
|
||||
var canvas = document.createElement("canvas");
|
||||
var context = canvas.getContext("2d");
|
||||
var ctx = canvas.getContext("2d");
|
||||
var ans = [];
|
||||
for (var j = 0; j < image.height; j += height) {
|
||||
for (var i = 0; i < image.width; i += width) {
|
||||
var w = Math.min(width, image.width - i), h = Math.min(height, image.height - j);
|
||||
canvas.width = w; canvas.height = h;
|
||||
context.drawImage(image, i, j, w, h, 0, 0, w, h);
|
||||
core.drawImage(ctx, image, i, j, w, h, 0, 0, w, h);
|
||||
var img = new Image();
|
||||
img.src = canvas.toDataURL("image/png");
|
||||
ans.push(img);
|
||||
@ -392,9 +392,16 @@ utils.prototype.setTwoDigits = function (x) {
|
||||
return parseInt(x) < 10 ? "0" + x : x;
|
||||
}
|
||||
|
||||
utils.prototype.formatSize = function (size) {
|
||||
if (size < 1024) return size + 'B';
|
||||
else if (size < 1024 * 1024) return (size/1024).toFixed(2) + "KB";
|
||||
else return (size/1024/1024).toFixed(2) + "MB";
|
||||
}
|
||||
|
||||
utils.prototype.formatBigNumber = function (x, onMap) {
|
||||
x = Math.floor(parseFloat(x));
|
||||
if (!core.isset(x)) return '???';
|
||||
if (x > 1e24 || x < -1e24) return x;
|
||||
|
||||
var c = x < 0 ? "-" : "";
|
||||
x = Math.abs(x);
|
||||
@ -430,12 +437,14 @@ utils.prototype.formatBigNumber = function (x, onMap) {
|
||||
|
||||
////// 数组转RGB //////
|
||||
utils.prototype.arrayToRGB = function (color) {
|
||||
if (!(color instanceof Array)) return color;
|
||||
var nowR = this.clamp(parseInt(color[0]), 0, 255), nowG = this.clamp(parseInt(color[1]), 0, 255),
|
||||
nowB = this.clamp(parseInt(color[2]), 0, 255);
|
||||
return "#" + ((1 << 24) + (nowR << 16) + (nowG << 8) + nowB).toString(16).slice(1);
|
||||
}
|
||||
|
||||
utils.prototype.arrayToRGBA = function (color) {
|
||||
if (!(color instanceof Array)) return color;
|
||||
if (color[3] == null) color[3] = 1;
|
||||
var nowR = this.clamp(parseInt(color[0]), 0, 255), nowG = this.clamp(parseInt(color[1]), 0, 255),
|
||||
nowB = this.clamp(parseInt(color[2]), 0, 255), nowA = this.clamp(parseFloat(color[3]), 0, 1);
|
||||
@ -1082,20 +1091,6 @@ utils.prototype._decodeCanvas = function (arr, width, height) {
|
||||
tempCanvas.putImageData(imgData, 0, 0);
|
||||
}
|
||||
|
||||
utils.prototype.hashCode = function (obj) {
|
||||
if (typeof obj == 'string') {
|
||||
var hash = 0, i, chr;
|
||||
if (obj.length === 0) return hash;
|
||||
for (i = 0; i < obj.length; i++) {
|
||||
chr = obj.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash |= 0;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
return this.hashCode(JSON.stringify(obj).split("").sort().join(""));
|
||||
}
|
||||
|
||||
utils.prototype.same = function (a, b) {
|
||||
if (a == null && b == null) return true;
|
||||
if (a == null || b == null) return false;
|
||||
@ -1119,51 +1114,6 @@ utils.prototype.same = function (a, b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
utils.prototype._export = function (floorIds) {
|
||||
if (!floorIds) floorIds = [core.status.floorId];
|
||||
else if (floorIds == 'all') floorIds = core.clone(core.floorIds);
|
||||
else if (typeof floorIds == 'string') floorIds = [floorIds];
|
||||
|
||||
var monsterMap = {};
|
||||
|
||||
// map
|
||||
var content = floorIds.length + "\n" + core.__SIZE__ + " " + core.__SIZE__ + "\n\n";
|
||||
floorIds.forEach(function (floorId) {
|
||||
var arr = core.maps._getMapArrayFromBlocks(core.status.maps[floorId].blocks, core.__SIZE__, core.__SIZE__);
|
||||
content += arr.map(function (x) {
|
||||
// check monster
|
||||
x.forEach(function (t) {
|
||||
var block = core.maps.getBlockByNumber(t);
|
||||
if (block.event.cls.indexOf("enemy") == 0) {
|
||||
monsterMap[t] = block.event.id;
|
||||
}
|
||||
})
|
||||
return x.join("\t");
|
||||
}).join("\n") + "\n\n";
|
||||
})
|
||||
|
||||
// values
|
||||
content += ["redJewel", "blueJewel", "greenJewel", "redPotion", "bluePotion",
|
||||
"yellowPotion", "greenPotion", "sword1", "shield1"].map(function (x) {
|
||||
return core.values[x] || 0;
|
||||
}).join(" ") + "\n\n";
|
||||
|
||||
// monster
|
||||
content += Object.keys(monsterMap).length + "\n";
|
||||
for (var t in monsterMap) {
|
||||
var id = monsterMap[t], monster = core.material.enemys[id];
|
||||
content += t + " " + monster.hp + " " + monster.atk + " " +
|
||||
monster.def + " " + monster.money + " " + monster.special + "\n";
|
||||
}
|
||||
content += "\n0 0 0 0 0 0\n\n";
|
||||
content += core.status.hero.hp + " " + core.status.hero.atk + " "
|
||||
+ core.status.hero.def + " " + core.status.hero.mdef + " " + core.status.hero.money + " "
|
||||
+ core.itemCount('yellowKey') + " " + core.itemCount("blueKey") + " " + core.itemCount("redKey") + " 0 "
|
||||
+ core.status.hero.loc.x + " " + core.status.hero.loc.y + "\n";
|
||||
|
||||
console.log(content);
|
||||
}
|
||||
|
||||
utils.prototype.unzip = function (blobOrUrl, success, error, convertToText, onprogress) {
|
||||
var _error = function (msg) {
|
||||
main.log(msg);
|
||||
@ -1227,7 +1177,7 @@ utils.prototype.http = function (type, url, formData, success, error, mimeType,
|
||||
};
|
||||
xhr.onprogress = function (e) {
|
||||
if (e.lengthComputable) {
|
||||
if (onprogress) onprogress(e.loaded / e.total);
|
||||
if (onprogress) onprogress(e.loaded, e.total);
|
||||
}
|
||||
}
|
||||
xhr.onabort = function () {
|
||||
|
||||
45
main.js
@ -85,7 +85,7 @@ function main() {
|
||||
'data', 'enemys', 'icons', 'maps', 'items', 'functions', 'events', 'plugins'
|
||||
];
|
||||
this.materials = [
|
||||
'animates', 'enemys', 'items', 'npcs', 'terrains', 'enemy48', 'npc48'
|
||||
'animates', 'enemys', 'items', 'npcs', 'terrains', 'enemy48', 'npc48', 'icons'
|
||||
];
|
||||
|
||||
this.statusBar = {
|
||||
@ -186,8 +186,8 @@ function main() {
|
||||
this.floors = {}
|
||||
this.canvas = {};
|
||||
|
||||
this.__VERSION__ = "2.6.6";
|
||||
this.__VERSION_CODE__ = 99;
|
||||
this.__VERSION__ = "2.7";
|
||||
this.__VERSION_CODE__ = 127;
|
||||
}
|
||||
|
||||
main.prototype.init = function (mode, callback) {
|
||||
@ -197,24 +197,33 @@ main.prototype.init = function (mode, callback) {
|
||||
main.mode = mode;
|
||||
|
||||
main.loadJs('project', main.pureData, function(){
|
||||
if (items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect
|
||||
&& items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip) {
|
||||
alert('即将跳转到接档工具...');
|
||||
window.location = 'migration.html';
|
||||
return;
|
||||
}
|
||||
|
||||
var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
|
||||
for(var ii in mainData)main[ii]=mainData[ii];
|
||||
|
||||
main.dom.startBackground.src="project/images/"+main.startBackground;
|
||||
main.dom.startLogo.style=main.startLogoStyle;
|
||||
main.dom.startButtonGroup.style = main.startButtonsStyle;
|
||||
main.levelChoose.forEach(function(value){
|
||||
main.dom.startBackground.src = main.styles.startBackground;
|
||||
main.dom.startLogo.style=main.styles.startLogoStyle;
|
||||
main.dom.startButtonGroup.style = main.styles.startButtonsStyle;
|
||||
main.levelChoose = main.levelChoose || [];
|
||||
main.levelChoose.forEach(function (value) {
|
||||
var span = document.createElement('span');
|
||||
span.setAttribute('class','startButton');
|
||||
span.innerText=value[0];
|
||||
span.innerText=value.title || '';
|
||||
(function(span,str_){
|
||||
span.onclick = function () {
|
||||
core.events.startGame(str_);
|
||||
}
|
||||
})(span,value[1]);
|
||||
})(span,value.name||'');
|
||||
main.dom.levelChooseButtons.appendChild(span);
|
||||
});
|
||||
main.createOnChoiceAnimation();
|
||||
main.importFonts(main.fonts);
|
||||
|
||||
main.loadJs('libs', main.loadList, function () {
|
||||
main.core = core;
|
||||
@ -371,6 +380,19 @@ main.prototype.selectButton = function (index) {
|
||||
}
|
||||
}
|
||||
|
||||
////// 创建字体 //////
|
||||
main.prototype.importFonts = function (fonts) {
|
||||
if (!(fonts instanceof Array) || fonts.length == 0) return;
|
||||
var style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
var html = '';
|
||||
fonts.forEach(function (font) {
|
||||
html += '@font-face { font-family: "'+font+'"; src: url("project/fonts/'+font+'.ttf") format("truetype")';
|
||||
});
|
||||
style.innerHTML = html;
|
||||
document.body.appendChild(style);
|
||||
}
|
||||
|
||||
main.prototype.listen = function () {
|
||||
|
||||
////// 窗口大小变化时 //////
|
||||
@ -710,10 +732,9 @@ main.dom.playGame.onclick = function () {
|
||||
main.dom.startButtons.style.display='none';
|
||||
main.core.control.checkBgm();
|
||||
|
||||
if (main.core.isset(main.core.flags.startDirectly) && main.core.flags.startDirectly) {
|
||||
if (main.levelChoose.length == 0) {
|
||||
core.events.startGame("");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
main.dom.levelChooseButtons.style.display='block';
|
||||
main.selectedButton = null;
|
||||
main.selectButton(0);
|
||||
|
||||
587
migration.html
Normal file
@ -0,0 +1,587 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv='content-type' content='text/html' charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=Edge, chrome=1'>
|
||||
<meta name='author' content='ckcz123'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=yes'>
|
||||
<title>HTML5魔塔样板V2.7接档工具</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>HTML5魔塔样板V2.7接档工具</h1>
|
||||
|
||||
<script src='_server/fs.js'></script>
|
||||
<script src='project/data.js'></script>
|
||||
<script src='project/enemys.js'></script>
|
||||
<script src='project/functions.js'></script>
|
||||
<script src='project/icons.js'></script>
|
||||
<script src='project/items.js'></script>
|
||||
<script src='project/maps.js'></script>
|
||||
<script src='project/plugins.js'></script>
|
||||
|
||||
<script>
|
||||
// 检查脚本编辑和插件编写;这两个绝对不能接
|
||||
if (functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.events.setInitData || !plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1.shop) {
|
||||
document.write("<h2 style='color:red'>错误:请勿覆盖脚本编辑(functions.js)和插件编写(plugins.js)!<br/>请从全新的V2.7样板中复制一个functions.js和plugins.js到project文件夹,再继续接档操作。</h2>");
|
||||
} else {
|
||||
document.write("<p><button id='action' onclick='action()'>点此一键接档</button><p><p id='message' style='color:red; display:none'>接档成功!请重启编辑器并继续以下接档流程;若仍然无法打开编辑器请联系小艾处理。</p>");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<h2>请严格按照如下流程,一步步进行接档操作。请勿随意增删接档过程,以免出现编辑器白屏、闪退等情况。</h2>
|
||||
|
||||
<p>
|
||||
<ol>
|
||||
<li><b style="color:red">做好备份,做好备份,做好备份!!!</b>接档前请一定先做好备份!</li>
|
||||
<li>使用RM转H5刻塔器所刻的塔不适用于此接档工具。</li>
|
||||
<li>将V2.6.6样板中project目录下,除了<code>project/functions.js</code>和<code>project/plugins.js</code>以外的其他文件和文件夹,直接复制到最新的V2.7样板中,然后打开本接档工具。</li>
|
||||
<li>点击上述的「点此一键接档」,并看到红字提示接档成功。此时编辑器应该可以正常打开。若此时无法打开编辑器请联系小艾处理。</li>
|
||||
<li>下拉框切到「全塔属性」,并注意以下内容:
|
||||
<ul>
|
||||
<li>现在素材和使用的其他图片等在文件夹中被拆分,请检查对应的图片文件已经正确移动到对应的文件夹。</li>
|
||||
<li>「难度选择项」的逻辑在V2.7中被修改;请重新制作。</li>
|
||||
<li>「全局商店」的结构在V2.7中被修改;请重新制作。</li>
|
||||
<li>部分方框进行了合并,请一个个仔细检查是否存在问题。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>下拉框切到「楼层属性」,并注意以下内容:
|
||||
<ul>
|
||||
<li><code>item_ratio</code>被重命名为<code>ratio</code>,请自行修改。</li>
|
||||
<li>楼层贴图的结构在V2.7中被修改;请重新制作。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>素材区的如下图块有所变动:
|
||||
<ul>
|
||||
<li>三色墙和六色门从terrains中解除引用;请用animates中的进行绘制。</li>
|
||||
<li>如下图块的图块属性已被重置:三色墙、六色门、四色网、四个单向箭头、亮灯。</li>
|
||||
<li>所有的<code>noPass:false</code>都改成<code>canPass:true</code>;请仔细检查可通行性。</li>
|
||||
<li>如下道具的道具属性已被重置,请仔细检查:三色钥匙、四色宝石(已改名Gem)、四色血瓶、破墙、破冰、炸弹、地震、冰冻、大黄门钥匙、上下楼器。</li>
|
||||
<li>即时道具获得的说明和提示文字均改成了<code>${}</code>计算,<code>ratio</code>需写明全称(参见宝石血瓶写法),请自行处理。</li>
|
||||
<li>npc48的默认动画帧数<code>null</code>改回为4;如需静止状态请手动改成1。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>下拉框切换到「脚本编辑」,并请重新编辑各个自己改过的函数(可以双开一个原版V266项目和当前接档的项目进行处理)。
|
||||
<ul>
|
||||
<li>请注意:V2.7中的经验全部从<code>experience</code>替换成简写的<code>exp</code>;写伤害计算等时请尤其注意。</li>
|
||||
<li>部分文案有所改变,如「阻击」从<code>snipe</code>改名<code>repulse</code>,<code>shoes</code>改名<code>amulet</code>等等,请自行处理。</li>
|
||||
<li><code>setInitData</code>已被删除,请将需要的额外初始化代码写入<code>startText</code>中。</li>
|
||||
<li><code>afterChangeLight, afterUseBomb, afterPassNet</code>已被删除,请去对应图块属性内修改。</li>
|
||||
<li>其他基本每个函数都有大幅修改,<b style="color:red">请勿直接拿原来的脚本整体覆盖,而是重新对函数进行需要的编辑!</b></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>下拉框切换到「插件编写」,并重新新增自己加过的插件。
|
||||
<ul>
|
||||
<li>V2.7不能保证插件的兼容性,请谨慎测试。</li>
|
||||
<li>如果插件出现不可用问题,请自行联系插件原作者更新插件到支持V2.7的版本。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>请仔细检查每个道具的道具效果、每个怪物的属性、每个楼层属性、以及每个点的事件(建议双开对比)。主要变动如下:
|
||||
<ul>
|
||||
<li>「数值增减」事件已被删除并被数值操作+运算符替代,编辑器将解析为自定义事件;但是游戏中仍然可以正确执行(你可以选择替换与否)。</li>
|
||||
<li>「隐藏事件」将不再默认删除该点(而只是纯粹的隐藏);请给有需要的「隐藏事件」勾选「同时删除」选项。</li>
|
||||
<li>「绘制圆」「绘制圆边框」「重启当前事件」已经被删除,并且无法再在游戏中使用,请替换成等价的写法。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b style='color:red'>接档后请做好充分的测试!最好能跑通录像以确认接档无误!</b></li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
<script>
|
||||
|
||||
function action() {
|
||||
action_data(function() {
|
||||
action_enemys(function() {
|
||||
action_icons(function() {
|
||||
action_items(function() {
|
||||
action_maps(function() {
|
||||
alert('接档成功!请重启编辑器并继续以下接档流程;若仍然无法打开编辑器请联系小艾处理。');
|
||||
document.getElementById('action').style.display = 'none';
|
||||
document.getElementById('message').style.display = 'block';
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function encode(str) {
|
||||
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
||||
return String.fromCharCode(parseInt(p1, 16))
|
||||
}))
|
||||
}
|
||||
|
||||
// 接档全局属性
|
||||
function action_data(callback) {
|
||||
var data = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d;
|
||||
var main = data.main, firstData = data.firstData, values = data.values, flags = data.flags;
|
||||
|
||||
// Step 0: 移动目录
|
||||
// materials
|
||||
['animates', 'enemys', 'items', 'npcs', 'terrains', 'enemy48', 'npc48', 'icons', 'airwall', 'fog', 'keyboard'].forEach(function (one) {
|
||||
fs.moveFile('project/images/'+one+".png", 'project/materials/'+one+'.png', function (e, d) {});
|
||||
});
|
||||
main.tilesets.forEach(function (one) {
|
||||
if (one.indexOf('.')<0) one += '.png';
|
||||
fs.moveFile('project/images/'+one, 'project/tilesets/'+one, function (e, d) {});
|
||||
});
|
||||
// bgms
|
||||
main.bgms.forEach(function (one) {
|
||||
fs.moveFile('project/sounds/'+one, 'project/bgms/'+one, function (e,d) {});
|
||||
})
|
||||
|
||||
// Step 1: 重置levelChoose和shop
|
||||
main.levelChoose = [];
|
||||
firstData.shops = [];
|
||||
main.fonts = [];
|
||||
|
||||
// Step 2: 合并main.styles
|
||||
if (!main.styles) main.styles = {
|
||||
"startBackground": "project/images/bg.jpg",
|
||||
"startLogoStyle": "color: black",
|
||||
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;",
|
||||
"statusLeftBackground": "url(project/materials/ground.png) repeat",
|
||||
"statusTopBackground": "url(project/materials/ground.png) repeat",
|
||||
"toolsBackground": "url(project/materials/ground.png) repeat",
|
||||
"borderColor": [204,204,204,1],
|
||||
"statusBarColor": [255,255,255,1],
|
||||
"floorChangingStyle": "background-color: black; color: white",
|
||||
"font": "Verdana"
|
||||
};
|
||||
["startLogoStyle", "startButtonsStyle", "statusLeftBackground", "statusTopBackground", "toolsBackground", "font"].forEach(function (one) {
|
||||
if (main[one]) main.styles[one] = main[one];
|
||||
})
|
||||
for (var key in main.styles) delete main[key];
|
||||
delete main.floorChangingBackground; delete main.floorChangingTextColor;
|
||||
|
||||
// Step 3: 重置勇士属性
|
||||
if (main.images.indexOf('hero.png') < 0) main.images.push('hero.png');
|
||||
firstData.hero.image = 'hero.png';
|
||||
firstData.hero.followers = [];
|
||||
if (firstData.hero.exp == null) firstData.hero.exp = firstData.hero.experience;
|
||||
delete firstData.hero.experience;
|
||||
delete firstData.hero.items.keys;
|
||||
|
||||
// Step 4: 重置全局开关
|
||||
if (values.statusCanvasRowsOnMobile == null)
|
||||
values.statusCanvasRowsOnMobile = flags.statusCanvasRowsOnMobile;
|
||||
delete flags.statusCanvasRowsOnMobile;
|
||||
if (values.redGem == null) values.redGem = values.redJewel;
|
||||
if (values.blueGem == null) values.blueGem = values.blueJewel;
|
||||
if (values.greenGem == null) values.greenGem = values.greenJewel;
|
||||
delete values.redJewel;
|
||||
delete values.blueJewel;
|
||||
delete values.greenJewel;
|
||||
delete values.moveSpeed;
|
||||
delete values.floorChangeTime;
|
||||
var statusList = [
|
||||
"enableFloor",
|
||||
"enableName",
|
||||
"enableLv",
|
||||
"enableHPMax",
|
||||
"enableHP",
|
||||
"enableMana",
|
||||
"enableAtk",
|
||||
"enableDef",
|
||||
"enableMDef",
|
||||
"enableMoney",
|
||||
"enableExp",
|
||||
"enableLevelUp",
|
||||
"levelUpLeftMode",
|
||||
"enableKeys",
|
||||
"enableGreenKey",
|
||||
"enablePZF",
|
||||
"enableDebuff",
|
||||
"enableSkill"
|
||||
];
|
||||
if (flags.statusBarItems == null) {
|
||||
flags.statusBarItems = [];
|
||||
statusList.forEach(function (one) {
|
||||
if (flags[one]) flags.statusBarItems.push(one);
|
||||
});
|
||||
}
|
||||
statusList.forEach(function (one) { delete flags[one]; });
|
||||
delete flags.pickaxeFourDirections;
|
||||
delete flags.bombFourDirections;
|
||||
delete flags.snowFourDirections;
|
||||
delete flags.bigKeyIsBox;
|
||||
delete flags.equipment;
|
||||
delete flags.iconInEquipbox;
|
||||
delete flags.hatredDecrease;
|
||||
delete flags.betweenAttackCeil;
|
||||
delete flags.startDirectly;
|
||||
delete flags.enableDisabledShop;
|
||||
delete flags.checkConsole;
|
||||
|
||||
// 写入
|
||||
var datastr = 'var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = \n';
|
||||
datastr += JSON.stringify(data, null, '\t');
|
||||
fs.writeFile('project/data.js', encode(datastr), 'base64', function (err, data) {
|
||||
if (err) {
|
||||
alert('datas接档失败!请查看控制台报错,并刷新重试。');
|
||||
console.error(err);
|
||||
} else callback();
|
||||
});
|
||||
}
|
||||
|
||||
// 接档怪物:experience->exp
|
||||
function action_enemys(callback) {
|
||||
var enemy = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
|
||||
for (var id in enemy) {
|
||||
if (enemy[id].experience != null) {
|
||||
enemy[id].exp = enemy[id].experience;
|
||||
}
|
||||
delete enemy[id].experience;
|
||||
}
|
||||
|
||||
var datastr = 'var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = \n';
|
||||
var emap = {};
|
||||
var estr = JSON.stringify(enemy, function (k, t) {
|
||||
if (t && t.hp != null) {
|
||||
delete t.id;
|
||||
var id_ = ":" + k + ":";
|
||||
emap[id_] = JSON.stringify(t);
|
||||
return id_;
|
||||
} else return t;
|
||||
}, '\t');
|
||||
for (var id_ in emap) {
|
||||
estr = estr.replace('"' + id_ + '"', emap[id_])
|
||||
}
|
||||
datastr += estr;
|
||||
fs.writeFile('project/enemys.js', encode(datastr), 'base64', function (err, data) {
|
||||
if (err) {
|
||||
alert('enemys接档失败!请查看控制台报错,并刷新重试。');
|
||||
console.error(err);
|
||||
} else callback();
|
||||
});
|
||||
}
|
||||
|
||||
function action_icons(callback) {
|
||||
var icons = icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1;
|
||||
var terrains = icons.terrains;
|
||||
// 三色墙&六色门
|
||||
delete terrains.yellowWall;
|
||||
delete terrains.blueWall;
|
||||
delete terrains.whiteWall;
|
||||
delete terrains.yellowDoor;
|
||||
delete terrains.blueDoor;
|
||||
delete terrains.redDoor;
|
||||
delete terrains.greenDoor;
|
||||
delete terrains.specialDoor;
|
||||
delete terrains.steelDoor;
|
||||
|
||||
// shop
|
||||
if (terrains.blueShopLeft == null) terrains.blueShopLeft = terrains['blueShop-left'];
|
||||
if (terrains.blueShopRight == null) terrains.blueShopRight = terrains['blueShop-right'];
|
||||
if (terrains.pinkShopLeft == null) terrains.pinkShopLeft = terrains['pinkShop-left'];
|
||||
if (terrains.pinkShopRight == null) terrains.pinkShopRight = terrains['pinkShop-right'];
|
||||
delete terrains['blueShop-left'];
|
||||
delete terrains['blueShop-right'];
|
||||
delete terrains['pinkShop-left'];
|
||||
delete terrains['pinkShop-right'];
|
||||
|
||||
if (icons.items.snow != null) icons.items.freezeBadge = icons.items.snow;
|
||||
delete icons.items.snow;
|
||||
|
||||
var datastr = 'var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = \n';
|
||||
datastr += JSON.stringify(icons, null, '\t');
|
||||
fs.writeFile('project/icons.js', encode(datastr), 'base64', function (err, data) {
|
||||
if (err) {
|
||||
alert('icons接档失败!请查看控制台报错,并刷新重试。');
|
||||
console.error(err);
|
||||
} else callback();
|
||||
});
|
||||
|
||||
Object.keys(icons.autotile).forEach(function (one) {
|
||||
fs.moveFile('project/images/'+one+'.png', 'project/autotiles/'+one+'.png', function (e,d) {});
|
||||
});
|
||||
}
|
||||
|
||||
function action_items(callback) {
|
||||
if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect || !items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
// Step 1: 合并内容
|
||||
var items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items;
|
||||
["itemEffect", "itemEffectTip", "useItemEvent", "useItemEffect", "canUseItemEffect", "equipCondition"].forEach(function(one) {
|
||||
var data = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a[one];
|
||||
if (!data) return;
|
||||
for (var id in data) {
|
||||
if (data[id] != null && items[id])
|
||||
items[id][one] = data[id];
|
||||
}
|
||||
});
|
||||
|
||||
// Step 2: 重置道具效果
|
||||
var data = {
|
||||
"yellowKey": {
|
||||
"cls": "tools",
|
||||
"name": "黄钥匙",
|
||||
"text": "可以打开一扇黄门",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"blueKey": {
|
||||
"cls": "tools",
|
||||
"name": "蓝钥匙",
|
||||
"text": "可以打开一扇蓝门",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"redKey": {
|
||||
"cls": "tools",
|
||||
"name": "红钥匙",
|
||||
"text": "可以打开一扇红门",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"redGem": {
|
||||
"cls": "items",
|
||||
"name": "红宝石",
|
||||
"text": "攻击+${core.values.redGem}",
|
||||
"itemEffect": "core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",攻击+${core.values.redGem * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.atk += core.values.redGem",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"blueGem": {
|
||||
"cls": "items",
|
||||
"name": "蓝宝石",
|
||||
"text": ",防御+${core.values.blueGem}",
|
||||
"itemEffect": "core.status.hero.def += core.values.blueGem * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",防御+${core.values.blueGem * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.def += core.values.blueGem",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"greenGem": {
|
||||
"cls": "items",
|
||||
"name": "绿宝石",
|
||||
"text": ",护盾+${core.values.greenGem}",
|
||||
"itemEffect": "core.status.hero.mdef += core.values.greenGem * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",护盾+${core.values.greenGem * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.mdef += core.values.greenGem",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"yellowGem": {
|
||||
"cls": "items",
|
||||
"name": "黄宝石",
|
||||
"text": "可以进行加点",
|
||||
"itemEffect": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
|
||||
"itemEffectTip": ",全属性提升",
|
||||
"useItemEvent": [
|
||||
{
|
||||
"type": "choices",
|
||||
"choices": [
|
||||
{
|
||||
"text": "攻击+1",
|
||||
"action": [
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "status:atk",
|
||||
"operator": "+=",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "防御+2",
|
||||
"action": [
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "status:def",
|
||||
"operator": "+=",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "生命+200",
|
||||
"action": [
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "status:hp",
|
||||
"operator": "+=",
|
||||
"value": "200"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"redPotion": {
|
||||
"cls": "items",
|
||||
"name": "红血瓶",
|
||||
"text": ",生命+${core.values.redPotion}",
|
||||
"itemEffect": "core.status.hero.hp += core.values.redPotion * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",生命+${core.values.redPotion * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.hp += core.values.redPotion",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"bluePotion": {
|
||||
"cls": "items",
|
||||
"name": "蓝血瓶",
|
||||
"text": ",生命+${core.values.bluePotion}",
|
||||
"itemEffect": "core.status.hero.hp += core.values.bluePotion * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",生命+${core.values.bluePotion * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.hp += core.values.bluePotion",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"yellowPotion": {
|
||||
"cls": "items",
|
||||
"name": "黄血瓶",
|
||||
"text": ",生命+${core.values.yellowPotion}",
|
||||
"itemEffect": "core.status.hero.hp += core.values.yellowPotion * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",生命+${core.values.yellowPotion * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.hp += core.values.yellowPotion",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"greenPotion": {
|
||||
"cls": "items",
|
||||
"name": "绿血瓶",
|
||||
"text": ",生命+${core.values.greenPotion}",
|
||||
"itemEffect": "core.status.hero.hp += core.values.greenPotion * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",生命+${core.values.greenPotion * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.hp += core.values.greenPotion",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"freezeBadge": {
|
||||
"cls": "constants",
|
||||
"name": "冰冻徽章",
|
||||
"text": "可以将面前的熔岩变成平地",
|
||||
"useItemEffect": "(function () {\n\tvar success = false;\n\n\tvar snowFourDirections = false; // 是否四方向雪花;如果是将其改成true\n\tif (snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (core.getBlockId(nx, ny) == 'lava') {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (core.getBlockId(core.nextX(), core.nextY()) == 'lava') {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"bigKey": {
|
||||
"cls": "tools",
|
||||
"name": "大黄门钥匙",
|
||||
"text": "可以开启当前层所有黄门",
|
||||
"itemEffect": "core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
|
||||
"itemEffectTip": ",全钥匙+1",
|
||||
"useItemEffect": "(function () {\n\tvar actions = core.searchBlock(\"yellowDoor\").map(function (block) {\n\t\treturn { \"type\": \"openDoor\", \"loc\": [block.x, block.y], \"async\": true };\n\t});\n\tactions.push({ \"type\": \"waitAsync\" });\n\tactions.push({ \"type\": \"tip\", \"text\": core.material.items[itemId].name + \"使用成功\" });\n\tcore.insertAction(actions);\n})();",
|
||||
"canUseItemEffect": "(function () {\n\treturn core.searchBlock('yellowDoor').length > 0;\n})();"
|
||||
},
|
||||
"pickaxe": {
|
||||
"cls": "tools",
|
||||
"name": "破墙镐",
|
||||
"text": "可以破坏勇士面前的墙",
|
||||
"useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"icePickaxe": {
|
||||
"cls": "tools",
|
||||
"name": "破冰镐",
|
||||
"text": "可以破坏勇士面前的一堵冰墙",
|
||||
"useItemEffect": "(function () {\n\tcore.removeBlock(core.nextX(), core.nextY());\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();",
|
||||
"canUseItemEffect": "(function () {\n\treturn core.getBlockId(core.nextX(), core.nextY()) == 'ice';\n})();"
|
||||
},
|
||||
"bomb": {
|
||||
"cls": "tools",
|
||||
"name": "炸弹",
|
||||
"text": "可以炸掉勇士面前的怪物",
|
||||
"useItemEffect": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"upFly": {
|
||||
"cls": "tools",
|
||||
"name": "上楼器",
|
||||
"text": "可以飞往楼上的相同位置",
|
||||
"useItemEffect": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) + 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
|
||||
"canUseItemEffect": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index < core.floorIds.length - 1) {\n\t\tvar toId = core.floorIds[index + 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();"
|
||||
},
|
||||
"downFly": {
|
||||
"cls": "tools",
|
||||
"name": "下楼器",
|
||||
"text": "可以飞往楼下的相同位置",
|
||||
"useItemEffect": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) - 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
|
||||
"canUseItemEffect": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index > 0) {\n\t\tvar toId = core.floorIds[index - 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();"
|
||||
},
|
||||
"earthquake": {
|
||||
"cls": "tools",
|
||||
"name": "地震卷轴",
|
||||
"text": "可以破坏当前层的所有墙",
|
||||
"useItemEffect": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap(core.status.floorId, function () {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t});\n})();",
|
||||
"canUseItemEffect": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();"
|
||||
},
|
||||
};
|
||||
for (var id in data) {
|
||||
items[id] = data[id];
|
||||
}
|
||||
|
||||
var datastr = 'var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = \n';
|
||||
datastr += JSON.stringify(items, function (k, v) {
|
||||
if (v && v.id != null) delete v.id;
|
||||
return v;
|
||||
}, '\t');
|
||||
fs.writeFile('project/items.js', encode(datastr), 'base64', function (err, data) {
|
||||
if (err) {
|
||||
alert('items接档失败!请查看控制台报错,并刷新重试。');
|
||||
console.error(err);
|
||||
} else callback();
|
||||
});
|
||||
}
|
||||
|
||||
function action_maps(callback) {
|
||||
var maps = maps_90f36752_8815_4be8_b32b_d7fad1d0542e;
|
||||
|
||||
var data = {
|
||||
"1": {"cls":"animates","id":"yellowWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
|
||||
"2": {"cls":"animates","id":"whiteWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
|
||||
"3": {"cls":"animates","id":"blueWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
|
||||
"7": {"cls":"terrains","id":"blueShopLeft"},
|
||||
"8": {"cls":"terrains","id":"blueShopRight"},
|
||||
"9": {"cls":"terrains","id":"pinkShopLeft"},
|
||||
"10": {"cls":"terrains","id":"pinkShopRight"},
|
||||
"11": {"cls":"animates","id":"lavaNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 血网的伤害效果移动到 checkBlock 中处理\n\n\t// 如果要做一次性血网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})();","name":"血网"},
|
||||
"12": {"cls":"animates","id":"poisonNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行毒处理\n\tif (!core.hasItem('amulet')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [0] });\n\t}\n\n\t// 如果要做一次性毒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"毒网"},
|
||||
"13": {"cls":"animates","id":"weakNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行衰处理\n\tif (!core.hasItem('amulet')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [1] });\n\t}\n\n\t// 如果要做一次性衰网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"衰网"},
|
||||
"14": {"cls":"animates","id":"curseNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行咒处理\n\tif (!core.hasItem('amulet')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [2] });\n\t}\n\n\t// 如果要做一次性咒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"咒网"},
|
||||
"54": {"cls":"items","id":"freezeBadge"},
|
||||
"81": {"cls":"animates","id":"yellowDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"yellowKey":1}},"name":"黄门"},
|
||||
"82": {"cls":"animates","id":"blueDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"blueKey":1}},"name":"蓝门"},
|
||||
"83": {"cls":"animates","id":"redDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"redKey":1}},"name":"红门"},
|
||||
"84": {"cls":"animates","id":"greenDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"greenKey":1}},"name":"绿门"},
|
||||
"85": {"cls":"animates","id":"specialDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"specialKey":1}},"name":"机关门"},
|
||||
"86": {"cls":"animates","id":"steelDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"steelKey":1}},"name":"铁门"},
|
||||
"161": {"cls":"terrains","id":"arrowUp","canPass":true,"cannotOut":["left","right","down"],"cannotIn":["up"]},
|
||||
"162": {"cls":"terrains","id":"arrowDown","canPass":true,"cannotOut":["left","right","up"],"cannotIn":["down"]},
|
||||
"163": {"cls":"terrains","id":"arrowLeft","canPass":true,"cannotOut":["up","down","right"],"cannotIn":["left"]},
|
||||
"164": {"cls":"terrains","id":"arrowRight","canPass":true,"cannotOut":["up","down","left"],"cannotIn":["right"]},
|
||||
"165": {"cls":"terrains","id":"light","trigger":"null","canPass":true,"script":"(function () {\n\tcore.setBlock(core.getNumberById('darkLight'), core.getHeroLoc('x'), core.getHeroLoc('y'));\n})();"},
|
||||
};
|
||||
|
||||
for (var id in data) {
|
||||
maps[id] = data[id];
|
||||
}
|
||||
|
||||
for (var id in maps) {
|
||||
if (maps[id].noPass === false || maps[id].noPass === 'false')
|
||||
maps[id].canPass = true;
|
||||
delete maps[id].noPass;
|
||||
}
|
||||
|
||||
var datastr = 'var maps_90f36752_8815_4be8_b32b_d7fad1d0542e = \n';
|
||||
var emap = {};
|
||||
var estr = JSON.stringify(maps, function (k, v) {
|
||||
if (v && v.id != null) {
|
||||
var id_ = ':' + v.id + ':';
|
||||
emap[id_] = JSON.stringify(v);
|
||||
return id_;
|
||||
} else return v
|
||||
}, '\t');
|
||||
for (var id_ in emap) {
|
||||
estr = estr.replace('"' + id_ + '"', emap[id_])
|
||||
}
|
||||
datastr += estr;
|
||||
|
||||
fs.writeFile('project/maps.js', encode(datastr), 'base64', function (err, data) {
|
||||
if (err) {
|
||||
alert('maps接档失败!请查看控制台报错,并刷新重试。');
|
||||
console.error(err);
|
||||
} else callback();
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
138
project/data.js
@ -36,53 +36,62 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"bomb.mp3",
|
||||
"centerFly.mp3"
|
||||
],
|
||||
"fonts": [],
|
||||
"nameMap": {
|
||||
"背景图.jpg": "bg.jpg",
|
||||
"背景音乐.mp3": "bgm.mp3"
|
||||
},
|
||||
"startBackground": "bg.jpg",
|
||||
"startLogoStyle": "color: black",
|
||||
"levelChoose": [
|
||||
[
|
||||
"简单",
|
||||
"Easy"
|
||||
],
|
||||
[
|
||||
"普通",
|
||||
"Normal"
|
||||
],
|
||||
[
|
||||
"困难",
|
||||
"Hard"
|
||||
],
|
||||
[
|
||||
"噩梦",
|
||||
"Hell"
|
||||
]
|
||||
{
|
||||
"title": "简单",
|
||||
"name": "Easy",
|
||||
"hard": 1,
|
||||
"action": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "在这里写该难度需执行的事件"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "普通",
|
||||
"name": "Normal",
|
||||
"hard": 2,
|
||||
"color": [
|
||||
0,
|
||||
255,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"action": []
|
||||
}
|
||||
],
|
||||
"equipName": [
|
||||
"武器",
|
||||
"盾牌"
|
||||
],
|
||||
"startBgm": null,
|
||||
"statusLeftBackground": null,
|
||||
"statusTopBackground": "url(project/materials/ground.png) repeat",
|
||||
"toolsBackground": "url(project/materials/ground.png) repeat",
|
||||
"borderColor": "#CCCCCC",
|
||||
"statusBarColor": "white",
|
||||
"hardLabelColor": "red",
|
||||
"floorChangingBackground": "black",
|
||||
"floorChangingTextColor": "white",
|
||||
"font": "Verdana",
|
||||
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;"
|
||||
"styles": {
|
||||
"startBackground": "project/images/bg.jpg",
|
||||
"startLogoStyle": "color: black",
|
||||
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;",
|
||||
"statusLeftBackground": "url(project/materials/ground.png) repeat",
|
||||
"statusTopBackground": "url(project/materials/ground.png) repeat",
|
||||
"toolsBackground": "url(project/materials/ground.png) repeat",
|
||||
"borderColor": [204,204,204,1],
|
||||
"statusBarColor": [255,255,255,1],
|
||||
"floorChangingStyle": "background-color: black; color: white",
|
||||
"font": "Verdana"
|
||||
}
|
||||
},
|
||||
"firstData": {
|
||||
"title": "魔塔样板",
|
||||
"name": "template",
|
||||
"version": "Ver 2.6.6",
|
||||
"version": "Ver 2.7",
|
||||
"floorId": "sample0",
|
||||
"hero": {
|
||||
"image": "hero.png",
|
||||
"animate": false,
|
||||
"name": "阳光",
|
||||
"lv": 1,
|
||||
"hpmax": 9999,
|
||||
@ -157,7 +166,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.flags.startDirectly",
|
||||
"condition": "main.levelChoose.length == 0",
|
||||
"true": [
|
||||
{
|
||||
"type": "comment",
|
||||
@ -171,7 +180,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\n\t\t\"text\": one[0],\n\t\t\"action\": [\n\t\t\t{ \"type\": \"function\", \"function\": \"function() { core.status.hard = '\" + one[1] + \"'; }\" }\n\t\t]\n\t});\n})\ncore.insertAction({ \"type\": \"choices\", \"choices\": choices });\n}"
|
||||
"function": "function(){\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\n\t\t\"text\": one.title || '',\n\t\t\"action\": [\n\t\t\t{ \"type\": \"function\", \"function\": \"function() { core.status.hard = '\" + (one.name || '') + \"'; }\" }\n\t\t]\n\t});\n})\ncore.insertAction({ \"type\": \"choices\", \"choices\": choices });\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -218,7 +227,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "!core.isReplaying()",
|
||||
"condition": "(!core.isReplaying())",
|
||||
"true": [
|
||||
{
|
||||
"type": "function",
|
||||
@ -238,60 +247,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
}
|
||||
],
|
||||
"startText": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "根据难度分歧设置<flag:hard>并给其他初始值"
|
||||
},
|
||||
{
|
||||
"type": "switch",
|
||||
"condition": "core.status.hard",
|
||||
"caseList": [
|
||||
{
|
||||
"case": "'Easy'",
|
||||
"action": [
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:hard",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "可以在这里修改初始道具或属性,比如赠送黄钥匙等"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"case": "'Normal'",
|
||||
"action": [
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:hard",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"case": "'Hard'",
|
||||
"action": [
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:hard",
|
||||
"value": "3"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"case": "'Hell'",
|
||||
"action": [
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:hard",
|
||||
"value": "4"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "初始剧情"
|
||||
@ -302,7 +257,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"shops": [
|
||||
{
|
||||
"id": "shop1",
|
||||
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
|
||||
"text": "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
|
||||
"textInList": "1F金币商店",
|
||||
"mustEnable": false,
|
||||
"disablePreview": false,
|
||||
@ -367,7 +322,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
},
|
||||
{
|
||||
"id": "shop2",
|
||||
"text": "\t[贪婪之神,pinkShop]勇敢的武士啊, 给我一定经验就可以:",
|
||||
"text": "\t[贪婪之神,expShop]勇敢的武士啊, 给我一定经验就可以:",
|
||||
"textInList": "1F经验商店",
|
||||
"mustEnable": false,
|
||||
"disablePreview": true,
|
||||
@ -464,9 +419,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"lavaDamage": 100,
|
||||
"poisonDamage": 10,
|
||||
"weakValue": 20,
|
||||
"redJewel": 3,
|
||||
"blueJewel": 3,
|
||||
"greenJewel": 5,
|
||||
"redGem": 3,
|
||||
"blueGem": 3,
|
||||
"greenGem": 5,
|
||||
"redPotion": 100,
|
||||
"bluePotion": 250,
|
||||
"yellowPotion": 500,
|
||||
@ -498,7 +453,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"betweenAttackMax": false,
|
||||
"useLoop": false,
|
||||
"startUsingCanvas": false,
|
||||
"startDirectly": false,
|
||||
"statusCanvas": false,
|
||||
"displayEnemyDamage": true,
|
||||
"displayCritical": true,
|
||||
|
||||
@ -2,66 +2,83 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
|
||||
{
|
||||
"greenSlime": {"name":"绿头怪","hp":100,"atk":120,"def":0,"money":1,"exp":1,"point":0,"special":[1,5,7,8]},
|
||||
"redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[16,18],"value":10},
|
||||
"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"slimelord": {"name":"怪王","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[1,9]},
|
||||
"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1]},
|
||||
"bigBat": {"name":"大蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"redBat": {"name":"红蝙蝠","hp":100,"atk":120,"def":0,"money":5,"exp":0,"point":0,"special":[4]},
|
||||
"vampire": {"name":"冥灵魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"skeletonSoilder": {"name":"骷髅士兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"ghostSkeleton": {"name":"冥队长","hp":100,"atk":120,"def":0,"money":8,"exp":0,"point":0,"special":[7]},
|
||||
"zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"rock": {"name":"石头人","hp":100,"atk":120,"def":0,"money":4,"exp":0,"point":0,"special":[3]},
|
||||
"slimeMan": {"name":"影子战士","hp":100,"atk":0,"def":0,"money":11,"exp":0,"point":0,"special":[10,21],"atkValue":2,"defValue":3},
|
||||
"bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":[2]},
|
||||
"redPriest": {"name":"高级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"brownWizard": {"name":"初级巫师","hp":100,"atk":120,"def":0,"money":16,"exp":0,"point":0,"special":[15],"value":100,"range":2},
|
||||
"redWizard": {"name":"高级巫师","hp":1000,"atk":1200,"def":0,"money":160,"exp":0,"point":0,"special":[15],"value":200,"zoneSquare":true},
|
||||
"yellowGuard": {"name":"初级卫兵","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[]},
|
||||
"blueGuard": {"name":"中级卫兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"redGuard": {"name":"高级卫兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":1},
|
||||
"bigBat": {"name":"大蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"redBat": {"name":"红蝙蝠","hp":100,"atk":120,"def":0,"money":5,"exp":0,"point":0,"special":4},
|
||||
"vampire": {"name":"冥灵魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"rock": {"name":"石头人","hp":100,"atk":120,"def":0,"money":4,"exp":0,"point":0,"special":3},
|
||||
"bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":2},
|
||||
"redPriest": {"name":"高级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"brownWizard": {"name":"初级巫师","hp":100,"atk":120,"def":0,"money":16,"exp":0,"point":0,"special":15,"value":100,"range":2},
|
||||
"redWizard": {"name":"高级巫师","hp":1000,"atk":1200,"def":0,"money":160,"exp":0,"point":0,"special":15,"value":200,"zoneSquare":true},
|
||||
"swordsman": {"name":"双手剑士","hp":100,"atk":120,"def":0,"money":6,"exp":0,"point":0,"special":[5,23]},
|
||||
"soldier": {"name":"冥战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"yellowKnight": {"name":"金骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"redKnight": {"name":"红骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"darkKnight": {"name":"黑骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"blackKing": {"name":"黑衣魔王","hp":1000,"atk":500,"def":0,"money":1000,"exp":1000,"point":0,"special":[],"notBomb":true},
|
||||
"yellowKing": {"name":"黄衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"greenKing": {"name":"青衣武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"blueKnight": {"name":"蓝骑士","hp":100,"atk":120,"def":0,"money":9,"exp":0,"point":0,"special":[8]},
|
||||
"goldSlime": {"name":"黄头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"poisonSkeleton": {"name":"紫骷髅","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"poisonBat": {"name":"紫蝙蝠","hp":100,"atk":120,"def":0,"money":14,"exp":0,"point":0,"special":[13]},
|
||||
"steelRock": {"name":"铁面人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"skeletonPriest": {"name":"骷髅法师","hp":100,"atk":100,"def":0,"money":0,"exp":0,"point":0,"special":[18,23],"value":20},
|
||||
"skeletonKing": {"name":"骷髅王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"skeletonWizard": {"name":"骷髅巫师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"redSkeletonCaption": {"name":"骷髅武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"badHero": {"name":"迷失勇者","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"demon": {"name":"魔神武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"demonPriest": {"name":"魔神法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"goldHornSlime": {"name":"金角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"redKing": {"name":"红衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"whiteKing": {"name":"白衣武士","hp":100,"atk":120,"def":0,"money":17,"exp":0,"point":0,"special":[16]},
|
||||
"blackMagician": {"name":"黑暗大法师","hp":100,"atk":120,"def":0,"money":12,"exp":0,"point":0,"special":[11],"value":0.3333333333333333,"add":true,"notBomb":true},
|
||||
"silverSlime": {"name":"银头怪","hp":100,"atk":120,"def":0,"money":15,"exp":0,"point":0,"special":[14]},
|
||||
"swordEmperor": {"name":"剑圣","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"whiteHornSlime": {"name":"尖角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"badPrincess": {"name":"痛苦魔女","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"badFairy": {"name":"黑暗仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"grayPriest": {"name":"中级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"redSwordsman": {"name":"剑王","hp":100,"atk":120,"def":0,"money":7,"exp":0,"point":0,"special":[6],"n":8},
|
||||
"whiteGhost": {"name":"水银战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"poisonZombie": {"name":"绿兽人","hp":100,"atk":120,"def":0,"money":13,"exp":0,"point":0,"special":[12]},
|
||||
"magicDragon": {"name":"魔龙","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"octopus": {"name":"血影","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"darkFairy": {"name":"仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"greenKnight": {"name":"强盾骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"angel": {"name":"天使","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"elemental": {"name":"元素生物","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"steelGuard": {"name":"铁守卫","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[18],"value":20},
|
||||
"evilBat": {"name":"邪恶蝙蝠","hp":1000,"atk":1,"def":0,"money":0,"exp":0,"point":0,"special":[2,3]}
|
||||
"soldier": {"name":"冥战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"yellowKnight": {"name":"金骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"redKnight": {"name":"红骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"darkKnight": {"name":"黑骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"blueKnight": {"name":"蓝骑士","hp":100,"atk":120,"def":0,"money":9,"exp":0,"point":0,"special":8},
|
||||
"goldSlime": {"name":"黄头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"poisonSkeleton": {"name":"紫骷髅","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"poisonBat": {"name":"紫蝙蝠","hp":100,"atk":120,"def":0,"money":14,"exp":0,"point":0,"special":13},
|
||||
"skeletonPriest": {"name":"骷髅法师","hp":100,"atk":100,"def":0,"money":0,"exp":0,"point":0,"special":18,"value":20},
|
||||
"skeletonKing": {"name":"骷髅王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"evilHero": {"name":"迷失勇者","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"demonPriest": {"name":"魔神法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"goldHornSlime": {"name":"金角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"silverSlime": {"name":"银头怪","hp":100,"atk":120,"def":0,"money":15,"exp":0,"point":0,"special":14},
|
||||
"whiteHornSlime": {"name":"尖角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"redSwordsman": {"name":"剑王","hp":100,"atk":120,"def":0,"money":7,"exp":0,"point":0,"special":6,"n":8},
|
||||
"poisonZombie": {"name":"绿兽人","hp":100,"atk":120,"def":0,"money":13,"exp":0,"point":0,"special":12},
|
||||
"octopus": {"name":"血影","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"princessEnemy": {"name":"假公主","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"angel": {"name":"天使","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"elemental": {"name":"元素生物","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"steelGuard": {"name":"铁守卫","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":18,"value":20},
|
||||
"evilBat": {"name":"邪恶蝙蝠","hp":1000,"atk":1,"def":0,"money":0,"exp":0,"point":0,"special":[2,3]},
|
||||
"frozenSkeleton": {"name":"冻死骨","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"silverSlimelord": {"name":"银怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"goldSlimelord": {"name":"金怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"skeletonWarrior": {"name":"骷髅士兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"ghostWarrior": {"name":"冥队长","hp":100,"atk":120,"def":0,"money":8,"exp":0,"point":0,"special":7},
|
||||
"whiteSlimeman": {"name":"水银战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"slimeman": {"name":"影子战士","hp":100,"atk":0,"def":0,"money":11,"exp":0,"point":0,"special":[10,21],"atkValue":2,"defValue":3},
|
||||
"yellowGT": {"name":"初级卫兵","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":0},
|
||||
"blueGT": {"name":"中级卫兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"redGT": {"name":"高级卫兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"blackMS": {"name":"黑衣魔王","hp":1000,"atk":500,"def":0,"money":1000,"exp":1000,"point":0,"special":0,"notBomb":true},
|
||||
"yellowMS": {"name":"黄衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"greenMS": {"name":"青衣武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"magicMaster": {"name":"黑暗大法师","hp":100,"atk":120,"def":0,"money":12,"exp":0,"point":0,"special":11,"value":0.3333333333333333,"add":true,"notBomb":true},
|
||||
"blueMS": {"name":"白衣武士","hp":100,"atk":120,"def":0,"money":17,"exp":0,"point":0,"special":16},
|
||||
"redMS": {"name":"红衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"devilWarrior": {"name":"魔神武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"fairyEnemy": {"name":"仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"dragon": {"name":"魔龙","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"skeletonKnight": {"name":"骷髅武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"skeletonPresbyter": {"name":"骷髅巫师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"ironRock": {"name":"铁面人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"grayRock": {"name":"灰色石头人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"yellowPriest": {"name":"中级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"evilPrincess": {"name":"痛苦魔女","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"blademaster": {"name":"剑圣","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"evilFairy": {"name":"黑暗仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"blueRock": {"name":"鬼邪石","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"skeletonLite": {"name":"骷髅精英","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"greenKnight": {"name":"强盾骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"bowman": {"name":"弓兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"liteBowman": {"name":"精锐弓兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"crismonZombie": {"name":"红兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"watcherSlime": {"name":"邪眼怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"mutantSlimeman": {"name":"变异战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"devilKnight": {"name":"恶灵骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"grayPriest": {"name":"混沌法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"greenGT": {"name":"卫兵队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"ghostSoldier": {"name":"冥队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
|
||||
"frostBat": {"name":"寒蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}
|
||||
}
|
||||
@ -175,7 +175,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
||||
"data": [
|
||||
{
|
||||
"type": "choices",
|
||||
"text": "\t[商人,woman]你有多余的钥匙想要出售吗?",
|
||||
"text": "\t[商人,trader]你有多余的钥匙想要出售吗?",
|
||||
"choices": [
|
||||
{
|
||||
"text": "黄钥匙(10金币)",
|
||||
@ -204,7 +204,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
"\t[商人,woman]你没有黄钥匙!"
|
||||
"\t[商人,trader]你没有黄钥匙!"
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -236,7 +236,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
"\t[商人,woman]你没有蓝钥匙!"
|
||||
"\t[商人,trader]你没有蓝钥匙!"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -8,7 +8,7 @@ main.floors.MT0=
|
||||
"cannotViewMap": false,
|
||||
"defaultGround": "ground",
|
||||
"images": [],
|
||||
"item_ratio": 1,
|
||||
"ratio": 1,
|
||||
"map": [
|
||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
|
||||
@ -8,7 +8,7 @@ main.floors.sample0=
|
||||
"defaultGround": "ground",
|
||||
"images": [],
|
||||
"bgm": "bgm.mp3",
|
||||
"item_ratio": 1,
|
||||
"ratio": 1,
|
||||
"map": [
|
||||
[ 0, 0,220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42],
|
||||
[ 0,246, 0,246, 0, 20, 0, 3, 58, 59, 60, 61, 41],
|
||||
@ -46,8 +46,8 @@ main.floors.sample0=
|
||||
}
|
||||
],
|
||||
"10,11": [
|
||||
"\t[老人,woman]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。",
|
||||
"\t[老人,woman]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
|
||||
"\t[老人,trader]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。",
|
||||
"\t[老人,trader]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
|
||||
{
|
||||
"type": "hide",
|
||||
"time": 500
|
||||
@ -63,24 +63,24 @@ main.floors.sample0=
|
||||
}
|
||||
],
|
||||
"2,8": [
|
||||
"\t[老人,magician]这些都是各种各样的怪物,所有怪物的数据都在enemys.js中设置。",
|
||||
"\t[老人,magician]这批怪物分别为:普通、先攻、魔攻、坚固、2连击、3连击、4连击、破甲、反击、净化。",
|
||||
"\t[老人,magician]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
|
||||
"\t[老人,wizard]这些都是各种各样的怪物,所有怪物的数据都在enemys.js中设置。",
|
||||
"\t[老人,wizard]这批怪物分别为:普通、先攻、魔攻、坚固、2连击、3连击、4连击、破甲、反击、净化。",
|
||||
"\t[老人,wizard]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
|
||||
{
|
||||
"type": "hide",
|
||||
"time": 500
|
||||
}
|
||||
],
|
||||
"2,5": [
|
||||
"\t[老人,magician]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值,可参见样板中黑暗大法师的写法。",
|
||||
"\t[老人,wizard]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值,可参见样板中黑暗大法师的写法。",
|
||||
{
|
||||
"type": "hide",
|
||||
"time": 500
|
||||
}
|
||||
],
|
||||
"2,3": [
|
||||
"\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值,可参见样板中初级巫师的写法。",
|
||||
"\t[老人,magician]夹击和领域同时发生时先计算领域,再夹击。\n自动寻路同样会尽量绕过你设置的这些点。",
|
||||
"\t[老人,wizard]领域、夹击。\n请注意领域怪需要设置value为伤害数值,可参见样板中初级巫师的写法。",
|
||||
"\t[老人,wizard]夹击和领域同时发生时先计算领域,再夹击。\n自动寻路同样会尽量绕过你设置的这些点。",
|
||||
{
|
||||
"type": "hide",
|
||||
"time": 500
|
||||
|
||||
@ -7,18 +7,20 @@ main.floors.sample1=
|
||||
"canUseQuickShop": true,
|
||||
"defaultGround": "grass",
|
||||
"images": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
"bg.jpg",
|
||||
0
|
||||
]
|
||||
{
|
||||
"name": "bg.jpg",
|
||||
"canvas": "bg",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 416,
|
||||
"h": 416
|
||||
}
|
||||
],
|
||||
"weather": [
|
||||
"snow",
|
||||
6
|
||||
],
|
||||
"item_ratio": 1,
|
||||
"ratio": 1,
|
||||
"map": [
|
||||
[ 7,131, 8,152, 9,130, 10,152,166,165,132,165,166],
|
||||
[ 0, 0, 0, 0, 0, 0, 0,152,165,164, 0,162,165],
|
||||
@ -263,13 +265,13 @@ main.floors.sample1=
|
||||
}
|
||||
],
|
||||
"10,4": [
|
||||
"\t[blackKing]你终于还是来了。",
|
||||
"\t[blackMS]你终于还是来了。",
|
||||
"\t[hero]放开我们的公主!",
|
||||
"\t[blackKing]如果我不愿意呢?",
|
||||
"\t[blackMS]如果我不愿意呢?",
|
||||
"\t[hero]无需多说,拔剑吧!",
|
||||
{
|
||||
"type": "battle",
|
||||
"id": "blackKing"
|
||||
"id": "blackMS"
|
||||
},
|
||||
{
|
||||
"type": "hide",
|
||||
@ -285,7 +287,7 @@ main.floors.sample1=
|
||||
7
|
||||
]
|
||||
},
|
||||
"\t[blackKing]没想到你已经变得这么强大了... 算你厉害。\n公主就交给你了,请好好对她。",
|
||||
"\t[blackMS]没想到你已经变得这么强大了... 算你厉害。\n公主就交给你了,请好好对她。",
|
||||
{
|
||||
"type": "hide"
|
||||
}
|
||||
@ -419,23 +421,23 @@ main.floors.sample1=
|
||||
{
|
||||
"case": "0",
|
||||
"action": [
|
||||
"\t[老人,woman]这是个很复杂的例子,它将教会你如何使用if 语句进行条件判断,以及 choices 提供选项来供用户进行选择。",
|
||||
"\t[老人,woman]第一次访问我将显示这段文字;从第二次开始将会向你出售钥匙。\n钥匙价格将随着访问次数递增。\n当合计出售了七把钥匙后,将送你一把大黄门钥匙,并消失不再出现。",
|
||||
"\t[老人,woman]这部分的逻辑比较长,请细心看样板的写法,是很容易看懂并理解的。"
|
||||
"\t[老人,trader]这是个很复杂的例子,它将教会你如何使用if 语句进行条件判断,以及 choices 提供选项来供用户进行选择。",
|
||||
"\t[老人,trader]第一次访问我将显示这段文字;从第二次开始将会向你出售钥匙。\n钥匙价格将随着访问次数递增。\n当合计出售了七把钥匙后,将送你一把大黄门钥匙,并消失不再出现。",
|
||||
"\t[老人,trader]这部分的逻辑比较长,请细心看样板的写法,是很容易看懂并理解的。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"case": "8",
|
||||
"action": [
|
||||
"\t[老人,woman]你购买的钥匙已经够多了,再继续卖给你的话我会有危险的。",
|
||||
"\t[老人,woman]看在你贡献给我这么多钱的份上,送你一把大黄门钥匙吧,希望你能好好用它。",
|
||||
"\t[老人,trader]你购买的钥匙已经够多了,再继续卖给你的话我会有危险的。",
|
||||
"\t[老人,trader]看在你贡献给我这么多钱的份上,送你一把大黄门钥匙吧,希望你能好好用它。",
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "item:bigKey",
|
||||
"operator": "+=",
|
||||
"value": "1"
|
||||
},
|
||||
"\t[老人,woman]我先走了,拜拜~",
|
||||
"\t[老人,trader]我先走了,拜拜~",
|
||||
{
|
||||
"type": "hide",
|
||||
"time": 500
|
||||
@ -450,7 +452,7 @@ main.floors.sample1=
|
||||
"action": [
|
||||
{
|
||||
"type": "choices",
|
||||
"text": "\t[老人,woman]少年,你需要钥匙吗?\n我这里有大把的!",
|
||||
"text": "\t[老人,trader]少年,你需要钥匙吗?\n我这里有大把的!",
|
||||
"choices": [
|
||||
{
|
||||
"text": "黄钥匙(${9+flag:woman_times}金币)",
|
||||
@ -473,7 +475,7 @@ main.floors.sample1=
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
"\t[老人,woman]你的金钱不足!"
|
||||
"\t[老人,trader]你的金钱不足!"
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -502,7 +504,7 @@ main.floors.sample1=
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
"\t[老人,woman]你的金钱不足!"
|
||||
"\t[老人,trader]你的金钱不足!"
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -528,7 +530,7 @@ main.floors.sample1=
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
"\t[老人,woman]你的金钱不足!",
|
||||
"\t[老人,trader]你的金钱不足!",
|
||||
{
|
||||
"type": "continue"
|
||||
}
|
||||
@ -560,8 +562,8 @@ main.floors.sample1=
|
||||
}
|
||||
],
|
||||
"12,11": [
|
||||
"\t[老人,womanMagician]使用 {\"type\":\"function\"} 可以写自定义的JS脚本。\n本塔支持的所有主要API会在doc文档内给出。",
|
||||
"\t[老人,womanMagician]例如这个例子:即将弹出一个输入窗口,然后会将你的输入结果直接加到你的攻击力上。",
|
||||
"\t[老人,recluse]使用 {\"type\":\"function\"} 可以写自定义的JS脚本。\n本塔支持的所有主要API会在doc文档内给出。",
|
||||
"\t[老人,recluse]例如这个例子:即将弹出一个输入窗口,然后会将你的输入结果直接加到你的攻击力上。",
|
||||
{
|
||||
"type": "input",
|
||||
"text": "请输入你要加攻击力的数值:"
|
||||
@ -584,7 +586,7 @@ main.floors.sample1=
|
||||
],
|
||||
"false": []
|
||||
},
|
||||
"\t[老人,womanMagician]具体可参见样板中本事件的写法。"
|
||||
"\t[老人,recluse]具体可参见样板中本事件的写法。"
|
||||
]
|
||||
},
|
||||
"changeFloor": {
|
||||
|
||||
@ -8,7 +8,7 @@ main.floors.sample2=
|
||||
"cannotViewMap": false,
|
||||
"defaultGround": "ground",
|
||||
"images": [],
|
||||
"item_ratio": 1,
|
||||
"ratio": 1,
|
||||
"map": [
|
||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
|
||||
@ -18,7 +18,7 @@ main.floors.sample3=
|
||||
10
|
||||
],
|
||||
"bgm": "bgm.mp3",
|
||||
"item_ratio": 1,
|
||||
"ratio": 1,
|
||||
"map": [
|
||||
[ 5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
|
||||
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
||||
@ -117,7 +117,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]我的真名为——黑暗大法师,第四区域的头目。",
|
||||
"\t[magicMaster]我的真名为——黑暗大法师,第四区域的头目。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -127,7 +127,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]以杰克的名义利用了你这么久,真是抱歉啊。",
|
||||
"\t[magicMaster]以杰克的名义利用了你这么久,真是抱歉啊。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -137,7 +137,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]盗贼杰克这个人类从未存在过,他只是我用来接近你的一副皮囊而已。",
|
||||
"\t[magicMaster]盗贼杰克这个人类从未存在过,他只是我用来接近你的一副皮囊而已。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -147,7 +147,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]为什么你看上去丝毫不生气?",
|
||||
"\t[magicMaster]为什么你看上去丝毫不生气?",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -167,7 +167,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]能够如此淡定的面对背叛,看来跟五年前相比,你确实成长了很多啊。",
|
||||
"\t[magicMaster]能够如此淡定的面对背叛,看来跟五年前相比,你确实成长了很多啊。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -177,12 +177,12 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]五年前那场屠城你应该这一生都不会忘记吧。",
|
||||
"\t[magicMaster]五年前那场屠城你应该这一生都不会忘记吧。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]很不巧,那场屠城的主谋,也是我。",
|
||||
"\t[magicMaster]很不巧,那场屠城的主谋,也是我。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -197,7 +197,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]你的双亲?这种事情我怎么可能会记得?\n你难道在踩死蚂蚁的时候还会一只只记下他们的样子吗?",
|
||||
"\t[magicMaster]你的双亲?这种事情我怎么可能会记得?\n你难道在踩死蚂蚁的时候还会一只只记下他们的样子吗?",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -207,17 +207,17 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]你应该对我心怀感激才对,如果不是那时的我看出了你隐藏的稀有勇者体质,你绝对不可能活到今天。",
|
||||
"\t[magicMaster]你应该对我心怀感激才对,如果不是那时的我看出了你隐藏的稀有勇者体质,你绝对不可能活到今天。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]在暗中动手脚让你通过勇者选拔的人也是我,我一直一直在暗中引导你走到今天这一步。",
|
||||
"\t[magicMaster]在暗中动手脚让你通过勇者选拔的人也是我,我一直一直在暗中引导你走到今天这一步。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]是我救赎了一无是处的你。",
|
||||
"\t[magicMaster]是我救赎了一无是处的你。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -232,12 +232,12 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]我刚才不是说过了吗?因为我看出了你有稀有勇者体质啊。",
|
||||
"\t[magicMaster]我刚才不是说过了吗?因为我看出了你有稀有勇者体质啊。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]你刚刚跟鬼帝交过手,应该已经很清楚这稀有勇者体质意味着什么了吧?",
|
||||
"\t[magicMaster]你刚刚跟鬼帝交过手,应该已经很清楚这稀有勇者体质意味着什么了吧?",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -247,7 +247,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]愚蠢!这意味着只要我对你加以引导跟培养,你就能成为这世间实力最强的存在!",
|
||||
"\t[magicMaster]愚蠢!这意味着只要我对你加以引导跟培养,你就能成为这世间实力最强的存在!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -257,7 +257,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]我利用你干的事情,你不是已经完成了吗?",
|
||||
"\t[magicMaster]我利用你干的事情,你不是已经完成了吗?",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -267,7 +267,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]不知不觉间,你已经在我的指引下跟鬼帝正面交手并且杀掉了他啊。",
|
||||
"\t[magicMaster]不知不觉间,你已经在我的指引下跟鬼帝正面交手并且杀掉了他啊。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -277,12 +277,12 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]你们两个一个是人类勇者,一个是魔物勇者,迟早会有交手的一天。",
|
||||
"\t[magicMaster]你们两个一个是人类勇者,一个是魔物勇者,迟早会有交手的一天。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]我只不过是操纵了一系列的连锁事件让这一天提早了数十年到来而已。",
|
||||
"\t[magicMaster]我只不过是操纵了一系列的连锁事件让这一天提早了数十年到来而已。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -292,22 +292,22 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]一个惧怕征战,爱好和平的懦夫,也配叫救世主?",
|
||||
"\t[magicMaster]一个惧怕征战,爱好和平的懦夫,也配叫救世主?",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]获得了力量,却只会被动挨打而不主动向人类世界出击,龟缩在第二区域惶惶度日,他根本就不配拥有稀有勇者体质。",
|
||||
"\t[magicMaster]获得了力量,却只会被动挨打而不主动向人类世界出击,龟缩在第二区域惶惶度日,他根本就不配拥有稀有勇者体质。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]为了不让这种人霸占着积累多年的庞大灵魂能量无作为,我设计让你杀掉了他。",
|
||||
"\t[magicMaster]为了不让这种人霸占着积累多年的庞大灵魂能量无作为,我设计让你杀掉了他。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]你没有辜负我的期待,成功战胜了那个废物,现在你体内累积的灵魂能量……也就是魔力,已经达到了能跟魔王匹敌的地步。",
|
||||
"\t[magicMaster]你没有辜负我的期待,成功战胜了那个废物,现在你体内累积的灵魂能量……也就是魔力,已经达到了能跟魔王匹敌的地步。",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -317,12 +317,12 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]不止如此,你现在的力量之强就算是统治世界也是绰绰有余!",
|
||||
"\t[magicMaster]不止如此,你现在的力量之强就算是统治世界也是绰绰有余!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]怎么样?要不要加入我的麾下,跟随我去征战人类世界?",
|
||||
"\t[magicMaster]怎么样?要不要加入我的麾下,跟随我去征战人类世界?",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -337,12 +337,12 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]……什么?!",
|
||||
"\t[magicMaster]……什么?!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]等一下!别冲动!你先等我把这利害关系理一理——",
|
||||
"\t[magicMaster]等一下!别冲动!你先等我把这利害关系理一理——",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -391,7 +391,7 @@ main.floors.sample3=
|
||||
"trigger": "action",
|
||||
"enable": false,
|
||||
"data": [
|
||||
"\t[blackMagician]听不进去人话的蠢货,就要用疼痛来管教!",
|
||||
"\t[magicMaster]听不进去人话的蠢货,就要用疼痛来管教!",
|
||||
{
|
||||
"type": "changePos",
|
||||
"direction": "up"
|
||||
@ -400,7 +400,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]出来吧!禁忌——紫电凶杀阵!",
|
||||
"\t[magicMaster]出来吧!禁忌——紫电凶杀阵!",
|
||||
{
|
||||
"type": "show",
|
||||
"loc": [
|
||||
@ -427,7 +427,7 @@ main.floors.sample3=
|
||||
"type": "sleep",
|
||||
"time": 500
|
||||
},
|
||||
"\t[blackMagician]感受绝望吧!冥顽不化的蠢货!",
|
||||
"\t[magicMaster]感受绝望吧!冥顽不化的蠢货!",
|
||||
{
|
||||
"type": "animate",
|
||||
"name": "yongchang",
|
||||
@ -482,12 +482,12 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]我的魔力可是充足的很啊!我会一直折磨到你屈服于我为止!",
|
||||
"\t[magicMaster]我的魔力可是充足的很啊!我会一直折磨到你屈服于我为止!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]人类!好好感受吧!当初你们施加于我的痛苦!如今我要百倍奉还!",
|
||||
"\t[magicMaster]人类!好好感受吧!当初你们施加于我的痛苦!如今我要百倍奉还!",
|
||||
{
|
||||
"type": "show",
|
||||
"loc": [
|
||||
@ -590,7 +590,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]可恶…多管闲事的妖精族…明明只要再让他承受一点疼痛来瓦解他的意志力,我的计划就成功了!",
|
||||
"\t[magicMaster]可恶…多管闲事的妖精族…明明只要再让他承受一点疼痛来瓦解他的意志力,我的计划就成功了!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -600,7 +600,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]不甘心!我不甘心!妖精公主又如何!\n只要是阻挡我的,不管是谁我都要铲除!",
|
||||
"\t[magicMaster]不甘心!我不甘心!妖精公主又如何!\n只要是阻挡我的,不管是谁我都要铲除!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -610,12 +610,12 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]呵呵呵……那个昏庸的魔王,掌握着那么庞大的魔物军队却只知道固守魔塔,而不主动侵略人类世界扩张领土!",
|
||||
"\t[magicMaster]呵呵呵……那个昏庸的魔王,掌握着那么庞大的魔物军队却只知道固守魔塔,而不主动侵略人类世界扩张领土!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]我实在是看不过眼,所以我才决定把这个具备稀有勇者体质的家伙培养成新一任魔王!\n来让这个世界的势力重新洗牌!",
|
||||
"\t[magicMaster]我实在是看不过眼,所以我才决定把这个具备稀有勇者体质的家伙培养成新一任魔王!\n来让这个世界的势力重新洗牌!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -625,7 +625,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]恼人至极的妖精族!呵呵呵……我干脆一不做二不休,连你也一块收拾了吧!",
|
||||
"\t[magicMaster]恼人至极的妖精族!呵呵呵……我干脆一不做二不休,连你也一块收拾了吧!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -635,7 +635,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]只会耍嘴皮子的恼人苍蝇!我倒要看看一块焦炭会不会说话!\n——招雷弹!!",
|
||||
"\t[magicMaster]只会耍嘴皮子的恼人苍蝇!我倒要看看一块焦炭会不会说话!\n——招雷弹!!",
|
||||
{
|
||||
"type": "animate",
|
||||
"name": "yongchang",
|
||||
@ -689,7 +689,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]哼!翅膀都被烧焦了还要嘴硬?你难不成真以为我不会对你动真格?",
|
||||
"\t[magicMaster]哼!翅膀都被烧焦了还要嘴硬?你难不成真以为我不会对你动真格?",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -719,7 +719,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]什么?!难不成你是想!!不可能……\n就为了一个渺小的人类,不可理喻!!",
|
||||
"\t[magicMaster]什么?!难不成你是想!!不可能……\n就为了一个渺小的人类,不可理喻!!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -734,7 +734,7 @@ main.floors.sample3=
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
},
|
||||
"\t[blackMagician]不!!不应该是这样的!我完美的计划竟然会被一只小小的妖精破坏!",
|
||||
"\t[magicMaster]不!!不应该是这样的!我完美的计划竟然会被一只小小的妖精破坏!",
|
||||
{
|
||||
"type": "playSound",
|
||||
"name": "item.mp3"
|
||||
@ -773,7 +773,7 @@ main.floors.sample3=
|
||||
"type": "sleep",
|
||||
"time": 200
|
||||
},
|
||||
"\t[blackMagician]不可能!!!!!",
|
||||
"\t[magicMaster]不可能!!!!!",
|
||||
{
|
||||
"type": "hide",
|
||||
"loc": [
|
||||
@ -871,7 +871,7 @@ main.floors.sample3=
|
||||
"\t[hero]好温暖……",
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "item:yellowJewel",
|
||||
"name": "item:yellowGem",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
@ -919,7 +919,7 @@ main.floors.sample3=
|
||||
},
|
||||
"afterBattle": {
|
||||
"6,4": [
|
||||
"\t[blackMagician]天真!你以为这样就能战胜我吗?",
|
||||
"\t[magicMaster]天真!你以为这样就能战胜我吗?",
|
||||
{
|
||||
"type": "show",
|
||||
"loc": [
|
||||
@ -933,7 +933,7 @@ main.floors.sample3=
|
||||
}
|
||||
],
|
||||
"7,5": [
|
||||
"\t[blackMagician]你打败的不过是我众多分身中的其中一个而已。",
|
||||
"\t[magicMaster]你打败的不过是我众多分身中的其中一个而已。",
|
||||
{
|
||||
"type": "show",
|
||||
"loc": [
|
||||
@ -947,7 +947,7 @@ main.floors.sample3=
|
||||
}
|
||||
],
|
||||
"5,4": [
|
||||
"\t[blackMagician]你的身体已经伤痕累累了,可我还留有着九成多的魔力。",
|
||||
"\t[magicMaster]你的身体已经伤痕累累了,可我还留有着九成多的魔力。",
|
||||
{
|
||||
"type": "show",
|
||||
"loc": [
|
||||
@ -961,7 +961,7 @@ main.floors.sample3=
|
||||
}
|
||||
],
|
||||
"5,5": [
|
||||
"\t[blackMagician]顽固的家伙!放弃抵抗吧!",
|
||||
"\t[magicMaster]顽固的家伙!放弃抵抗吧!",
|
||||
{
|
||||
"type": "show",
|
||||
"loc": [
|
||||
@ -975,7 +975,7 @@ main.floors.sample3=
|
||||
}
|
||||
],
|
||||
"7,4": [
|
||||
"\t[blackMagician]哈哈哈哈!我的灵魂远比你想象的强大!\n我即是永恒!",
|
||||
"\t[magicMaster]哈哈哈哈!我的灵魂远比你想象的强大!\n我即是永恒!",
|
||||
{
|
||||
"type": "show",
|
||||
"loc": [
|
||||
|
||||
@ -26,6 +26,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 初始化地图
|
||||
core.status.floorId = floorId;
|
||||
core.status.maps = maps;
|
||||
core.maps._resetFloorImages();
|
||||
// 初始化怪物和道具
|
||||
core.material.enemys = core.enemys.getEnemys();
|
||||
core.material.items = core.items.getItems();
|
||||
@ -40,7 +41,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core._init_sys_flags();
|
||||
// 初始化界面,状态栏等
|
||||
core.resize();
|
||||
core.updateGlobalAttribute();
|
||||
// 状态栏是否显示
|
||||
if (core.hasFlag('hideStatusBar'))
|
||||
core.hideStatusBar(core.hasFlag('showToolbox'));
|
||||
@ -115,6 +115,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.status.hero.loc = heroLoc;
|
||||
// 检查重生怪并重置
|
||||
if (!fromLoad) {
|
||||
core.extractBlocks(floorId);
|
||||
core.status.maps[floorId].blocks.forEach(function (block) {
|
||||
if (block.disable && core.enemys.hasSpecial(block.event.id, 23)) {
|
||||
block.disable = false;
|
||||
@ -358,7 +359,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
}
|
||||
|
||||
// 如果该点存在事件 -- V2.5.4 以后阻击怪也可以有战后事件了
|
||||
core.push(todo, core.floors[core.status.floorId].afterBattle[x + "," + y]);
|
||||
if (core.status.floorId != null) {
|
||||
core.push(todo, core.floors[core.status.floorId].afterBattle[x + "," + y]);
|
||||
}
|
||||
|
||||
// 在这里增加其他的自定义事件需求
|
||||
/*
|
||||
@ -385,6 +388,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
|
||||
var todo = [];
|
||||
// 检查该点的获得开门后事件。
|
||||
if (core.status.floorId == null) return;
|
||||
var event = core.floors[core.status.floorId].afterOpenDoor[x + "," + y];
|
||||
if (event) core.unshift(todo, event);
|
||||
|
||||
@ -403,6 +407,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
|
||||
var todo = [];
|
||||
// 检查该点的获得道具后事件。
|
||||
if (core.status.floorId == null) return;
|
||||
var event = core.floors[core.status.floorId].afterGetItem[x + "," + y];
|
||||
if (event && (event instanceof Array || !isGentleClick || !event.disableOnGentleClick)) {
|
||||
core.unshift(todo, event);
|
||||
@ -432,7 +437,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
return [
|
||||
[1, "先攻", "怪物首先攻击"],
|
||||
[2, "魔攻", "怪物无视勇士的防御"],
|
||||
[3, "坚固", "勇士每回合最多只能对怪物造成1点伤害"],
|
||||
[3, "坚固", "怪物防御不小于勇士攻击-1"],
|
||||
[4, "2连击", "怪物每回合攻击2次"],
|
||||
[5, "3连击", "怪物每回合攻击3次"],
|
||||
[6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }],
|
||||
@ -516,6 +521,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
var cache = core.status.checkBlock.cache[index];
|
||||
if (!cache) {
|
||||
// 没有该点的缓存,则遍历每个图块
|
||||
core.extractBlocks(floorId);
|
||||
core.status.maps[floorId].blocks.forEach(function (block) {
|
||||
if (!block.disable) {
|
||||
// 获得该图块的ID
|
||||
@ -833,7 +839,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
break;
|
||||
case 52: // 快捷键4:破冰/冰冻/地震/上下楼器/... 其他道具依次判断
|
||||
{
|
||||
var list = ["icePickaxe", "snow", "earthquake", "upFly", "downFly", "jumpShoes", "lifeWand", "poisonWine", "weakWine", "curseWine", "superWine"];
|
||||
var list = ["icePickaxe", "freezeBadge", "earthquake", "upFly", "downFly", "jumpShoes", "lifeWand", "poisonWine", "weakWine", "curseWine", "superWine"];
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var itemId = list[i];
|
||||
if (core.canUseItem(itemId)) {
|
||||
@ -934,7 +940,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
var toAttribute = core.getFlag('globalAttribute', core.status.globalAttribute);
|
||||
if (!core.same(toAttribute, core.status.globalAttribute)) {
|
||||
core.status.globalAttribute = toAttribute;
|
||||
core.updateGlobalAttribute();
|
||||
core.resize();
|
||||
}
|
||||
// 重置音量
|
||||
core.events.setVolume(core.getFlag("__volume__", 1), 0);
|
||||
@ -1032,6 +1038,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
|
||||
// 难度
|
||||
core.statusBar.hard.innerText = core.status.hard;
|
||||
core.statusBar.hard.style.color = core.getFlag('__hardColor__', 'red');
|
||||
// 自定义状态栏绘制
|
||||
core.drawStatusBar();
|
||||
|
||||
@ -1051,7 +1058,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
|
||||
var damage = {}, // 每个点的伤害值
|
||||
type = {}, // 每个点的伤害类型
|
||||
snipe = {}, // 每个点的阻击怪信息
|
||||
repulse = {}, // 每个点的阻击怪信息
|
||||
ambush = {}; // 每个点的捕捉信息
|
||||
|
||||
// 计算血网和领域、阻击、激光的伤害,计算捕捉信息
|
||||
@ -1065,7 +1072,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
type[loc] = type[loc] || {};
|
||||
|
||||
// 血网
|
||||
if (id == 'lavaNet' && !core.hasItem('shoes')) {
|
||||
if (id == 'lavaNet' && !core.hasItem('amulet')) {
|
||||
damage[loc] = (damage[loc] || 0) + core.values.lavaDamage;
|
||||
type[loc]["血网伤害"] = true;
|
||||
}
|
||||
@ -1096,8 +1103,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
}
|
||||
|
||||
// 阻击
|
||||
// 如果要防止阻击伤害,可以直接简单的将 flag:no_snipe 设为true
|
||||
if (enemy && core.hasSpecial(enemy.special, 18) && !core.hasFlag('no_snipe')) {
|
||||
// 如果要防止阻击伤害,可以直接简单的将 flag:no_repulse 设为true
|
||||
if (enemy && core.hasSpecial(enemy.special, 18) && !core.hasFlag('no_repulse')) {
|
||||
for (var dir in core.utils.scan) {
|
||||
var nx = x + core.utils.scan[dir].x,
|
||||
ny = y + core.utils.scan[dir].y,
|
||||
@ -1112,7 +1119,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
var rnx = x + core.utils.scan[rdir].x,
|
||||
rny = y + core.utils.scan[rdir].y;
|
||||
if (rnx >= 0 && rnx < width && rny >= 0 && rny < height && core.getBlock(rnx, rny, floorId) == null) {
|
||||
snipe[currloc] = (snipe[currloc] || []).concat([
|
||||
repulse[currloc] = (repulse[currloc] || []).concat([
|
||||
[x, y, id, rdir]
|
||||
]);
|
||||
}
|
||||
@ -1207,7 +1214,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.status.checkBlock = {
|
||||
damage: damage,
|
||||
type: type,
|
||||
snipe: snipe,
|
||||
repulse: repulse,
|
||||
ambush: ambush,
|
||||
cache: {} // clear cache
|
||||
};
|
||||
@ -1281,6 +1288,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 判定能否瞬移到该点
|
||||
if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y);
|
||||
if (ignoreSteps >= 0) {
|
||||
// 中毒也允许瞬移
|
||||
if (core.hasFlag('poison')) {
|
||||
var damage = ignoreSteps * core.values.poisonDamage;
|
||||
if (damage >= core.status.hero.hp) return false;
|
||||
core.status.hero.statistics.poisonDamage += damage;
|
||||
core.status.hero.hp -= damage;
|
||||
}
|
||||
|
||||
core.clearMap('hero');
|
||||
// 获得勇士最后的朝向
|
||||
var lastDirection = core.status.route[core.status.route.length - 1];
|
||||
@ -1295,6 +1310,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 统计信息
|
||||
core.status.hero.statistics.moveDirectly++;
|
||||
core.status.hero.statistics.ignoreSteps += ignoreSteps;
|
||||
if (core.hasFlag('poison')) {
|
||||
core.updateStatusBar();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1355,7 +1373,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 绘制下一个数据
|
||||
var name = toDraw[index];
|
||||
// 图片大小25x25
|
||||
ctx.drawImage(core.statusBar.icons[name], leftOffset, topOffset, 25, 25);
|
||||
core.drawImage(ctx, core.statusBar.icons[name], leftOffset, topOffset, 25, 25);
|
||||
// 文字内容
|
||||
var text = (core.statusBar[name] || {}).innerText || " ";
|
||||
// 斜体判定:如果不是纯数字和字母,斜体会非常难看,需要取消
|
||||
@ -1391,9 +1409,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
return [
|
||||
'yellowDoor', 'blueDoor', 'redDoor', 'greenDoor', 'steelDoor',
|
||||
'yellowKey', 'blueKey', 'redKey', 'greenKey', 'steelKey',
|
||||
'redJewel', 'blueJewel', 'greenJewel', 'yellowJewel',
|
||||
'redGem', 'blueGem', 'greenGem', 'yellowGem',
|
||||
'redPotion', 'bluePotion', 'greenPotion', 'yellowPotion', 'superPotion',
|
||||
'pickaxe', 'bomb', 'centerFly', 'icePickaxe', 'snow',
|
||||
'pickaxe', 'bomb', 'centerFly', 'icePickaxe', 'freezeBadge',
|
||||
'earthquake', 'upFly', 'downFly', 'jumpShoes', 'lifeWand',
|
||||
'poisonWine', 'weakWine', 'curseWine', 'superWine',
|
||||
'sword1', 'sword2', 'sword3', 'sword4', 'sword5',
|
||||
|
||||
141
project/icons.js
@ -93,37 +93,46 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
|
||||
"downPortal": 23,
|
||||
"leftPortal": 24,
|
||||
"rightPortal": 25,
|
||||
"upPortal": 26
|
||||
"upPortal": 26,
|
||||
"steelDoor2": 27,
|
||||
"steelDoor3": 28,
|
||||
"iceDoor": 29,
|
||||
"iceDoor2": 30,
|
||||
"magentaWall": 31
|
||||
},
|
||||
"npcs": {
|
||||
"man": 0,
|
||||
"woman": 1,
|
||||
"trader": 1,
|
||||
"thief": 2,
|
||||
"fairy": 3,
|
||||
"magician": 4,
|
||||
"womanMagician": 5,
|
||||
"oldMan": 6,
|
||||
"child": 7,
|
||||
"wood": 8,
|
||||
"pinkShop": 9,
|
||||
"blueShop": 10,
|
||||
"wizard": 4,
|
||||
"recluse": 5,
|
||||
"king": 6,
|
||||
"youngMan": 7,
|
||||
"sign": 8,
|
||||
"expShop": 9,
|
||||
"moneyShop": 10,
|
||||
"princess": 11,
|
||||
"wlt": 12,
|
||||
"wt": 13,
|
||||
"wrt": 14,
|
||||
"wl": 15,
|
||||
"wc": 16,
|
||||
"wr": 17,
|
||||
"wlb": 18,
|
||||
"wrb": 19,
|
||||
"dlt": 20,
|
||||
"dt": 21,
|
||||
"drt": 22,
|
||||
"dl": 23,
|
||||
"dc": 24,
|
||||
"dr": 25,
|
||||
"dlb": 26,
|
||||
"drb": 27
|
||||
"greenMan": 28,
|
||||
"blueTrader": 29,
|
||||
"redMSNpc": 30,
|
||||
"blackTrader": 31,
|
||||
"octopusLeftTop": 12,
|
||||
"octopusTop": 13,
|
||||
"octopusRightTop": 14,
|
||||
"octopusLeft": 15,
|
||||
"octopusCenter": 16,
|
||||
"octopusRight": 17,
|
||||
"octopusLeftBottom": 18,
|
||||
"octopusRightBottom": 19,
|
||||
"dragonLeftTop": 20,
|
||||
"dragonTop": 21,
|
||||
"dragonRightTop": 22,
|
||||
"dragonLeft": 23,
|
||||
"dragonCenter": 24,
|
||||
"dragonRight": 25,
|
||||
"dragonLeftBottom": 26,
|
||||
"dragonRightBottom": 27
|
||||
},
|
||||
"npc48": {
|
||||
"npc0": 0,
|
||||
@ -141,57 +150,73 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
|
||||
"redBat": 6,
|
||||
"vampire": 7,
|
||||
"skeleton": 8,
|
||||
"skeletonSoilder": 9,
|
||||
"skeletonCaptain": 10,
|
||||
"ghostSkeleton": 11,
|
||||
"zombie": 12,
|
||||
"zombieKnight": 13,
|
||||
"rock": 14,
|
||||
"slimeMan": 15,
|
||||
"bluePriest": 16,
|
||||
"redPriest": 17,
|
||||
"brownWizard": 18,
|
||||
"redWizard": 19,
|
||||
"yellowGuard": 20,
|
||||
"blueGuard": 21,
|
||||
"redGuard": 22,
|
||||
"swordsman": 23,
|
||||
"soldier": 24,
|
||||
"yellowKnight": 25,
|
||||
"redKnight": 26,
|
||||
"darkKnight": 27,
|
||||
"blackKing": 28,
|
||||
"yellowKing": 29,
|
||||
"greenKing": 30,
|
||||
"blueKnight": 31,
|
||||
"goldSlime": 32,
|
||||
"poisonSkeleton": 33,
|
||||
"poisonBat": 34,
|
||||
"steelRock": 35,
|
||||
"skeletonPriest": 36,
|
||||
"skeletonKing": 37,
|
||||
"skeletonWizard": 38,
|
||||
"redSkeletonCaption": 39,
|
||||
"badHero": 40,
|
||||
"demon": 41,
|
||||
"demonPriest": 42,
|
||||
"goldHornSlime": 43,
|
||||
"redKing": 44,
|
||||
"whiteKing": 45,
|
||||
"blackMagician": 46,
|
||||
"silverSlime": 47,
|
||||
"swordEmperor": 48,
|
||||
"whiteHornSlime": 49,
|
||||
"badPrincess": 50,
|
||||
"badFairy": 51,
|
||||
"grayPriest": 52,
|
||||
"redSwordsman": 53,
|
||||
"whiteGhost": 54,
|
||||
"poisonZombie": 55,
|
||||
"magicDragon": 56,
|
||||
"octopus": 57,
|
||||
"darkFairy": 58,
|
||||
"greenKnight": 59
|
||||
"princessEnemy": 59,
|
||||
"skeletonWarrior": 9,
|
||||
"frozenSkeleton": 69,
|
||||
"silverSlimelord": 60,
|
||||
"goldSlimelord": 61,
|
||||
"whiteSlimeman": 54,
|
||||
"slimeman": 15,
|
||||
"yellowGT": 20,
|
||||
"blueGT": 21,
|
||||
"redGT": 22,
|
||||
"blackMS": 28,
|
||||
"yellowMS": 29,
|
||||
"greenMS": 30,
|
||||
"magicMaster": 46,
|
||||
"blueMS": 45,
|
||||
"redMS": 44,
|
||||
"devilWarrior": 41,
|
||||
"fairyEnemy": 58,
|
||||
"dragon": 56,
|
||||
"skeletonKnight": 39,
|
||||
"skeletonPresbyter": 38,
|
||||
"ironRock": 35,
|
||||
"grayRock": 62,
|
||||
"yellowPriest": 52,
|
||||
"evilPrincess": 50,
|
||||
"blademaster": 48,
|
||||
"evilFairy": 51,
|
||||
"blueRock": 63,
|
||||
"skeletonLite": 64,
|
||||
"greenKnight": 65,
|
||||
"bowman": 66,
|
||||
"liteBowman": 67,
|
||||
"crismonZombie": 68,
|
||||
"watcherSlime": 70,
|
||||
"mutantSlimeman": 71,
|
||||
"frostBat": 72,
|
||||
"devilKnight": 73,
|
||||
"grayPriest": 74,
|
||||
"greenGT": 75,
|
||||
"ghostSoldier": 11,
|
||||
"evilHero": 40
|
||||
},
|
||||
"enemy48": {
|
||||
"angel": 0,
|
||||
@ -206,10 +231,10 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
|
||||
"greenKey": 3,
|
||||
"steelKey": 4,
|
||||
"bigKey": 6,
|
||||
"redJewel": 16,
|
||||
"blueJewel": 17,
|
||||
"greenJewel": 18,
|
||||
"yellowJewel": 19,
|
||||
"redGem": 16,
|
||||
"blueGem": 17,
|
||||
"greenGem": 18,
|
||||
"yellowGem": 19,
|
||||
"redPotion": 20,
|
||||
"bluePotion": 21,
|
||||
"greenPotion": 22,
|
||||
@ -236,7 +261,7 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
|
||||
"upFly": 15,
|
||||
"downFly": 14,
|
||||
"coin": 11,
|
||||
"snow": 41,
|
||||
"freezeBadge": 41,
|
||||
"cross": 40,
|
||||
"superPotion": 29,
|
||||
"earthquake": 8,
|
||||
@ -244,9 +269,9 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
|
||||
"weakWine": 25,
|
||||
"curseWine": 27,
|
||||
"superWine": 28,
|
||||
"knife": 42,
|
||||
"moneyPocket": 46,
|
||||
"shoes": 47,
|
||||
"dagger": 42,
|
||||
"silverCoin": 46,
|
||||
"amulet": 47,
|
||||
"hammer": 48,
|
||||
"jumpShoes": 49,
|
||||
"skill1": 30,
|
||||
|
||||
853
project/items.js
@ -1,430 +1,57 @@
|
||||
var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
{
|
||||
"items": {
|
||||
"yellowKey": {
|
||||
"cls": "tools",
|
||||
"name": "黄钥匙",
|
||||
"text": "可以打开一扇黄门",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"blueKey": {
|
||||
"cls": "tools",
|
||||
"name": "蓝钥匙",
|
||||
"text": "可以打开一扇蓝门",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"redKey": {
|
||||
"cls": "tools",
|
||||
"name": "红钥匙",
|
||||
"text": "可以打开一扇红门",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"redJewel": {
|
||||
"cls": "items",
|
||||
"name": "红宝石",
|
||||
"text": "',攻击+${core.values.redJewel}'"
|
||||
},
|
||||
"blueJewel": {
|
||||
"cls": "items",
|
||||
"name": "蓝宝石",
|
||||
"text": "',防御+${core.values.blueJewel}'"
|
||||
},
|
||||
"greenJewel": {
|
||||
"cls": "items",
|
||||
"name": "绿宝石",
|
||||
"text": "',护盾+${core.values.greenJewel}'"
|
||||
},
|
||||
"yellowJewel": {
|
||||
"cls": "items",
|
||||
"name": "黄宝石",
|
||||
"text": "可以进行加点"
|
||||
},
|
||||
"redPotion": {
|
||||
"cls": "items",
|
||||
"name": "红血瓶",
|
||||
"text": "',生命+${core.values.redPotion}'"
|
||||
},
|
||||
"bluePotion": {
|
||||
"cls": "items",
|
||||
"name": "蓝血瓶",
|
||||
"text": "',生命+${core.values.bluePotion}'"
|
||||
},
|
||||
"yellowPotion": {
|
||||
"cls": "items",
|
||||
"name": "黄血瓶",
|
||||
"text": "',生命+${core.values.yellowPotion'}"
|
||||
},
|
||||
"greenPotion": {
|
||||
"cls": "items",
|
||||
"name": "绿血瓶",
|
||||
"text": "',生命+${core.values.greenPotion}'"
|
||||
},
|
||||
"sword0": {
|
||||
"cls": "items",
|
||||
"name": "破旧的剑",
|
||||
"text": "一把已经生锈的剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 0,
|
||||
"animate": "sword"
|
||||
}
|
||||
},
|
||||
"sword1": {
|
||||
"cls": "items",
|
||||
"name": "铁剑",
|
||||
"text": "一把很普通的铁剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 10,
|
||||
"animate": "sword"
|
||||
}
|
||||
},
|
||||
"sword2": {
|
||||
"cls": "items",
|
||||
"name": "银剑",
|
||||
"text": "一把很普通的银剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 20,
|
||||
"animate": "sword"
|
||||
}
|
||||
},
|
||||
"sword3": {
|
||||
"cls": "items",
|
||||
"name": "骑士剑",
|
||||
"text": "一把很普通的骑士剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 40,
|
||||
"animate": "sword"
|
||||
}
|
||||
},
|
||||
"sword4": {
|
||||
"cls": "items",
|
||||
"name": "圣剑",
|
||||
"text": "一把很普通的圣剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 80,
|
||||
"animate": "sword"
|
||||
}
|
||||
},
|
||||
"sword5": {
|
||||
"cls": "items",
|
||||
"name": "神圣剑",
|
||||
"text": "一把很普通的神圣剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"atk": 100,
|
||||
"animate": "sword"
|
||||
}
|
||||
},
|
||||
"shield0": {
|
||||
"cls": "items",
|
||||
"name": "破旧的盾",
|
||||
"text": "一个很破旧的铁盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 0
|
||||
}
|
||||
},
|
||||
"shield1": {
|
||||
"cls": "items",
|
||||
"name": "铁盾",
|
||||
"text": "一个很普通的铁盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 10
|
||||
}
|
||||
},
|
||||
"shield2": {
|
||||
"cls": "items",
|
||||
"name": "银盾",
|
||||
"text": "一个很普通的银盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 20
|
||||
}
|
||||
},
|
||||
"shield3": {
|
||||
"cls": "items",
|
||||
"name": "骑士盾",
|
||||
"text": "一个很普通的骑士盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 40
|
||||
}
|
||||
},
|
||||
"shield4": {
|
||||
"cls": "items",
|
||||
"name": "圣盾",
|
||||
"text": "一个很普通的圣盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 80
|
||||
}
|
||||
},
|
||||
"shield5": {
|
||||
"cls": "items",
|
||||
"name": "神圣盾",
|
||||
"text": "一个很普通的神圣盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"def": 100,
|
||||
"mdef": 100
|
||||
}
|
||||
},
|
||||
"superPotion": {
|
||||
"cls": "items",
|
||||
"name": "圣水"
|
||||
},
|
||||
"moneyPocket": {
|
||||
"cls": "items",
|
||||
"name": "金钱袋"
|
||||
},
|
||||
"book": {
|
||||
"cls": "constants",
|
||||
"name": "怪物手册",
|
||||
"text": "可以查看当前楼层各怪物属性",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"fly": {
|
||||
"cls": "constants",
|
||||
"name": "楼层传送器",
|
||||
"text": "可以自由往来去过的楼层",
|
||||
"hideInReplay": true,
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"coin": {
|
||||
"cls": "constants",
|
||||
"name": "幸运金币",
|
||||
"text": "持有时打败怪物可得双倍金币"
|
||||
},
|
||||
"snow": {
|
||||
"cls": "constants",
|
||||
"name": "冰冻徽章",
|
||||
"text": "可以将面前的熔岩变成平地"
|
||||
},
|
||||
"cross": {
|
||||
"cls": "constants",
|
||||
"name": "十字架",
|
||||
"text": "持有后无视怪物的无敌属性"
|
||||
},
|
||||
"knife": {
|
||||
"cls": "constants",
|
||||
"name": "屠龙匕首",
|
||||
"text": "该道具尚未被定义"
|
||||
},
|
||||
"shoes": {
|
||||
"cls": "constants",
|
||||
"name": "绿鞋",
|
||||
"text": "持有时无视负面地形"
|
||||
},
|
||||
"bigKey": {
|
||||
"cls": "tools",
|
||||
"name": "大黄门钥匙",
|
||||
"text": "可以开启当前层所有黄门"
|
||||
},
|
||||
"greenKey": {
|
||||
"cls": "tools",
|
||||
"name": "绿钥匙",
|
||||
"text": "可以打开一扇绿门"
|
||||
},
|
||||
"steelKey": {
|
||||
"cls": "tools",
|
||||
"name": "铁门钥匙",
|
||||
"text": "可以打开一扇铁门"
|
||||
},
|
||||
"pickaxe": {
|
||||
"cls": "tools",
|
||||
"name": "破墙镐",
|
||||
"text": "可以破坏勇士面前的墙"
|
||||
},
|
||||
"icePickaxe": {
|
||||
"cls": "tools",
|
||||
"name": "破冰镐",
|
||||
"text": "可以破坏勇士面前的一堵冰墙"
|
||||
},
|
||||
"bomb": {
|
||||
"cls": "tools",
|
||||
"name": "炸弹",
|
||||
"text": "可以炸掉勇士面前的怪物"
|
||||
},
|
||||
"centerFly": {
|
||||
"cls": "tools",
|
||||
"name": "中心对称飞行器",
|
||||
"text": "可以飞向当前楼层中心对称的位置"
|
||||
},
|
||||
"upFly": {
|
||||
"cls": "tools",
|
||||
"name": "上楼器",
|
||||
"text": "可以飞往楼上的相同位置"
|
||||
},
|
||||
"downFly": {
|
||||
"cls": "tools",
|
||||
"name": "下楼器",
|
||||
"text": "可以飞往楼下的相同位置"
|
||||
},
|
||||
"earthquake": {
|
||||
"cls": "tools",
|
||||
"name": "地震卷轴",
|
||||
"text": "可以破坏当前层的所有墙"
|
||||
},
|
||||
"poisonWine": {
|
||||
"cls": "tools",
|
||||
"name": "解毒药水",
|
||||
"text": "可以解除中毒状态"
|
||||
},
|
||||
"weakWine": {
|
||||
"cls": "tools",
|
||||
"name": "解衰药水",
|
||||
"text": "可以解除衰弱状态"
|
||||
},
|
||||
"curseWine": {
|
||||
"cls": "tools",
|
||||
"name": "解咒药水",
|
||||
"text": "可以解除诅咒状态"
|
||||
},
|
||||
"superWine": {
|
||||
"cls": "tools",
|
||||
"name": "万能药水",
|
||||
"text": "可以解除所有不良状态"
|
||||
},
|
||||
"hammer": {
|
||||
"cls": "tools",
|
||||
"name": "圣锤",
|
||||
"text": "该道具尚未被定义"
|
||||
},
|
||||
"lifeWand": {
|
||||
"cls": "tools",
|
||||
"name": "生命魔杖",
|
||||
"text": "可以恢复100点生命值"
|
||||
},
|
||||
"jumpShoes": {
|
||||
"cls": "tools",
|
||||
"name": "跳跃靴",
|
||||
"text": "能跳跃到前方两格处"
|
||||
},
|
||||
"skill1": {
|
||||
"cls": "constants",
|
||||
"name": "技能:二倍斩",
|
||||
"text": "可以打开或关闭主动技能二倍斩",
|
||||
"hideInReplay": true
|
||||
},
|
||||
"wand": {
|
||||
"cls": "items",
|
||||
"name": "新物品"
|
||||
}
|
||||
"yellowKey": {
|
||||
"cls": "tools",
|
||||
"name": "黄钥匙",
|
||||
"text": "可以打开一扇黄门",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"itemEffect": {
|
||||
"redJewel": "core.status.hero.atk += core.values.redJewel * ratio",
|
||||
"blueJewel": "core.status.hero.def += core.values.blueJewel * ratio",
|
||||
"greenJewel": "core.status.hero.mdef += core.values.greenJewel * ratio",
|
||||
"yellowJewel": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
|
||||
"redPotion": "core.status.hero.hp += core.values.redPotion * ratio",
|
||||
"bluePotion": "core.status.hero.hp += core.values.bluePotion * ratio",
|
||||
"yellowPotion": "core.status.hero.hp += core.values.yellowPotion * ratio",
|
||||
"greenPotion": "core.status.hero.hp += core.values.greenPotion * ratio",
|
||||
"sword0": "core.status.hero.atk += 0",
|
||||
"sword1": "core.status.hero.atk += 10",
|
||||
"sword2": "core.status.hero.atk += 20",
|
||||
"sword3": "core.status.hero.atk += 40",
|
||||
"sword4": "core.status.hero.atk += 80",
|
||||
"sword5": "core.status.hero.atk += 100",
|
||||
"shield0": "core.status.hero.def += 0",
|
||||
"shield1": "core.status.hero.def += 10",
|
||||
"shield2": "core.status.hero.def += 20",
|
||||
"shield3": "core.status.hero.def += 40",
|
||||
"shield4": "core.status.hero.def += 80",
|
||||
"shield5": "core.status.hero.def += 100;core.status.hero.mdef += 100",
|
||||
"bigKey": "core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
|
||||
"superPotion": "core.status.hero.hp *= 2",
|
||||
"moneyPocket": "core.status.hero.money += 500"
|
||||
"blueKey": {
|
||||
"cls": "tools",
|
||||
"name": "蓝钥匙",
|
||||
"text": "可以打开一扇蓝门",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"itemEffectTip": {
|
||||
"redJewel": "',攻击+'+core.values.redJewel * ratio",
|
||||
"blueJewel": "',防御+'+core.values.blueJewel * ratio",
|
||||
"greenJewel": "',护盾+'+core.values.greenJewel * ratio",
|
||||
"yellowJewel": "',全属性提升'",
|
||||
"redPotion": "',生命+'+core.values.redPotion * ratio",
|
||||
"bluePotion": "',生命+'+core.values.bluePotion * ratio",
|
||||
"yellowPotion": "',生命+'+core.values.yellowPotion * ratio",
|
||||
"greenPotion": "',生命+'+core.values.greenPotion * ratio",
|
||||
"sword0": "',攻击+0'",
|
||||
"sword1": "',攻击+10'",
|
||||
"sword2": "',攻击+20'",
|
||||
"sword3": "',攻击+40'",
|
||||
"sword4": "',攻击+80'",
|
||||
"sword5": "',攻击+100'",
|
||||
"shield0": "',防御+0'",
|
||||
"shield1": "',防御+10'",
|
||||
"shield2": "',防御+20'",
|
||||
"shield3": "',防御+40'",
|
||||
"shield4": "',防御+80'",
|
||||
"shield5": "',防御+100,护盾+100'",
|
||||
"bigKey": "',全钥匙+1'",
|
||||
"superPotion": "',生命值翻倍'",
|
||||
"moneyPocket": "',金币+500'"
|
||||
"redKey": {
|
||||
"cls": "tools",
|
||||
"name": "红钥匙",
|
||||
"text": "可以打开一扇红门",
|
||||
"hideInToolbox": true
|
||||
},
|
||||
"useItemEffect": {
|
||||
"book": "core.ui.drawBook(0);",
|
||||
"fly": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
|
||||
"earthquake": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap(core.status.floorId, function () {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t});\n})();",
|
||||
"pickaxe": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
|
||||
"icePickaxe": "(function () {\n\tcore.removeBlock(core.nextX(), core.nextY());\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();",
|
||||
"snow": "(function () {\n\tvar success = false;\n\n\tvar snowFourDirections = false; // 是否四方向雪花;如果是将其改成true\n\tif (snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (core.getBlockId(nx, ny) == 'lava') {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (core.getBlockId(core.nextX(), core.nextY()) == 'lava') {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
|
||||
"bigKey": "(function () {\n\tvar actions = core.searchBlock(\"yellowDoor\").map(function (block) {\n\t\treturn { \"type\": \"openDoor\", \"loc\": [block.x, block.y], \"async\": true };\n\t});\n\tactions.push({ \"type\": \"waitAsync\" });\n\tactions.push({ \"type\": \"tip\", \"text\": core.material.items[itemId].name + \"使用成功\" });\n\tcore.insertAction(actions);\n})();",
|
||||
"bomb": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();",
|
||||
"centerFly": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', core.bigmap.width - 1 - core.getHeroLoc('x'));\ncore.setHeroLoc('y', core.bigmap.height - 1 - core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
||||
"upFly": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) + 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
|
||||
"downFly": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) - 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
|
||||
"poisonWine": "core.removeFlag('poison');",
|
||||
"weakWine": "core.removeFlag('weak');\nif (core.values.weakValue>=1) { // >=1:直接扣数值\n\tcore.status.hero.atk += core.values.weakValue;\n\tcore.status.hero.def += core.values.weakValue;\n}\nelse { // <1:扣比例\n\tcore.addBuff(\"atk\", core.values.weakValue);\n\tcore.addBuff(\"def\", core.values.weakValue);\n}",
|
||||
"curseWine": "core.removeFlag('curse');",
|
||||
"superWine": "core.removeFlag('poison');\nif (core.hasFlag('weak')) {\n\tcore.removeFlag('weak');\n\tif (core.values.weakValue>=1) { // >=1:直接扣数值\n\t\tcore.status.hero.atk += core.values.weakValue;\n\t\tcore.status.hero.def += core.values.weakValue;\n\t}\n\telse { // <1:扣比例\n\t\tcore.addBuff(\"atk\", core.values.weakValue);\n\t\tcore.addBuff(\"def\", core.values.weakValue);\n\t}\n}\ncore.removeFlag('curse');",
|
||||
"lifeWand": null,
|
||||
"jumpShoes": "core.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });",
|
||||
"redPotion": "core.status.hero.hp += core.values.redPotion",
|
||||
"bluePotion": "core.status.hero.hp += core.values.bluePotion",
|
||||
"greenPotion": "core.status.hero.hp += core.values.greenPotion",
|
||||
"yellowPotion": "core.status.hero.hp += core.values.yellowPotion",
|
||||
"redJewel": "core.status.hero.atk += core.values.redJewel",
|
||||
"blueJewel": "core.status.hero.def += core.values.blueJewel",
|
||||
"greenJewel": "core.status.hero.mdef += core.values.greenJewel",
|
||||
"yellowJewel": null,
|
||||
"skill1": "// 二倍斩的flag:skill为1\nif (core.getFlag('skill', 0)==0) { // 判断当前是否已经开了技能\n\tif (core.getStatus('mana')>=5) { // 这里要写当前能否开技能的条件判断,比如魔力值至少要多少\n\t\tcore.setFlag('skill', 1); // 开技能1\n\t\tcore.setFlag('skillName', '二倍斩'); // 设置技能名\n\t}\n\telse {\n\t\tcore.drawTip(\"魔力不足,无法开启技能\");\n\t}\n}\nelse { // 关闭技能\n\tcore.setFlag('skill', 0); // 关闭技能状态\n\tcore.setFlag('skillName', '无');\n}"
|
||||
"redGem": {
|
||||
"cls": "items",
|
||||
"name": "红宝石",
|
||||
"text": "攻击+${core.values.redGem}",
|
||||
"itemEffect": "core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",攻击+${core.values.redGem * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.atk += core.values.redGem",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"canUseItemEffect": {
|
||||
"book": "true",
|
||||
"fly": "(function () {\n\treturn core.status.maps[core.status.floorId].canFlyTo;\n})();",
|
||||
"pickaxe": "true",
|
||||
"icePickaxe": "(function () {\n\treturn core.getBlockId(core.nextX(), core.nextY()) == 'ice';\n})();",
|
||||
"bomb": "true",
|
||||
"earthquake": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();",
|
||||
"centerFly": "(function () {\n\tvar toX = core.bigmap.width - 1 - core.getHeroLoc('x'),\n\t\ttoY = core.bigmap.height - 1 - core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();",
|
||||
"upFly": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index < core.floorIds.length - 1) {\n\t\tvar toId = core.floorIds[index + 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
|
||||
"downFly": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index > 0) {\n\t\tvar toId = core.floorIds[index - 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
|
||||
"snow": "true",
|
||||
"bigKey": "(function () {\n\treturn core.searchBlock('yellowDoor').length > 0;\n})();",
|
||||
"poisonWine": "core.hasFlag('poison');",
|
||||
"weakWine": "core.hasFlag('weak');",
|
||||
"curseWine": "core.hasFlag('curse');",
|
||||
"superWine": "(function() {\n\treturn core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse');\n})();",
|
||||
"lifeWand": "true",
|
||||
"jumpShoes": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();",
|
||||
"redPotion": "true",
|
||||
"bluePotion": "true",
|
||||
"greenPotion": "true",
|
||||
"yellowPotion": "true",
|
||||
"redJewel": "true",
|
||||
"blueJewel": "true",
|
||||
"greenJewel": "true",
|
||||
"yellowJewel": "true",
|
||||
"skill1": "true"
|
||||
"blueGem": {
|
||||
"cls": "items",
|
||||
"name": "蓝宝石",
|
||||
"text": ",防御+${core.values.blueGem}",
|
||||
"itemEffect": "core.status.hero.def += core.values.blueGem * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",防御+${core.values.blueGem * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.def += core.values.blueGem",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"equipCondition": {},
|
||||
"useItemEvent": {
|
||||
"yellowJewel": [
|
||||
"greenGem": {
|
||||
"cls": "items",
|
||||
"name": "绿宝石",
|
||||
"text": ",护盾+${core.values.greenGem}",
|
||||
"itemEffect": "core.status.hero.mdef += core.values.greenGem * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",护盾+${core.values.greenGem * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.mdef += core.values.greenGem",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"yellowGem": {
|
||||
"cls": "items",
|
||||
"name": "黄宝石",
|
||||
"text": "可以进行加点",
|
||||
"itemEffect": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
|
||||
"itemEffectTip": ",全属性提升",
|
||||
"useItemEvent": [
|
||||
{
|
||||
"type": "choices",
|
||||
"choices": [
|
||||
@ -464,7 +91,369 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
]
|
||||
}
|
||||
],
|
||||
"lifeWand": [
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"redPotion": {
|
||||
"cls": "items",
|
||||
"name": "红血瓶",
|
||||
"text": ",生命+${core.values.redPotion}",
|
||||
"itemEffect": "core.status.hero.hp += core.values.redPotion * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",生命+${core.values.redPotion * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.hp += core.values.redPotion",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"bluePotion": {
|
||||
"cls": "items",
|
||||
"name": "蓝血瓶",
|
||||
"text": ",生命+${core.values.bluePotion}",
|
||||
"itemEffect": "core.status.hero.hp += core.values.bluePotion * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",生命+${core.values.bluePotion * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.hp += core.values.bluePotion",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"yellowPotion": {
|
||||
"cls": "items",
|
||||
"name": "黄血瓶",
|
||||
"text": ",生命+${core.values.yellowPotion}",
|
||||
"itemEffect": "core.status.hero.hp += core.values.yellowPotion * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",生命+${core.values.yellowPotion * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.hp += core.values.yellowPotion",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"greenPotion": {
|
||||
"cls": "items",
|
||||
"name": "绿血瓶",
|
||||
"text": ",生命+${core.values.greenPotion}",
|
||||
"itemEffect": "core.status.hero.hp += core.values.greenPotion * core.status.thisMap.ratio",
|
||||
"itemEffectTip": ",生命+${core.values.greenPotion * core.status.thisMap.ratio}",
|
||||
"useItemEffect": "core.status.hero.hp += core.values.greenPotion",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"sword0": {
|
||||
"cls": "items",
|
||||
"name": "破旧的剑",
|
||||
"text": "一把已经生锈的剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"animate": "sword",
|
||||
"value": {
|
||||
"atk": 0
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.atk += 0",
|
||||
"itemEffectTip": ",攻击+0"
|
||||
},
|
||||
"sword1": {
|
||||
"cls": "items",
|
||||
"name": "铁剑",
|
||||
"text": "一把很普通的铁剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"animate": "sword",
|
||||
"value": {
|
||||
"atk": 10
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.atk += 10",
|
||||
"itemEffectTip": ",攻击+10"
|
||||
},
|
||||
"sword2": {
|
||||
"cls": "items",
|
||||
"name": "银剑",
|
||||
"text": "一把很普通的银剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"animate": "sword",
|
||||
"value": {
|
||||
"atk": 20
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.atk += 20",
|
||||
"itemEffectTip": ",攻击+20"
|
||||
},
|
||||
"sword3": {
|
||||
"cls": "items",
|
||||
"name": "骑士剑",
|
||||
"text": "一把很普通的骑士剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"animate": "sword",
|
||||
"value": {
|
||||
"atk": 40
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.atk += 40",
|
||||
"itemEffectTip": ",攻击+40"
|
||||
},
|
||||
"sword4": {
|
||||
"cls": "items",
|
||||
"name": "圣剑",
|
||||
"text": "一把很普通的圣剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"animate": "sword",
|
||||
"value": {
|
||||
"atk": 80
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.atk += 80",
|
||||
"itemEffectTip": ",攻击+80"
|
||||
},
|
||||
"sword5": {
|
||||
"cls": "items",
|
||||
"name": "神圣剑",
|
||||
"text": "一把很普通的神圣剑",
|
||||
"equip": {
|
||||
"type": 0,
|
||||
"animate": "sword",
|
||||
"value": {
|
||||
"atk": 160
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.atk += 100",
|
||||
"itemEffectTip": ",攻击+100"
|
||||
},
|
||||
"shield0": {
|
||||
"cls": "items",
|
||||
"name": "破旧的盾",
|
||||
"text": "一个很破旧的铁盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"value": {
|
||||
"def": 0
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.def += 0",
|
||||
"itemEffectTip": ",防御+0"
|
||||
},
|
||||
"shield1": {
|
||||
"cls": "items",
|
||||
"name": "铁盾",
|
||||
"text": "一个很普通的铁盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"value": {
|
||||
"def": 10
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.def += 10",
|
||||
"itemEffectTip": ",防御+10"
|
||||
},
|
||||
"shield2": {
|
||||
"cls": "items",
|
||||
"name": "银盾",
|
||||
"text": "一个很普通的银盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"value": {
|
||||
"def": 20
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.def += 20",
|
||||
"itemEffectTip": ",防御+20"
|
||||
},
|
||||
"shield3": {
|
||||
"cls": "items",
|
||||
"name": "骑士盾",
|
||||
"text": "一个很普通的骑士盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"value": {
|
||||
"def": 40
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.def += 40",
|
||||
"itemEffectTip": ",防御+40"
|
||||
},
|
||||
"shield4": {
|
||||
"cls": "items",
|
||||
"name": "圣盾",
|
||||
"text": "一个很普通的圣盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"value": {
|
||||
"def": 80
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.def += 80",
|
||||
"itemEffectTip": ",防御+80"
|
||||
},
|
||||
"shield5": {
|
||||
"cls": "items",
|
||||
"name": "神圣盾",
|
||||
"text": "一个很普通的神圣盾",
|
||||
"equip": {
|
||||
"type": 1,
|
||||
"value": {
|
||||
"def": 100,
|
||||
"mdef": 100
|
||||
}
|
||||
},
|
||||
"itemEffect": "core.status.hero.def += 100;core.status.hero.mdef += 100",
|
||||
"itemEffectTip": ",防御+100,护盾+100"
|
||||
},
|
||||
"superPotion": {
|
||||
"cls": "items",
|
||||
"name": "圣水",
|
||||
"itemEffect": "core.status.hero.hp *= 2",
|
||||
"itemEffectTip": ",生命值翻倍"
|
||||
},
|
||||
"silverCoin": {
|
||||
"cls": "items",
|
||||
"name": "银币",
|
||||
"itemEffect": "core.status.hero.money += 500",
|
||||
"itemEffectTip": ",金币+500"
|
||||
},
|
||||
"book": {
|
||||
"cls": "constants",
|
||||
"name": "怪物手册",
|
||||
"text": "可以查看当前楼层各怪物属性",
|
||||
"hideInToolbox": true,
|
||||
"useItemEffect": "core.ui.drawBook(0);",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"fly": {
|
||||
"cls": "constants",
|
||||
"name": "楼层传送器",
|
||||
"text": "可以自由往来去过的楼层",
|
||||
"hideInReplay": true,
|
||||
"hideInToolbox": true,
|
||||
"useItemEffect": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
|
||||
"canUseItemEffect": "(function () {\n\treturn core.status.maps[core.status.floorId].canFlyTo;\n})();"
|
||||
},
|
||||
"coin": {
|
||||
"cls": "constants",
|
||||
"name": "幸运金币",
|
||||
"text": "持有时打败怪物可得双倍金币"
|
||||
},
|
||||
"freezeBadge": {
|
||||
"cls": "constants",
|
||||
"name": "冰冻徽章",
|
||||
"text": "可以将面前的熔岩变成平地",
|
||||
"useItemEffect": "(function () {\n\tvar success = false;\n\n\tvar snowFourDirections = false; // 是否四方向雪花;如果是将其改成true\n\tif (snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (core.getBlockId(nx, ny) == 'lava') {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (core.getBlockId(core.nextX(), core.nextY()) == 'lava') {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"cross": {
|
||||
"cls": "constants",
|
||||
"name": "十字架",
|
||||
"text": "持有后无视怪物的无敌属性"
|
||||
},
|
||||
"dagger": {
|
||||
"cls": "constants",
|
||||
"name": "屠龙匕首",
|
||||
"text": "该道具尚未被定义"
|
||||
},
|
||||
"amulet": {
|
||||
"cls": "constants",
|
||||
"name": "护符",
|
||||
"text": "持有时无视负面地形"
|
||||
},
|
||||
"bigKey": {
|
||||
"cls": "tools",
|
||||
"name": "大黄门钥匙",
|
||||
"text": "可以开启当前层所有黄门",
|
||||
"itemEffect": "core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
|
||||
"itemEffectTip": ",全钥匙+1",
|
||||
"useItemEffect": "(function () {\n\tvar actions = core.searchBlock(\"yellowDoor\").map(function (block) {\n\t\treturn { \"type\": \"openDoor\", \"loc\": [block.x, block.y], \"async\": true };\n\t});\n\tactions.push({ \"type\": \"waitAsync\" });\n\tactions.push({ \"type\": \"tip\", \"text\": core.material.items[itemId].name + \"使用成功\" });\n\tcore.insertAction(actions);\n})();",
|
||||
"canUseItemEffect": "(function () {\n\treturn core.searchBlock('yellowDoor').length > 0;\n})();"
|
||||
},
|
||||
"greenKey": {
|
||||
"cls": "tools",
|
||||
"name": "绿钥匙",
|
||||
"text": "可以打开一扇绿门"
|
||||
},
|
||||
"steelKey": {
|
||||
"cls": "tools",
|
||||
"name": "铁门钥匙",
|
||||
"text": "可以打开一扇铁门"
|
||||
},
|
||||
"pickaxe": {
|
||||
"cls": "tools",
|
||||
"name": "破墙镐",
|
||||
"text": "可以破坏勇士面前的墙",
|
||||
"useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"icePickaxe": {
|
||||
"cls": "tools",
|
||||
"name": "破冰镐",
|
||||
"text": "可以破坏勇士面前的一堵冰墙",
|
||||
"useItemEffect": "(function () {\n\tcore.removeBlock(core.nextX(), core.nextY());\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();",
|
||||
"canUseItemEffect": "(function () {\n\treturn core.getBlockId(core.nextX(), core.nextY()) == 'ice';\n})();"
|
||||
},
|
||||
"bomb": {
|
||||
"cls": "tools",
|
||||
"name": "炸弹",
|
||||
"text": "可以炸掉勇士面前的怪物",
|
||||
"useItemEffect": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸;如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"centerFly": {
|
||||
"cls": "tools",
|
||||
"name": "中心对称飞行器",
|
||||
"text": "可以飞向当前楼层中心对称的位置",
|
||||
"useItemEffect": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', core.bigmap.width - 1 - core.getHeroLoc('x'));\ncore.setHeroLoc('y', core.bigmap.height - 1 - core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
||||
"canUseItemEffect": "(function () {\n\tvar toX = core.bigmap.width - 1 - core.getHeroLoc('x'),\n\t\ttoY = core.bigmap.height - 1 - core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();"
|
||||
},
|
||||
"upFly": {
|
||||
"cls": "tools",
|
||||
"name": "上楼器",
|
||||
"text": "可以飞往楼上的相同位置",
|
||||
"useItemEffect": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) + 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
|
||||
"canUseItemEffect": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index < core.floorIds.length - 1) {\n\t\tvar toId = core.floorIds[index + 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();"
|
||||
},
|
||||
"downFly": {
|
||||
"cls": "tools",
|
||||
"name": "下楼器",
|
||||
"text": "可以飞往楼下的相同位置",
|
||||
"useItemEffect": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) - 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
|
||||
"canUseItemEffect": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index > 0) {\n\t\tvar toId = core.floorIds[index - 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();"
|
||||
},
|
||||
"earthquake": {
|
||||
"cls": "tools",
|
||||
"name": "地震卷轴",
|
||||
"text": "可以破坏当前层的所有墙",
|
||||
"useItemEffect": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap(core.status.floorId, function () {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t});\n})();",
|
||||
"canUseItemEffect": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();"
|
||||
},
|
||||
"poisonWine": {
|
||||
"cls": "tools",
|
||||
"name": "解毒药水",
|
||||
"text": "可以解除中毒状态",
|
||||
"useItemEffect": "core.removeFlag('poison');",
|
||||
"canUseItemEffect": "core.hasFlag('poison');"
|
||||
},
|
||||
"weakWine": {
|
||||
"cls": "tools",
|
||||
"name": "解衰药水",
|
||||
"text": "可以解除衰弱状态",
|
||||
"useItemEffect": "core.removeFlag('weak');\nif (core.values.weakValue>=1) { // >=1:直接扣数值\n\tcore.status.hero.atk += core.values.weakValue;\n\tcore.status.hero.def += core.values.weakValue;\n}\nelse { // <1:扣比例\n\tcore.addBuff(\"atk\", core.values.weakValue);\n\tcore.addBuff(\"def\", core.values.weakValue);\n}",
|
||||
"canUseItemEffect": "core.hasFlag('weak');"
|
||||
},
|
||||
"curseWine": {
|
||||
"cls": "tools",
|
||||
"name": "解咒药水",
|
||||
"text": "可以解除诅咒状态",
|
||||
"useItemEffect": "core.removeFlag('curse');",
|
||||
"canUseItemEffect": "core.hasFlag('curse');"
|
||||
},
|
||||
"superWine": {
|
||||
"cls": "tools",
|
||||
"name": "万能药水",
|
||||
"text": "可以解除所有不良状态",
|
||||
"useItemEffect": "core.removeFlag('poison');\nif (core.hasFlag('weak')) {\n\tcore.removeFlag('weak');\n\tif (core.values.weakValue>=1) { // >=1:直接扣数值\n\t\tcore.status.hero.atk += core.values.weakValue;\n\t\tcore.status.hero.def += core.values.weakValue;\n\t}\n\telse { // <1:扣比例\n\t\tcore.addBuff(\"atk\", core.values.weakValue);\n\t\tcore.addBuff(\"def\", core.values.weakValue);\n\t}\n}\ncore.removeFlag('curse');",
|
||||
"canUseItemEffect": "(function() {\n\treturn core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse');\n})();"
|
||||
},
|
||||
"hammer": {
|
||||
"cls": "tools",
|
||||
"name": "圣锤",
|
||||
"text": "该道具尚未被定义"
|
||||
},
|
||||
"lifeWand": {
|
||||
"cls": "tools",
|
||||
"name": "生命魔杖",
|
||||
"text": "可以恢复100点生命值",
|
||||
"useItemEvent": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "先恢复一个魔杖(因为使用道具必须消耗一个)"
|
||||
@ -499,6 +488,26 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"输入不合法!"
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"jumpShoes": {
|
||||
"cls": "tools",
|
||||
"name": "跳跃靴",
|
||||
"text": "能跳跃到前方两格处",
|
||||
"useItemEffect": "core.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });",
|
||||
"canUseItemEffect": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();"
|
||||
},
|
||||
"skill1": {
|
||||
"cls": "constants",
|
||||
"name": "技能:二倍斩",
|
||||
"text": "可以打开或关闭主动技能二倍斩",
|
||||
"hideInReplay": true,
|
||||
"useItemEffect": "// 二倍斩的flag:skill为1\nif (core.getFlag('skill', 0)==0) { // 判断当前是否已经开了技能\n\tif (core.getStatus('mana')>=5) { // 这里要写当前能否开技能的条件判断,比如魔力值至少要多少\n\t\tcore.setFlag('skill', 1); // 开技能1\n\t\tcore.setFlag('skillName', '二倍斩'); // 设置技能名\n\t}\n\telse {\n\t\tcore.drawTip(\"魔力不足,无法开启技能\");\n\t}\n}\nelse { // 关闭技能\n\tcore.setFlag('skill', 0); // 关闭技能状态\n\tcore.setFlag('skillName', '无');\n}",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"wand": {
|
||||
"cls": "items",
|
||||
"name": "新物品"
|
||||
}
|
||||
}
|
||||
171
project/maps.js
@ -1,8 +1,8 @@
|
||||
var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
{
|
||||
"1": {"cls":"animates","id":"yellowWall","canBreak":true,"animate":1,"doorInfo":[null,"door.mp3","door.mp3"]},
|
||||
"2": {"cls":"animates","id":"whiteWall","canBreak":true,"animate":1,"doorInfo":[null,"door.mp3","door.mp3"]},
|
||||
"3": {"cls":"animates","id":"blueWall","canBreak":true,"animate":1,"doorInfo":[null,"door.mp3","door.mp3"]},
|
||||
"1": {"cls":"animates","id":"yellowWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
|
||||
"2": {"cls":"animates","id":"whiteWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
|
||||
"3": {"cls":"animates","id":"blueWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
|
||||
"4": {"cls":"animates","id":"star","name":"星空"},
|
||||
"5": {"cls":"animates","id":"lava","name":"岩浆"},
|
||||
"6": {"cls":"terrains","id":"ice"},
|
||||
@ -11,9 +11,9 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"9": {"cls":"terrains","id":"pinkShopLeft"},
|
||||
"10": {"cls":"terrains","id":"pinkShopRight"},
|
||||
"11": {"cls":"animates","id":"lavaNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 血网的伤害效果移动到 checkBlock 中处理\n\n\t// 如果要做一次性血网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})();","name":"血网"},
|
||||
"12": {"cls":"animates","id":"poisonNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行毒处理\n\tif (!core.hasItem('shoes')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [0] });\n\t}\n\n\t// 如果要做一次性毒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"毒网"},
|
||||
"13": {"cls":"animates","id":"weakNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行衰处理\n\tif (!core.hasItem('shoes')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [1] });\n\t}\n\n\t// 如果要做一次性衰网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"衰网"},
|
||||
"14": {"cls":"animates","id":"curseNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行咒处理\n\tif (!core.hasItem('shoes')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [2] });\n\t}\n\n\t// 如果要做一次性咒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"咒网"},
|
||||
"12": {"cls":"animates","id":"poisonNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行毒处理\n\tif (!core.hasItem('amulet')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [0] });\n\t}\n\n\t// 如果要做一次性毒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"毒网"},
|
||||
"13": {"cls":"animates","id":"weakNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行衰处理\n\tif (!core.hasItem('amulet')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [1] });\n\t}\n\n\t// 如果要做一次性衰网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"衰网"},
|
||||
"14": {"cls":"animates","id":"curseNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行咒处理\n\tif (!core.hasItem('amulet')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [2] });\n\t}\n\n\t// 如果要做一次性咒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"咒网"},
|
||||
"15": {"cls":"animates","id":"blueWater"},
|
||||
"16": {"cls":"animates","id":"water"},
|
||||
"20": {"cls":"autotile","id":"autotile"},
|
||||
@ -23,10 +23,10 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"24": {"cls":"items","id":"greenKey"},
|
||||
"25": {"cls":"items","id":"steelKey"},
|
||||
"26": {"cls":"items","id":"bigKey"},
|
||||
"27": {"cls":"items","id":"redJewel"},
|
||||
"28": {"cls":"items","id":"blueJewel"},
|
||||
"29": {"cls":"items","id":"greenJewel"},
|
||||
"30": {"cls":"items","id":"yellowJewel"},
|
||||
"27": {"cls":"items","id":"redGem"},
|
||||
"28": {"cls":"items","id":"blueGem"},
|
||||
"29": {"cls":"items","id":"greenGem"},
|
||||
"30": {"cls":"items","id":"yellowGem"},
|
||||
"31": {"cls":"items","id":"redPotion"},
|
||||
"32": {"cls":"items","id":"bluePotion"},
|
||||
"33": {"cls":"items","id":"greenPotion"},
|
||||
@ -50,7 +50,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"51": {"cls":"items","id":"upFly"},
|
||||
"52": {"cls":"items","id":"downFly"},
|
||||
"53": {"cls":"items","id":"coin"},
|
||||
"54": {"cls":"items","id":"snow"},
|
||||
"54": {"cls":"items","id":"freezeBadge"},
|
||||
"55": {"cls":"items","id":"cross"},
|
||||
"56": {"cls":"items","id":"superPotion"},
|
||||
"57": {"cls":"items","id":"earthquake"},
|
||||
@ -58,9 +58,9 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"59": {"cls":"items","id":"weakWine"},
|
||||
"60": {"cls":"items","id":"curseWine"},
|
||||
"61": {"cls":"items","id":"superWine"},
|
||||
"62": {"cls":"items","id":"knife"},
|
||||
"63": {"cls":"items","id":"moneyPocket"},
|
||||
"64": {"cls":"items","id":"shoes"},
|
||||
"62": {"cls":"items","id":"dagger"},
|
||||
"63": {"cls":"items","id":"silverCoin"},
|
||||
"64": {"cls":"items","id":"amulet"},
|
||||
"65": {"cls":"items","id":"hammer"},
|
||||
"68": {"cls":"items","id":"lifeWand"},
|
||||
"69": {"cls":"items","id":"jumpShoes"},
|
||||
@ -68,12 +68,12 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"71": {"cls":"items","id":"shield0"},
|
||||
"72": {"cls":"items","id":"skill1"},
|
||||
"73": {"cls":"items","id":"wand"},
|
||||
"81": {"cls":"animates","id":"yellowDoor","trigger":"openDoor","animate":1,"doorInfo":[{"yellowKey":1},"door.mp3","door.mp3"],"name":"黄门"},
|
||||
"82": {"cls":"animates","id":"blueDoor","trigger":"openDoor","animate":1,"doorInfo":[{"blueKey":1},"door.mp3","door.mp3"],"name":"蓝门"},
|
||||
"83": {"cls":"animates","id":"redDoor","trigger":"openDoor","animate":1,"doorInfo":[{"redKey":1},"door.mp3","door.mp3"],"name":"红门"},
|
||||
"84": {"cls":"animates","id":"greenDoor","trigger":"openDoor","animate":1,"doorInfo":[{"greenKey":1},"door.mp3","door.mp3"],"name":"绿门"},
|
||||
"85": {"cls":"animates","id":"specialDoor","trigger":"openDoor","animate":1,"doorInfo":[null,"door.mp3","door.mp3"],"name":"机关门"},
|
||||
"86": {"cls":"animates","id":"steelDoor","trigger":"openDoor","animate":1,"doorInfo":[{"steelKey":1},"door.mp3","door.mp3"],"name":"铁门"},
|
||||
"81": {"cls":"animates","id":"yellowDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"yellowKey":1}},"name":"黄门"},
|
||||
"82": {"cls":"animates","id":"blueDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"blueKey":1}},"name":"蓝门"},
|
||||
"83": {"cls":"animates","id":"redDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"redKey":1}},"name":"红门"},
|
||||
"84": {"cls":"animates","id":"greenDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"greenKey":1}},"name":"绿门"},
|
||||
"85": {"cls":"animates","id":"specialDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"specialKey":1}},"name":"机关门"},
|
||||
"86": {"cls":"animates","id":"steelDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"steelKey":1}},"name":"铁门"},
|
||||
"87": {"cls":"terrains","id":"upFloor","canPass":true},
|
||||
"88": {"cls":"terrains","id":"downFloor","canPass":true},
|
||||
"89": {"cls":"animates","id":"portal","canPass":true},
|
||||
@ -86,22 +86,31 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"102": {"cls":"animates","id":"crystalBottom"},
|
||||
"103": {"cls":"animates","id":"fire"},
|
||||
"104": {"cls":"animates","id":"switch"},
|
||||
"105": {"cls":"animates","id":"steelDoor2","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
|
||||
"106": {"cls":"animates","id":"steelDoor3","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
|
||||
"107": {"cls":"animates","id":"iceDoor","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
|
||||
"108": {"cls":"animates","id":"iceDoor2","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
|
||||
"109": {"cls":"animates","id":"magentaWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
|
||||
"121": {"cls":"npcs","id":"man"},
|
||||
"122": {"cls":"npcs","id":"woman"},
|
||||
"122": {"cls":"npcs","id":"trader"},
|
||||
"123": {"cls":"npcs","id":"thief"},
|
||||
"124": {"cls":"npcs","id":"fairy"},
|
||||
"125": {"cls":"npcs","id":"magician"},
|
||||
"126": {"cls":"npcs","id":"womanMagician"},
|
||||
"127": {"cls":"npcs","id":"oldMan"},
|
||||
"128": {"cls":"npcs","id":"child"},
|
||||
"129": {"cls":"npcs","id":"wood"},
|
||||
"130": {"cls":"npcs","id":"pinkShop"},
|
||||
"131": {"cls":"npcs","id":"blueShop"},
|
||||
"125": {"cls":"npcs","id":"wizard"},
|
||||
"126": {"cls":"npcs","id":"recluse"},
|
||||
"127": {"cls":"npcs","id":"king"},
|
||||
"128": {"cls":"npcs","id":"youngMan"},
|
||||
"129": {"cls":"npcs","id":"sign"},
|
||||
"130": {"cls":"npcs","id":"expShop"},
|
||||
"131": {"cls":"npcs","id":"moneyShop"},
|
||||
"132": {"cls":"npcs","id":"princess"},
|
||||
"133": {"cls":"npc48","id":"npc0","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}},
|
||||
"134": {"cls":"npc48","id":"npc1","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}},
|
||||
"135": {"cls":"npc48","id":"npc2","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}},
|
||||
"136": {"cls":"npc48","id":"npc3","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}},
|
||||
"133": {"cls":"npc48","id":"npc0","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1},
|
||||
"134": {"cls":"npc48","id":"npc1","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1},
|
||||
"135": {"cls":"npc48","id":"npc2","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1},
|
||||
"136": {"cls":"npc48","id":"npc3","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1},
|
||||
"137": {"cls":"npcs","id":"greenMan"},
|
||||
"138": {"cls":"npcs","id":"blueTrader"},
|
||||
"139": {"cls":"npcs","id":"redMSNpc"},
|
||||
"140": {"cls":"npcs","id":"blackTrader"},
|
||||
"151": {"cls":"autotile","id":"autotile1"},
|
||||
"152": {"cls":"autotile","id":"autotile2"},
|
||||
"153": {"cls":"autotile","id":"autotile3"},
|
||||
@ -115,22 +124,22 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"168": {"cls":"terrains","id":"flower","canPass":true},
|
||||
"169": {"cls":"terrains","id":"box","trigger":"pushBox"},
|
||||
"170": {"cls":"terrains","id":"boxed","trigger":"pushBox"},
|
||||
"181": {"cls":"npcs","id":"wlt"},
|
||||
"182": {"cls":"npcs","id":"wt"},
|
||||
"183": {"cls":"npcs","id":"wrt"},
|
||||
"184": {"cls":"npcs","id":"wl"},
|
||||
"185": {"cls":"npcs","id":"wc"},
|
||||
"186": {"cls":"npcs","id":"wr"},
|
||||
"187": {"cls":"npcs","id":"wlb"},
|
||||
"188": {"cls":"npcs","id":"wrb"},
|
||||
"189": {"cls":"npcs","id":"dlt"},
|
||||
"190": {"cls":"npcs","id":"dt"},
|
||||
"191": {"cls":"npcs","id":"drt"},
|
||||
"192": {"cls":"npcs","id":"dl"},
|
||||
"193": {"cls":"npcs","id":"dc"},
|
||||
"194": {"cls":"npcs","id":"dr"},
|
||||
"195": {"cls":"npcs","id":"dlb"},
|
||||
"196": {"cls":"npcs","id":"drb"},
|
||||
"181": {"cls":"npcs","id":"octopusLeftTop"},
|
||||
"182": {"cls":"npcs","id":"octopusTop"},
|
||||
"183": {"cls":"npcs","id":"octopusRightTop"},
|
||||
"184": {"cls":"npcs","id":"octopusLeft"},
|
||||
"185": {"cls":"npcs","id":"octopusCenter"},
|
||||
"186": {"cls":"npcs","id":"octopusRight"},
|
||||
"187": {"cls":"npcs","id":"octopusLeftBottom"},
|
||||
"188": {"cls":"npcs","id":"octopusRightBottom"},
|
||||
"189": {"cls":"npcs","id":"dragonLeftTop"},
|
||||
"190": {"cls":"npcs","id":"dragonTop"},
|
||||
"191": {"cls":"npcs","id":"dragonRightTop"},
|
||||
"192": {"cls":"npcs","id":"dragonLeft"},
|
||||
"193": {"cls":"npcs","id":"dragonCenter"},
|
||||
"194": {"cls":"npcs","id":"dragonRight"},
|
||||
"195": {"cls":"npcs","id":"dragonLeftBottom"},
|
||||
"196": {"cls":"npcs","id":"dragonRightBottom"},
|
||||
"201": {"cls":"enemys","id":"greenSlime"},
|
||||
"202": {"cls":"enemys","id":"redSlime"},
|
||||
"203": {"cls":"enemys","id":"blackSlime"},
|
||||
@ -140,61 +149,77 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"207": {"cls":"enemys","id":"redBat"},
|
||||
"208": {"cls":"enemys","id":"vampire"},
|
||||
"209": {"cls":"enemys","id":"skeleton"},
|
||||
"210": {"cls":"enemys","id":"skeletonSoilder"},
|
||||
"210": {"cls":"enemys","id":"skeletonWarrior"},
|
||||
"211": {"cls":"enemys","id":"skeletonCaptain"},
|
||||
"212": {"cls":"enemys","id":"ghostSkeleton"},
|
||||
"212": {"cls":"enemys","id":"ghostSoldier"},
|
||||
"213": {"cls":"enemys","id":"zombie"},
|
||||
"214": {"cls":"enemys","id":"zombieKnight"},
|
||||
"215": {"cls":"enemys","id":"rock"},
|
||||
"216": {"cls":"enemys","id":"slimeMan"},
|
||||
"216": {"cls":"enemys","id":"slimeman"},
|
||||
"217": {"cls":"enemys","id":"bluePriest"},
|
||||
"218": {"cls":"enemys","id":"redPriest"},
|
||||
"219": {"cls":"enemys","id":"brownWizard"},
|
||||
"220": {"cls":"enemys","id":"redWizard"},
|
||||
"221": {"cls":"enemys","id":"yellowGuard"},
|
||||
"222": {"cls":"enemys","id":"blueGuard"},
|
||||
"223": {"cls":"enemys","id":"redGuard"},
|
||||
"221": {"cls":"enemys","id":"yellowGT"},
|
||||
"222": {"cls":"enemys","id":"blueGT"},
|
||||
"223": {"cls":"enemys","id":"redGT"},
|
||||
"224": {"cls":"enemys","id":"swordsman"},
|
||||
"225": {"cls":"enemys","id":"soldier"},
|
||||
"226": {"cls":"enemys","id":"yellowKnight"},
|
||||
"227": {"cls":"enemys","id":"redKnight"},
|
||||
"228": {"cls":"enemys","id":"darkKnight"},
|
||||
"229": {"cls":"enemys","id":"blackKing"},
|
||||
"230": {"cls":"enemys","id":"yellowKing"},
|
||||
"231": {"cls":"enemys","id":"greenKing"},
|
||||
"229": {"cls":"enemys","id":"blackMS"},
|
||||
"230": {"cls":"enemys","id":"yellowMS"},
|
||||
"231": {"cls":"enemys","id":"greenMS"},
|
||||
"232": {"cls":"enemys","id":"blueKnight"},
|
||||
"233": {"cls":"enemys","id":"goldSlime"},
|
||||
"234": {"cls":"enemys","id":"poisonSkeleton"},
|
||||
"235": {"cls":"enemys","id":"poisonBat"},
|
||||
"236": {"cls":"enemys","id":"steelRock"},
|
||||
"236": {"cls":"enemys","id":"ironRock"},
|
||||
"237": {"cls":"enemys","id":"skeletonPriest"},
|
||||
"238": {"cls":"enemys","id":"skeletonKing"},
|
||||
"239": {"cls":"enemys","id":"skeletonWizard"},
|
||||
"240": {"cls":"enemys","id":"redSkeletonCaption"},
|
||||
"241": {"cls":"enemys","id":"badHero"},
|
||||
"242": {"cls":"enemys","id":"demon"},
|
||||
"239": {"cls":"enemys","id":"skeletonPresbyter"},
|
||||
"240": {"cls":"enemys","id":"skeletonKnight"},
|
||||
"241": {"cls":"enemys","id":"evilHero"},
|
||||
"242": {"cls":"enemys","id":"devilWarrior"},
|
||||
"243": {"cls":"enemys","id":"demonPriest"},
|
||||
"244": {"cls":"enemys","id":"goldHornSlime"},
|
||||
"245": {"cls":"enemys","id":"redKing"},
|
||||
"246": {"cls":"enemys","id":"whiteKing"},
|
||||
"247": {"cls":"enemys","id":"blackMagician"},
|
||||
"245": {"cls":"enemys","id":"redMS"},
|
||||
"246": {"cls":"enemys","id":"blueMS"},
|
||||
"247": {"cls":"enemys","id":"magicMaster"},
|
||||
"248": {"cls":"enemys","id":"silverSlime"},
|
||||
"249": {"cls":"enemys","id":"swordEmperor"},
|
||||
"249": {"cls":"enemys","id":"blademaster"},
|
||||
"250": {"cls":"enemys","id":"whiteHornSlime"},
|
||||
"251": {"cls":"enemys","id":"badPrincess"},
|
||||
"252": {"cls":"enemys","id":"badFairy"},
|
||||
"253": {"cls":"enemys","id":"grayPriest"},
|
||||
"251": {"cls":"enemys","id":"evilPrincess"},
|
||||
"252": {"cls":"enemys","id":"evilFairy"},
|
||||
"253": {"cls":"enemys","id":"yellowPriest"},
|
||||
"254": {"cls":"enemys","id":"redSwordsman"},
|
||||
"255": {"cls":"enemys","id":"whiteGhost"},
|
||||
"255": {"cls":"enemys","id":"whiteSlimeman"},
|
||||
"256": {"cls":"enemys","id":"poisonZombie"},
|
||||
"257": {"cls":"enemys","id":"magicDragon"},
|
||||
"257": {"cls":"enemys","id":"dragon"},
|
||||
"258": {"cls":"enemys","id":"octopus"},
|
||||
"259": {"cls":"enemys","id":"darkFairy"},
|
||||
"260": {"cls":"enemys","id":"greenKnight"},
|
||||
"259": {"cls":"enemys","id":"fairyEnemy"},
|
||||
"260": {"cls":"enemys","id":"princessEnemy"},
|
||||
"261": {"cls":"enemy48","id":"angel"},
|
||||
"262": {"cls":"enemy48","id":"elemental"},
|
||||
"263": {"cls":"enemy48","id":"steelGuard"},
|
||||
"264": {"cls":"enemy48","id":"evilBat"},
|
||||
"265": {"cls":"enemys","id":"silverSlimelord"},
|
||||
"266": {"cls":"enemys","id":"goldSlimelord"},
|
||||
"267": {"cls":"enemys","id":"grayRock"},
|
||||
"268": {"cls":"enemys","id":"blueRock"},
|
||||
"269": {"cls":"enemys","id":"skeletonLite"},
|
||||
"270": {"cls":"enemys","id":"greenKnight"},
|
||||
"271": {"cls":"enemys","id":"bowman"},
|
||||
"272": {"cls":"enemys","id":"liteBowman"},
|
||||
"273": {"cls":"enemys","id":"crismonZombie"},
|
||||
"274": {"cls":"enemys","id":"frozenSkeleton"},
|
||||
"275": {"cls":"enemys","id":"watcherSlime"},
|
||||
"276": {"cls":"enemys","id":"mutantSlimeman"},
|
||||
"277": {"cls":"enemys","id":"frostBat"},
|
||||
"278": {"cls":"enemys","id":"devilKnight"},
|
||||
"279": {"cls":"enemys","id":"grayPriest"},
|
||||
"280": {"cls":"enemys","id":"greenGT"},
|
||||
"300": {"cls":"terrains","id":"ground"},
|
||||
"301": {"cls":"terrains","id":"grass"},
|
||||
"302": {"cls":"terrains","id":"grass2"},
|
||||
|
||||
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 600 B After Width: | Height: | Size: 817 B |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 8.6 KiB |
BIN
project/materials/icons_old.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 20 KiB |
@ -124,38 +124,42 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
|
||||
////// 将一个全局商店转变成可预览的公共事件 //////
|
||||
this._convertShop = function (shop) {
|
||||
return [{
|
||||
"type": "while",
|
||||
"condition": "true",
|
||||
"data": [
|
||||
// 检测能否访问该商店
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.isShopVisited('" + shop.id + "')",
|
||||
"true": [
|
||||
// 可以访问,直接插入执行效果
|
||||
{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', false) }" },
|
||||
],
|
||||
"false": [
|
||||
// 不能访问的情况下:检测能否预览
|
||||
{
|
||||
"type": "if",
|
||||
"condition": shop.disablePreview,
|
||||
"true": [
|
||||
// 不可预览,提示并退出
|
||||
"当前无法访问该商店!",
|
||||
{ "type": "break" },
|
||||
],
|
||||
"false": [
|
||||
// 可以预览:将商店全部内容进行替换
|
||||
{ "type": "tip", "text": "当前处于预览模式,不可购买" },
|
||||
{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', true) }" },
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}];
|
||||
return [
|
||||
{ "type": "function", "function": "function() {core.setFlag('@temp@shop', true);}" },
|
||||
{
|
||||
"type": "while",
|
||||
"condition": "true",
|
||||
"data": [
|
||||
// 检测能否访问该商店
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.isShopVisited('" + shop.id + "')",
|
||||
"true": [
|
||||
// 可以访问,直接插入执行效果
|
||||
{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', false) }" },
|
||||
],
|
||||
"false": [
|
||||
// 不能访问的情况下:检测能否预览
|
||||
{
|
||||
"type": "if",
|
||||
"condition": shop.disablePreview,
|
||||
"true": [
|
||||
// 不可预览,提示并退出
|
||||
"当前无法访问该商店!",
|
||||
{ "type": "break" },
|
||||
],
|
||||
"false": [
|
||||
// 可以预览:将商店全部内容进行替换
|
||||
{ "type": "tip", "text": "当前处于预览模式,不可购买" },
|
||||
{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', true) }" },
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{ "type": "function", "function": "function() {core.removeFlag('@temp@shop');}" }
|
||||
];
|
||||
}
|
||||
|
||||
this._convertShop_replaceChoices = function (shopId, previewMode) {
|
||||
@ -220,6 +224,62 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
return null;
|
||||
}
|
||||
|
||||
/// 允许商店X键退出
|
||||
core.registerAction('keyUp', 'shops', function (keycode) {
|
||||
if (!core.status.lockControl || !core.hasFlag("@temp@shop") || core.status.event.id != 'action') return false;
|
||||
if (core.status.event.data.type != 'choices') return false;
|
||||
var data = core.status.event.data.current;
|
||||
var choices = data.choices;
|
||||
var topIndex = core.actions.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
if (keycode == 88) { // X
|
||||
core.actions._clickAction(core.actions.HSIZE, topIndex + choices.length - 1);
|
||||
return true;
|
||||
}
|
||||
}, 60);
|
||||
|
||||
},
|
||||
"removeMap": function () {
|
||||
// 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。
|
||||
// 推荐用法:
|
||||
// 对于超高层或分区域塔,当在1区时将2区以后的地图删除;1区结束时恢复2区,进二区时删除1区地图,以此类推
|
||||
// 这样可以大幅减少存档空间,以及加快存读档速度
|
||||
|
||||
// 删除楼层
|
||||
// core.removeMaps("MT1", "MT300") 删除MT1~MT300之间的全部层
|
||||
// core.removeMaps("MT10") 只删除MT10层
|
||||
this.removeMaps = function (fromId, toId) {
|
||||
toId = toId || fromId;
|
||||
var fromIndex = core.floorIds.indexOf(fromId),
|
||||
toIndex = core.floorIds.indexOf(toId);
|
||||
if (toIndex < 0) toIndex = core.floorIds.length - 1;
|
||||
flags.__removed__ = flags.__removed__ || [];
|
||||
for (var i = fromIndex; i <= toIndex; ++i) {
|
||||
var floorId = core.floorIds[i];
|
||||
delete flags.__visited__[floorId];
|
||||
flags.__removed__.push(floorId);
|
||||
core.status.maps[floorId].deleted = true;
|
||||
core.status.maps[floorId].canFlyTo = false;
|
||||
core.status.maps[floorId].cannotViewMap = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 恢复楼层
|
||||
// core.resumeMaps("MT1", "MT300") 恢复MT1~MT300之间的全部层
|
||||
// core.resumeMaps("MT10") 只恢复MT10层
|
||||
this.resumeMaps = function (fromId, toId) {
|
||||
toId = toId || fromId;
|
||||
var fromIndex = core.floorIds.indexOf(fromId),
|
||||
toIndex = core.floorIds.indexOf(toId);
|
||||
if (toIndex < 0) toIndex = core.floorIds.length - 1;
|
||||
flags.__removed__ = flags.__removed__ || [];
|
||||
for (var i = fromIndex; i <= toIndex; ++i) {
|
||||
var floorId = core.floorIds[i];
|
||||
flags.__removed__ = flags.__removed__.filter(function (f) { return f != floorId; });
|
||||
if (core.status.maps[floorId].deleted) {
|
||||
core.status.maps[floorId] = core.loadFloor(floorId);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"itemShop": function () {
|
||||
// 道具商店相关的插件
|
||||
@ -618,41 +678,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
};
|
||||
};
|
||||
|
||||
// 其实只注释了最后一行,只能这样了
|
||||
control.drawHero = function (status, offset) {
|
||||
if (!core.isPlaying() || !core.status.floorId || core.status.gameOver) return;
|
||||
var x = core.getHeroLoc('x'),
|
||||
y = core.getHeroLoc('y'),
|
||||
direction = core.getHeroLoc('direction');
|
||||
status = status || 'stop';
|
||||
offset = offset || 0;
|
||||
var way = core.utils.scan[direction];
|
||||
var dx = way.x,
|
||||
dy = way.y,
|
||||
offsetX = dx * offset,
|
||||
offsetY = dy * offset;
|
||||
core.bigmap.offsetX = core.clamp((x - core.__HALF_SIZE__) * 32 + offsetX, 0, 32 * core.bigmap.width - core.__PIXELS__);
|
||||
core.bigmap.offsetY = core.clamp((y - core.__HALF_SIZE__) * 32 + offsetY, 0, 32 * core.bigmap.height - core.__PIXELS__);
|
||||
core.clearAutomaticRouteNode(x + dx, y + dy);
|
||||
core.clearMap('hero');
|
||||
|
||||
if (!core.hasFlag('hideHero')) {
|
||||
this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
|
||||
core.drawImage('hero', block.img, block.heroIcon[block.status] * block.width,
|
||||
block.heroIcon.loc * block.height, block.width, block.height,
|
||||
block.posx + (32 - block.width) / 2, block.posy + 32 - block.height, block.width, block.height);
|
||||
});
|
||||
}
|
||||
|
||||
core.control.updateViewport();
|
||||
//core.setGameCanvasTranslate('hero', 0, 0);
|
||||
};
|
||||
|
||||
// 复写转发
|
||||
core.drawHero = function (status, offset) {
|
||||
return core.control.drawHero(status, offset);
|
||||
};
|
||||
|
||||
// 创建摄像机对象
|
||||
this.camera = new this.Camera();
|
||||
|
||||
@ -661,13 +686,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
this.camera.update();
|
||||
};
|
||||
|
||||
core.control._drawHero_updateViewport = function () {
|
||||
core.control.updateViewport();
|
||||
}
|
||||
|
||||
// 代理原本的镜头事件
|
||||
control.updateViewport = function () {
|
||||
core.control.updateViewport = function () {
|
||||
core.plugin.camera.requestCameraUpdate();
|
||||
};
|
||||
|
||||
// 更变楼层的行为追加,重置镜头
|
||||
events.prototype.changingFloor = function (floorId, heroLoc) {
|
||||
core.events.changingFloor = function (floorId, heroLoc) {
|
||||
this.eventdata.changingFloor(floorId, heroLoc);
|
||||
core.plugin.camera.resetCamera();
|
||||
};
|
||||
|
||||
14
runtime.d.ts
vendored
@ -42,7 +42,7 @@ type Animate = {
|
||||
|
||||
type Floor = {
|
||||
title: string,
|
||||
item_ratio: number
|
||||
ratio: number
|
||||
}
|
||||
|
||||
type ResolvedMap = {
|
||||
@ -221,9 +221,7 @@ type gameStatus = {
|
||||
toolsBackground: string
|
||||
borderColor: string
|
||||
statusBarColor: string
|
||||
hardLabelColor: string
|
||||
floorChangingBackground: string
|
||||
floorChangingTextColor: string
|
||||
floorChangingStyle: string
|
||||
font: string
|
||||
}
|
||||
curtainColor: null
|
||||
@ -652,9 +650,9 @@ declare class events {
|
||||
|
||||
/**
|
||||
* 设置一项楼层属性并刷新状态栏
|
||||
* @example core.setFloorInfo('item_ratio', 2, 'MT0'); // 把主塔0层的血瓶和宝石变为双倍效果
|
||||
* @param name 'title','name','canFlyTo','canUseQuickShop','cannotViewMap','cannotMoveDirectly','upFloor','downFloor','defaultGround','images','color','weather','bgm','item_ratio','underGround'之一
|
||||
* @param values 属性的新值,可选。对'title'、'name'、'defaultGround'和'bgm'需要是字符串,对'underGround'和四个'canXxx'需要是布尔值,对两个'xxxFloor'需要是一行两列的自然数数组,对'item_ratio'需要是数字
|
||||
* @example core.setFloorInfo('ratio', 2, 'MT0'); // 把主塔0层的血瓶和宝石变为双倍效果
|
||||
* @param name 'title','name','canFlyTo','canUseQuickShop','cannotViewMap','cannotMoveDirectly','upFloor','downFloor','defaultGround','images','color','weather','bgm','ratio','underGround'之一
|
||||
* @param values 属性的新值,可选。对'title'、'name'、'defaultGround'和'bgm'需要是字符串,对'underGround'和四个'canXxx'需要是布尔值,对两个'xxxFloor'需要是一行两列的自然数数组,对'ratio'需要是数字
|
||||
* @param floorId 楼层id,不填视为当前层
|
||||
* @param prefix 独立开关前缀,一般不需要,下同
|
||||
*/
|
||||
@ -1542,7 +1540,7 @@ declare class utils {
|
||||
|
||||
/**
|
||||
* 读取一个全局存储,适用于global:xxx,支持录像。
|
||||
* @example if (core.getGlobal('一周目已通关', false) === true) core.getItem('knife'); // 二周目游戏进行到此处时会获得一把屠龙匕首
|
||||
* @example if (core.getGlobal('一周目已通关', false) === true) core.getItem('dagger'); // 二周目游戏进行到此处时会获得一把屠龙匕首
|
||||
* @param key 全局变量名称,支持中文
|
||||
* @param defaultValue 可选,当此全局变量不存在或值为null、undefined时,用此值代替
|
||||
* @returns 全局变量的值
|
||||
|
||||
48
server.py
@ -7,6 +7,7 @@
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import base64
|
||||
|
||||
isPy3 = sys.version_info > (3, 0)
|
||||
@ -67,7 +68,10 @@ def static_file(path):
|
||||
if not os.path.isfile(path):
|
||||
abort(404)
|
||||
return None
|
||||
return Response(get_file(path), mimetype = get_mimetype(path))
|
||||
mimetype = get_mimetype(path)
|
||||
response = Response(get_file(path), mimetype = mimetype)
|
||||
if mimetype.startswith('audio/'): response.headers["Accept-Ranges"] = "bytes"
|
||||
return response
|
||||
|
||||
def process_request():
|
||||
data = request.get_data() # str in py2 and bytes in py3
|
||||
@ -138,6 +142,48 @@ def listFile():
|
||||
if os.path.isfile(os.path.join(filename, f))]
|
||||
return "[" + ", ".join(['"'+f+'"' for f in files]) + "]"
|
||||
|
||||
@app.route('/makeDir', methods=['POST'])
|
||||
def makeDir():
|
||||
data = process_request()
|
||||
filename = data.get('name', None)
|
||||
if filename is None or not is_sub(filename):
|
||||
abort(403)
|
||||
return
|
||||
if not os.path.exists(filename):
|
||||
os.makedirs(filename)
|
||||
return 'Success'
|
||||
|
||||
@app.route('/moveFile', methods=['POST'])
|
||||
def moveFile():
|
||||
data = process_request()
|
||||
src = data.get('src', None)
|
||||
dest = data.get('dest', None)
|
||||
if src is None or dest is None or not is_sub(src) or not is_sub(dest):
|
||||
abort(403)
|
||||
return
|
||||
if not os.path.exists(src):
|
||||
abort(404)
|
||||
return
|
||||
if src == dest:
|
||||
return 'Success'
|
||||
if os.path.exists(dest):
|
||||
os.remove(dest)
|
||||
os.rename(src, dest)
|
||||
return 'Success'
|
||||
|
||||
@app.route('/deleteFile', methods=['POST'])
|
||||
def deleteFile():
|
||||
data = process_request()
|
||||
name = data.get('name', None)
|
||||
if name is None or not is_sub(name):
|
||||
abort(403)
|
||||
return
|
||||
if os.path.isfile(name):
|
||||
os.remove(name)
|
||||
elif os.path.isdir(name):
|
||||
shutil.rmtree(name)
|
||||
return 'Success'
|
||||
|
||||
def port_used(port):
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
result = True
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
color: #fff;
|
||||
font-size: 0.6rem;
|
||||
position: absolute;
|
||||
top: 8%;
|
||||
top: 10%;
|
||||
left: 5%;
|
||||
z-index: 15;
|
||||
}
|
||||
@ -295,27 +295,22 @@ p#name {
|
||||
|
||||
#bg {
|
||||
z-index: 10;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
#event {
|
||||
z-index: 30;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
#hero {
|
||||
z-index: 40;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
#event2 {
|
||||
z-index: 50;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
#fg {
|
||||
z-index: 60;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
#damage {
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
(已完成!) 7. 建议把core.playBgm(bgm, startTime)的startTime参数在事件中也提供出来,以用于一些演出(比如适当的剧情处直接从高潮开始)。同理可以让“暂停背景音乐”记录下当前播放到了第几秒,并在“恢复背景音乐”中自动从这个秒数恢复。作者还可以手动配合音量渐变效果
|
||||
(已完成!) 8. 系统设置菜单中“音量”和“步时”的点击区并不是根据文本长度自动适配的,这导致作者修改文本(包括但不限于翻译)后玩家难以找到准确的点击区,建议优化
|
||||
(已完成!) 9. 建议给“显示选择项”、“显示确认框”、“等待用户操作”这三个事件添加一个“若多少毫秒内不响应则触发的分支”,用来实现一些如新新2的QTE,录像中可以记录“choice: timeout”、“confirm: timeout”和“wait: timeout”来表示触发了超时分支
|
||||
10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点
|
||||
(已完成!) 10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点
|
||||
(已完成!) 11. 建议修复勇士后退时跟随者的鬼畜行为,并推出一套能够对跟随者位置和朝向进行读写的API甚至事件,且允许这些信息被计入存档,以实现一些演出效果甚至游戏要素,如新新2用公主占位防冰块
|
||||
(已完成!) 12. “设置怪物属性”事件的下拉框目前只支持一部分,另一部分只能通过手敲json再解析来得到,希望提供完整支持
|
||||
(已完成!) 13. 建议给core.moveAction(callback)提供对应的事件,用于在事件中让勇士像事件外一样移动,从而正常触发跑毒和阻激夹域捕等
|
||||
@ -28,7 +28,7 @@
|
||||
(已完成!) 清除最近使用图块
|
||||
(已完成!) cannotIn / cannotOut使用选项框
|
||||
(已完成!) noPass->canPass改成选择框
|
||||
初始化&读档优化:不一次读取全部楼层并创建
|
||||
(已完成!) 初始化&读档优化:不一次读取全部楼层并创建
|
||||
(已完成!) 绿钥匙进状态栏
|
||||
(已完成!) 图块ID不可全数字
|
||||
(已完成!) 怪物详细信息富文本化
|
||||
@ -43,16 +43,36 @@
|
||||
(已完成!) 动画/音乐/音效自动补全
|
||||
(已完成!) 重构全局商店!
|
||||
(已完成!) 读档时色调数据丢失
|
||||
圆角边框
|
||||
像素高分辨率问题
|
||||
(已完成!) 圆角边框
|
||||
(不处理) 像素高分辨率问题
|
||||
(已完成!) 道具效果优化,删除部分道具相关的开关
|
||||
(已完成!) 素材列表选择
|
||||
(已完成!) 油漆桶,动态更改地图大小
|
||||
地图拉框选择复制剪切删除
|
||||
(已完成!) 地图拉框选择复制剪切删除
|
||||
(已完成!) 额外素材区拖动选择一个区域
|
||||
(已完成!) 素材替换
|
||||
(已完成!) 大屏幕下放大游戏界面
|
||||
(已完成!) 最近使用/最常使用的图块
|
||||
(已完成!) loader并行加载
|
||||
(已完成!) 合并items.js
|
||||
(已完成!) 增加fonts目录,全塔属性增加fonts引用
|
||||
(已完成!) 右边框输入完后解析按钮高亮
|
||||
(已完成!) 32x48的门
|
||||
(已完成!) 难度分歧的图块(颜色,含SL界面)
|
||||
(已完成!) 装备同时加属性和比例
|
||||
(已完成!) removeMap和resumeMap
|
||||
(已完成!) 右键图块选择复制/粘贴事件
|
||||
(已完成!) showImage, drawImage,立绘等加上对称选项
|
||||
(已完成!) 更多的图块blockly化
|
||||
(已完成!) 勇士帧动画
|
||||
(不处理;现在静止状态可以有帧动画了,所以不考虑行走过程动画) 行走动画
|
||||
(已完成!) 合并main中一些设置内容
|
||||
(已完成!) \t[this], 勇士朝下,flag:arg清理,瞬移扣血
|
||||
nowLoc;同步存档合并;右键反复弹出;失去焦点右键;地图编辑框无效
|
||||
|
||||
-------------
|
||||
|
||||
(不处理) 0. 部分文案的修改,如“地图编辑器”(启动服务.exe中)、“enemys”、“snipe”
|
||||
(不处理) 0. 部分文案的修改,如“地图编辑器”(启动服务.exe中)、“enemys”、“repulse”
|
||||
(造塔工具相关都给鹿神) 1. 便捷PS工具希望加入自定义单位宽高功能,希望把“白底转透明”增强为“纯色底转透明”(弹窗由作者输入RGB或RGBA值)。
|
||||
(已修复) 2. 请求修复(如果还没修复)新建单张空白地图无法自定义宽高的bug
|
||||
(文档相关给秋橙) 3. 希望给M键“追加素材”功能写个更详细的说明,在线文档中没有所以离线文档中也没写成
|
||||
@ -82,7 +102,7 @@
|
||||
(已完成!) 27. 勇士后退时跟随者很鬼畜,建议优化(每步聚集算是一种简陋的办法)
|
||||
(不处理) 28. 勇士的移动帧只有2,建议改为允许作者指定
|
||||
(不处理) 29. 建议加一对“勇士开始抖动”和“勇士停止抖动”事件指令,来让勇士像图块一样原地抖动(即全局动画)。目前这个效果还只能通过隐藏勇士(或切换透明行走图)并转变图块/图层块来实现且只能用于事件处理中QAQ
|
||||
30. 建议加一个“视角锁定”事件指令,从而允许用事件改变勇士位置、朝向或行走图时不会使视角重置到以其为中心,用于一些演出效果
|
||||
(不处理) 30. 建议加一个“视角锁定”事件指令,从而允许用事件改变勇士位置、朝向或行走图时不会使视角重置到以其为中心,用于一些演出效果
|
||||
(已完成!) 31. 楼层切换事件(绿点)一旦使用blockly编辑就会无视全塔属性的切换时间,只能手动在表格中删除时间(数据相关“楼层切换”事件指令也有这个问题,有群友还希望这个默认时间能像步时和音量一样由玩家设定来节约拆塔时间)。使用blockly编辑也无法做出“ignore:true”的效果(用来覆盖全塔属性的禁止穿透),建议优化
|
||||
(已完成!) 32. (关于CC的来回回档优化版)据其称,清空存档后会出现bug,此外他使用了W键导致二倍斩失效了(js的switch语句遇到duplicate cases居然不报错吗...)
|
||||
(已完成!) 33. (疑似已被CC修复)楼传平面塔模式在记录离开位置时会错误地把读档也算作离开
|
||||
@ -106,7 +126,7 @@
|
||||
(已修复!) 49. 系统设置菜单中音量和步时的点击区并不是根据文本长度自动适配的,这导致作者修改文本(包括但不限于翻译)后玩家难以找到准确的点击区,建议优化
|
||||
(不处理) 50. 建议给录像播放时的N键提供一个对应的移动端操作,以方便移动端作者
|
||||
(已完成!) 51. 希望给“显示选择项”、“显示确认框”、“等待用户操作”这三个事件添加一个“若多少毫秒内不响应则触发的分支”,用来实现一些QTE,录像中可以记录“choice: timeout”、“confirm: timeout”和“wait: timeout”来表示触发了超时分支
|
||||
52. 希望给“转变图块”加一个淡入时间参数(显隐和转变图层块也希望加个淡入淡出时间参数,图层块也希望提供移动和跳跃事件),专门用于原本是空地或空气墙的情况。目前要实现这样的效果必须使用红点,然而红点有着“推箱子、阻击、捕捉、重生、炸锤和afterXxx事件”的系列问题,且会导致core.removeBlock()(隐藏事件)退化为core.hideBlock()
|
||||
(已完成!) 52. 希望给“转变图块”加一个淡入时间参数(显隐和转变图层块也希望加个淡入淡出时间参数,图层块也希望提供移动和跳跃事件),专门用于原本是空地或空气墙的情况。目前要实现这样的效果必须使用红点,然而红点有着“推箱子、阻击、捕捉、重生、炸锤和afterXxx事件”的系列问题,且会导致core.removeBlock()(隐藏事件)退化为core.hideBlock()
|
||||
(不处理) 53. 希望“移动事件”的移速和淡出速度拆开成两个参数,目前这样捆绑在一起不太自由
|
||||
(已完成) 54. 建议把图块属性的noPass改为勾选框而不是下拉框,因为null一定表示不可通行(道具根本没有noPass)
|
||||
(不处理,可以转变图块) 55. “移动事件”和“跳跃事件”会导致本来勾选了不显伤的怪物突然有了显伤,非常难看,建议优化
|
||||
@ -124,10 +144,10 @@
|
||||
(不处理) 67. “画面震动”事件希望不要光左右晃,至少做成QQ窗口抖动的效果吧w
|
||||
(不处理) 68. “自动存档”事件希望加一个“读此档后打断当前事件”的勾选项,否则这种自动存档用于强制战斗之前就没什么意义了,读了档还是会强制战斗。录像兼容性方面,不知道如果这种自动存档只用于事件开头是不是就不会有问题
|
||||
(已修复!) 69. “等待用户操作”虽然提供了场合块但还不支持将多个按键的场合合并(比如空格、回车和C键一般会被作者予以合并,执行内容如果只是大致相同也值得合并,在块内再行分歧),希望支持一下
|
||||
70. “显隐勇士”事件指令希望加个淡入淡出时间参数
|
||||
(已完成!) 70. “显隐勇士”事件指令希望加个淡入淡出时间参数
|
||||
(不处理,请用等待事件) 1. 希望给core.drawTip()和core.playSound()出个同步版本,目前只有异步版本,后者如果要模拟同步就得绑在一个透明动画上
|
||||
(已完成!) 72. “绘制描边文本”事件希望加一个“描边颜色”参数,目前只能描黑边
|
||||
73. 画弧既然有现成的API,那建议也作为UI绘制事件提供。甚至希望提供画椭圆功能(长短轴水平或铅直的那种)参数为中心坐标和长短轴长度
|
||||
(已完成!) 73. 画弧既然有现成的API,那建议也作为UI绘制事件提供。甚至希望提供画椭圆功能(长短轴水平或铅直的那种)参数为中心坐标和长短轴长度
|
||||
(已完成!) 74. “设置画布属性”的基准线建议增加'hanging'和'ideographic'这两种模式
|
||||
(已完成!) 75. 建议修复“绘制多行文本”时行距比字号大不太多会导致各行下缘丢失的bug(加大行距又会导致第一行的纵坐标难以估计),此bug在道具商店和1.3倍行距英文看的很明显
|
||||
(已完成!) 76. (来自群友)建议给第一代全局商店像“显示选择项”一样提供图标、颜色和出现条件
|
||||
|
||||
94
v266-v2.7接档说明.txt
Normal file
@ -0,0 +1,94 @@
|
||||
V2.6.6 -> V2.7 接档说明:
|
||||
|
||||
此版本仅可接档【地图】,【事件】和【怪物数据】。脚本编辑等不可进行接档。
|
||||
|
||||
请严格按照此说明进行每一步操作以避免可能的bug。接档前请做好备份。
|
||||
|
||||
接档准备:
|
||||
- Visual Studio Code
|
||||
- 需要进行接档的V266的样板
|
||||
- 两个全新的V2.7的样板(一个用于接档结果,一个用于抄部分修改后的内容)
|
||||
|
||||
接档步骤:
|
||||
1. 将V266的样板中,【project】目录下的如下文件和文件夹,直接复制并覆盖到V2.7的样板中的project目录下:
|
||||
- animates/
|
||||
- floors/
|
||||
- enemys.js
|
||||
- events.js
|
||||
- icons.js
|
||||
- items.js
|
||||
- maps.js
|
||||
|
||||
2. 将V266样板中,【project/images】目录下的图片,拆分后放入V2.7的对应图片目录下:
|
||||
- 系统默认图片放入materials中
|
||||
- 自动元件放入autotiles中
|
||||
- 额外素材放入tilesets中
|
||||
- 使用到的其他图片放入images中
|
||||
【请注意】hero.png在V2.7请放入images目录(而不是materials目录)
|
||||
|
||||
3. 将V266样板中,【project/sounds】目录下的音乐和音效,分别放入V2.7的bgms和sounds目录。
|
||||
|
||||
4. 使用VSCode直接分别打开V266和V2.7的【project/data.js】,并执行以下操作:
|
||||
- 将【main】一项的全部内容从V2.6.6直接复制到V2.7
|
||||
- 将【firstData】一项中的,【title】,【name】,【floorId】,【hero】直接复制到
|
||||
- 在注册的图片中,请手动补上【hero.png】项
|
||||
- 在【hero】中【name】上方增加 "image": "hero.png"
|
||||
- 在【hero】中【steps】上方新增一项 "followers": []
|
||||
- 将【hero】中的【experience】改成【exp】
|
||||
- 删除【hero】中【items】中的【keys】项
|
||||
请勿覆盖或复制其他内容(例如全塔数值或全局开关),否则可能导致编辑器无法打开。
|
||||
|
||||
5. 使用VSCode分别打开接档后的V2.7和纯净的V2.7的【project/items.js】,并执行以下操作:
|
||||
- 将三色钥匙的cls从"keys"改成"tools",并新增 "hideInToolbox": true
|
||||
- 如下道具的【useItemEffect】和【canUseItemEffect】有所改变,请直接从纯净的V2.7覆盖到你要接档的V2.7:
|
||||
- earthquake, pickaxe, icePickaxe, freezeBadge, bigKey, bomb, upFly, downFly
|
||||
- 如果确认你的塔不会使用该道具,可忽略
|
||||
- 黄宝石和生命魔杖增加了【useItemEvent】;如需使用请进行复制
|
||||
|
||||
6. 使用VSCode打开接档后的V2.7的【project/icons.js】,并执行如下操作:
|
||||
- 找到【terrains】中的三色墙和六色门,删除对应的这几行
|
||||
- yellowWall, blueWall, whiteWall, yellowDoor, blueDoor, redDoor, greenDoor, specialDoor, steelDoor
|
||||
- (在V2.7中,terrains不再保留门的引用,门效果仅由animates决定)
|
||||
- 将【terrains】中的 moneyShop-left, moneyShop-right, expShop-left, expShop-right 分别重命名为
|
||||
blueShopLeft, blueShopRight, pinkShopLeft, pinkShopRight
|
||||
|
||||
7. 使用VSCode分别打开接档后的V2.7和纯净的V2.7的【project/maps.js】,并执行以下操作:
|
||||
- 将纯净的V2.7中如下ID的行,直接替换掉要接档的V2.7:
|
||||
- yellowWall, whiteWall, blueWall, blueShopLeft, blueShopRight, pinkShopLeft, pinkShopRight,
|
||||
lavaNet, poisonNet, weakNet, curseNet, yellowDoor, blueDoor, redDoor, greenDoor, specialDoor, steelDoor,
|
||||
arrowUp, arrowDown, arrowLeft, arrowRight, light
|
||||
- 将所有的 "noPass":false 改成 "canPass":true 原来是 "noPass":true 的请直接删除
|
||||
- V2.7中,不再在图块属性使用noPass,而是全部改成了canPass;请检查此文件的全部noPass是否被替换或删除
|
||||
|
||||
8. 到这一步后已经可以打开编辑器了。
|
||||
- 如果打开编辑器白屏或报错,请检查一下上面是否每个步骤都完成了
|
||||
- 如果还有问题请联系小艾
|
||||
|
||||
9. 在编辑器中,切换到「全塔属性」标签,并进行修改:
|
||||
- V2.7中,全局商店的结构完全重写了,请重新实现一遍
|
||||
- 全塔开关中,是否在状态栏显示XXX改成在同一个方框中
|
||||
- 删除了部分全局数值和全塔开关
|
||||
|
||||
10. 在编辑器中,切换到「脚本编辑」标签,并进行修改:
|
||||
- setInitData已经被删除;移动到了开场剧情的startText中
|
||||
- 删除了afterChangeLight和afterPassNet脚本
|
||||
- 很多函数的实现有所改变,改变较为严重的有:
|
||||
- resetGame, changingFloor, afterBattle, getDamageInfo, saveData, loadData,
|
||||
updateStatusBar, updateCheckBlock, moveOneStep
|
||||
- 修改脚本编辑(例如getDamageInfo)时,请勿直接拿原来的脚本进行覆盖,而是重新对函数进行修改!
|
||||
|
||||
11. 在编辑器中,切换到「插件编写」标签,并重新增加新增的插件插件
|
||||
- 请勿随意修改已有的默认插件
|
||||
|
||||
12. 逐楼层检查firstArrive以及每个点的事件列表;主要事件API变化如下:
|
||||
- 所有的「数值增减」事件已被删除,被数值设置+运算符替代
|
||||
- 编辑器将无法再解析「数值增减」事件(会被解析成自定义事件),但是游戏中仍然可以正确执行
|
||||
- 「隐藏事件」将不再默认删除该点(而只是纯粹的隐藏);请给有需要的「隐藏事件」勾选「同时删除」选项
|
||||
- 「重启当前事件」已经被删除并且无法在游戏中使用。请替换成等价的循环处理或者插入事件
|
||||
- 在V2.7中,所有的experience全部改名exp;请检查所有对经验值进行操作的地方
|
||||
|
||||
其他:
|
||||
Jewel改名Gem
|
||||
道具效果提示文字replaceText
|
||||
|
||||
|
||||