split resources folder

This commit is contained in:
tocque 2020-05-15 14:42:26 +08:00
parent 5426e09e81
commit 8100bf72b1
25 changed files with 24 additions and 26 deletions

View File

@ -149,7 +149,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();

View File

@ -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; });

View File

@ -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;
}

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -65,8 +65,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",

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 600 B

After

Width:  |  Height:  |  Size: 600 B

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 298 KiB

After

Width:  |  Height:  |  Size: 298 KiB

View File

@ -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;