split resources folder
@ -149,7 +149,7 @@ editor.prototype.init = function (callback) {
|
|||||||
var useCompress = main.useCompress;
|
var useCompress = main.useCompress;
|
||||||
main.useCompress = false;
|
main.useCompress = false;
|
||||||
editor.airwallImg = new Image();
|
editor.airwallImg = new Image();
|
||||||
editor.airwallImg.src = './project/images/airwall.png';
|
editor.airwallImg.src = './project/materials/airwall.png';
|
||||||
|
|
||||||
main.init('editor', function () {
|
main.init('editor', function () {
|
||||||
editor.config = new editor_config();
|
editor.config = new editor_config();
|
||||||
|
|||||||
10
libs/core.js
@ -190,9 +190,9 @@ function core() {
|
|||||||
},
|
},
|
||||||
"globalAttribute": {
|
"globalAttribute": {
|
||||||
'equipName': main.equipName || [],
|
'equipName': main.equipName || [],
|
||||||
"statusLeftBackground": main.statusLeftBackground || "url(project/images/ground.png) repeat",
|
"statusLeftBackground": main.statusLeftBackground || "url(project/materials/ground.png) repeat",
|
||||||
"statusTopBackground": main.statusTopBackground || "url(project/images/ground.png) repeat",
|
"statusTopBackground": main.statusTopBackground || "url(project/materials/ground.png) repeat",
|
||||||
"toolsBackground": main.toolsBackground || "url(project/images/ground.png) repeat",
|
"toolsBackground": main.toolsBackground || "url(project/images/materials.png) repeat",
|
||||||
"borderColor": main.borderColor || "white",
|
"borderColor": main.borderColor || "white",
|
||||||
"statusBarColor": main.statusBarColor || "white",
|
"statusBarColor": main.statusBarColor || "white",
|
||||||
"hardLabelColor": main.hardLabelColor || "red",
|
"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.groundCanvas.canvas.width = core.material.groundCanvas.canvas.height = 32;
|
||||||
core.material.groundPattern = core.material.groundCanvas.createPattern(core.material.groundCanvas.canvas, 'repeat');
|
core.material.groundPattern = core.material.groundCanvas.createPattern(core.material.groundCanvas.canvas, 'repeat');
|
||||||
core.bigmap.tempCanvas = document.createElement('canvas').getContext('2d');
|
core.bigmap.tempCanvas = document.createElement('canvas').getContext('2d');
|
||||||
core.loadImage('fog', function (name, img) { core.animateFrame.weather.fog = img; });
|
core.loadImage("materials", 'fog', function (name, img) { core.animateFrame.weather.fog = img; });
|
||||||
core.loadImage('keyboard', function (name, img) {core.material.images.keyboard = img; });
|
core.loadImage("materials", 'keyboard', function (name, img) {core.material.images.keyboard = img; });
|
||||||
// 记录存档编号
|
// 记录存档编号
|
||||||
core.saves.saveIndex = core.getLocalStorage('saveIndex', 1);
|
core.saves.saveIndex = core.getLocalStorage('saveIndex', 1);
|
||||||
core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; });
|
core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; });
|
||||||
|
|||||||
@ -39,7 +39,7 @@ loader.prototype._load = function (callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loader.prototype._loadIcons = function () {
|
loader.prototype._loadIcons = function () {
|
||||||
this.loadImage("icons.png", function (id, image) {
|
this.loadImage("materials", "icons.png", function (id, image) {
|
||||||
var images = core.splitImage(image);
|
var images = core.splitImage(image);
|
||||||
for (var key in core.statusBar.icons) {
|
for (var key in core.statusBar.icons) {
|
||||||
if (typeof core.statusBar.icons[key] == 'number') {
|
if (typeof core.statusBar.icons[key] == 'number') {
|
||||||
@ -54,9 +54,9 @@ loader.prototype._loadIcons = function () {
|
|||||||
loader.prototype._loadMaterialImages = function (callback) {
|
loader.prototype._loadMaterialImages = function (callback) {
|
||||||
this._setStartLoadTipText("正在加载资源文件...");
|
this._setStartLoadTipText("正在加载资源文件...");
|
||||||
if (main.useCompress) {
|
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 {
|
} 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 = {};
|
core.material.images.images = {};
|
||||||
|
|
||||||
var images = core.clone(core.images);
|
var images = core.clone(core.images);
|
||||||
if (images.indexOf("hero.png") < 0)
|
|
||||||
images.push("hero.png");
|
|
||||||
|
|
||||||
this._setStartLoadTipText("正在加载图片文件...");
|
this._setStartLoadTipText("正在加载图片文件...");
|
||||||
if (main.useCompress) {
|
if (main.useCompress) {
|
||||||
@ -79,14 +77,14 @@ loader.prototype._loadExtraImages = function (callback) {
|
|||||||
|
|
||||||
this.loadImagesFromZip('project/images/images.h5data', images, core.material.images.images, callback);
|
this.loadImagesFromZip('project/images/images.h5data', images, core.material.images.images, callback);
|
||||||
gifs.forEach(function (gif) {
|
gifs.forEach(function (gif) {
|
||||||
this.loadImage(gif, function (id, image) {
|
this.loadImage("images", gif, function (id, image) {
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
core.material.images.images[gif] = image;
|
core.material.images.images[gif] = image;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, this);
|
}, this);
|
||||||
} else {
|
} 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("正在加载自动元件...");
|
this._setStartLoadTipText("正在加载自动元件...");
|
||||||
if (main.useCompress) {
|
if (main.useCompress) {
|
||||||
this.loadImagesFromZip('project/images/autotiles.h5data', keys, autotiles, _callback);
|
this.loadImagesFromZip('project/autotiles/autotiles.h5data', keys, autotiles, _callback);
|
||||||
} else {
|
} else {
|
||||||
this.loadImages(keys, autotiles, _callback);
|
this.loadImages("autotiles", keys, autotiles, _callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,20 +129,20 @@ loader.prototype._loadTilesets = function (callback) {
|
|||||||
}
|
}
|
||||||
this._setStartLoadTipText("正在加载额外素材...");
|
this._setStartLoadTipText("正在加载额外素材...");
|
||||||
if (main.useCompress) {
|
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 {
|
} 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 (!names || names.length == 0) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var items = 0;
|
var items = 0;
|
||||||
for (var i = 0; i < names.length; i++) {
|
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 + "...");
|
core.loader._setStartLoadTipText('正在加载图片 ' + id + "...");
|
||||||
if (toSave[id] !== undefined) {
|
if (toSave[id] !== undefined) {
|
||||||
if (image != null)
|
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 {
|
try {
|
||||||
var name = imgName;
|
var name = imgName;
|
||||||
if (name.indexOf(".") < 0)
|
if (name.indexOf(".") < 0)
|
||||||
@ -204,7 +202,7 @@ loader.prototype.loadImage = function (imgName, callback) {
|
|||||||
image.onerror = function () {
|
image.onerror = function () {
|
||||||
callback(imgName, null);
|
callback(imgName, null);
|
||||||
}
|
}
|
||||||
image.src = 'project/images/' + name + "?v=" + main.version;
|
image.src = 'project/' + dir + '/' + name + "?v=" + main.version;
|
||||||
if (name.endsWith('.gif'))
|
if (name.endsWith('.gif'))
|
||||||
callback(imgName, null);
|
callback(imgName, null);
|
||||||
}
|
}
|
||||||
@ -313,7 +311,7 @@ loader.prototype.loadOneMusic = function (name) {
|
|||||||
var music = new Audio();
|
var music = new Audio();
|
||||||
music.preload = 'none';
|
music.preload = 'none';
|
||||||
if (main.bgmRemote) music.src = main.bgmRemoteRoot + core.firstData.name + '/' + name;
|
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';
|
music.loop = 'loop';
|
||||||
core.material.bgms[name] = music;
|
core.material.bgms[name] = music;
|
||||||
}
|
}
|
||||||
|
|||||||
|
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 |
@ -65,8 +65,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
],
|
],
|
||||||
"startBgm": null,
|
"startBgm": null,
|
||||||
"statusLeftBackground": null,
|
"statusLeftBackground": null,
|
||||||
"statusTopBackground": "url(project/images/ground.png) repeat",
|
"statusTopBackground": "url(project/materials/ground.png) repeat",
|
||||||
"toolsBackground": "url(project/images/ground.png) repeat",
|
"toolsBackground": "url(project/materials/ground.png) repeat",
|
||||||
"borderColor": "#CCCCCC",
|
"borderColor": "#CCCCCC",
|
||||||
"statusBarColor": "white",
|
"statusBarColor": "white",
|
||||||
"hardLabelColor": "red",
|
"hardLabelColor": "red",
|
||||||
|
|||||||
|
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: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
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;
|
box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
-webkit-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;
|
z-index: 185;
|
||||||
display: none;
|
display: none;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -232,7 +232,7 @@
|
|||||||
}
|
}
|
||||||
#toolBar {
|
#toolBar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: url(project/images/ground.png) repeat;
|
background: url(project/materials/ground.png) repeat;
|
||||||
z-index: 210;
|
z-index: 210;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
|
|||||||