diff --git a/README.md b/README.md index e0138286..42bdcf2a 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,11 @@ ___ 试图打造一个最适合diy玩家游玩的民间三国杀,所有的一切都是为了更好的制作diy而设计的。 项目仍处于啥都没有的阶段。不过我为了整理思路,也写了点[文档](./doc/index.md)。 + +___ + +## 如何构建 + +安装Qt Creator和Qt 5.15.2。必要时自行配置CMake。 + +然后下载swig,并为其配置环境变量,即可构建FreeKill。 diff --git a/qml/Pages/Room.qml b/qml/Pages/Room.qml index 1feb2648..7590298d 100644 --- a/qml/Pages/Room.qml +++ b/qml/Pages/Room.qml @@ -119,7 +119,7 @@ Item { toast.show("Sucesessfully entered room."); dashboardModel = { - general: config.avatar, + general: "liubei", screenName: config.screenName, role: "unknown", kingdom: "qun", diff --git a/src/network/router.cpp b/src/network/router.cpp index e618a532..6faecd8b 100644 --- a/src/network/router.cpp +++ b/src/network/router.cpp @@ -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(parent())->getUid() + (int)qobject_cast(parent())->getId() ); ServerInstance->callLua(command, QJsonDocument(arr).toJson()); } diff --git a/src/server/server.cpp b/src/server/server.cpp index 70bf1ad8..d433c5e1 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -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()); diff --git a/src/server/serverplayer.cpp b/src/server/serverplayer.cpp index 887fdb92..4b2f9cd7 100644 --- a/src/server/serverplayer.cpp +++ b/src/server/serverplayer.cpp @@ -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; diff --git a/src/server/serverplayer.h b/src/server/serverplayer.h index 40b01ee2..217e1c51 100644 --- a/src/server/serverplayer.h +++ b/src/server/serverplayer.h @@ -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; diff --git a/src/swig/player.i b/src/swig/player.i index cf01a9ea..87e7af37 100644 --- a/src/swig/player.i +++ b/src/swig/player.i @@ -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;