This commit is contained in:
parent
4c2d617d57
commit
2821866c39
42
game/game.js
42
game/game.js
|
@ -5146,11 +5146,40 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(confirm('游戏似乎未正常载入,是否重置游戏?')){
|
if(lib.device){
|
||||||
localStorage.clear();
|
if(navigator.notification){
|
||||||
if(indexedDB) indexedDB.deleteDatabase(lib.configprefix+'data');
|
navigator.notification.confirm(
|
||||||
window.location.reload();
|
'游戏似乎未正常载入,是否重置游戏?',
|
||||||
}
|
function(index){
|
||||||
|
if(index==2){
|
||||||
|
localStorage.removeItem('noname_inited');
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
else if(index==3){
|
||||||
|
localStorage.clear();
|
||||||
|
localStorage.setItem('noname_inited',true);
|
||||||
|
if(indexedDB) indexedDB.deleteDatabase(lib.configprefix+'data');
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'确认退出',
|
||||||
|
['取消','重新下载','重置设置']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(confirm('游戏似乎未正常载入,是否重置游戏?')){
|
||||||
|
localStorage.removeItem('noname_inited');
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(confirm('游戏似乎未正常载入,是否重置游戏?')){
|
||||||
|
localStorage.clear();
|
||||||
|
if(indexedDB) indexedDB.deleteDatabase(lib.configprefix+'data');
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},5000);
|
},5000);
|
||||||
var links=document.head.querySelectorAll('link');
|
var links=document.head.querySelectorAll('link');
|
||||||
|
@ -6045,7 +6074,6 @@
|
||||||
if(url.indexOf('http')!=0){
|
if(url.indexOf('http')!=0){
|
||||||
url=get.url(dev)+url;
|
url=get.url(dev)+url;
|
||||||
}
|
}
|
||||||
game.saveConfig('downloadedFile',true);
|
|
||||||
game.ensureDirectory(folder,function(){
|
game.ensureDirectory(folder,function(){
|
||||||
try{
|
try{
|
||||||
var file = lib.node.fs.createWriteStream(__dirname+'/'+folder);
|
var file = lib.node.fs.createWriteStream(__dirname+'/'+folder);
|
||||||
|
@ -6238,7 +6266,6 @@
|
||||||
if(url.indexOf('http')!=0){
|
if(url.indexOf('http')!=0){
|
||||||
url=get.url(dev)+url;
|
url=get.url(dev)+url;
|
||||||
}
|
}
|
||||||
game.saveConfig('downloadedFile',true);
|
|
||||||
var fileTransfer = new FileTransfer();
|
var fileTransfer = new FileTransfer();
|
||||||
folder=lib.assetURL+folder;
|
folder=lib.assetURL+folder;
|
||||||
game.print(typeof onprogress);
|
game.print(typeof onprogress);
|
||||||
|
@ -20349,6 +20376,7 @@
|
||||||
},
|
},
|
||||||
fetch:function(url,onload,onerror,onprogress){
|
fetch:function(url,onload,onerror,onprogress){
|
||||||
var tmpName='~tmp'+get.id();
|
var tmpName='~tmp'+get.id();
|
||||||
|
game.saveConfig('downloadedFile',true);
|
||||||
game.download(encodeURI(url),tmpName,function(){
|
game.download(encodeURI(url),tmpName,function(){
|
||||||
game.readFile(tmpName,function(data){
|
game.readFile(tmpName,function(data){
|
||||||
onload(data);
|
onload(data);
|
||||||
|
|
Loading…
Reference in New Issue