diff --git a/data/gui/online/create_server.stkgui b/data/gui/online/create_server.stkgui index 31dfd0a8a..f319b2df4 100644 --- a/data/gui/online/create_server.stkgui +++ b/data/gui/online/create_server.stkgui @@ -4,34 +4,33 @@
-
-
-
- - - -
-
-
- -
- + - - - diff --git a/src/states_screens/create_server_screen.cpp b/src/states_screens/create_server_screen.cpp index 7b9e3275d..11777c624 100644 --- a/src/states_screens/create_server_screen.cpp +++ b/src/states_screens/create_server_screen.cpp @@ -46,7 +46,6 @@ DEFINE_SCREEN_SINGLETON( CreateServerScreen ); CreateServerScreen::CreateServerScreen() : Screen("online/create_server.stkgui") { m_server_creation_request = NULL; - m_enter_server = true; } // CreateServerScreen // ---------------------------------------------------------------------------- @@ -57,8 +56,11 @@ void CreateServerScreen::loadedFromFile() m_name_widget = getWidget("name"); assert(m_name_widget != NULL); + m_name_widget->setText(CurrentUser::acquire()->getUserName() + _("'s server")); + CurrentUser::release(); m_max_players_widget = getWidget("max_players"); assert(m_max_players_widget != NULL); + m_max_players_widget->setValue(8); m_info_widget = getWidget("info"); assert(m_info_widget != NULL); @@ -86,6 +88,7 @@ void CreateServerScreen::init() Screen::init(); setInitialFocus(); DemoWorld::resetIdleTime(); + m_info_widget->setText("", false); } // ---------------------------------------------------------------------------- void CreateServerScreen::onUpdate(float delta, irr::video::IVideoDriver* driver) @@ -96,13 +99,7 @@ void CreateServerScreen::onUpdate(float delta, irr::video::IVideoDriver* driver { if(m_server_creation_request->isSuccess()) { - if (m_enter_server){ - new ServerInfoDialog(m_server_creation_request->getCreatedServerID(),true); - } - else - { - StateManager::get()->escapePressed(); - } + new ServerInfoDialog(m_server_creation_request->getCreatedServerID(), true); } else { diff --git a/src/states_screens/create_server_screen.hpp b/src/states_screens/create_server_screen.hpp index c70b5f931..2b28ac229 100644 --- a/src/states_screens/create_server_screen.hpp +++ b/src/states_screens/create_server_screen.hpp @@ -37,8 +37,6 @@ private: CreateServerScreen(); - bool m_enter_server; - GUIEngine::TextBoxWidget * m_name_widget; GUIEngine::SpinnerWidget * m_max_players_widget; @@ -48,8 +46,6 @@ private: GUIEngine::IconButtonWidget * m_create_widget; GUIEngine::IconButtonWidget * m_cancel_widget; - - Online::CurrentUser::ServerCreationRequest * m_server_creation_request; /** \brief Sets which widget has to be focused. Depends on the user state. */ diff --git a/src/states_screens/dialogs/server_info_dialog.cpp b/src/states_screens/dialogs/server_info_dialog.cpp index 2c467750c..8371a4a40 100644 --- a/src/states_screens/dialogs/server_info_dialog.cpp +++ b/src/states_screens/dialogs/server_info_dialog.cpp @@ -40,12 +40,13 @@ using namespace Online; // ----------------------------------------------------------------------------- -ServerInfoDialog::ServerInfoDialog(uint32_t server_id, bool join) : +ServerInfoDialog::ServerInfoDialog(uint32_t server_id, bool from_server_creation) : ModalDialog(0.8f,0.8f) { m_server_id = server_id; m_self_destroy = false; m_enter_lobby = false; + m_from_server_creation = from_server_creation; m_server_join_request = NULL; loadFromFile("online/server_info_dialog.stkgui"); @@ -57,7 +58,8 @@ ServerInfoDialog::ServerInfoDialog(uint32_t server_id, bool join) : ServersManager::release(); m_info_widget = getWidget("info"); assert(m_info_widget != NULL); - + if (m_from_server_creation) + m_info_widget->setText(_("Server successfully created. You can now join it."), true); m_options_widget = getWidget("options"); assert(m_options_widget != NULL); m_join_widget = getWidget("join"); @@ -65,8 +67,7 @@ ServerInfoDialog::ServerInfoDialog(uint32_t server_id, bool join) : m_cancel_widget = getWidget("cancel"); assert(m_cancel_widget != NULL); m_options_widget->setFocusForPlayer(PLAYER_ID_GAME_MASTER); - if (join) - requestJoin(); + } // ----------------------------------------------------------------------------- @@ -149,10 +150,10 @@ void ServerInfoDialog::onUpdate(float dt) if (m_self_destroy) { ModalDialog::dismiss(); + if (m_from_server_creation) + StateManager::get()->popMenu(); if (m_enter_lobby) - { StateManager::get()->pushScreen(NetworkingLobby::getInstance()); - } return; } } diff --git a/src/states_screens/dialogs/server_info_dialog.hpp b/src/states_screens/dialogs/server_info_dialog.hpp index 4df591722..ea8b903c3 100644 --- a/src/states_screens/dialogs/server_info_dialog.hpp +++ b/src/states_screens/dialogs/server_info_dialog.hpp @@ -41,6 +41,7 @@ private: bool m_self_destroy; bool m_enter_lobby; + bool m_from_server_creation; Online::CurrentUser::ServerJoinRequest * m_server_join_request; float m_load_timer; @@ -57,14 +58,13 @@ private: void requestJoin(); public: - ServerInfoDialog(uint32_t server_id, bool join = false); + ServerInfoDialog(uint32_t server_id, bool just_created = false); ~ServerInfoDialog(); void onEnterPressedInternal(); GUIEngine::EventPropagation processEvent(const std::string& eventSource); virtual void onUpdate(float dt); - //virtual void onTextUpdated(); }; #endif