Fix known bugs

This commit is contained in:
ckcz123 2020-06-08 11:33:17 +08:00
parent d25151060f
commit 4e0d981e4a
6 changed files with 36 additions and 7 deletions

View File

@ -1042,7 +1042,10 @@ ActionParser.prototype.matchId = function(args) {
var Id_List = MotaActionBlocks['Id_List'].options; // [["变量", "flag"], ...]
match=new RegExp('^('+Id_List.map(function(v){return v[1]}).join('|')+'):([a-zA-Z0-9_\\u4E00-\\u9FCC]+)$').exec(args[0])
if(match){
args=[match[1],MotaActionFunctions.replaceToName_token(match[2])]
if (match[1] == 'status' || match[1] == 'item') {
match[2] = MotaActionFunctions.replaceToName_token(match[2]);
}
args=[match[1],match[2]]
return rt(MotaActionBlocks['idIdList_e'].xmlText, args);
}
return {ret:false}

View File

@ -379,7 +379,7 @@ editor_datapanel_wrapper = function (editor) {
} else if (cls == 'items') {
if (confirm("你确定要覆盖此道具的全部属性么?这是个不可逆操作!")) {
var name = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a[id].name;
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a[id] = core.clone(editor.uivalues.copyEnemyItem.data[x]);
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a[id] = core.clone(editor.uivalues.copyEnemyItem.data);
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a[id].id = id;
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a[id].name = name;
editor.file.saveSetting('items', [], function (err) {

View File

@ -158,6 +158,7 @@ editor_game_wrapper = function (editor, main, core) {
//与editor.map同形的全0
mapArray = eval('[' + Array(editor.map.length + 1).join('[' + Array(editor.map[0].length + 1).join('0,') + '],') + ']');
}
mapArray = core.maps._processInvalidMap(mapArray, editor.map[0].length, editor.map.length);
editor[name] = mapArray.map(function (v) {
return v.map(function (v) {
var x = parseInt(v), y = editor.indexs[x];

View File

@ -215,7 +215,7 @@
<div class="searchLogo"></div>
<input type="text" id="searchBlock" placeholder="搜索事件块..."/>
</div>
<button class="cpPanel" onclick="editor_blockly.selectPoint()">地图选点</button>
<button class="cpPanel" onclick="editor.uievent.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>

View File

@ -210,7 +210,7 @@
<div class="searchLogo"></div>
<input type="text" id="searchBlock" placeholder="搜索事件块..."/>
</div>
<button class="cpPanel" onclick="editor_blockly.selectPoint()" style="margin-left:5px">地图选点</button>
<button class="cpPanel" onclick="editor.uievent.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>

View File

@ -245,19 +245,44 @@ maps.prototype.compressMap = function (mapArr, floorId) {
return mapArr;
}
maps.prototype._processInvalidMap = function (mapArr, width, height) {
if (mapArr.length == height && mapArr[0].length == width) return mapArr;
var allZeros = [];
for (var i = 0; i < width; ++i) {
allZeros.push(0);
}
var map = [];
for (var i = 0; i < height; ++i) {
map.push(core.clone(allZeros));
}
for (var j = 0; j < height; ++j) {
for (var i = 0; i < width; ++i) {
if (j < mapArr.length && i < mapArr[j].length)
map[j][i] = mapArr[j][i];
}
}
return map;
}
////// 解压缩地图
maps.prototype.decompressMap = function (mapArr, floorId) {
var floorMap = core.floors[floorId].map;
if (!mapArr) return core.clone(floorMap);
var mw = core.floors[floorId].width;
var mh = core.floors[floorId].height;
var floorMap = this._processInvalidMap(core.floors[floorId].map, mw, mh);
if (!mapArr) return core.clone(floorMap);
for (var x = 0; x < mh; x++) {
if (x >= mapArr.length) {
mapArr.push(0);
}
if (mapArr[x] === 0) {
mapArr[x] = core.clone(floorMap[x]);
}
else {
for (var y = 0; y < mw; y++) {
if (y >= mapArr[x].length) mapArr[x].push(-1);
if (mapArr[x][y] === -1) {
mapArr[x][y] = floorMap[x][y];
}