mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
greeting for login/logout
This commit is contained in:
parent
1b80a2b2ca
commit
553022db14
|
@ -29,6 +29,18 @@
|
|||
</message>
|
||||
</context>
|
||||
|
||||
<context>
|
||||
<name>Server</name>
|
||||
<message>
|
||||
<source>%1 logged in</source>
|
||||
<translation>玩家 <b>%1</b> 加入服务器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 logged out</source>
|
||||
<translation>玩家 <b>%1</b> 离开服务器</translation>
|
||||
</message>
|
||||
</context>
|
||||
|
||||
<context>
|
||||
<name>Init</name>
|
||||
<message>
|
||||
|
|
|
@ -81,7 +81,7 @@ Server::~Server() {
|
|||
}
|
||||
|
||||
bool Server::listen(const QHostAddress &address, ushort port) {
|
||||
bool ret = server->listen(address, port);
|
||||
bool ret = server->listen(address, port);
|
||||
isListening = ret;
|
||||
return ret;
|
||||
}
|
||||
|
@ -330,6 +330,7 @@ void Server::handleNameAndPassword(ClientSocket *client, const QString &name,
|
|||
player->setScreenName(name);
|
||||
player->setAvatar(obj["avatar"].toString());
|
||||
player->setId(obj["id"].toString().toInt());
|
||||
broadcast("ServerMessage", tr("%1 logged in").arg(player->getScreenName()));
|
||||
players.insert(player->getId(), player);
|
||||
|
||||
// tell the lobby player's basic property
|
||||
|
@ -373,6 +374,7 @@ void Server::onRoomAbandoned() {
|
|||
void Server::onUserDisconnected() {
|
||||
ServerPlayer *player = qobject_cast<ServerPlayer *>(sender());
|
||||
qInfo() << "Player" << player->getId() << "disconnected";
|
||||
broadcast("ServerMessage", tr("%1 logged out").arg(player->getScreenName()));
|
||||
Room *room = player->getRoom();
|
||||
if (room->isStarted()) {
|
||||
if (room->getObservers().contains(player)) {
|
||||
|
@ -401,6 +403,4 @@ void Server::readConfig() {
|
|||
// defaults
|
||||
}
|
||||
|
||||
QJsonValue Server::getConfig(const QString &key) {
|
||||
return config.value(key);
|
||||
}
|
||||
QJsonValue Server::getConfig(const QString &key) { return config.value(key); }
|
||||
|
|
Loading…
Reference in New Issue
Block a user