2020-03-10 03:43:11 +00:00
|
|
|
'use strict';
|
|
|
|
game.import('mode',function(lib,game,ui,get,ai,_status){
|
|
|
|
return {
|
|
|
|
name:'connect',
|
|
|
|
start:function(){
|
|
|
|
var directstartmode=lib.config.directstartmode;
|
|
|
|
ui.create.menu(true);
|
|
|
|
event.textnode=ui.create.div('','输入联机地址');
|
|
|
|
var createNode=function(){
|
|
|
|
if(event.created) return;
|
|
|
|
if(directstartmode&&lib.node){
|
|
|
|
ui.exitroom=ui.create.system('退出房间',function(){
|
|
|
|
game.saveConfig('directstartmode');
|
|
|
|
game.reload();
|
|
|
|
},true);
|
|
|
|
game.switchMode(directstartmode);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(lib.node&&window.require){
|
|
|
|
ui.startServer=ui.create.system('启动服务器',function(e){
|
2023-05-02 11:26:19 +00:00
|
|
|
ui.click.shortcut(false);
|
2020-03-10 03:43:11 +00:00
|
|
|
e.stopPropagation();
|
|
|
|
ui.click.connectMenu();
|
|
|
|
},true);
|
|
|
|
}
|
|
|
|
|
|
|
|
event.created=true;
|
|
|
|
var node=ui.create.div('.shadowed');
|
|
|
|
node.style.width='400px';
|
|
|
|
node.style.height='30px';
|
|
|
|
node.style.lineHeight='30px';
|
|
|
|
node.style.fontFamily='xinwei';
|
|
|
|
node.style.fontSize='30px';
|
|
|
|
node.style.padding='10px';
|
|
|
|
node.style.left='calc(50% - 210px)';
|
|
|
|
node.style.top='calc(50% - 20px)';
|
|
|
|
node.style.whiteSpace='nowrap';
|
2023-10-11 09:41:25 +00:00
|
|
|
node.textContent=lib.config.last_ip||lib.hallURL;
|
2020-03-10 03:43:11 +00:00
|
|
|
node.contentEditable=true;
|
|
|
|
node.style.webkitUserSelect='text';
|
|
|
|
node.style.textAlign='center';
|
v1.9.122.3 (#146)
* change lib.init.parsex, Enable 'step' to be used through nesting
* Fixed an issue where nonstandard statement 'step 0' before standard statement 'step 0' would cause an error
* zhangshiping; tw_madai bug fix
* modify all the skills with incorrect "locked" tag
* Change the game.exit function to restart the app for WKWebview users using ios. And added the macintosh field to the judgment of lib.device
* various bug fix
* Revert "various bug fix"
This reverts commit ca7a363172a837af9244fca300d6a008cafc03ac.
* various bug fix
* some sudio
* unlock zhenghun, fix sbdiaochan
* add and adjust some audio, fix some bugs
* add trigger "useSkill" and "logSkillBegin"
* brand new wuxie
* Update standard.js
* update 武安国
* iriya!
* Add character lushi; fix clansankuang
* add 魏关羽/涛神,unlock 关宁/向朗/谋孙策/谋大乔/谋刘表,add related audio
* fix: adjust the edit box style to fix the text overflow problem 🐛
* fix 修文 and some other small bugs
* 伊莉雅·罗日杰斯特文斯卡娅
* Fix the issue of "game.getDB" and "game. deleteDB" reporting errors without "lib.db"
* Some browsers do not support "autoplay", so "onconplay" listening has been added
* sunwukong
* more zooms
* unlock 周善, modify 卢氏/卞喜/刘虞/黄祖/李采薇/张翼/笮融/孙寒华/TW董昭, fix some bug, add omitted audio
* change the number of 如意金箍棒 to 9 instead of 5; fix 夏侯尚's bug; add audio for sunwukong & donghailongwang
* Add the default accept value of '*/*' to the HTML selection file label
* longwang
* add&modify some audio
* add 族王凌/界SP黄月英/界张松/武诸葛亮,fix 晖云's bug; resolve conflicts, bring 武诸葛 up to date, fix 龙王's bug
* add 阮籍, add a skillTag in "jiu2" named jiuSustain for ruanji
* add some audio, sort some characters in sp
* sync 界SP黄月英
* add some character intros
* make 谋弈 play audio correctly
* revert some skills back to new ones
* v1.9.122.3
* Update update.js
---------
Co-authored-by: shijian <2954700422@qq.com>
Co-authored-by: copcap <copcap@outlook.com>
Co-authored-by: copcap <43802486+copcap@users.noreply.github.com>
Co-authored-by: PBK-B <pbk-b@PBK6.cn>
2023-06-30 15:06:19 +00:00
|
|
|
node.style.overflow='hidden';
|
2020-03-10 03:43:11 +00:00
|
|
|
|
|
|
|
var connect=function(e){
|
2023-10-16 13:13:13 +00:00
|
|
|
const info=lib.config.reconnect_info;
|
|
|
|
if(info&&info[0]==node.textContent){
|
|
|
|
game.onlineID=info[1];
|
|
|
|
if(typeof (game.roomId=info[2])=='string') game.roomIdServer=true;
|
|
|
|
}
|
2023-10-11 09:41:25 +00:00
|
|
|
event.textnode.textContent='正在连接...';
|
2020-03-10 03:43:11 +00:00
|
|
|
clearTimeout(event.timeout);
|
|
|
|
if(e) e.preventDefault();
|
2023-11-06 18:07:27 +00:00
|
|
|
game.saveConfig('last_ip',node.textContent);
|
2023-10-11 09:41:25 +00:00
|
|
|
game.connect(node.textContent,function(success){
|
2020-03-10 03:43:11 +00:00
|
|
|
if(!success&&event.textnode){
|
|
|
|
alert('连接失败');
|
2023-10-11 09:41:25 +00:00
|
|
|
event.textnode.textContent='输入联机地址';
|
2020-03-10 03:43:11 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
node.addEventListener('keydown',function(e){
|
|
|
|
if(e.keyCode==13){
|
|
|
|
connect(e);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
ui.window.appendChild(node);
|
|
|
|
ui.ipnode=node;
|
|
|
|
|
|
|
|
var text=event.textnode;
|
|
|
|
text.style.width='400px';
|
|
|
|
text.style.height='30px';
|
|
|
|
text.style.lineHeight='30px';
|
|
|
|
text.style.fontFamily='xinwei';
|
|
|
|
text.style.fontSize='30px';
|
|
|
|
text.style.padding='10px';
|
|
|
|
text.style.left='calc(50% - 200px)';
|
|
|
|
text.style.top='calc(50% - 80px)';
|
|
|
|
text.style.textAlign='center';
|
|
|
|
ui.window.appendChild(text);
|
|
|
|
ui.iptext=text;
|
|
|
|
|
|
|
|
var button=ui.create.div('.menubutton.highlight.large.pointerdiv','连接',connect);
|
|
|
|
button.style.width='70px';
|
|
|
|
button.style.left='calc(50% - 35px)';
|
|
|
|
button.style.top='calc(50% + 60px)';
|
|
|
|
ui.window.appendChild(button);
|
|
|
|
ui.ipbutton=button;
|
|
|
|
|
|
|
|
ui.hall_button=ui.create.system('联机大厅',function(){
|
2023-10-11 09:41:25 +00:00
|
|
|
node.textContent=get.config('hall_ip')||lib.hallURL;
|
2020-03-10 03:43:11 +00:00
|
|
|
connect();
|
|
|
|
},true);
|
|
|
|
if(!get.config('hall_button')){
|
|
|
|
ui.hall_button.style.display='none';
|
|
|
|
}
|
|
|
|
ui.recentIP=ui.create.system('最近连接',null,true);
|
|
|
|
var clickLink=function(){
|
2023-10-11 09:41:25 +00:00
|
|
|
node.textContent=this.textContent;
|
2020-03-10 03:43:11 +00:00
|
|
|
connect();
|
|
|
|
};
|
|
|
|
lib.setPopped(ui.recentIP,function(){
|
|
|
|
if(!lib.config.recentIP.length) return;
|
|
|
|
var uiintro=ui.create.dialog('hidden');
|
|
|
|
uiintro.listen(function(e){
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
|
|
|
var list=ui.create.div('.caption');
|
|
|
|
for(var i=0;i<lib.config.recentIP.length;i++){
|
2023-10-11 09:41:25 +00:00
|
|
|
ui.create.div('.text.textlink',list,clickLink).textContent=get.trimip(lib.config.recentIP[i]);
|
2020-03-10 03:43:11 +00:00
|
|
|
}
|
|
|
|
uiintro.add(list);
|
|
|
|
var clear=uiintro.add('<div class="text center">清除</div>');
|
|
|
|
clear.style.paddingTop=0;
|
|
|
|
clear.style.paddingBottom='3px';
|
|
|
|
clear.listen(function(){
|
|
|
|
lib.config.recentIP.length=0;
|
|
|
|
game.saveConfig('recentIP',[]);
|
|
|
|
uiintro.delete();
|
|
|
|
});
|
|
|
|
return uiintro;
|
|
|
|
},220);
|
2023-11-08 01:02:22 +00:00
|
|
|
if (get.config('read_clipboard','connect')){
|
2023-10-26 18:51:56 +00:00
|
|
|
var ced=false;
|
|
|
|
function read(text){
|
|
|
|
try{
|
|
|
|
var text2=text.split('\n')[2];
|
|
|
|
var ip=text2.slice(5);
|
|
|
|
if(ip.length>0&&text2.startsWith("联机地址:")&&(ced||confirm('是否根据剪贴板的邀请链接以进入联机地址和房间?'))){
|
|
|
|
node.innerHTML=ip;
|
|
|
|
event.textnode.innerHTML='正在连接...';
|
|
|
|
clearTimeout(event.timeout);
|
|
|
|
game.saveConfig('last_ip',node.innerHTML);
|
|
|
|
game.connect(node.innerHTML,function(success){
|
|
|
|
if(!success&&event.textnode){
|
|
|
|
alert('邀请链接解析失败');
|
|
|
|
event.textnode.innerHTML='输入联机地址';
|
|
|
|
}
|
|
|
|
if (success) _status.read_clipboard_text=text;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}catch(e){console.log(e);}
|
|
|
|
}
|
|
|
|
window.focus();
|
2023-10-27 08:00:38 +00:00
|
|
|
if (navigator.clipboard&&lib.node){
|
2023-10-26 18:51:56 +00:00
|
|
|
navigator.clipboard.readText().then(read).catch(_=>{});
|
|
|
|
}else{
|
|
|
|
var input=ui.create.node('textarea',ui.window,{opacity:'0'});
|
|
|
|
input.select();
|
|
|
|
var result=document.execCommand('paste');
|
|
|
|
input.blur();
|
|
|
|
ui.window.removeChild(input);
|
2023-10-27 08:00:38 +00:00
|
|
|
if(result||input.value.length>0) read(input.value);
|
2023-10-26 18:51:56 +00:00
|
|
|
else if(confirm('是否输入邀请链接以进入联机地址和房间?')){
|
|
|
|
ced=true;
|
|
|
|
var text=prompt('请输入邀请链接');
|
|
|
|
if(typeof text=='string'&&text.length>0) read(text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-10 03:43:11 +00:00
|
|
|
lib.init.onfree();
|
|
|
|
}
|
|
|
|
if(window.isNonameServer){
|
|
|
|
game.connect(window.isNonameServerIp||'localhost');
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
createNode();
|
|
|
|
}
|
|
|
|
if(!game.onlineKey){
|
|
|
|
game.onlineKey=localStorage.getItem(lib.configprefix+'key');
|
|
|
|
if(!game.onlineKey){
|
|
|
|
game.onlineKey=get.id();
|
|
|
|
localStorage.setItem(lib.configprefix+'key',game.onlineKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_status.connectDenied=createNode;
|
|
|
|
setTimeout(lib.init.onfree,1000);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|