@ -151,7 +151,7 @@ editor.prototype.init = function (callback) {
|
||||
var useCompress = main.useCompress;
|
||||
main.useCompress = false;
|
||||
editor.airwallImg = new Image();
|
||||
editor.airwallImg.src = './project/images/airwall.png';
|
||||
editor.airwallImg.src = './project/materials/airwall.png';
|
||||
|
||||
main.init('editor', function () {
|
||||
editor.config = new editor_config();
|
||||
|
||||
@ -57,11 +57,21 @@ editor_table_wrapper = function (editor) {
|
||||
}
|
||||
|
||||
editor_table.prototype.gap = function (field) {
|
||||
return /* html */`<tr><td>----</td><td>----</td><td>${field}</td><td>----</td></tr>\n`
|
||||
var tokenlist = field.slice(2, -2).split("']['");
|
||||
var rule = tokenlist.join("-");
|
||||
tokenlist.pop();
|
||||
var self = tokenlist.join("-");
|
||||
var status = !!tokenPool[rule];
|
||||
return /* html */`<tr data-gap="${rule}" data-field="${self}">
|
||||
<td>----</td>
|
||||
<td>----</td>
|
||||
<td>${field}</td>
|
||||
<td><button style="background: #FFCCAA" onclick='editor.table.onFoldBtnClick(this)' data-fold="${ status ? "true" : "false" }">${ status ? "展开" : "折叠" }</button></td>
|
||||
</tr>\n`
|
||||
}
|
||||
|
||||
editor_table.prototype.tr = function (guid, field, shortField, commentHTMLescape, cobjstr, shortComment, tdstr, type) {
|
||||
return /* html */`<tr id="${guid}">
|
||||
return /* html */`<tr id="${guid}" data-field="${field.slice(2, -2).split("']['").join("-")}">
|
||||
<td title="${field}">${shortField}</td>
|
||||
<td title="${commentHTMLescape}" cobj="${cobjstr}">${shortComment || commentHTMLescape}</td>
|
||||
<td><div class="etableInputDiv ${type}">${tdstr}</div></td>
|
||||
@ -348,6 +358,36 @@ editor_table_wrapper = function (editor) {
|
||||
}
|
||||
}
|
||||
|
||||
var tokenPool = {};
|
||||
var tokenstyle = document.createElement("style");
|
||||
document.body.appendChild(tokenstyle);
|
||||
|
||||
tokenPoolRender = function() {
|
||||
var content = "";
|
||||
Object.keys(tokenPool).forEach(function(k) {
|
||||
content += /* CSS */`[data-field|=${k}]{ display: none }`;
|
||||
})
|
||||
tokenstyle.innerHTML = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当"折叠"被按下时
|
||||
*/
|
||||
editor_table.prototype.onFoldBtnClick = function (button) {
|
||||
var tr = button.parentNode.parentNode;
|
||||
if (button.dataset.fold == "true") {
|
||||
delete tokenPool[tr.dataset.gap];
|
||||
tokenPoolRender();
|
||||
button.dataset.fold = "false";
|
||||
button.innerText = "折叠";
|
||||
} else {
|
||||
tokenPool[tr.dataset.gap] = true;
|
||||
tokenPoolRender();
|
||||
button.dataset.fold = "true";
|
||||
button.innerText = "展开";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 当"显示完整注释"被按下时
|
||||
*/
|
||||
|
||||
@ -244,6 +244,14 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"hero": {
|
||||
"_type": "object",
|
||||
"_data": {
|
||||
"image": {
|
||||
"_leaf": true,
|
||||
"_type": "select",
|
||||
"_select": {
|
||||
"values": [null].concat(Object.keys(editor.core.material.images))
|
||||
},
|
||||
"_data": "勇士行走图"
|
||||
},
|
||||
"name": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
|
||||
10
libs/core.js
@ -190,9 +190,9 @@ function core() {
|
||||
},
|
||||
"globalAttribute": {
|
||||
'equipName': main.equipName || [],
|
||||
"statusLeftBackground": main.statusLeftBackground || "url(project/images/ground.png) repeat",
|
||||
"statusTopBackground": main.statusTopBackground || "url(project/images/ground.png) repeat",
|
||||
"toolsBackground": main.toolsBackground || "url(project/images/ground.png) repeat",
|
||||
"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",
|
||||
@ -374,8 +374,8 @@ core.prototype._init_others = function () {
|
||||
core.material.groundCanvas.canvas.width = core.material.groundCanvas.canvas.height = 32;
|
||||
core.material.groundPattern = core.material.groundCanvas.createPattern(core.material.groundCanvas.canvas, 'repeat');
|
||||
core.bigmap.tempCanvas = document.createElement('canvas').getContext('2d');
|
||||
core.loadImage('fog', function (name, img) { core.animateFrame.weather.fog = img; });
|
||||
core.loadImage('keyboard', function (name, img) {core.material.images.keyboard = img; });
|
||||
core.loadImage("materials", 'fog', function (name, img) { core.animateFrame.weather.fog = img; });
|
||||
core.loadImage("materials", 'keyboard', function (name, img) {core.material.images.keyboard = img; });
|
||||
// 记录存档编号
|
||||
core.saves.saveIndex = core.getLocalStorage('saveIndex', 1);
|
||||
core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; });
|
||||
|
||||
@ -2871,8 +2871,11 @@ events.prototype._jumpHero_finished = function (animate, ex, ey, callback) {
|
||||
events.prototype.setHeroIcon = function (name, noDraw) {
|
||||
name = core.getMappedName(name);
|
||||
var img = core.material.images.images[name];
|
||||
if (!img) return;
|
||||
core.setFlag("heroIcon", name);
|
||||
if (!img) {
|
||||
console.error("找不到图片: "+img);
|
||||
return;
|
||||
}
|
||||
core.status.hero.image = name;
|
||||
core.material.images.hero = img;
|
||||
core.material.icons.hero.width = img.width / 4;
|
||||
core.material.icons.hero.height = img.height / 4;
|
||||
|
||||
@ -39,7 +39,7 @@ loader.prototype._load = function (callback) {
|
||||
}
|
||||
|
||||
loader.prototype._loadIcons = function () {
|
||||
this.loadImage("icons.png", function (id, image) {
|
||||
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') {
|
||||
@ -54,9 +54,9 @@ loader.prototype._loadIcons = function () {
|
||||
loader.prototype._loadMaterialImages = function (callback) {
|
||||
this._setStartLoadTipText("正在加载资源文件...");
|
||||
if (main.useCompress) {
|
||||
this.loadImagesFromZip('project/images/materials.h5data', core.materials, core.material.images, callback);
|
||||
this.loadImagesFromZip('project/materials/materials.h5data', core.materials, core.material.images, callback);
|
||||
} else {
|
||||
this.loadImages(core.materials, core.material.images, callback);
|
||||
this.loadImages("materials", core.materials, core.material.images, callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +64,6 @@ loader.prototype._loadExtraImages = function (callback) {
|
||||
core.material.images.images = {};
|
||||
|
||||
var images = core.clone(core.images);
|
||||
if (images.indexOf("hero.png") < 0)
|
||||
images.push("hero.png");
|
||||
|
||||
this._setStartLoadTipText("正在加载图片文件...");
|
||||
if (main.useCompress) {
|
||||
@ -79,14 +77,14 @@ loader.prototype._loadExtraImages = function (callback) {
|
||||
|
||||
this.loadImagesFromZip('project/images/images.h5data', images, core.material.images.images, callback);
|
||||
gifs.forEach(function (gif) {
|
||||
this.loadImage(gif, function (id, image) {
|
||||
this.loadImage("images", gif, function (id, image) {
|
||||
if (image != null) {
|
||||
core.material.images.images[gif] = image;
|
||||
}
|
||||
});
|
||||
}, this);
|
||||
} else {
|
||||
this.loadImages(images, core.material.images.images, callback);
|
||||
this.loadImages("images", images, core.material.images.images, callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,9 +105,9 @@ loader.prototype._loadAutotiles = function (callback) {
|
||||
}
|
||||
this._setStartLoadTipText("正在加载自动元件...");
|
||||
if (main.useCompress) {
|
||||
this.loadImagesFromZip('project/images/autotiles.h5data', keys, autotiles, _callback);
|
||||
this.loadImagesFromZip('project/autotiles/autotiles.h5data', keys, autotiles, _callback);
|
||||
} else {
|
||||
this.loadImages(keys, autotiles, _callback);
|
||||
this.loadImages("autotiles", keys, autotiles, _callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,20 +129,20 @@ loader.prototype._loadTilesets = function (callback) {
|
||||
}
|
||||
this._setStartLoadTipText("正在加载额外素材...");
|
||||
if (main.useCompress) {
|
||||
this.loadImagesFromZip('project/images/tilesets.h5data', core.tilesets, core.material.images.tilesets, _callback);
|
||||
this.loadImagesFromZip('project/tilesets/tilesets.h5data', core.tilesets, core.material.images.tilesets, _callback);
|
||||
} else {
|
||||
this.loadImages(core.tilesets, core.material.images.tilesets, _callback);
|
||||
this.loadImages("tilesets", core.tilesets, core.material.images.tilesets, _callback);
|
||||
}
|
||||
}
|
||||
|
||||
loader.prototype.loadImages = function (names, toSave, callback) {
|
||||
loader.prototype.loadImages = function (dir, names, toSave, callback) {
|
||||
if (!names || names.length == 0) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
var items = 0;
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
this.loadImage(names[i], function (id, image) {
|
||||
this.loadImage(dir, names[i], function (id, image) {
|
||||
core.loader._setStartLoadTipText('正在加载图片 ' + id + "...");
|
||||
if (toSave[id] !== undefined) {
|
||||
if (image != null)
|
||||
@ -192,7 +190,7 @@ loader.prototype.loadImagesFromZip = function (url, names, toSave, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype.loadImage = function (imgName, callback) {
|
||||
loader.prototype.loadImage = function (dir, imgName, callback) {
|
||||
try {
|
||||
var name = imgName;
|
||||
if (name.indexOf(".") < 0)
|
||||
@ -204,7 +202,7 @@ loader.prototype.loadImage = function (imgName, callback) {
|
||||
image.onerror = function () {
|
||||
callback(imgName, null);
|
||||
}
|
||||
image.src = 'project/images/' + name + "?v=" + main.version;
|
||||
image.src = 'project/' + dir + '/' + name + "?v=" + main.version;
|
||||
if (name.endsWith('.gif'))
|
||||
callback(imgName, null);
|
||||
}
|
||||
@ -313,7 +311,7 @@ loader.prototype.loadOneMusic = function (name) {
|
||||
var music = new Audio();
|
||||
music.preload = 'none';
|
||||
if (main.bgmRemote) music.src = main.bgmRemoteRoot + core.firstData.name + '/' + name;
|
||||
else music.src = 'project/sounds/' + name;
|
||||
else music.src = 'project/bgms/' + name;
|
||||
music.loop = 'loop';
|
||||
core.material.bgms[name] = music;
|
||||
}
|
||||
|
||||
@ -1238,7 +1238,7 @@ maps.prototype._drawThumbnail_realDrawTempCanvas = function (floorId, blocks, op
|
||||
this.drawEvents(floorId, blocks, tempCanvas);
|
||||
// 缩略图:勇士
|
||||
if (options.heroLoc) {
|
||||
options.heroIcon = options.heroIcon || core.getFlag("heroIcon", "hero.png");
|
||||
options.heroIcon = options.heroIcon || core.status.hero.image;
|
||||
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;
|
||||
|
||||
@ -2057,7 +2057,7 @@ ui.prototype.drawCenterFly = function () {
|
||||
var fillstyle = 'rgba(255,0,0,0.5)';
|
||||
if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)';
|
||||
var toX = core.bigmap.width - 1 - core.getHeroLoc('x'), toY = core.bigmap.height - 1 - core.getHeroLoc('y');
|
||||
core.drawThumbnail(null, null, {heroLoc: core.status.hero.loc, heroIcon: core.getFlag('heroIcon', "hero.png")},
|
||||
core.drawThumbnail(null, null, {heroLoc: core.status.hero.loc, heroIcon: core.status.hero.image},
|
||||
{ctx: 'ui', centerX: toX, centerY: toY});
|
||||
var offsetX = core.clamp(toX - core.__HALF_SIZE__, 0, core.bigmap.width - core.__SIZE__),
|
||||
offsetY = core.clamp(toY - core.__HALF_SIZE__, 0, core.bigmap.height - core.__SIZE__);
|
||||
@ -2542,7 +2542,7 @@ ui.prototype._drawSLPanel_drawRecord = function(title, data, x, y, size, cho, hi
|
||||
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, {
|
||||
heroLoc: data.hero.loc, heroIcon: data.hero.flags.heroIcon, flags: data.hero.flags
|
||||
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
|
||||
});
|
||||
|
||||
2
main.js
@ -85,7 +85,7 @@ function main() {
|
||||
'data', 'enemys', 'icons', 'maps', 'items', 'functions', 'events', 'plugins'
|
||||
];
|
||||
this.materials = [
|
||||
'animates', 'enemys', 'hero', 'items', 'npcs', 'terrains', 'enemy48', 'npc48'
|
||||
'animates', 'enemys', 'items', 'npcs', 'terrains', 'enemy48', 'npc48'
|
||||
];
|
||||
|
||||
this.statusBar = {
|
||||
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
@ -10,7 +10,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
],
|
||||
"images": [
|
||||
"bg.jpg",
|
||||
"winskin.png"
|
||||
"winskin.png",
|
||||
"hero.png"
|
||||
],
|
||||
"tilesets": [
|
||||
"magictower.png"
|
||||
@ -65,8 +66,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
],
|
||||
"startBgm": null,
|
||||
"statusLeftBackground": null,
|
||||
"statusTopBackground": "url(project/images/ground.png) repeat",
|
||||
"toolsBackground": "url(project/images/ground.png) repeat",
|
||||
"statusTopBackground": "url(project/materials/ground.png) repeat",
|
||||
"toolsBackground": "url(project/materials/ground.png) repeat",
|
||||
"borderColor": "#CCCCCC",
|
||||
"statusBarColor": "white",
|
||||
"hardLabelColor": "red",
|
||||
@ -81,6 +82,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"version": "Ver 2.6.6",
|
||||
"floorId": "sample0",
|
||||
"hero": {
|
||||
"image": "hero.png",
|
||||
"name": "阳光",
|
||||
"lv": 1,
|
||||
"hpmax": 9999,
|
||||
|
||||
@ -16,7 +16,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 初始化人物,图标,统计信息
|
||||
core.status.hero = core.clone(hero);
|
||||
window.flags = core.status.hero.flags;
|
||||
core.events.setHeroIcon(core.getFlag('heroIcon', 'hero.png'), true);
|
||||
core.events.setHeroIcon(core.status.hero.image, true);
|
||||
core.control._initStatistics(core.animateFrame.totalTime);
|
||||
core.status.hero.statistics.totalTime = core.animateFrame.totalTime =
|
||||
Math.max(core.status.hero.statistics.totalTime, core.animateFrame.totalTime);
|
||||
@ -939,7 +939,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 重置音量
|
||||
core.events.setVolume(core.getFlag("__volume__", 1), 0);
|
||||
// 加载勇士图标
|
||||
var icon = core.getFlag("heroIcon", "hero.png");
|
||||
var icon = core.status.hero.image;
|
||||
icon = core.getMappedName(icon);
|
||||
if (core.material.images.images[icon]) {
|
||||
core.material.images.hero = core.material.images.images[icon];
|
||||
|
||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 600 B After Width: | Height: | Size: 600 B |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 298 KiB After Width: | Height: | Size: 298 KiB |
@ -198,7 +198,7 @@
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
background: url(project/images/ground.png) repeat;
|
||||
background: url(project/materials/ground.png) repeat;
|
||||
z-index: 185;
|
||||
display: none;
|
||||
top: 0;
|
||||
@ -232,7 +232,7 @@
|
||||
}
|
||||
#toolBar {
|
||||
position: absolute;
|
||||
background: url(project/images/ground.png) repeat;
|
||||
background: url(project/materials/ground.png) repeat;
|
||||
z-index: 210;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
|
||||