This commit is contained in:
libccy 2016-04-17 17:51:07 +08:00
parent 6445b51f21
commit 317b74089f
4 changed files with 76 additions and 19 deletions

View File

@ -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<ui.rooms.length;i++){
if(list[i]&&list[i]!='server'&&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);
}
}
}
}

23
game/phantom.js Normal file
View File

@ -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');
}
});

View File

@ -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<rooms.length;i++){
if(!rooms[i].owner){
index=i;break;
}
@ -45,7 +45,7 @@
}
},
server:function(){
for(var i=rooms.length-1;i>=0;i--){
for(var i=0;i<rooms.length;i++){
if(!rooms[i].owner){
rooms[i].owner=this;
rooms[i].servermode=true;

View File

@ -35,6 +35,7 @@ window.noname_source_list=[
'game/http.js',
'game/jszip.js',
'game/package.js',
'game/phantom.js',
'game/server.js',
'game/source.js',
'game/update.js',