RLG-Web: improve game-starting messages.
Include the name of the player and game when watching or playing.
This commit is contained in:
parent
db242817fd
commit
24879b8123
2 changed files with 7 additions and 4 deletions
|
|
@ -625,7 +625,7 @@ function startgame(game) {
|
||||||
termemu.resize(reply.h, reply.w);
|
termemu.resize(reply.h, reply.w);
|
||||||
setTitle("Playing as " + session.lname);
|
setTitle("Playing as " + session.lname);
|
||||||
debug(1, "Playing with id " + session.id);
|
debug(1, "Playing with id " + session.id);
|
||||||
message("Your game has started.");
|
message("You are now playing " + game.name + ".");
|
||||||
setmode("play");
|
setmode("play");
|
||||||
getData();
|
getData();
|
||||||
}
|
}
|
||||||
|
|
@ -661,7 +661,9 @@ function startwatching(gamenumber) {
|
||||||
termemu.toAltBuf();
|
termemu.toAltBuf();
|
||||||
setTitle("Watching");
|
setTitle("Watching");
|
||||||
debug(1, "Watching with id " + session.id);
|
debug(1, "Watching with id " + session.id);
|
||||||
message("You are now watching.");
|
var pname = reply.p;
|
||||||
|
var gname = games[reply.g].name;
|
||||||
|
message("You are now watching " + pname + " play " + gname + ".");
|
||||||
setmode("watch");
|
setmode("watch");
|
||||||
getData();
|
getData();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -621,7 +621,7 @@ function startgame(req, res, formdata) {
|
||||||
if (success) {
|
if (success) {
|
||||||
res.writeHead(200, {'Content-Type': 'application/json'});
|
res.writeHead(200, {'Content-Type': 'application/json'});
|
||||||
var reply = {"t": "s", "id": nclient.id, "w": nclient.w, "h":
|
var reply = {"t": "s", "id": nclient.id, "w": nclient.w, "h":
|
||||||
nclient.h};
|
nclient.h, "p": username, "g": gname};
|
||||||
res.write(JSON.stringify(reply));
|
res.write(JSON.stringify(reply));
|
||||||
res.end();
|
res.end();
|
||||||
}
|
}
|
||||||
|
|
@ -647,7 +647,8 @@ function watch(req, res, formdata) {
|
||||||
}
|
}
|
||||||
var session = sessions[gamenumber];
|
var session = sessions[gamenumber];
|
||||||
var watch = new Watcher(session);
|
var watch = new Watcher(session);
|
||||||
var reply = {"t": "w", "id": watch.id, "w": session.w, "h": session.h};
|
var reply = {"t": "w", "id": watch.id, "w": session.w, "h": session.h,
|
||||||
|
"p": session.pname, "g": session.game.uname};
|
||||||
res.writeHead(200, {'Content-Type': 'application/json'});
|
res.writeHead(200, {'Content-Type': 'application/json'});
|
||||||
res.write(JSON.stringify(reply));
|
res.write(JSON.stringify(reply));
|
||||||
res.end();
|
res.end();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue