From fefb3e88c68c29217a69ae8b8fbe617894a58651 Mon Sep 17 00:00:00 2001 From: libccy Date: Sun, 26 Mar 2017 23:36:08 +0800 Subject: [PATCH] tmp --- game/game.js | 16 +++++++++++++--- game/update.js | 3 +-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/game/game.js b/game/game.js index 61477c70d..348ddbdcc 100644 --- a/game/game.js +++ b/game/game.js @@ -6207,12 +6207,18 @@ } }); } - game.download=function(url,folder,onsuccess,onerror,dev){ + 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; + game.print(typeof onprogress); + if(onprogress){ + fileTransfer.onprogress=function(progressEvent){ + onprogress(progressEvent.loaded,progressEvent.total); + }; + } fileTransfer.download(encodeURI(url),encodeURI(folder),onsuccess,onerror); }; game.readFile=function(filename,callback,onerror){ @@ -20263,7 +20269,8 @@ download(); }, fetch:function(url,onload,onerror,onprogress){ - var tmpName=get.id(); + var tmpName='_tmp_'+get.id(); + game.saveConfig('downloadedFile',true); game.download(encodeURI(url),tmpName,function(){ game.readFile(tmpName,function(data){ onload(data); @@ -30569,7 +30576,10 @@ },function(){ that.innerHTML='下载失败'; that.classList.add('nopointer'); - },function(byte){ + },function(byte,total){ + if(total){ + size=total; + } if(byte==-1){ byte=size; } diff --git a/game/update.js b/game/update.js index 50819930d..59a8848dd 100644 --- a/game/update.js +++ b/game/update.js @@ -1,9 +1,8 @@ window.noname_update={ - version:'1.9.16.1', + version:'1.9.16', update:'1.9.15', changeLog:[ 'bug修复', - '扩展下载进度' ], files:[ 'game/game.js',