http
This commit is contained in:
parent
6633de9317
commit
8c8588d236
10
game/game.js
10
game/game.js
|
@ -48,7 +48,7 @@
|
|||
var lib={
|
||||
configprefix:'noname_0.9_',
|
||||
versionOL:4,
|
||||
updateURL:localStorage.getItem('noname_download_source')||'http://isha.applinzi.com/',
|
||||
updateURL:localStorage.getItem('noname_download_source')||'http://123.206.77.253',
|
||||
assetURL:'',
|
||||
hallURL:'123.206.77.253',
|
||||
changeLog:[],
|
||||
|
@ -12521,6 +12521,11 @@
|
|||
ui.click.configMenu();
|
||||
}
|
||||
},
|
||||
closeConnectMenu:function(){
|
||||
if(ui.connectMenuContainer&&!ui.connectMenuContainer.classList.contains('hidden')){
|
||||
ui.click.connectMenu();
|
||||
}
|
||||
},
|
||||
closePopped:function(){
|
||||
if(ui.currentpopped){
|
||||
if(ui.currentpopped._uiintro){
|
||||
|
@ -17496,6 +17501,7 @@
|
|||
menu=menux.menu;
|
||||
}
|
||||
else{
|
||||
ui.connectMenuContainer=menuContainer;
|
||||
ui.click.connectMenu=function(){
|
||||
if(menuContainer.classList.contains('hidden')){
|
||||
if(_status.waitingForPlayer){
|
||||
|
@ -22035,6 +22041,7 @@
|
|||
}
|
||||
},
|
||||
roundmenu:function(){
|
||||
game.closeConnectMenu();
|
||||
switch(lib.config.round_menu_func){
|
||||
case 'system':
|
||||
game.closePopped();
|
||||
|
@ -22724,6 +22731,7 @@
|
|||
var dx=_status._swipeorigin.touches.clientX-_status._swipeorigin.clientX;
|
||||
var dy=_status._swipeorigin.touches.clientY-_status._swipeorigin.clientY;
|
||||
var goswipe=function(action){
|
||||
game.closeConnectMenu();
|
||||
switch(action){
|
||||
case 'system':
|
||||
game.closePopped();
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
var http = require('http');
|
||||
var fs = require('fs');
|
||||
var server = new http.Server();
|
||||
server.listen(80);
|
||||
server.on('request', function(request, response) {
|
||||
var url = require('url').parse(request.url);
|
||||
switch(url.pathname) {
|
||||
case ''||'/' :
|
||||
fs.readFile('./index.html', function(err, content){
|
||||
if(err) {
|
||||
response.writeHead(404, { 'Content-Type':'text/plain; charset="UTF-8"' });
|
||||
response.write(err.message);
|
||||
response.end();
|
||||
} else {
|
||||
response.writeHead(200, { 'Content-Type' : 'text/html; charset=UTF-8' });
|
||||
response.write(content);
|
||||
response.end();
|
||||
}
|
||||
});
|
||||
break;
|
||||
case '/test/delay':
|
||||
var delay = parseInt(url.query) || 2000;
|
||||
response.writeHead(200, {'Content-type':'text/plain; charset=UTF-8'});
|
||||
response.write('Sleeping for' + delay + ' milliseconds...');
|
||||
setTimeout(function(){
|
||||
response.write('done.');
|
||||
response.end();
|
||||
}, delay);
|
||||
break;
|
||||
case '/test/mirror':
|
||||
response.writeHead(200, {'Content-type':'text/plain; charset=UTF-8'});
|
||||
response.write(request.mothod + ' ' + request.url + ' HTTP/' + request.httpVersion + '\r\n');
|
||||
for (var h in request.headers) {
|
||||
response.write(h + ':' + request.headers[h] + '\r\n');
|
||||
}
|
||||
response.write('\r\n');
|
||||
request.on('data', function(chunk) { response.write(chunk); });
|
||||
request.on('end', function(chunk){ response.end(); });
|
||||
break;
|
||||
case '/json' :
|
||||
response.writeHead(200, {'Content-type':'application/json; charset=UTF-8'});
|
||||
response.write(JSON.stringify({test:'success'}));
|
||||
response.end();
|
||||
break;
|
||||
default:
|
||||
var filename = url.pathname.substring(1);
|
||||
var type = getType(filename.substring(filename.lastIndexOf('.')+1));
|
||||
fs.readFile(filename, function(err, content){
|
||||
if(err) {
|
||||
response.writeHead(404, { 'Content-Type':'text/plain; charset="UTF-8"' });
|
||||
response.write(err.message);
|
||||
response.end();
|
||||
} else {
|
||||
response.writeHead(200, { 'Content-Type' : type });
|
||||
response.write(content);
|
||||
response.end();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
function getType(endTag){
|
||||
var type=null;
|
||||
switch(endTag){
|
||||
case 'html' :
|
||||
case 'htm' :
|
||||
type = 'text/html; charset=UTF-8';
|
||||
break;
|
||||
case 'js' :
|
||||
type = 'application/javascript; charset="UTF-8"';
|
||||
break;
|
||||
case 'css' :
|
||||
type = 'text/css; charset="UTF-8"';
|
||||
break;
|
||||
case 'txt' :
|
||||
type = 'text/plain; charset="UTF-8"';
|
||||
break;
|
||||
case 'manifest' :
|
||||
type = 'text/cache-manifest; charset="UTF-8"';
|
||||
break;
|
||||
default :
|
||||
type = 'application/octet-stream';
|
||||
break;
|
||||
}
|
||||
return type;
|
||||
}
|
|
@ -32,6 +32,7 @@ window.noname_source_list=[
|
|||
'game/asset.js',
|
||||
'game/config.js',
|
||||
'game/game.js',
|
||||
'game/http.js',
|
||||
'game/jszip.js',
|
||||
'game/package.js',
|
||||
'game/server.js',
|
||||
|
|
Loading…
Reference in New Issue