mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
feat(chat): implement client-server chat messaging
Add protobuf definition for ChatMsg, new packet ID CHAT_MSG (4001), and handle sending/receiving chat messages on both client and server side. Wire up UI components (ChatBox, TextField) to allow message input and display, including a message queue in ClientWorld for thread-safe processing. Also add default initialization for ChatMessage::time.
This commit is contained in:
@@ -334,6 +334,11 @@ void WorldScene::set_chatting(bool chatting) {
|
||||
Logger::info("World Scene Chatting {}", chatting);
|
||||
}
|
||||
|
||||
// Not thread safe
|
||||
void WorldScene::handle_chat_message(ChatMessage& message) {
|
||||
m_hud_ui.add_chat_message(message);
|
||||
}
|
||||
|
||||
void WorldScene::set_error(std::string_view error) {
|
||||
Logger::error("WorldScene Error Set {}", error);
|
||||
m_error_ui.set_error(error);
|
||||
|
||||
Reference in New Issue
Block a user