1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-02 09:02:03 +02:00
vcmi/client/serverLobby/LobbyWindow.h

61 lines
1.4 KiB
C++
Raw Normal View History

/*
* LobbyWindow.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "../gui/InterfaceObjectConfigurable.h"
#include "../windows/CWindowObject.h"
#include "../../lib/network/NetworkClient.h"
class LobbyWindow;
class LobbyWidget : public InterfaceObjectConfigurable
{
LobbyWindow * window;
public:
LobbyWidget(LobbyWindow * window);
std::shared_ptr<CLabel> getAccountNameLabel();
std::shared_ptr<CTextInput> getMessageInput();
std::shared_ptr<CTextBox> getGameChat();
};
class LobbyClient : public NetworkClient
{
LobbyWindow * window;
void onPacketReceived(const std::vector<uint8_t> & message) override;
2023-11-12 13:27:22 +02:00
void onConnectionFailed(const std::string & errorMessage) override;
void onConnectionEstablished() override;
2023-11-12 13:27:22 +02:00
void onDisconnected() override;
public:
explicit LobbyClient(LobbyWindow * window);
void sendMessage(const JsonNode & data);
};
class LobbyWindow : public CWindowObject
{
std::string chatHistory;
std::shared_ptr<LobbyWidget> widget;
std::shared_ptr<LobbyClient> connection;
2023-11-12 13:27:22 +02:00
void tick(uint32_t msPassed);
public:
LobbyWindow();
void doSendChatMessage();
void onGameChatMessage(const std::string & sender, const std::string & message, const std::string & when);
};