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,12 +405,13 @@ editor.prototype.updateLastUsedMap = function () {
ctx.strokeStyle = 'rgba(255,128,0,0.85)'; ctx.strokeStyle = 'rgba(255,128,0,0.85)';
ctx.lineWidth = 4; ctx.lineWidth = 4;
for (var i = 0; i < editor.uivalues.lastUsed.length; ++i) { for (var i = 0; i < editor.uivalues.lastUsed.length; ++i) {
try {
var x = i % core.__SIZE__, y = parseInt(i / core.__SIZE__); var x = i % core.__SIZE__, y = parseInt(i / core.__SIZE__);
var info = editor.uivalues.lastUsed[i]; var info = editor.uivalues.lastUsed[i];
if (!info || !info.images) continue; if (!info || !info.images) continue;
if (info.isTile) { 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); 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') { } 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); ctx.drawImage(core.material.images.autotile[info.id], 0, 0, 32, 32, x * 32, y * 32, 32, 32);
} else { } else {
var per_height = info.images.endsWith('48') ? 48 : 32; var per_height = info.images.endsWith('48') ? 48 : 32;
@ -419,6 +420,7 @@ editor.prototype.updateLastUsedMap = function () {
if (selectBox.isSelected() && editor.info.id == info.id) { if (selectBox.isSelected() && editor.info.id == info.id) {
ctx.strokeRect(32 * x + 2, 32 * y + 2, 28, 28); 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]); core.loader._loadAnimate(t, animates[name]);
} }
} }
}, null, true, function (percentage) { }, null, true);
core.loader._setStartProgressVal(percentage * 100);
});
} else { } else {
core.animates.forEach(function (t) { core.animates.forEach(function (t) {
core.http('GET', 'project/animates/' + t + ".animate?v=" + main.version, null, function (content) { 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]); core.loader._loadOneSound_decodeData(name, data[name]);
} }
} }
}, null, false, function (percentage) {
core.loader._setStartProgressVal(percentage * 100);
}); });
} else { } else {
core.sounds.forEach(function (t) { core.sounds.forEach(function (t) {

View File

@ -258,6 +258,11 @@ maps.prototype.saveMap = function (floorId) {
} }
return map; 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 map = maps[floorId], floor = core.floors[floorId];
var blocks = this._getMapArrayFromBlocks(map.blocks, floor.width, floor.height, true); var blocks = this._getMapArrayFromBlocks(map.blocks, floor.width, floor.height, true);
if (main.mode == 'editor') return blocks; if (main.mode == 'editor') return blocks;
@ -293,6 +298,23 @@ maps.prototype.loadMap = function (data, floorId) {
return this.loadFloor(floorId, 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) { maps.prototype.resizeMap = function (floorId) {
floorId = floorId || core.status.floorId; floorId = floorId || core.status.floorId;