This commit is contained in:
libccy 2016-04-26 10:34:31 +08:00
parent 8c47460ceb
commit 49d66436d1
2 changed files with 23 additions and 22 deletions

View File

@ -27,8 +27,9 @@
break; break;
} }
} }
if(window.location.href.indexOf('index.html?server')!=-1){ var index=window.location.href.indexOf('index.html?server=');
window.isNonameServer=true; if(index!=-1){
window.isNonameServer=window.location.href.slice(index+18);
window.indexedDB=null; window.indexedDB=null;
} }
}()); }());
@ -12513,7 +12514,7 @@
},true); },true);
if(window.isNonameServer){ if(window.isNonameServer){
var cfg='pagecfg'+lib.config.pageId; var cfg='pagecfg'+window.isNonameServer;
if(lib.config[cfg]){ if(lib.config[cfg]){
lib.configOL=lib.config[cfg][0]; lib.configOL=lib.config[cfg][0];
game.send('server','server',lib.config[cfg].slice(1)); game.send('server','server',lib.config[cfg].slice(1));
@ -16034,7 +16035,7 @@
} }
if(window.isNonameServer){ if(window.isNonameServer){
lib.configOL.gameStarted=false; lib.configOL.gameStarted=false;
game.saveConfig('pagecfg'+lib.config.pageId,[lib.configOL,game.roomId,_status.onlinenickname,_status.onlineavatar]); game.saveConfig('pagecfg'+window.isNonameServer,[lib.configOL,game.roomId,_status.onlinenickname,_status.onlineavatar]);
game.reload(); game.reload();
} }
}, },

View File

@ -1,38 +1,38 @@
var reload=function(){
if(!lib.node||!lib.node.clients||!lib.node.clients.length){
game.reload();
}
};
var page1 = require('webpage').create(); var page1 = require('webpage').create();
page1.settings.userAgent = 'SpecialAgent'; page1.settings.userAgent = 'SpecialAgent';
page1.open('http://localhost/index.html?server=true', function(status) { page1.open('http://localhost/index.html?server=1', function(status) {
if(status !== 'success') { if(status !== 'success') {
console.log('Unable to access network'); console.log('Unable to access network');
} }
else{ setInterval(function(){
page.evaluate(function(){ page1.evaluate(reload);
game.saveConfig('pageId',1); },3600000);
});
}
}); });
var page2 = require('webpage').create(); var page2 = require('webpage').create();
page2.settings.userAgent = 'SpecialAgent'; page2.settings.userAgent = 'SpecialAgent';
page2.open('http://localhost/index.html?server=true', function(status) { page2.open('http://localhost/index.html?server=2', function(status) {
if(status !== 'success') { if(status !== 'success') {
console.log('Unable to access network'); console.log('Unable to access network');
} }
else{ setInterval(function(){
page.evaluate(function(){ page2.evaluate(reload);
game.saveConfig('pageId',2); },3600000);
});
}
}); });
var page3 = require('webpage').create(); var page3 = require('webpage').create();
page3.settings.userAgent = 'SpecialAgent'; page3.settings.userAgent = 'SpecialAgent';
page3.open('http://localhost/index.html?server=true', function(status) { page3.open('http://localhost/index.html?server=3', function(status) {
if(status !== 'success') { if(status !== 'success') {
console.log('Unable to access network'); console.log('Unable to access network');
} }
else{ setInterval(function(){
page.evaluate(function(){ page3.evaluate(reload);
game.saveConfig('pageId',3); },3600000);
});
}
}); });