Commit efab095d authored by rockyl's avatar rockyl

修复

parent 14372fa3
This diff is collapsed.
This diff is collapsed.
{"id":"engine","url":"engine.dee8bb73f7c234c7fe2527549add0fab7ca3d3fc.js"}
\ No newline at end of file
{"id":"engine","url":"engine.8ae778db8ef99e121b1d622a45079bb758d196e1.js"}
\ No newline at end of file
......@@ -784,6 +784,9 @@ export default class Container extends DisplayObject {
}
set x(value: number) {
if(this.destroyed){
return;
}
if (value == this.transform.position.x) return;
this.transform.position.x = value;
......@@ -795,6 +798,9 @@ export default class Container extends DisplayObject {
}
set y(value: number) {
if(this.destroyed){
return;
}
if (value == this.transform.position.y) return;
this.transform.position.y = value;
......
......@@ -137,15 +137,19 @@ class AlignManager {
}
}
if(that.children){
that.children.forEach(v => this.align(v));
}
}
/**
* 自动大小
* @param that
*/
private autoSize(that) {
if(!that.children){
return;
}
const len = that.children.length
if (len > 0) {
......
......@@ -322,7 +322,7 @@ export class GameStage extends Node {
};
async loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete) {
const {assets,} = this._config;
const {assets, customs} = this._config;
let loaded = 0;
let assetsToLoad = assets;
......@@ -342,9 +342,25 @@ export class GameStage extends Node {
}
} else {
total = assetsToLoad.length;
if (customs) {
for (let custom of customs) {
if (custom.assets) {
total += custom.assets.length;
}
}
}
await loadAssets(assetsToLoad, p).catch(e => {
console.log(e);
});
if (customs) {
for (let custom of customs) {
if (custom.assets) {
await loadAssets(custom.assets, p).catch(e => {
console.log(e);
});
}
}
}
}
function p() {
......
......@@ -21,17 +21,31 @@ for (let item of search.replace('?', '').split('&')) {
* @param parent
*/
export function appendScript(script, parent = document.body) {
if(!script){
if (!script) {
return;
}
let scriptContent;
if (script.indexOf('<script') === 0) {
let temp = document.createElement('div');
temp.innerHTML = script;
scriptContent = temp.children[0].innerHTML;
for (let i = 0, li = temp.children.length; i < li; i++) {
const child: any = temp.children[i];
if (child.src) {
parent.appendChild(child);
i--;
li--;
} else {
_appendScript(child.innerHTML, parent);
}
}
} else {
scriptContent = script;
_appendScript(script, parent);
}
}
function _appendScript(scriptContent, parent) {
let scriptEl = document.createElement('script');
scriptEl.innerHTML = scriptContent;
parent.appendChild(scriptEl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment