mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-24 04:53:37 +00:00
feat(jui): (re-)add transitional screens
Adds a new MessageScreen class to display custom messages and restores areas where ReceivingLevelScreen was used
This commit is contained in:
parent
48b7d2f3a4
commit
7c3ba79f83
|
|
@ -292,7 +292,7 @@ void ClientConnection::handleLogin(std::shared_ptr<LoginPacket> packet) {
|
|||
minecraft->createPrimaryLocalPlayer(ProfileManager.GetPrimaryPad());
|
||||
|
||||
minecraft->player->dimension = packet->dimension;
|
||||
// minecraft->setScreen(new ReceivingLevelScreen(this));
|
||||
minecraft->setScreen(new ReceivingLevelScreen(this));
|
||||
minecraft->player->entityId = packet->clientVersion;
|
||||
|
||||
std::uint8_t networkSmallId = getSocket()->getSmallId();
|
||||
|
|
@ -2636,7 +2636,7 @@ void ClientConnection::handleRespawn(std::shared_ptr<RespawnPacket> packet) {
|
|||
|
||||
// minecraft->player->dimension = packet->dimension;
|
||||
minecraft->localplayers[m_userIndex]->dimension = packet->dimension;
|
||||
// minecraft->setScreen(new ReceivingLevelScreen(this));
|
||||
minecraft->setScreen(new ReceivingLevelScreen(this));
|
||||
// minecraft->addPendingLocalConnection(m_userIndex, this);
|
||||
|
||||
#ifdef _XBOX
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "../../../Minecraft.World/Util/Random.h"
|
||||
#include "../../MinecraftServer.h"
|
||||
#include "../../GameState/Options.h"
|
||||
#include "MessageScreen.h"
|
||||
#include <string>
|
||||
|
||||
CreateWorldScreen::CreateWorldScreen(Screen* lastScreen) {
|
||||
|
|
@ -43,10 +44,8 @@ void CreateWorldScreen::init() {
|
|||
buttons.push_back(new Button(1, width / 2 + 5, height - 28, 150, 20,
|
||||
language->getElement(L"gui.cancel")));
|
||||
|
||||
nameEdit = new EditBox(
|
||||
this, font, width / 2 - 100, 60, 200, 20,
|
||||
language->getElement(
|
||||
L"testWorld")); // 4J - test - should be L"selectWorld.newWorld"
|
||||
nameEdit = new EditBox(this, font, width / 2 - 100, 60, 200, 20,
|
||||
language->getElement(L"selectWorld.newWorld"));
|
||||
nameEdit->inFocus = true;
|
||||
nameEdit->setMaxLength(32);
|
||||
|
||||
|
|
@ -294,7 +293,11 @@ void CreateWorldScreen::buttonClicked(Button* button) {
|
|||
loadingParams->completionData = completionData;
|
||||
|
||||
ui.NavigateToScene(0, eUIScene_FullscreenProgress, loadingParams);
|
||||
// 4J Stu - This screen is not used, so removing this to stop the build failing
|
||||
Language* language = Language::getInstance();
|
||||
minecraft->setScreen(
|
||||
new MessageScreen(language->getElement(L"menu.generatingLevel")));
|
||||
// 4J Stu - This screen is not used, so removing this to stop the build
|
||||
// failing
|
||||
#if 0
|
||||
minecraft->gameMode = new SurvivalMode(minecraft);
|
||||
minecraft->selectLevel(resultFolder, nameEdit->getValue(), seedValue);
|
||||
|
|
|
|||
19
Minecraft.Client/UI/Screens/MessageScreen.cpp
Normal file
19
Minecraft.Client/UI/Screens/MessageScreen.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include "../../Platform/stdafx.h"
|
||||
#include "MessageScreen.h"
|
||||
|
||||
MessageScreen::MessageScreen(const std::wstring& message) {
|
||||
this->message = message;
|
||||
}
|
||||
|
||||
void MessageScreen::keyPressed(char eventCharacter, int eventKey) {}
|
||||
|
||||
void MessageScreen::init() { buttons.clear(); }
|
||||
|
||||
void MessageScreen::buttonClicked(Button* button) {}
|
||||
|
||||
void MessageScreen::render(int xm, int ym, float a) {
|
||||
renderDirtBackground(0);
|
||||
drawCenteredString(font, message, width / 2, height / 2 - 50, 0xffffff);
|
||||
|
||||
Screen::render(xm, ym, a);
|
||||
}
|
||||
27
Minecraft.Client/UI/Screens/MessageScreen.h
Normal file
27
Minecraft.Client/UI/Screens/MessageScreen.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
#include "../Screen.h"
|
||||
|
||||
// 4jcraft addition
|
||||
|
||||
class MessageScreen : public Screen {
|
||||
private:
|
||||
std::wstring message;
|
||||
|
||||
public:
|
||||
MessageScreen(const std::wstring& message);
|
||||
|
||||
protected:
|
||||
using Screen::keyPressed;
|
||||
|
||||
virtual void keyPressed(char eventCharacter, int eventKey);
|
||||
|
||||
public:
|
||||
virtual void init();
|
||||
virtual void tick();
|
||||
|
||||
protected:
|
||||
virtual void buttonClicked(Button* button);
|
||||
|
||||
public:
|
||||
virtual void render(int xm, int ym, float a);
|
||||
};
|
||||
Loading…
Reference in a new issue