diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/InBedChatScreen.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/InBedChatScreen.cpp')
| -rw-r--r-- | Minecraft.Client/InBedChatScreen.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/Minecraft.Client/InBedChatScreen.cpp b/Minecraft.Client/InBedChatScreen.cpp new file mode 100644 index 00000000..fca3d022 --- /dev/null +++ b/Minecraft.Client/InBedChatScreen.cpp @@ -0,0 +1,70 @@ +#include "stdafx.h" +#include "InBedChatScreen.h" +#include "Button.h" +#include "MultiplayerLocalPlayer.h" +#include "..\Minecraft.World\net.minecraft.locale.h" +#include "..\Minecraft.World\StringHelpers.h" + +void InBedChatScreen::init() +{ + Keyboard::enableRepeatEvents(true); + + Language *language = Language::getInstance(); + + buttons.push_back(new Button(WAKE_UP_BUTTON, width / 2 - 100, height - 40, language->getElement(L"multiplayer.stopSleeping"))); + +} + +void InBedChatScreen::removed() +{ + Keyboard::enableRepeatEvents(false); +} + +void InBedChatScreen::keyPressed(wchar_t ch, int eventKey) +{ + if (eventKey == Keyboard::KEY_ESCAPE) + { + sendWakeUp(); + } + else if (eventKey == Keyboard::KEY_RETURN) + { + wstring msg = trimString(message); + if (msg.length() > 0) + { + minecraft->player->chat(trimString(message)); + } + message = L""; + } + else + { + ChatScreen::keyPressed(ch, eventKey); + } +} + +void InBedChatScreen::render(int xm, int ym, float a) +{ + ChatScreen::render(xm, ym, a); +} + +void InBedChatScreen::buttonClicked(Button *button) +{ + if (button->id == WAKE_UP_BUTTON) + { + sendWakeUp(); + } + else + { + ChatScreen::buttonClicked(button); + } +} + +void InBedChatScreen::sendWakeUp() +{ + /* 4J - TODO + if (minecraft.player instanceof MultiplayerLocalPlayer) + { + ClientConnection connection = ((MultiplayerLocalPlayer) minecraft.player).connection; + connection.send(new PlayerCommandPacket(minecraft.player, PlayerCommandPacket.STOP_SLEEPING)); + } + */ +}
\ No newline at end of file |
