From 317b74089f822f20f13309c532850e8cf3262061 Mon Sep 17 00:00:00 2001 From: libccy Date: Sun, 17 Apr 2016 17:51:07 +0800 Subject: [PATCH] cfg --- game/game.js | 67 ++++++++++++++++++++++++++++++++++++------------- game/phantom.js | 23 +++++++++++++++++ game/server.js | 4 +-- game/source.js | 1 + 4 files changed, 76 insertions(+), 19 deletions(-) create mode 100644 game/phantom.js diff --git a/game/game.js b/game/game.js index 7925c5620..1a906eaab 100755 --- a/game/game.js +++ b/game/game.js @@ -12100,6 +12100,21 @@ } } }, + changeNumConfig:function(num,index,bool){ + if(this.id==game.onlinezhu){ + lib.configOL.number=num; + game.send('server','config',lib.configOL); + if(game.connectPlayers&&game.connectPlayers[index]){ + if(bool){ + game.connectPlayers[index].classList.add('unselectable2'); + } + else{ + game.connectPlayers[index].classList.remove('unselectable2'); + } + game.updateWaiting(); + } + } + }, chat:function(id,str){ var player; if(lib.playerOL[id]){ @@ -12246,17 +12261,17 @@ }, updaterooms:function(list){ if(ui.rooms){ + ui.window.classList.add('more_room'); var list2=['re_caocao','liubei','sunquan','sp_zhangjiao','yuanshao','dongzhuo']; var more_room=false; for(var i=0;i=3){ + if(list[i]&&i>=3){ more_room=true; } ui.rooms[i].initRoom(list[i],list2[i]); } if(!more_room){ - if(list[0]&&list[1]&&list[2]&& - list[0]!='server'&&list[1]!='server'&&list[2]!='server'){ + if(list[0]&&list[1]&&list[2]){ more_room=true; } } @@ -23950,22 +23965,40 @@ if(ui.intro) return; if(this.classList.contains('connect')){ if(game.online){ - if(this.roomfull){ - alert('房间已满'); - } - else if(this.roomgaming&&!game.onlineID){ - alert('房间不允许旁观') - } - else if(this.hasOwnProperty('roomindex')){ - if(!_status.enteringroom){ - _status.enteringroom=true; - _status.enteringroomserver=this.serving; - if(this.roomempty){ - _status.roomindex=this.roomindex; - ui.click.connectMenu(); + if(game.onlinezhu){ + if(!this.playerid&&game.connectPlayers){ + if(lib.configOL.mode=='versus') return; + if(lib.configOL.mode=='identity'&&lib.configOL.identity_mode=='zhong') return; + if(!this.classList.contains('unselectable2')&&lib.configOL.number<=2) return; + this.classList.toggle('unselectable2') + if(this.classList.contains('unselectable2')){ + lib.configOL.number--; } else{ - game.send('server','enter',this.roomindex,lib.config.connect_nickname,lib.config.connect_avatar); + lib.configOL.number++; + } + game.send('changeNumConfig',lib.configOL.number, + game.connectPlayers.indexOf(this),this.classList.contains('unselectable2')); + } + } + else{ + if(this.roomfull){ + alert('房间已满'); + } + else if(this.roomgaming&&!game.onlineID){ + alert('房间不允许旁观') + } + else if(this.hasOwnProperty('roomindex')){ + if(!_status.enteringroom){ + _status.enteringroom=true; + _status.enteringroomserver=this.serving; + if(this.roomempty){ + _status.roomindex=this.roomindex; + ui.click.connectMenu(); + } + else{ + game.send('server','enter',this.roomindex,lib.config.connect_nickname,lib.config.connect_avatar); + } } } } diff --git a/game/phantom.js b/game/phantom.js new file mode 100644 index 000000000..434ae12eb --- /dev/null +++ b/game/phantom.js @@ -0,0 +1,23 @@ +var page1 = require('webpage').create(); +page1.settings.userAgent = 'SpecialAgent'; +page1.open('http://localhost/index.html?server=true', function(status) { + if(status !== 'success') { + console.log('Unable to access network'); + } +}); + +var page2 = require('webpage').create(); +page2.settings.userAgent = 'SpecialAgent'; +page2.open('http://localhost/index.html?server=true', function(status) { + if(status !== 'success') { + console.log('Unable to access network'); + } +}); + +var page3 = require('webpage').create(); +page3.settings.userAgent = 'SpecialAgent'; +page3.open('http://localhost/index.html?server=true', function(status) { + if(status !== 'success') { + console.log('Unable to access network'); + } +}); diff --git a/game/server.js b/game/server.js index da1111f5a..478f519bc 100644 --- a/game/server.js +++ b/game/server.js @@ -9,7 +9,7 @@ if(index=='auto'){ index=0; this.servermode='auto'; - for(var i=rooms.length-1;i>=0;i--){ + for(var i=0;i=0;i--){ + for(var i=0;i