Fix known bugs

This commit is contained in:
ckcz123 2020-07-09 16:28:28 +08:00
parent e63b646630
commit f9e4bdc947
4 changed files with 33 additions and 24 deletions

View File

@ -477,7 +477,7 @@ editor.prototype.updateMap = function () {
return 0; return 0;
} }
}); });
}), {'events': editor.currentFloorData.events}, editor.currentFloorId); }), null, editor.currentFloorId);
core.status.thisMap.blocks = blocks; core.status.thisMap.blocks = blocks;
if (editor.uivalues.bigmap) return this._updateMap_bigmap(); if (editor.uivalues.bigmap) return this._updateMap_bigmap();
@ -513,15 +513,17 @@ editor.prototype.updateMap = function () {
} }
//ctx.drawImage(core.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32); //ctx.drawImage(core.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
} }
// 绘制地图 start if (editor.map.length * editor.map[0].length < 4096) {
for (var y = 0; y < editor.map.length; y++) { for (var y = 0; y < editor.map.length; y++) {
for (var x = 0; x < editor.map[0].length; x++) { for (var x = 0; x < editor.map[0].length; x++) {
drawTile(editor.dom.evCtx, x, y, editor.map[y][x]); drawTile(editor.dom.evCtx, x, y, editor.map[y][x]);
editor.dom.canvas.forEach(function (one) { editor.dom.canvas.forEach(function (one) {
drawTile(editor.dom[one + 'Ctx'], x, y, editor[one+'map'][y][x]); drawTile(editor.dom[one + 'Ctx'], x, y, editor[one+'map'][y][x]);
}); });
}
} }
} }
// 绘制地图 end // 绘制地图 end
editor.drawEventBlock(); editor.drawEventBlock();

View File

