Fix 266 bugs

This commit is contained in:
ckcz123 2020-01-13 10:22:31 +08:00
parent ee3e90a9db
commit 347af83355
3 changed files with 39 additions and 19 deletions

View File

@ -405,20 +405,22 @@ editor.prototype.updateLastUsedMap = function () {
ctx.strokeStyle = 'rgba(255,128,0,0.85)';
ctx.lineWidth = 4;
for (var i = 0; i < editor.uivalues.lastUsed.length; ++i) {
var x = i % core.__SIZE__, y = parseInt(i / core.__SIZE__);
var info = editor.uivalues.lastUsed[i];
if (!info || !info.images) continue;
if (info.isTile) {
ctx.drawImage(core.material.images.tilesets[info.images], 32 * info.x, 32 * info.y, 32, 32, x*32, y*32, 32, 32);
} else if (info.images == 'autotile') {
ctx.drawImage(core.material.images.autotile[info.id], 0, 0, 32, 32, x * 32, y * 32, 32, 32);
} else {
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 (selectBox.isSelected() && editor.info.id == info.id) {
ctx.strokeRect(32 * x + 2, 32 * y + 2, 28, 28);
}
try {
var x = i % core.__SIZE__, y = parseInt(i / core.__SIZE__);
var info = editor.uivalues.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);
} else if (info.images == 'autotile' && core.material.images.autotile[info.id]) {
ctx.drawImage(core.material.images.autotile[info.id], 0, 0, 32, 32, x * 32, y * 32, 32, 32);
} else {
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 (selectBox.isSelected() && editor.info.id == info.id) {
ctx.strokeRect(32 * x + 2, 32 * y + 2, 28, 28);
}
} catch (e) {}
}
}

View File

@ -207,9 +207,7 @@ loader.prototype._loadAnimates = function () {
core.loader._loadAnimate(t, animates[name]);
}
}
}, null, true, function (percentage) {
core.loader._setStartProgressVal(percentage * 100);
});
}, null, true);
} else {
core.animates.forEach(function (t) {
core.http('GET', 'project/animates/' + t + ".animate?v=" + main.version, null, function (content) {
@ -284,8 +282,6 @@ loader.prototype._loadMusic = function () {
core.loader._loadOneSound_decodeData(name, data[name]);
}
}
}, null, false, function (percentage) {
core.loader._setStartProgressVal(percentage * 100);
});
} else {
core.sounds.forEach(function (t) {

View File

@ -258,6 +258,11 @@ maps.prototype.saveMap = function (floorId) {
}
return map;
}
// 砍层状态:直接返回
if (main.mode == 'play' && (flags.__removed__ || []).indexOf(floorId) >= 0) {
return { 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;
@ -293,6 +298,23 @@ 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;