mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
Remove property uid of serverplayer
This commit is contained in:
parent
432a306de0
commit
3fb3570fa0
|
@ -5,3 +5,11 @@ ___
|
|||
试图打造一个最适合diy玩家游玩的民间三国杀,所有的一切都是为了更好的制作diy而设计的。
|
||||
|
||||
项目仍处于啥都没有的阶段。不过我为了整理思路,也写了点[文档](./doc/index.md)。
|
||||
|
||||
___
|
||||
|
||||
## 如何构建
|
||||
|
||||
安装Qt Creator和Qt 5.15.2。必要时自行配置CMake。
|
||||
|
||||
然后下载swig,并为其配置环境变量,即可构建FreeKill。
|
||||
|
|
|
@ -119,7 +119,7 @@ Item {
|
|||
toast.show("Sucesessfully entered room.");
|
||||
|
||||
dashboardModel = {
|
||||
general: config.avatar,
|
||||
general: "liubei",
|
||||
screenName: config.screenName,
|
||||
role: "unknown",
|
||||
kingdom: "qun",
|
||||
|
|
|
@ -159,7 +159,7 @@ void Router::handlePacket(const QByteArray& rawPacket)
|
|||
// Add the uid of sender to jsonData
|
||||
QJsonArray arr = QJsonDocument::fromJson(jsonData.toUtf8()).array();
|
||||
arr.prepend(
|
||||
(int)qobject_cast<ServerPlayer *>(parent())->getUid()
|
||||
(int)qobject_cast<ServerPlayer *>(parent())->getId()
|
||||
);
|
||||
ServerInstance->callLua(command, QJsonDocument(arr).toJson());
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ void Server::handleNameAndPassword(ClientSocket *client, const QString& name, co
|
|||
player->setSocket(client);
|
||||
client->disconnect(this);
|
||||
connect(client, &ClientSocket::disconnected, this, [player](){
|
||||
qDebug() << "Player" << player->getUid() << "disconnected";
|
||||
qDebug() << "Player" << player->getId() << "disconnected";
|
||||
});
|
||||
player->setScreenName(name);
|
||||
player->setAvatar(result["avatar"].toArray()[0].toString());
|
||||
|
|
|
@ -3,13 +3,7 @@
|
|||
#include "server.h"
|
||||
|
||||
ServerPlayer::ServerPlayer(Room *room)
|
||||
: uid(0)
|
||||
{
|
||||
static int m_playerid = 0;
|
||||
m_playerid++;
|
||||
|
||||
uid = m_playerid;
|
||||
|
||||
socket = nullptr;
|
||||
router = new Router(this, socket, Router::TYPE_SERVER);
|
||||
|
||||
|
@ -21,11 +15,6 @@ ServerPlayer::~ServerPlayer()
|
|||
router->deleteLater();
|
||||
}
|
||||
|
||||
uint ServerPlayer::getUid() const
|
||||
{
|
||||
return uid;
|
||||
}
|
||||
|
||||
void ServerPlayer::setSocket(ClientSocket *socket)
|
||||
{
|
||||
this->socket = socket;
|
||||
|
|
|
@ -14,8 +14,6 @@ public:
|
|||
explicit ServerPlayer(Room *room);
|
||||
~ServerPlayer();
|
||||
|
||||
uint getUid() const;
|
||||
|
||||
void setSocket(ClientSocket *socket);
|
||||
|
||||
Server *getServer() const;
|
||||
|
@ -32,7 +30,6 @@ public:
|
|||
void prepareForRequest(const QString &command,
|
||||
const QVariant &data = QVariant());
|
||||
private:
|
||||
uint uid;
|
||||
ClientSocket *socket; // socket for communicating with client
|
||||
Router *router;
|
||||
Server *server;
|
||||
|
|
|
@ -39,8 +39,6 @@ extern ClientPlayer *Self;
|
|||
%nodefaultdtor ServerPlayer;
|
||||
class ServerPlayer : public Player {
|
||||
public:
|
||||
unsigned int getUid() const;
|
||||
|
||||
void setSocket(ClientSocket *socket);
|
||||
|
||||
Server *getServer() const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user