From 0dfdecaf7034aa255712c407682013e17e48c1d4 Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Sun, 3 Sep 2023 13:54:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=B6=E4=BD=9C=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E7=9A=84=E5=87=BD=E6=95=B0=E8=A2=AB=E6=87=92=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E7=9A=84=E9=97=AE=E9=A2=98=E4=BB=A5=E5=8F=8A=E5=9B=9E?= =?UTF-8?q?=E6=BB=9AdeleteDB=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/game/game.js b/game/game.js index 9d7c6e3f8..2f5d3cd03 100644 --- a/game/game.js +++ b/game/game.js @@ -38583,21 +38583,28 @@ lib[_status.dburgent?'ondb2':'ondb'].push(['deleteDB',Array.from(arguments)]); return; } - const store=lib.db.transaction([type],'readwrite').objectStore(type); - if(arguments.length!=1){ + if(arguments.length==1){ + game.getDB(type,null,function(obj){ + const store=lib.db.transaction([type],'readwrite').objectStore(type); + for(let id in obj){ + lib.status.reload++; + } + for(let id in obj){ + store.delete(id).onsuccess=game.reload2; + } + game.reload2(); + }); + } + else{ lib.status.reload++; + const store=lib.db.transaction([type],'readwrite').objectStore(type); store.delete(id).onsuccess=function(){ - if(callback) callback.apply(this,arguments); + if(callback){ + callback.apply(this,arguments); + } game.reload2(); }; - return; } - game.getDB(type,null,obj=>{ - const objKeys=Object.keys(obj); - lib.status.reload+=objKeys.length; - objKeys.forEach(value=>store.delete(value).onsuccess=game.reload2); - game.reload2(); - }); }, save:(key,value,mode)=>{ if(_status.reloading) return; @@ -42365,6 +42372,10 @@ var page=ui.create.div('#create-extension'); var node=ui.create.div('.menubutton.large','制作扩展',start.firstChild,clickMode); node.mode='create'; + game.editExtension=function(name){ + node._initLink(); + game.editExtension(name); + }; node._initLink=function(){ node.link=page; var pageboard=ui.create.div(page);