diff --git a/game/game.js b/game/game.js index 036beb109..42def08fd 100644 --- a/game/game.js +++ b/game/game.js @@ -5803,7 +5803,7 @@ var index=window.location.href.indexOf('index.html?server='); if(index!=-1){ window.isNonameServer=window.location.href.slice(index+18); - window.indexedDB=null; + window.nodb=true; } else{ index=localStorage.getItem(lib.configprefix+'asserver'); @@ -6319,375 +6319,12 @@ lib.assetURL=noname_inited; } - ui.css={menu:lib.init.css(lib.assetURL+'layout/default','menu',function(){ - ui.css.default=lib.init.css(lib.assetURL+'layout/default','layout'); - })}; - - if(lib.device){ - lib.init.cordovaReady=function(){ - if(lib.device=='android'){ - document.addEventListener("pause", function(){ - if(!_status.paused2&&!_status.event.isMine()){ - ui.click.pause(); - } - if(ui.backgroundMusic){ - ui.backgroundMusic.pause(); - } - }); - document.addEventListener("resume", function(){ - if(ui.backgroundMusic){ - ui.backgroundMusic.play(); - } - }); - document.addEventListener("backbutton", function(){ - if(ui.arena&&ui.arena.classList.contains('menupaused')){ - if(window.saveNonameInput){ - window.saveNonameInput(); - } - else{ - ui.click.configMenu(); - } - } - else if(lib.config.confirm_exit){ - navigator.notification.confirm( - '是否退出游戏?', - function(index){ - switch(index){ - case 2:game.saveConfig('null');game.reload();break; - case 3:navigator.app.exitApp();break; - } - }, - '确认退出', - ['取消','重新开始','退出'] - ); - } - else{ - navigator.app.exitApp(); - } - }); - } - game.download=function(url,folder,onsuccess,onerror,dev,onprogress){ - if(url.indexOf('http')!=0){ - url=get.url(dev)+url; - } - var fileTransfer = new FileTransfer(); - folder=lib.assetURL+folder; - if(onprogress){ - fileTransfer.onprogress=function(progressEvent){ - onprogress(progressEvent.loaded,progressEvent.total); - }; - } - lib.config.brokenFile.add(folder); - game.saveConfigValue('brokenFile'); - fileTransfer.download(encodeURI(url),encodeURI(folder),function(){ - lib.config.brokenFile.remove(folder); - game.saveConfigValue('brokenFile'); - if(onsuccess){ - onsuccess(); - } - },onerror); - }; - game.readFile=function(filename,callback,onerror){ - window.resolveLocalFileSystemURL(lib.assetURL,function(entry){ - entry.getFile(filename,{},function(fileEntry){ - fileEntry.file(function(fileToLoad){ - var fileReader = new FileReader(); - fileReader.onload = function(e){ - callback(e.target.result); - }; - fileReader.readAsArrayBuffer(fileToLoad, "UTF-8"); - },onerror); - },onerror); - },onerror); - }; - game.writeFile=function(data,path,name,callback){ - if(Object.prototype.toString.call(data)=='[object File]'){ - var fileReader = new FileReader(); - fileReader.onload = function(e){ - game.writeFile(e.target.result,path,name,callback); - }; - fileReader.readAsArrayBuffer(data, "UTF-8"); - } - else{ - window.resolveLocalFileSystemURL(lib.assetURL+path,function(entry){ - entry.getFile(name,{create:true},function(fileEntry){ - fileEntry.createWriter(function(fileWriter){ - fileWriter.onwriteend=callback; - fileWriter.write(data); - }); - }); - }); - } - }; - game.removeFile=function(dir,callback){ - window.resolveLocalFileSystemURL(lib.assetURL,function(entry){ - entry.getFile(dir,{},function(fileEntry){ - fileEntry.remove(); - if(callback){ - callback(); - } - }); - }); - }; - game.getFileList=function(dir,callback){ - var files=[],folders=[]; - window.resolveLocalFileSystemURL(lib.assetURL+dir,function(entry){ - var dirReader=entry.createReader(); - var entries=[]; - var readEntries=function(){ - dirReader.readEntries(function(results){ - if(!results.length){ - entries.sort(); - for(var i=0;i