From fd9972f6f3f34f8f3dc74b889c79c2477bc62f2f Mon Sep 17 00:00:00 2001 From: shijian <2954700422@qq.com> Date: Fri, 27 Oct 2023 15:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=81=94=E6=9C=BA=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F(=E5=BA=94=E7=94=A8=E5=A4=96)=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/game/game.js b/game/game.js index 8f33c9349..7e4cc606e 100644 --- a/game/game.js +++ b/game/game.js @@ -6609,6 +6609,12 @@ frequent:true, intro:'在用户填写的IP地址没有直接指定使用WS/WSS协议的情况下,默认使用WSS协议,而非WS协议来连接到联机服务器。
请不要轻易勾选此项!', }, + read_clipboard:{ + name:'读取邀请链接', + init:false, + frequent:true, + intro:'读取剪贴板以解析邀请链接自动加入联机房间', + } } }, boss:{ @@ -34866,16 +34872,17 @@ try{ var roomId=text.split('\n')[1].match(/\d+/); var caption=ui.rooms.find(caption=>caption.key==roomId); - if (caption && (confirm(`是否通过复制的内容加入${roomId}房间?`) || _status.read_clipboard_text)){ + if (caption&&(confirm(`是否通过复制的内容加入${roomId}房间?`)||_status.read_clipboard_text)){ ui.click.connectroom.call(caption); + delete _status.read_clipboard_text; } - }catch(e){console.log(e);} + }catch(e){console.log(e)} } if(_status.read_clipboard_text){ read(_status.read_clipboard_text); }else{ window.focus(); - if(navigator.clipboard){ + if(navigator.clipboard&&lib.node){ navigator.clipboard.readText().then(read).catch(_=>{}); }else{ var input=ui.create.node('textarea',ui.window,{opacity:'0'}); @@ -34883,7 +34890,7 @@ var result=document.execCommand('paste'); input.blur(); ui.window.removeChild(input); - if(result) read(input.value); + if(result||input.value.length>0) read(input.value); //也就小b兼容版不支持直接读取了 else if(confirm('是否输入邀请链接以加入房间?')){ var text=prompt('请输入邀请链接'); @@ -53419,7 +53426,7 @@ ipbar.style.borderRadius='2px'; ipbar.style.position='relative'; - var button=ui.create.div('.menubutton.large.highlight.connectbutton.pointerdiv',game.online?'退出联机':'开始游戏',ui.window,function(){ + var button=ui.create.div('.menubutton.large.highlight.connectbutton.connectbutton1.pointerdiv',game.online?'退出联机':'开始游戏',ui.window,function(){ if(button.clicked) return; if(game.online){ if(game.onlinezhu){ @@ -53455,10 +53462,10 @@ var shareButton=ui.create.div('.menubutton.large.highlight.connectbutton.connectbutton2.pointerdiv','分享房间',ui.window,function(){ var text=`无名杀-联机-${lib.translate[get.mode()]}-${game.connectPlayers.filter(p=>p.avatar).length}/${game.connectPlayers.filter(p=>!p.classList.contains('unselectable2')).length}\n${get.connectNickname()}邀请你加入${game.roomId}房间\n联机地址:${game.ip}\n请先通过游戏内菜单-开始-联机中启用“读取邀请链接”选项`; window.focus(); - if(navigator.clipboard){ + if(navigator.clipboard&&lib.node){ navigator.clipboard.writeText(text).then(()=>{ game.alert(`分享内容复制成功`); - }).catch(e => { + }).catch(e=>{ game.alert(`分享内容复制失败${e||''}`); }); }else{ @@ -53521,10 +53528,10 @@ ui.handcards1Container.onmousewheel=ui.click.mousewheel; ui.handcards2Container.onmousewheel=ui.click.mousewheel; } - ui.handcards1Container.ontouchstart = ui.click.touchStart; - ui.handcards2Container.ontouchstart = ui.click.touchStart; - ui.handcards1Container.ontouchmove = ui.click.touchScroll; - ui.handcards2Container.ontouchmove = ui.click.touchScroll; + ui.handcards1Container.ontouchstart=ui.click.touchStart; + ui.handcards2Container.ontouchstart=ui.click.touchStart; + ui.handcards1Container.ontouchmove=ui.click.touchScroll; + ui.handcards2Container.ontouchmove=ui.click.touchScroll; ui.handcards1Container.style.webkitOverflowScrolling='touch'; ui.handcards2Container.style.webkitOverflowScrolling='touch';