Update networking lobbdy for better display info
This commit is contained in:
parent
2a117d8e44
commit
34caab24fe
@ -3,58 +3,30 @@
|
|||||||
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
|
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
|
||||||
<header text_align="center" width="80%" align="center" I18N="In networking lobby" text="Lobby"/>
|
<header text_align="center" width="80%" align="center" I18N="In networking lobby" text="Lobby"/>
|
||||||
<spacer height="15" width="10"/>
|
<spacer height="15" width="10"/>
|
||||||
<div proportion="1" x="2%" width="96%" layout="vertical-row">
|
<div proportion="3" x="2%" width="96%" layout="vertical-row">
|
||||||
<div width="100%" proportion="2" layout="horizontal-row">
|
<div width="100%" proportion="2" layout="horizontal-row">
|
||||||
<box id="info" proportion="2" height="100%" layout="vertical-row">
|
<bubble id="text" proportion="3" height="100%"/>
|
||||||
<div width="100%" height="fit" layout="horizontal-row" >
|
|
||||||
<label proportion="1" text_align="left" I18N="In the networking lobby" text="Server name:"/>
|
|
||||||
<label proportion="2" text_align="left" id="server_name" text=""/>
|
|
||||||
</div>
|
|
||||||
<div width="100%" height="fit" layout="horizontal-row" >
|
|
||||||
<label proportion="1" text_align="left" I18N="In the networking lobby" text="Difficulty:"/>
|
|
||||||
<label proportion="2" text_align="left" id="server_difficulty" text=""/>
|
|
||||||
</div>
|
|
||||||
<div width="100%" height="fit" layout="horizontal-row" >
|
|
||||||
<label proportion="1" text_align="left" I18N="In the networking lobby" text="Game mode:"/>
|
|
||||||
<label proportion="2" text_align="left" id="server_game_mode" text=""/>
|
|
||||||
</div>
|
|
||||||
</box>
|
|
||||||
<spacer width="20" height="20"/>
|
<spacer width="20" height="20"/>
|
||||||
<box proportion="1" height="100%" layout="vertical-row">
|
<box proportion="1" height="100%" layout="vertical-row">
|
||||||
<list id="players" width="100%" height="100%"/>
|
<list id="players" width="100%" height="100%"/>
|
||||||
</box>
|
</box>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<spacer width="20" height="20"/>
|
|
||||||
|
|
||||||
<div width="100%" proportion="1" layout="horizontal-row">
|
|
||||||
<box proportion="2" height="100%" layout="vertical-row">
|
|
||||||
<list id="chat" width="100%" height="100%"/>
|
|
||||||
</box>
|
|
||||||
<spacer width="20" height="20"/>
|
|
||||||
<box id="actions" proportion="1" height="100%" layout="vertical-row">
|
|
||||||
<!-- <label I18N="In networking lobby" word_wrap="true" text="actions" align="center" text-align="center"/>
|
|
||||||
-->
|
|
||||||
<icon-button id="start" width="64" height="64" icon="gui/green_check.png" align="center"
|
|
||||||
I18N="In the network lobby" text="Start Race"/>
|
|
||||||
|
|
||||||
</box>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<spacer height="10"/>
|
||||||
<spacer width="10" height="7%"/>
|
<div width="100%" proportion="1" layout="horizontal-row">
|
||||||
|
<spacer width="20" height="20"/>
|
||||||
<bottombar x="2%" width="96%" height="10%" layout="horizontal-row">
|
<box proportion="2" height="100%" layout="horizontal-row">
|
||||||
<label text_align="left" align="center" height="100%" id="online_status" proportion="1" text=""/>
|
<textbox id="chat" width="100%" height="25%"/>
|
||||||
|
</box>
|
||||||
<spacer width="10" height="10" />
|
<spacer width="20"/>
|
||||||
|
<buttonbar id="actions" proportion="1" width="75%" height="75%">
|
||||||
<buttonbar id="menu_bottomrow" x="0" y="0" width="20%" height="100%" align="center">
|
<icon-button id="start" width="64" height="64" icon="gui/green_check.png" align="center"
|
||||||
<icon-button id="exit" width="64" height="64" icon="gui/main_quit.png" extend_label="50"
|
I18N="In the network lobby" text="Start Race"/>
|
||||||
I18N="In the networking lobby" text="Exit" label_location="hover"/>
|
<icon-button id="exit" width="64" height="64" icon="gui/main_quit.png" align="center"
|
||||||
|
I18N="In the network lobby" text="Exit"/>
|
||||||
</buttonbar>
|
</buttonbar>
|
||||||
</bottombar>
|
</div>
|
||||||
|
<spacer height="10"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||||
</stkgui>
|
</stkgui>
|
||||||
|
@ -24,12 +24,11 @@
|
|||||||
|
|
||||||
#include "challenges/unlock_manager.hpp"
|
#include "challenges/unlock_manager.hpp"
|
||||||
#include "config/player_manager.hpp"
|
#include "config/player_manager.hpp"
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "guiengine/widgets/bubble_widget.hpp"
|
||||||
#include "guiengine/scalable_font.hpp"
|
|
||||||
#include "guiengine/widgets/icon_button_widget.hpp"
|
#include "guiengine/widgets/icon_button_widget.hpp"
|
||||||
#include "guiengine/widgets/label_widget.hpp"
|
|
||||||
#include "guiengine/widgets/list_widget.hpp"
|
#include "guiengine/widgets/list_widget.hpp"
|
||||||
#include "guiengine/widgets/ribbon_widget.hpp"
|
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||||
|
#include "guiengine/widgets/text_box_widget.hpp"
|
||||||
#include "input/device_manager.hpp"
|
#include "input/device_manager.hpp"
|
||||||
#include "input/input_manager.hpp"
|
#include "input/input_manager.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
@ -61,7 +60,6 @@ DEFINE_SCREEN_SINGLETON( NetworkingLobby );
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
NetworkingLobby::NetworkingLobby() : Screen("online/networking_lobby.stkgui")
|
NetworkingLobby::NetworkingLobby() : Screen("online/networking_lobby.stkgui")
|
||||||
{
|
{
|
||||||
m_server = NULL;
|
|
||||||
m_player_list = NULL;
|
m_player_list = NULL;
|
||||||
} // NetworkingLobby
|
} // NetworkingLobby
|
||||||
|
|
||||||
@ -75,26 +73,16 @@ void NetworkingLobby::loadedFromFile()
|
|||||||
m_start_button= getWidget<IconButtonWidget>("start");
|
m_start_button= getWidget<IconButtonWidget>("start");
|
||||||
assert(m_start_button!= NULL);
|
assert(m_start_button!= NULL);
|
||||||
|
|
||||||
m_server_name_widget = getWidget<LabelWidget>("server_name");
|
m_text_bubble = getWidget<BubbleWidget>("text");
|
||||||
assert(m_server_name_widget != NULL);
|
assert(m_text_bubble != NULL);
|
||||||
|
|
||||||
m_server_difficulty = getWidget<LabelWidget>("server_difficulty");
|
m_chat_box = getWidget<TextBoxWidget>("chat");
|
||||||
assert(m_server_difficulty != NULL);
|
assert(m_chat_box != NULL);
|
||||||
|
|
||||||
m_server_game_mode = getWidget<LabelWidget>("server_game_mode");
|
|
||||||
assert(m_server_game_mode != NULL);
|
|
||||||
|
|
||||||
m_online_status_widget = getWidget<LabelWidget>("online_status");
|
|
||||||
assert(m_online_status_widget != NULL);
|
|
||||||
|
|
||||||
m_bottom_menu_widget = getWidget<RibbonWidget>("menu_bottomrow");
|
|
||||||
assert(m_bottom_menu_widget != NULL);
|
|
||||||
|
|
||||||
m_player_list = getWidget<ListWidget>("players");
|
m_player_list = getWidget<ListWidget>("players");
|
||||||
assert(m_player_list!= NULL);
|
assert(m_player_list!= NULL);
|
||||||
|
|
||||||
m_exit_widget = (IconButtonWidget *) m_bottom_menu_widget
|
m_exit_widget = getWidget<IconButtonWidget>("exit");;
|
||||||
->findWidgetNamed("exit");
|
|
||||||
assert(m_exit_widget != NULL);
|
assert(m_exit_widget != NULL);
|
||||||
|
|
||||||
} // loadedFromFile
|
} // loadedFromFile
|
||||||
@ -112,18 +100,25 @@ void NetworkingLobby::beforeAddingWidget()
|
|||||||
*/
|
*/
|
||||||
void NetworkingLobby::init()
|
void NetworkingLobby::init()
|
||||||
{
|
{
|
||||||
|
m_server_info.clear();
|
||||||
Screen::init();
|
Screen::init();
|
||||||
setInitialFocus();
|
setInitialFocus();
|
||||||
m_server = ServersManager::get()->getJoinedServer();
|
Server* server = ServersManager::get()->getJoinedServer();
|
||||||
if (m_server)
|
if (server)
|
||||||
{
|
{
|
||||||
m_server_name_widget->setText(m_server->getName(), false);
|
m_server_name = server->getName();
|
||||||
|
core::stringw each_line;
|
||||||
|
each_line = _("Server name: %s", m_server_name);
|
||||||
|
m_server_info.push_back(each_line);
|
||||||
|
|
||||||
core::stringw difficulty = race_manager->getDifficultyName(m_server->getDifficulty());
|
const core::stringw& difficulty_name =
|
||||||
m_server_difficulty->setText(difficulty, false);
|
race_manager->getDifficultyName(race_manager->getDifficulty());
|
||||||
|
each_line = _("Difficulty: %s", difficulty_name);
|
||||||
|
m_server_info.push_back(each_line);
|
||||||
|
|
||||||
core::stringw mode = RaceManager::getNameOf(m_server->getRaceMinorMode());
|
core::stringw mode = RaceManager::getNameOf(server->getRaceMinorMode());
|
||||||
m_server_game_mode->setText(mode, false);
|
each_line = _("Game mode: %s", mode);
|
||||||
|
m_server_info.push_back(each_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!NetworkConfig::get()->isServer())
|
if(!NetworkConfig::get()->isServer())
|
||||||
@ -136,15 +131,37 @@ void NetworkingLobby::init()
|
|||||||
StateManager::get()->createActivePlayer(profile, device);
|
StateManager::get()->createActivePlayer(profile, device);
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void NetworkingLobby::addMoreServerInfo(const core::stringw& info)
|
||||||
|
{
|
||||||
|
} // addMoreServerInfo
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void NetworkingLobby::onUpdate(float delta)
|
void NetworkingLobby::onUpdate(float delta)
|
||||||
{
|
{
|
||||||
// FIXME Network looby should be closed when stkhost is shut down
|
auto lp = LobbyProtocol::get<LobbyProtocol>();
|
||||||
|
if (!lp)
|
||||||
|
{
|
||||||
|
const core::stringw connect_msg = StringUtils::loadingDots(
|
||||||
|
_("Connecting to server %s", m_server_name));
|
||||||
|
m_text_bubble->setText(connect_msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
core::stringw total_msg;
|
||||||
|
for (auto& string : m_server_info)
|
||||||
|
{
|
||||||
|
total_msg += string;
|
||||||
|
total_msg += L"\n";
|
||||||
|
}
|
||||||
|
m_text_bubble->setText(total_msg);
|
||||||
|
}
|
||||||
if(NetworkConfig::get()->isClient())
|
if(NetworkConfig::get()->isClient())
|
||||||
{
|
{
|
||||||
m_start_button->setVisible(STKHost::existHost() &&
|
m_start_button->setVisible(STKHost::existHost() &&
|
||||||
STKHost::get()->isAuthorisedToControl());
|
STKHost::get()->isAuthorisedToControl());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // onUpdate
|
} // onUpdate
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -22,12 +22,13 @@
|
|||||||
|
|
||||||
class Server;
|
class Server;
|
||||||
|
|
||||||
namespace GUIEngine {
|
namespace GUIEngine
|
||||||
|
{
|
||||||
class Widget;
|
class Widget;
|
||||||
class ListWidget;
|
class ListWidget;
|
||||||
class IconButtonWidget;
|
class IconButtonWidget;
|
||||||
class LabelWidget;
|
class BubbleWidget;
|
||||||
class RibbonWidget;
|
class TextBoxWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class NetworkPlayerProfile;
|
class NetworkPlayerProfile;
|
||||||
@ -42,19 +43,17 @@ class NetworkingLobby : public GUIEngine::Screen,
|
|||||||
private:
|
private:
|
||||||
friend class GUIEngine::ScreenSingleton<NetworkingLobby>;
|
friend class GUIEngine::ScreenSingleton<NetworkingLobby>;
|
||||||
|
|
||||||
Server * m_server;
|
|
||||||
|
|
||||||
NetworkingLobby();
|
NetworkingLobby();
|
||||||
|
|
||||||
|
core::stringw m_server_name;
|
||||||
|
std::vector<core::stringw> m_server_info;
|
||||||
|
|
||||||
GUIEngine::IconButtonWidget * m_back_widget;
|
GUIEngine::IconButtonWidget * m_back_widget;
|
||||||
GUIEngine::LabelWidget * m_server_name_widget;
|
GUIEngine::BubbleWidget * m_text_bubble;
|
||||||
GUIEngine::LabelWidget * m_online_status_widget;
|
|
||||||
GUIEngine::RibbonWidget * m_bottom_menu_widget;
|
|
||||||
GUIEngine::IconButtonWidget * m_exit_widget;
|
GUIEngine::IconButtonWidget * m_exit_widget;
|
||||||
GUIEngine::IconButtonWidget *m_start_button;
|
GUIEngine::IconButtonWidget *m_start_button;
|
||||||
GUIEngine::ListWidget *m_player_list;
|
GUIEngine::ListWidget *m_player_list;
|
||||||
GUIEngine::LabelWidget* m_server_difficulty;
|
GUIEngine::TextBoxWidget* m_chat_box;
|
||||||
GUIEngine::LabelWidget* m_server_game_mode;
|
|
||||||
|
|
||||||
/** \brief Sets which widget has to be focused. Depends on the user state. */
|
/** \brief Sets which widget has to be focused. Depends on the user state. */
|
||||||
void setInitialFocus();
|
void setInitialFocus();
|
||||||
@ -88,6 +87,8 @@ public:
|
|||||||
/** \brief Implements the callback when a dialog gets closed. */
|
/** \brief Implements the callback when a dialog gets closed. */
|
||||||
virtual void onDialogClose() OVERRIDE;
|
virtual void onDialogClose() OVERRIDE;
|
||||||
|
|
||||||
|
/** Used to insert each client chat message (reserved). */
|
||||||
|
void addMoreServerInfo(const core::stringw& info);
|
||||||
void addPlayer(NetworkPlayerProfile *profile);
|
void addPlayer(NetworkPlayerProfile *profile);
|
||||||
void removePlayer(NetworkPlayerProfile *profile);
|
void removePlayer(NetworkPlayerProfile *profile);
|
||||||
}; // class NetworkingLobby
|
}; // class NetworkingLobby
|
||||||
|
Loading…
Reference in New Issue
Block a user