git auto update
This commit is contained in:
parent
1e2f18d782
commit
9aee3f1650
BIN
assets/sprite-pointer_tail.png
Normal file
BIN
assets/sprite-pointer_tail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 634 B |
@ -10,10 +10,10 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scriptManager= {};
|
var ScriptManager= {};
|
||||||
scriptManager.loadingcount=0;
|
ScriptManager.loading_count=0;
|
||||||
|
|
||||||
scriptManager.loadjs=async function(pth) {
|
ScriptManager.loadjs=async function(pth) {
|
||||||
var resolve;
|
var resolve;
|
||||||
var reject;
|
var reject;
|
||||||
var ret=new Promise(function(s, r) {
|
var ret=new Promise(function(s, r) {
|
||||||
@ -27,7 +27,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removelisteners();
|
removelisteners();
|
||||||
scriptManager.loadingcount--;
|
ScriptManager.loading_count--;
|
||||||
if(xhr.status!=200) {
|
if(xhr.status!=200) {
|
||||||
onfail();
|
onfail();
|
||||||
return;
|
return;
|
||||||
@ -72,19 +72,19 @@
|
|||||||
xhr.open("GET", pth, true);
|
xhr.open("GET", pth, true);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
|
|
||||||
scriptManager.loadingcount++;
|
ScriptManager.loading_count++;
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
scriptManager.isDone=function() {
|
ScriptManager.isDone=function() {
|
||||||
return scriptManager.loadingcount==0;
|
return ScriptManager.loading_count==0;
|
||||||
};
|
};
|
||||||
|
|
||||||
scriptManager.waitAll=async function() {
|
ScriptManager.waitAll=async function() {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var i;
|
var i;
|
||||||
i=setInterval(function() {
|
i=setInterval(function() {
|
||||||
if(scriptManager.loadingcount==0) {
|
if(ScriptManager.loading_count==0) {
|
||||||
clearInterval(i);
|
clearInterval(i);
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
@ -92,5 +92,5 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
window.scriptManager=scriptManager;
|
window.ScriptManager=ScriptManager;
|
||||||
})();
|
})();
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
//jsloadentry.js
|
//jsloadentry.js
|
||||||
|
|
||||||
(async function() {
|
(async function() {
|
||||||
if(!(typeof scriptManager=="object"&&"loadjs" in scriptManager)) {
|
if(!(typeof ScriptManager=="object"&&"loadjs" in ScriptManager)) {
|
||||||
if(typeof loadfail=="function") {
|
if(typeof loadfail=="function") {
|
||||||
loadfail("jsloadentry.js: scriptManager.loadjs is not defined");
|
loadfail("jsloadentry.js: ScriptManager.loadjs is not defined");
|
||||||
} else {
|
} else {
|
||||||
window.alert("jsloadentry.js: scriptManager.loadjs is not defined");
|
window.alert("jsloadentry.js: ScriptManager.loadjs is not defined");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptManager.loadjs("./js/libpolyfill.requestAnimationFrame.js");
|
ScriptManager.loadjs("./js/libpolyfill.requestAnimationFrame.js");
|
||||||
scriptManager.loadjs("./js/libutil.js");
|
ScriptManager.loadjs("./js/libutil.js");
|
||||||
scriptManager.loadjs("./js/libcubicbezier.js");
|
ScriptManager.loadjs("./js/libcubicbezier.js");
|
||||||
scriptManager.loadjs("./js/libwebglcheck.js");
|
ScriptManager.loadjs("./js/libwebglcheck.js");
|
||||||
scriptManager.loadjs("./js/libpixi_v891gl.dev.min.js");
|
ScriptManager.loadjs("./js/libpixi_v891gl.dev.min.js");
|
||||||
//scriptManager.loadjs("./js/libpixi_v891gl.prod.min.js");
|
//ScriptManager.loadjs("./js/libpixi_v891gl.prod.min.js");
|
||||||
await scriptManager.waitAll();
|
ScriptManager.loadjs("./js/libassetloader.js");
|
||||||
await scriptManager.loadjs("./js/libtransition.js");
|
await ScriptManager.waitAll();
|
||||||
await scriptManager.loadjs("./js/libmain.js");
|
await ScriptManager.loadjs("./js/libtransition.js");
|
||||||
scriptManager.loadjs("./js/libpointerfx.js");
|
await ScriptManager.loadjs("./js/libmain.js");
|
||||||
await scriptManager.waitAll();
|
ScriptManager.loadjs("./js/libpointerfx.js");
|
||||||
|
await ScriptManager.waitAll();
|
||||||
})();
|
})();
|
112
js/libassetloader.js
Normal file
112
js/libassetloader.js
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
//libassetloader.js
|
||||||
|
|
||||||
|
(async function() {
|
||||||
|
if(typeof XMLHttpRequest!="function") {
|
||||||
|
if(typeof loadfail=="function") {
|
||||||
|
loadfail("libassetloader.js: XMLHttpRequest(type of "+(typeof XMLHttpRequest)+") is not a function");
|
||||||
|
} else {
|
||||||
|
window.alert("libassetloader.js: XMLHttpRequest(type of "+(typeof XMLHttpRequest)+") is not a function");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(typeof Blob!="function") {
|
||||||
|
if(typeof loadfail=="function") {
|
||||||
|
loadfail("libassetloader.js: Blob(type of "+(typeof Blob)+") is not a function");
|
||||||
|
} else {
|
||||||
|
window.alert("libassetloader.js: Blob(type of "+(typeof Blob)+") is not a function");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(typeof URL!="function") {
|
||||||
|
if(typeof loadfail=="function") {
|
||||||
|
loadfail("libassetloader.js: URL(type of "+(typeof URL)+") is not a function");
|
||||||
|
} else {
|
||||||
|
window.alert("libassetloader.js: URL(type of "+(typeof URL)+") is not a function");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var AssetManager= {};
|
||||||
|
|
||||||
|
// map http url -> blob url
|
||||||
|
AssetManager.loadedAssets= {};
|
||||||
|
|
||||||
|
AssetManager.loading_count=0;
|
||||||
|
|
||||||
|
AssetManager.loadWithCache=async function(pth) {
|
||||||
|
if(pth in AssetManager.loadedAssets) {
|
||||||
|
return Promise.resolve(AssetManager.loadedAssets[pth]);
|
||||||
|
}
|
||||||
|
return AssetManager.do_fetch_res(pth);
|
||||||
|
};
|
||||||
|
|
||||||
|
AssetManager.do_fetch_res=async function(pth) {
|
||||||
|
var resolve;
|
||||||
|
var reject;
|
||||||
|
var ret=new Promise(function(s, r) {
|
||||||
|
resolve=s;
|
||||||
|
reject=r;
|
||||||
|
});
|
||||||
|
var xhr=new XMLHttpRequest();
|
||||||
|
|
||||||
|
xhr.responseType = "blob";
|
||||||
|
|
||||||
|
var onreadystatechange=async function() {
|
||||||
|
if(xhr.readyState!=XMLHttpRequest.DONE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
removelisteners();
|
||||||
|
AssetManager.loading_count--;
|
||||||
|
if(xhr.status!=200) {
|
||||||
|
onfail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AssetManager.loadedAssets[pth]=URL.createObjectURL(xhr.response);
|
||||||
|
console.debug("asset "+pth+" loaded from source.");
|
||||||
|
resolve(AssetManager.loadedAssets[pth]);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
var onfail=function() {
|
||||||
|
removelisteners();
|
||||||
|
xhr.abort();
|
||||||
|
window.loadfail("asset "+pth+" load failed");
|
||||||
|
reject("asset "+pth+" load failed");
|
||||||
|
};
|
||||||
|
|
||||||
|
var removelisteners=function() {
|
||||||
|
xhr.removeEventListener("readystatechange", onreadystatechange);
|
||||||
|
xhr.removeEventListener("error", onfail);
|
||||||
|
xhr.removeEventListener("abort", onfail);
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.addEventListener("readystatechange", onreadystatechange);
|
||||||
|
xhr.addEventListener("error", onfail);
|
||||||
|
xhr.addEventListener("abort", onfail);
|
||||||
|
|
||||||
|
xhr.open("GET", pth, true);
|
||||||
|
xhr.send();
|
||||||
|
|
||||||
|
AssetManager.loading_count++;
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
AssetManager.isDone=function() {
|
||||||
|
return AssetManager.loading_count==0;
|
||||||
|
};
|
||||||
|
|
||||||
|
AssetManager.waitAll=async function() {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
var i;
|
||||||
|
i=setInterval(function() {
|
||||||
|
if(AssetManager.loading_count==0) {
|
||||||
|
clearInterval(i);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
window.AssetManager=AssetManager;
|
||||||
|
|
||||||
|
})();
|
@ -1,3 +1,5 @@
|
|||||||
|
//libmain.js
|
||||||
|
|
||||||
return (async function() {
|
return (async function() {
|
||||||
if(typeof PIXI!="object") {
|
if(typeof PIXI!="object") {
|
||||||
if(typeof loadfail=="function") {
|
if(typeof loadfail=="function") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user