mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-07 02:47:13 +00:00
fix(jui): call eXuiServerAction_PauseServer to pause server-side too
This commit is contained in:
parent
0fbbac1cde
commit
32fee4334d
|
|
@ -22,6 +22,11 @@ void PauseScreen::init() {
|
|||
saveStep = 0;
|
||||
buttons.clear();
|
||||
int yo = -16;
|
||||
// 4jcraft: solves the issue of client-side only pausing in the java gui
|
||||
if (g_NetworkManager.IsLocalGame() &&
|
||||
g_NetworkManager.GetPlayerCount() == 1)
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),
|
||||
eXuiServerAction_PauseServer, (void*)TRUE);
|
||||
buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo,
|
||||
L"Save and quit to title"));
|
||||
if (minecraft->isClientSide()) {
|
||||
|
|
@ -49,6 +54,15 @@ void PauseScreen::init() {
|
|||
*/
|
||||
}
|
||||
|
||||
void PauseScreen::keyPressed(wchar_t eventCharacter, int eventKey) {
|
||||
if (eventKey == Keyboard::KEY_ESCAPE && g_NetworkManager.IsLocalGame() &&
|
||||
g_NetworkManager.GetPlayerCount() == 1)
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),
|
||||
eXuiServerAction_PauseServer, (void*)FALSE);
|
||||
|
||||
Screen::keyPressed(eventCharacter, eventKey);
|
||||
}
|
||||
|
||||
void PauseScreen::exitWorld(Minecraft* minecraft, bool save) {
|
||||
// 4jcraft: made our own static method for use in the java gui (other
|
||||
// places such as the deathscreen need this)
|
||||
|
|
@ -78,6 +92,8 @@ void PauseScreen::buttonClicked(Button* button) {
|
|||
exitWorld(minecraft, true);
|
||||
}
|
||||
if (button->id == 4) {
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),
|
||||
eXuiServerAction_PauseServer, (void*)FALSE);
|
||||
minecraft->setScreen(NULL);
|
||||
// minecraft->grabMouse(); // 4J - removed
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ private:
|
|||
public:
|
||||
PauseScreen(); // 4J added
|
||||
virtual void init();
|
||||
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
|
||||
static void exitWorld(Minecraft* minecraft, bool save);
|
||||
|
||||
protected:
|
||||
|
|
|
|||
Loading…
Reference in a new issue