@ -1032,6 +1032,7 @@ editor_mappanel_wrapper = function (editor) {
} }
editor.constructor.prototype.savePreMap = function () { editor.constructor.prototype.savePreMap = function () {
if (editor.map.length * editor.map[0].length >= 4096) return;
var dt = {}; var dt = {};
editor.dom.maps.forEach(function (one) { editor.dom.maps.forEach(function (one) {
dt[one] = editor[one]; dt[one] = editor[one];

View File

@ -39,7 +39,6 @@ dynamicMapEditor.prototype._init = function () {
this.dom.style.top = '3px'; this.dom.style.top = '3px';
this.dom.style.zIndex = 99999; this.dom.style.zIndex = 99999;
this.canvas = this.dom.getContext("2d"); this.canvas = this.dom.getContext("2d");
this.canvas.font = "12px Verdana";
core.dom.gameGroup.appendChild(this.dom); core.dom.gameGroup.appendChild(this.dom);
this.initInfos(); this.initInfos();
@ -52,13 +51,16 @@ dynamicMapEditor.prototype._init = function () {
dynamicMapEditor.prototype.initInfos = function () { dynamicMapEditor.prototype.initInfos = function () {
this.items = []; this.items = [];
var ids = {};
this.displayIds.forEach(function (v) { this.displayIds.forEach(function (v) {
if (v.startsWith("cls:")) { if (v.startsWith("cls:")) {
var cls = v.substr(4); var cls = v.substr(4);
for (var id in core.maps.blocksInfo) { for (var id in core.maps.blocksInfo) {
var u = core.maps.blocksInfo[id]; var u = core.maps.blocksInfo[id];
if (u && u.cls == cls) { if (u && u.cls == cls) {
if (ids[u.id]) continue;
this.items.push(core.getBlockInfo(u.id)); this.items.push(core.getBlockInfo(u.id));
ids[u.id] = true;
} }
} }
} else if (v == 'none') { } else if (v == 'none') {
@ -91,14 +93,12 @@ dynamicMapEditor.prototype.onKeyUp = function(e) {
} else if (e.keyCode == 221) { } else if (e.keyCode == 221) {
this.applyCurrentChange(); this.applyCurrentChange();
return true; return true;
} else { } else if (e.keyCode >= 48 && e.keyCode <= 57) {
// 0-9 // 0-9
if (e.keyCode >= 48 && e.keyCode <= 57) { if (e.altKey) {
if (e.altKey) { this.savedItem(e.keyCode - 48);
this.savedItem(e.keyCode - 48); } else {
} else { this.loadItem(e.keyCode - 48);
this.loadItem(e.keyCode - 48);
}
} }
return true; return true;
} }
@ -335,12 +335,12 @@ dynamicMapEditor.prototype.refreshToolBox = function() {
if (item.image) core.drawImage(this.canvas, item.image, 0, item.height * item.posY, 32, 32, rect.x + 4, rect.y, 32, 32); if (item.image) core.drawImage(this.canvas, item.image, 0, item.height * item.posY, 32, 32, rect.x + 4, rect.y, 32, 32);
if (item.name) { if (item.name) {
this.canvas.textAlign = 'center'; this.canvas.textAlign = 'center';
core.fillText(this.canvas, item.name, rect.x + 20, rect.y + 44, '#FFFFFF', null, 40); core.fillText(this.canvas, item.name, rect.x + 20, rect.y + 44, '#FFFFFF', '11px Verdana', 40);
} }
if (core.material.enemys[item.id]) { if (core.material.enemys[item.id]) {
this.canvas.textAlign = 'left'; this.canvas.textAlign = 'left';
var damageString = core.enemys.getDamageString(item.id); var damageString = core.enemys.getDamageString(item.id);
core.fillBoldText(this.canvas, damageString.damage, rect.x + 5, rect.y + 31, damageString.color); core.fillBoldText(this.canvas, damageString.damage, rect.x + 5, rect.y + 31, damageString.color, null, '11px Verdana');
var critical = core.enemys.nextCriticals(item.id, 1); var critical = core.enemys.nextCriticals(item.id, 1);
critical = core.formatBigNumber((critical[0]||[])[0], true); critical = core.formatBigNumber((critical[0]||[])[0], true);
if (critical == '???') critical = '?'; if (critical == '???') critical = '?';
@ -350,25 +350,25 @@ dynamicMapEditor.prototype.refreshToolBox = function() {
this.canvas.textAlign = 'center'; this.canvas.textAlign = 'center';
this.canvas.fillStyle = '#FFFFFF'; this.canvas.fillStyle = '#FFFFFF';
if(this.pageId > 0) core.fillText(this.canvas, '上一页', this.offsetX + 20, 365, '#FFFFFF'); if(this.pageId > 0) core.fillText(this.canvas, '上一页', this.offsetX + 20, 365, '#FFFFFF', '11px Verdana');
if(this.pageId < this.pageMax-1) core.fillText(this.canvas, '下一页',this.offsetX + 100, 365, '#FFFFFF'); if(this.pageId < this.pageMax-1) core.fillText(this.canvas, '下一页',this.offsetX + 100, 365, '#FFFFFF', '11px Verdana');
core.fillText(this.canvas, '帮助', this.offsetX + 60, 365, '#FFFFFF'); core.fillText(this.canvas, '帮助', this.offsetX + 60, 365, '#FFFFFF');
var text1 = core.formatBigNumber(core.getRealStatus('hp'), true) + "/" + var text1 = core.formatBigNumber(core.getRealStatus('hp'), true) + "/" +
core.formatBigNumber(core.getRealStatus('atk'), true) + "/" + core.formatBigNumber(core.getRealStatus('atk'), true) + "/" +
core.formatBigNumber(core.getRealStatus("def"), true) + "/" + core.formatBigNumber(core.getRealStatus("def"), true) + "/" +
core.formatBigNumber(core.getRealStatus("mdef"), true); core.formatBigNumber(core.getRealStatus("mdef"), true);
core.fillText(this.canvas, text1, this.offsetX + 60, 380, '#FF7F00', 120); core.fillText(this.canvas, text1, this.offsetX + 60, 380, '#FF7F00', '11px Verdana', 120);
var text2 = core.formatBigNumber(core.getRealStatus('money', true)) + "/" + var text2 = core.formatBigNumber(core.getRealStatus('money', true)) + "/" +
core.formatBigNumber(core.getRealStatus('exp'), true) + "/" + core.formatBigNumber(core.getRealStatus('exp'), true) + "/" +
core.itemCount('yellowKey') + '/' + core.itemCount('blueKey') + '/' + core.itemCount('yellowKey') + '/' + core.itemCount('blueKey') + '/' +
core.itemCount('redKey'); core.itemCount('redKey');
core.fillText(this.canvas, text2, this.offsetX + 60, 395, '#FF7F00', 120); core.fillText(this.canvas, text2, this.offsetX + 60, 395, '#FF7F00', '11px Verdana', 120);
var text3 = core.itemCount('pickaxe') + '/' + core.itemCount('bomb') + '/' + var text3 = core.itemCount('pickaxe') + '/' + core.itemCount('bomb') + '/' +
core.itemCount('centerFly'); core.itemCount('centerFly');
if (core.hasFlag('poison')) text3 += "/毒"; if (core.hasFlag('poison')) text3 += "/毒";
if (core.hasFlag('weak')) text3 += "/衰"; if (core.hasFlag('weak')) text3 += "/衰";
if (core.hasFlag('curse')) text3 += "/咒"; if (core.hasFlag('curse')) text3 += "/咒";
core.fillText(this.canvas, text3, this.offsetX + 60, 410, '#FF7F00', 120); core.fillText(this.canvas, text3, this.offsetX + 60, 410, '#FF7F00', '11px Verdana', 120);
if(this.selectedItem) { if(this.selectedItem) {
var rect = this.itemRect(this.selectedIndex); var rect = this.itemRect(this.selectedIndex);
core.strokeRect(this.canvas, rect.x, rect.y, rect.w, rect.h, '#FF7F00', 4); core.strokeRect(this.canvas, rect.x, rect.y, rect.w, rect.h, '#FF7F00', 4);

View File

@ -86,7 +86,13 @@ maps.prototype._mapIntoBlocks = function (map, floor, floorId) {
var mh = core.floors[floorId].height; var mh = core.floors[floorId].height;
for (var i = 0; i < mh; i++) { for (var i = 0; i < mh; i++) {
for (var j = 0; j < mw; j++) { for (var j = 0; j < mw; j++) {
var block = this.initBlock(j, i, (map[i] || [])[j], true, floor); var number = (map[i] || [])[j] || 0, block;
if (main.mode == 'editor') {
if (!number) continue;
block = {x: j, y: i, id: number, event: this.getBlockByNumber(number).event};
} else {
block = this.initBlock(j, i, number, true, floor);
}
if (block.id != 0 || block.event.trigger) if (block.id != 0 || block.event.trigger)
blocks.push(block); blocks.push(block);
} }