From c8ae2f2b66ec6d0e569db45443f6e79d053f0c33 Mon Sep 17 00:00:00 2001 From: libccy Date: Sat, 18 Nov 2017 00:14:55 +0800 Subject: [PATCH] 2 --- game/game.js | 95 +++++++++++++++++++++++++++++++++++++++++++------- game/update.js | 3 +- 2 files changed, 83 insertions(+), 15 deletions(-) diff --git a/game/game.js b/game/game.js index 04a31ccc9..eb1d29f1f 100644 --- a/game/game.js +++ b/game/game.js @@ -23129,6 +23129,20 @@ init:true } }; + if(obj.package&&obj.package.author){ + lib.extensionMenu['extension_'+obj.name].author={ + name:'作者:'+obj.package.author, + clear:true, + nopointer:true, + } + } + if(obj.package&&obj.package.intro){ + lib.extensionMenu['extension_'+obj.name].intro={ + name:obj.package.intro, + clear:true, + nopointer:true, + } + } for(var i in obj.config){ lib.extensionMenu['extension_'+obj.name][i]=obj.config[i]; } @@ -23140,9 +23154,12 @@ name:'编辑此扩展', clear:true, onclick:function(){ - if(game.editExtension){ + if(game.editExtension&&lib.extensionPack&&lib.extensionPack[obj.name]){ game.editExtension(obj.name); } + else{ + alert('无法编辑未启用的扩展,请启用此扩展并重启后重试') + } } } } @@ -32271,9 +32288,61 @@ inputExtName.style.width='80px'; inputExtName.style.textAlign='center'; inputExtLine.appendChild(inputExtName); + + var buttonConfirmOnclick=function(){ + buttonConfirm.style.display='none'; + inputExtSpan.style.display='none'; + inputExtName.style.display='none'; + authorExtLine.style.display='none'; + introExtLine.style.display='none'; + okExtLine.style.display='none'; + buttonRename.style.display=''; + buttonSave.style.display=''; + buttonReset.style.display=''; + buttonExport.style.display=''; + inputExtSpan.innerHTML='扩展名称:'; + }; + var createExtLine=function(str,str2){ + var infoExtLine=ui.create.div(pageboard); + infoExtLine.style.display='none'; + infoExtLine.style.padding='0 10px 10px 10px'; + infoExtLine.style.height='22px'; + infoExtLine.style.lineHeight='22px'; + infoExtLine.style.whiteSpace='nowrap'; + infoExtLine.style.overflow='visible'; + if(typeof str=='boolean'){ + var inputConfirm=document.createElement('button'); + inputConfirm.innerHTML='确定'; + inputConfirm.onclick=buttonConfirmOnclick; + infoExtLine.appendChild(inputConfirm); + return infoExtLine; + } + var infoExtSpan=document.createElement('span'); + infoExtSpan.innerHTML='扩展'+str+':'; + infoExtLine.appendChild(infoExtSpan); + var infoExtName=document.createElement('input'); + infoExtName.type='text'; + infoExtName.style.width='80px'; + infoExtName.value=str2||''; + infoExtName.style.textAlign='center'; + infoExtLine.appendChild(infoExtName); + return infoExtLine; + }; + var authorExtLine=createExtLine('作者',lib.config.connect_nickname); + var introExtLine=createExtLine('描述','暂无描述'); + var okExtLine=createExtLine(true); + game.editExtension=function(name){ page.currentExtension=name||'无名扩展'; inputExtName.value=page.currentExtension; + if(name&&lib.extensionPack[name]){ + authorExtLine.querySelector('input').value=lib.extensionPack[name].author||''; + introExtLine.querySelector('input').value=lib.extensionPack[name].intro||''; + } + else{ + authorExtLine.querySelector('input').value=lib.config.connect_nickname||''; + introExtLine.querySelector('input').value='暂无描述'; + } if(name){ inputExtName.disabled=true; buttonConfirm.style.display='none'; @@ -32287,6 +32356,7 @@ else{ inputExtName.disabled=false; buttonConfirm.style.display=''; + inputExtSpan.innerHTML='扩展名:'; inputExtSpan.style.display=''; inputExtName.style.display=''; buttonRename.style.display='none'; @@ -32296,6 +32366,9 @@ } exportExtLine.style.display='none'; shareExtLine.style.display='none'; + authorExtLine.style.display='none'; + introExtLine.style.display='none'; + okExtLine.style.display='none'; dash1.reset(name); dash2.reset(name); dash3.reset(name); @@ -32362,7 +32435,9 @@ str+=',package:'+get.stringify({ character:dash1.content.pack, card:dash2.content.pack, - skill:dash3.content.pack + skill:dash3.content.pack, + intro:introExtLine.querySelector('input').value||'', + author:authorExtLine.querySelector('input').value||'' }); var files={character:[],card:[],skill:[]}; for(var i in dash1.content.image){ @@ -32396,25 +32471,19 @@ var buttonConfirm=document.createElement('button'); buttonConfirm.innerHTML='确定'; buttonConfirm.style.marginLeft='5px'; - buttonConfirm.onclick=function(){ - buttonConfirm.style.display='none'; - inputExtSpan.style.display='none'; - inputExtName.style.display='none'; - buttonRename.style.display=''; - buttonSave.style.display=''; - buttonReset.style.display=''; - buttonExport.style.display=''; - }; + buttonConfirm.onclick=buttonConfirmOnclick; inputExtLine.appendChild(buttonConfirm); var buttonRename=document.createElement('button'); - buttonRename.innerHTML='改名'; + buttonRename.innerHTML='选项'; buttonRename.style.marginLeft='2px'; buttonRename.style.marginRight='2px'; buttonRename.style.display='none'; buttonRename.onclick=function(){ - buttonConfirm.style.display=''; inputExtSpan.style.display=''; inputExtName.style.display=''; + authorExtLine.style.display=''; + introExtLine.style.display=''; + okExtLine.style.display='block'; inputExtName.disabled=false; buttonRename.style.display='none'; buttonSave.style.display='none'; diff --git a/game/update.js b/game/update.js index 887ea6f2a..723f3378c 100644 --- a/game/update.js +++ b/game/update.js @@ -2,8 +2,7 @@ window.noname_update={ version:'1.9.44', update:'1.9.43', changeLog:[ - '新扩展导出选项', - 'bug修复' + '扩展可添加作者信息和描述', ], files:[ 'game/game.js',