First implementation prototype of the new netwoking UI, as discussed.
This commit is contained in:
parent
c59af9136c
commit
d92476ae70
29
data/gui/online/lan.stkgui
Normal file
29
data/gui/online/lan.stkgui
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<stkgui>
|
||||||
|
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||||
|
|
||||||
|
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
|
||||||
|
<header id="title" text_align="center" width="80%" align="center" text="Local Networking"/>
|
||||||
|
|
||||||
|
<spacer height="5%" width="10"/>
|
||||||
|
<icon id="logo" align="center" proportion="1" width="100%" icon="gui/logo.png"/>
|
||||||
|
<spacer height="5%" width="10"/>
|
||||||
|
|
||||||
|
<buttonbar id="lan" proportion="1" width="90%" align="center">
|
||||||
|
<icon-button id="find_lan_server" width="128" height="128"
|
||||||
|
icon="gui/online/menu_find_server.png" focus_icon="gui/online/menu_find_server_hover.png"
|
||||||
|
I18N="In the online multiplayer screen" text="Find Server"/>
|
||||||
|
<icon-button id="create_lan_server" width="128" height="128"
|
||||||
|
icon="gui/online/menu_create_server.png" focus_icon="gui/online/menu_create_server_hover.png"
|
||||||
|
I18N="In the online multiplayer screen" text="Create Server"/>
|
||||||
|
<!--
|
||||||
|
<icon-button id="manage_user" width="128" height="128"
|
||||||
|
icon="gui/options_players.png"
|
||||||
|
I18N="In the online multiplayer screen" text="Users"/>
|
||||||
|
-->
|
||||||
|
</buttonbar>
|
||||||
|
|
||||||
|
<spacer height="10%" width="10"/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</stkgui>
|
29
data/gui/online/online.stkgui
Normal file
29
data/gui/online/online.stkgui
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<stkgui>
|
||||||
|
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
|
||||||
|
<header text_align="center" width="80%" align="center" text="Online"/>
|
||||||
|
<spacer height="15" width="10"/>
|
||||||
|
<button id="user-id" width="20%" height="fit" align="center"/>
|
||||||
|
<spacer height="15" width="10"/>
|
||||||
|
<icon id="logo" align="center" proportion="4" width="100%" icon="gui/logo.png"/>
|
||||||
|
|
||||||
|
<spacer height="15" width="10"/>
|
||||||
|
|
||||||
|
<buttonbar id="menu_toprow" proportion="3" width="90%" align="center">
|
||||||
|
<icon-button id="lan" width="128" height="128"
|
||||||
|
icon="gui/menu_multi.png" focus_icon="gui/menu_multi_focus.png"
|
||||||
|
I18N="Networking menu button" text="Local Networking"/>
|
||||||
|
<icon-button id="wan" width="128" height="128"
|
||||||
|
icon="gui/menu_multi.png" focus_icon="gui/menu_multi_focus.png"
|
||||||
|
I18N="Networking menu button" text="Global Networking"/>
|
||||||
|
<icon-button id="online" width="128" height="128"
|
||||||
|
icon="gui/menu_online.png" focus_icon="gui/menu_online_focus.png"
|
||||||
|
I18N="Networking menu button" text="Your profile"/>
|
||||||
|
</buttonbar>
|
||||||
|
|
||||||
|
<spacer height="10%" width="10"/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||||
|
</stkgui>
|
@ -9,7 +9,6 @@
|
|||||||
<spacer height="25" width="10"/>
|
<spacer height="25" width="10"/>
|
||||||
|
|
||||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||||
<icon-button id="tab_servers" width="128" height="128" icon="gui/main_network.png"/>
|
|
||||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/gp_copy.png"
|
<icon-button id="tab_achievements" width="128" height="128" icon="gui/gp_copy.png"
|
||||||
I18N="Section in the profile screen" text="Achievements"/>
|
I18N="Section in the profile screen" text="Achievements"/>
|
||||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"/>
|
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"/>
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
<spacer height="25" width="10"/>
|
<spacer height="25" width="10"/>
|
||||||
|
|
||||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||||
<icon-button id="tab_servers" width="128" height="128" icon="gui/main_network.png"/>
|
|
||||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/gp_copy.png"/>
|
<icon-button id="tab_achievements" width="128" height="128" icon="gui/gp_copy.png"/>
|
||||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"
|
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"
|
||||||
I18N="Section in the profile screen" text="Friends"/>
|
I18N="Section in the profile screen" text="Friends"/>
|
||||||
|
@ -3,59 +3,25 @@
|
|||||||
<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"/>
|
||||||
|
|
||||||
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
|
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
|
||||||
<header id="title" text_align="center" width="80%" align="center" text="..."/>
|
<header id="title" text_align="center" width="80%" align="center" text="Global Networking"/>
|
||||||
|
|
||||||
<spacer height="25" width="10"/>
|
<spacer height="5%" width="10"/>
|
||||||
|
<icon id="logo" align="center" proportion="1" width="100%" icon="gui/logo.png"/>
|
||||||
|
<spacer height="5%" width="10"/>
|
||||||
|
|
||||||
|
<buttonbar id="wan" proportion="1" width="90%" align="center">
|
||||||
|
<icon-button id="find_wan_server" width="128" height="128"
|
||||||
|
icon="gui/online/menu_find_server.png" focus_icon="gui/online/menu_find_server_hover.png"
|
||||||
|
I18N="In the online multiplayer screen" text="Find Server"/>
|
||||||
|
<icon-button id="create_wan_server" width="128" height="128"
|
||||||
|
icon="gui/online/menu_create_server.png" focus_icon="gui/online/menu_create_server_hover.png"
|
||||||
|
I18N="In the online multiplayer screen" text="Create Server"/>
|
||||||
|
<icon-button id="quick_wan_play" width="128" height="128"
|
||||||
|
icon="gui/online/menu_quick_play.png" focus_icon="gui/online/menu_quick_play_hover.png"
|
||||||
|
I18N="In the online multiplayer screen" text="Quick Play"/>
|
||||||
|
</buttonbar>
|
||||||
|
|
||||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
<spacer height="10%" width="10"/>
|
||||||
<icon-button id="tab_servers" width="128" height="128" icon="gui/main_network.png" I18N="Section in the profile screen" text="Servers"/>
|
|
||||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/gp_copy.png"/>
|
|
||||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" />
|
|
||||||
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png" />
|
|
||||||
</tabs>
|
|
||||||
|
|
||||||
<box proportion="1" width="100%" layout="vertical-row">
|
|
||||||
<div x="1%" y="2%" width="98%" height="96%" layout="vertical-row" >
|
|
||||||
|
|
||||||
<spacer height="5%" width="25"/>
|
|
||||||
|
|
||||||
<box width="100%" proportion="1" padding="10" layout="vertical-row">
|
|
||||||
<bright width="100%" text="Local Networking" align="center" text_align="left" />
|
|
||||||
|
|
||||||
<buttonbar id="lan" proportion="2" width="90%" align="center">
|
|
||||||
<icon-button id="find_lan_server" width="128" height="128"
|
|
||||||
icon="gui/online/menu_find_server.png" focus_icon="gui/online/menu_find_server_hover.png"
|
|
||||||
I18N="In the online multiplayer screen" text="Find Server"/>
|
|
||||||
<icon-button id="create_lan_server" width="128" height="128"
|
|
||||||
icon="gui/online/menu_create_server.png" focus_icon="gui/online/menu_create_server_hover.png"
|
|
||||||
I18N="In the online multiplayer screen" text="Create Server"/>
|
|
||||||
<!--
|
|
||||||
<icon-button id="manage_user" width="128" height="128"
|
|
||||||
icon="gui/options_players.png"
|
|
||||||
I18N="In the online multiplayer screen" text="Users"/>
|
|
||||||
-->
|
|
||||||
</buttonbar>
|
|
||||||
</box>
|
|
||||||
|
|
||||||
<spacer height="5%" width="25"/>
|
|
||||||
|
|
||||||
<box width="100%" proportion="1" padding="10" layout="vertical-row">
|
|
||||||
<bright width="100%" text="Global Networking" align="center" text_align="left" />
|
|
||||||
|
|
||||||
<buttonbar id="wan" proportion="2" width="90%" align="center">
|
|
||||||
<icon-button id="find_wan_server" width="128" height="128"
|
|
||||||
icon="gui/online/menu_find_server.png" focus_icon="gui/online/menu_find_server_hover.png"
|
|
||||||
I18N="In the online multiplayer screen" text="Find Server"/>
|
|
||||||
<icon-button id="create_wan_server" width="128" height="128"
|
|
||||||
icon="gui/online/menu_create_server.png" focus_icon="gui/online/menu_create_server_hover.png"
|
|
||||||
I18N="In the online multiplayer screen" text="Create Server"/>
|
|
||||||
<icon-button id="quick_wan_play" width="128" height="128"
|
|
||||||
icon="gui/online/menu_quick_play.png" focus_icon="gui/online/menu_quick_play_hover.png"
|
|
||||||
I18N="In the online multiplayer screen" text="Quick Play"/>
|
|
||||||
</buttonbar>
|
|
||||||
</box>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</box>
|
|
||||||
</div>
|
</div>
|
||||||
</stkgui>
|
</stkgui>
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
<spacer height="25" width="10"/>
|
<spacer height="25" width="10"/>
|
||||||
|
|
||||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||||
<icon-button id="tab_servers" width="128" height="128" icon="gui/main_network.png"/>
|
|
||||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/gp_copy.png"/>
|
<icon-button id="tab_achievements" width="128" height="128" icon="gui/gp_copy.png"/>
|
||||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" />
|
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" />
|
||||||
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"
|
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "states_screens/offline_kart_selection.hpp"
|
#include "states_screens/offline_kart_selection.hpp"
|
||||||
#include "states_screens/online_profile_achievements.hpp"
|
#include "states_screens/online_profile_achievements.hpp"
|
||||||
#include "states_screens/online_profile_servers.hpp"
|
#include "states_screens/online_profile_servers.hpp"
|
||||||
|
#include "states_screens/online_screen.hpp"
|
||||||
#include "states_screens/options_screen_video.hpp"
|
#include "states_screens/options_screen_video.hpp"
|
||||||
#include "states_screens/state_manager.hpp"
|
#include "states_screens/state_manager.hpp"
|
||||||
#include "states_screens/user_screen.hpp"
|
#include "states_screens/user_screen.hpp"
|
||||||
@ -69,15 +70,12 @@ using namespace Online;
|
|||||||
|
|
||||||
DEFINE_SCREEN_SINGLETON( MainMenuScreen );
|
DEFINE_SCREEN_SINGLETON( MainMenuScreen );
|
||||||
|
|
||||||
bool MainMenuScreen::m_enable_online = false;
|
bool MainMenuScreen::m_enable_online = true;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
MainMenuScreen::MainMenuScreen() : Screen("main_menu.stkgui")
|
MainMenuScreen::MainMenuScreen() : Screen("main_menu.stkgui")
|
||||||
{
|
{
|
||||||
m_online_string = _("Online");
|
|
||||||
//I18N: Used as a verb, appears on the main menu (login button)
|
|
||||||
m_login_string = _("Login");
|
|
||||||
} // MainMenuScreen
|
} // MainMenuScreen
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -151,10 +149,10 @@ void MainMenuScreen::init()
|
|||||||
w->setBadge(LOADING_BADGE);
|
w->setBadge(LOADING_BADGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_online = getWidget<IconButtonWidget>("online");
|
IconButtonWidget* online = getWidget<IconButtonWidget>("online");
|
||||||
|
|
||||||
if(!m_enable_online)
|
if (!m_enable_online)
|
||||||
m_online->setActive(false);
|
online->setActive(false);
|
||||||
|
|
||||||
LabelWidget* w = getWidget<LabelWidget>("info_addons");
|
LabelWidget* w = getWidget<LabelWidget>("info_addons");
|
||||||
const core::stringw &news_text = NewsManager::get()->getNextNewsMessage();
|
const core::stringw &news_text = NewsManager::get()->getNextNewsMessage();
|
||||||
@ -179,32 +177,25 @@ void MainMenuScreen::init()
|
|||||||
} // init
|
} // init
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void MainMenuScreen::onUpdate(float delta)
|
|
||||||
|
|
||||||
|
void MainMenuScreen::onUpdate(float delta)
|
||||||
{
|
{
|
||||||
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
||||||
if(PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_GUEST ||
|
if(PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_GUEST ||
|
||||||
PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN)
|
PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN)
|
||||||
{
|
{
|
||||||
m_user_id->setText(player->getLastOnlineName() + "@stk");
|
m_user_id->setText(player->getLastOnlineName() + "@stk");
|
||||||
m_online->setActive(true);
|
|
||||||
m_online->setLabel(m_online_string);
|
|
||||||
}
|
}
|
||||||
else if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_OUT)
|
else if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_OUT)
|
||||||
{
|
{
|
||||||
m_online->setActive(true);
|
|
||||||
m_online->setLabel(m_login_string);
|
|
||||||
m_user_id->setText(player->getName());
|
m_user_id->setText(player->getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// now must be either logging in or logging out
|
// now must be either logging in or logging out
|
||||||
m_online->setActive(false);
|
|
||||||
m_user_id->setText(player->getName());
|
m_user_id->setText(player->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_online->setLabel(PlayerManager::getCurrentOnlineId() ? m_online_string
|
|
||||||
: m_login_string);
|
|
||||||
IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons");
|
IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons");
|
||||||
if (addons_icon != NULL)
|
if (addons_icon != NULL)
|
||||||
{
|
{
|
||||||
@ -472,6 +463,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
|||||||
}
|
}
|
||||||
else if (selection == "story")
|
else if (selection == "story")
|
||||||
{
|
{
|
||||||
|
NetworkConfig::get()->unsetNetworking();
|
||||||
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
||||||
if (player->isFirstTime())
|
if (player->isFirstTime())
|
||||||
{
|
{
|
||||||
@ -505,24 +497,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
|||||||
}
|
}
|
||||||
else if (selection == "online")
|
else if (selection == "online")
|
||||||
{
|
{
|
||||||
if(UserConfigParams::m_internet_status!=RequestManager::IPERM_ALLOWED)
|
OnlineScreen::getInstance()->push();
|
||||||
{
|
|
||||||
new MessageDialog(_("You can not play online without internet access. "
|
|
||||||
"If you want to play online, go to options, select "
|
|
||||||
" tab 'User Interface', and edit "
|
|
||||||
"\"Connect to the Internet\"."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PlayerManager::getCurrentOnlineId())
|
|
||||||
{
|
|
||||||
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
|
|
||||||
OnlineProfileServers::getInstance()->push();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UserScreen::getInstance()->push();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (selection == "addons")
|
else if (selection == "addons")
|
||||||
{
|
{
|
||||||
|
@ -32,13 +32,6 @@ class MainMenuScreen : public GUIEngine::Screen, public GUIEngine::ScreenSinglet
|
|||||||
private:
|
private:
|
||||||
friend class GUIEngine::ScreenSingleton<MainMenuScreen>;
|
friend class GUIEngine::ScreenSingleton<MainMenuScreen>;
|
||||||
|
|
||||||
core::stringw m_online_string;
|
|
||||||
|
|
||||||
core::stringw m_login_string;
|
|
||||||
|
|
||||||
/** Keep the widget to avoid looking it up every frame. */
|
|
||||||
GUIEngine::IconButtonWidget* m_online;
|
|
||||||
|
|
||||||
/** Keep the widget to to the user name. */
|
/** Keep the widget to to the user name. */
|
||||||
GUIEngine::ButtonWidget *m_user_id;
|
GUIEngine::ButtonWidget *m_user_id;
|
||||||
|
|
||||||
|
112
src/states_screens/online_lan.cpp
Normal file
112
src/states_screens/online_lan.cpp
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2010-2015 Glenn De Jonghe
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#include "states_screens/online_profile_servers.hpp"
|
||||||
|
|
||||||
|
#include "audio/sfx_manager.hpp"
|
||||||
|
#include "config/player_manager.hpp"
|
||||||
|
#include "guiengine/engine.hpp"
|
||||||
|
#include "guiengine/scalable_font.hpp"
|
||||||
|
#include "guiengine/screen.hpp"
|
||||||
|
#include "guiengine/widget.hpp"
|
||||||
|
#include "network/network_config.hpp"
|
||||||
|
#include "network/protocol_manager.hpp"
|
||||||
|
#include "network/protocols/connect_to_server.hpp"
|
||||||
|
#include "network/protocols/request_connection.hpp"
|
||||||
|
#include "network/servers_manager.hpp"
|
||||||
|
#include "states_screens/state_manager.hpp"
|
||||||
|
#include "states_screens/create_server_screen.hpp"
|
||||||
|
#include "states_screens/networking_lobby.hpp"
|
||||||
|
#include "states_screens/online_lan.hpp"
|
||||||
|
#include "states_screens/server_selection.hpp"
|
||||||
|
#include "utils/translation.hpp"
|
||||||
|
|
||||||
|
#include <IGUIButton.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace GUIEngine;
|
||||||
|
using namespace irr::core;
|
||||||
|
using namespace irr::gui;
|
||||||
|
using namespace Online;
|
||||||
|
|
||||||
|
DEFINE_SCREEN_SINGLETON( OnlineLanScreen );
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
OnlineLanScreen::OnlineLanScreen() : GUIEngine::Screen("online/lan.stkgui")
|
||||||
|
{
|
||||||
|
} // OnlineLanScreen
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineLanScreen::loadedFromFile()
|
||||||
|
{
|
||||||
|
} // loadedFromFile
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineLanScreen::init()
|
||||||
|
{
|
||||||
|
RibbonWidget* ribbon = getWidget<RibbonWidget>("lan");
|
||||||
|
assert(ribbon != NULL);
|
||||||
|
ribbon->select("find_lan_server", PLAYER_ID_GAME_MASTER);
|
||||||
|
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||||
|
} // init
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineLanScreen::eventCallback(Widget* widget, const std::string& name, const int playerID)
|
||||||
|
{
|
||||||
|
if (name == "back")
|
||||||
|
{
|
||||||
|
StateManager::get()->popMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (name == "lan")
|
||||||
|
{
|
||||||
|
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);
|
||||||
|
std::string selection = ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
if (selection == "create_lan_server")
|
||||||
|
{
|
||||||
|
NetworkConfig::get()->setIsLAN();
|
||||||
|
NetworkConfig::get()->setIsServer(true);
|
||||||
|
CreateServerScreen::getInstance()->push();
|
||||||
|
// TODO: create lan server
|
||||||
|
}
|
||||||
|
else if (selection == "find_lan_server")
|
||||||
|
{
|
||||||
|
NetworkConfig::get()->setIsLAN();
|
||||||
|
NetworkConfig::get()->setIsServer(false);
|
||||||
|
ServerSelection::getInstance()->push();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // eventCallback
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Also called when pressing the back button. It resets the flags to indicate
|
||||||
|
* a networked game.
|
||||||
|
*/
|
||||||
|
bool OnlineLanScreen::onEscapePressed()
|
||||||
|
{
|
||||||
|
NetworkConfig::get()->unsetNetworking();
|
||||||
|
//StateManager::get()->popMenu();
|
||||||
|
return true;
|
||||||
|
} // onEscapePressed
|
||||||
|
|
57
src/states_screens/online_lan.hpp
Normal file
57
src/states_screens/online_lan.hpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2013-2015 Glenn De Jonghe
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __HEADER_OLAN_HPP__
|
||||||
|
#define __HEADER_OLAN_HPP__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <irrString.h>
|
||||||
|
|
||||||
|
#include "guiengine/screen.hpp"
|
||||||
|
#include "guiengine/widgets.hpp"
|
||||||
|
#include "states_screens/online_profile_base.hpp"
|
||||||
|
|
||||||
|
namespace GUIEngine { class Widget; }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Online profiel overview screen
|
||||||
|
* \ingroup states_screens
|
||||||
|
*/
|
||||||
|
class OnlineLanScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OnlineLanScreen>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
OnlineLanScreen();
|
||||||
|
|
||||||
|
public:
|
||||||
|
friend class GUIEngine::ScreenSingleton<OnlineLanScreen>;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void loadedFromFile() OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
|
||||||
|
const int playerID) OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void init() OVERRIDE;
|
||||||
|
virtual bool onEscapePressed() OVERRIDE;
|
||||||
|
|
||||||
|
}; // class OnlineProfileServers
|
||||||
|
|
||||||
|
#endif
|
@ -42,7 +42,6 @@ using namespace Online;
|
|||||||
OnlineProfileBase::OnlineProfileBase(const std::string &filename)
|
OnlineProfileBase::OnlineProfileBase(const std::string &filename)
|
||||||
: Screen(filename.c_str())
|
: Screen(filename.c_str())
|
||||||
{
|
{
|
||||||
m_servers_tab = NULL;
|
|
||||||
m_friends_tab = NULL;
|
m_friends_tab = NULL;
|
||||||
m_achievements_tab = NULL;
|
m_achievements_tab = NULL;
|
||||||
m_settings_tab = NULL;
|
m_settings_tab = NULL;
|
||||||
@ -63,9 +62,6 @@ void OnlineProfileBase::loadedFromFile()
|
|||||||
m_friends_tab = (IconButtonWidget *)m_profile_tabs->findWidgetNamed("tab_friends");
|
m_friends_tab = (IconButtonWidget *)m_profile_tabs->findWidgetNamed("tab_friends");
|
||||||
assert(m_friends_tab != NULL);
|
assert(m_friends_tab != NULL);
|
||||||
|
|
||||||
m_servers_tab = (IconButtonWidget *)m_profile_tabs->findWidgetNamed("tab_servers");
|
|
||||||
assert(m_servers_tab != NULL);
|
|
||||||
|
|
||||||
m_achievements_tab = (IconButtonWidget*)m_profile_tabs->findWidgetNamed("tab_achievements");
|
m_achievements_tab = (IconButtonWidget*)m_profile_tabs->findWidgetNamed("tab_achievements");
|
||||||
assert(m_profile_tabs == NULL || m_achievements_tab != NULL);
|
assert(m_profile_tabs == NULL || m_achievements_tab != NULL);
|
||||||
|
|
||||||
@ -107,7 +103,6 @@ void OnlineProfileBase::init()
|
|||||||
|
|
||||||
if (m_profile_tabs)
|
if (m_profile_tabs)
|
||||||
{
|
{
|
||||||
m_servers_tab->setTooltip(_("Servers"));
|
|
||||||
m_friends_tab->setTooltip(_("Friends"));
|
m_friends_tab->setTooltip(_("Friends"));
|
||||||
m_achievements_tab->setTooltip(_("Achievements"));
|
m_achievements_tab->setTooltip(_("Achievements"));
|
||||||
m_settings_tab->setTooltip(_("Account Settings"));
|
m_settings_tab->setTooltip(_("Account Settings"));
|
||||||
@ -159,8 +154,6 @@ void OnlineProfileBase::eventCallback(Widget* widget, const std::string& name,
|
|||||||
sm->replaceTopMostScreen(TabOnlineProfileAchievements::getInstance());
|
sm->replaceTopMostScreen(TabOnlineProfileAchievements::getInstance());
|
||||||
else if (selection == m_settings_tab->m_properties[PROP_ID])
|
else if (selection == m_settings_tab->m_properties[PROP_ID])
|
||||||
sm->replaceTopMostScreen(OnlineProfileSettings::getInstance());
|
sm->replaceTopMostScreen(OnlineProfileSettings::getInstance());
|
||||||
else if (selection == m_servers_tab->m_properties[PROP_ID])
|
|
||||||
sm->replaceTopMostScreen(OnlineProfileServers::getInstance());
|
|
||||||
}
|
}
|
||||||
else if (name == "back")
|
else if (name == "back")
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,6 @@ protected:
|
|||||||
/** Pointer to the various widgets on the screen. */
|
/** Pointer to the various widgets on the screen. */
|
||||||
GUIEngine::LabelWidget * m_header;
|
GUIEngine::LabelWidget * m_header;
|
||||||
GUIEngine::RibbonWidget* m_profile_tabs;
|
GUIEngine::RibbonWidget* m_profile_tabs;
|
||||||
GUIEngine::IconButtonWidget * m_servers_tab;
|
|
||||||
GUIEngine::IconButtonWidget * m_friends_tab;
|
GUIEngine::IconButtonWidget * m_friends_tab;
|
||||||
GUIEngine::IconButtonWidget * m_achievements_tab;
|
GUIEngine::IconButtonWidget * m_achievements_tab;
|
||||||
GUIEngine::IconButtonWidget * m_settings_tab;
|
GUIEngine::IconButtonWidget * m_settings_tab;
|
||||||
|
@ -48,7 +48,7 @@ DEFINE_SCREEN_SINGLETON( OnlineProfileServers );
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
OnlineProfileServers::OnlineProfileServers() : OnlineProfileBase("online/profile_servers.stkgui")
|
OnlineProfileServers::OnlineProfileServers() : GUIEngine::Screen("online/profile_servers.stkgui")
|
||||||
{
|
{
|
||||||
} // OnlineProfileServers
|
} // OnlineProfileServers
|
||||||
|
|
||||||
@ -56,44 +56,28 @@ OnlineProfileServers::OnlineProfileServers() : OnlineProfileBase("online/profile
|
|||||||
|
|
||||||
void OnlineProfileServers::loadedFromFile()
|
void OnlineProfileServers::loadedFromFile()
|
||||||
{
|
{
|
||||||
OnlineProfileBase::loadedFromFile();
|
|
||||||
} // loadedFromFile
|
} // loadedFromFile
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void OnlineProfileServers::init()
|
void OnlineProfileServers::init()
|
||||||
{
|
{
|
||||||
OnlineProfileBase::init();
|
RibbonWidget* ribbon = getWidget<RibbonWidget>("wan");
|
||||||
m_profile_tabs->select( m_servers_tab->m_properties[PROP_ID], PLAYER_ID_GAME_MASTER );
|
assert(ribbon != NULL);
|
||||||
m_servers_tab->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
ribbon->select("find_wan_server", PLAYER_ID_GAME_MASTER);
|
||||||
// OnlineScreen::getInstance()->push();
|
ribbon->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void OnlineProfileServers::eventCallback(Widget* widget, const std::string& name, const int playerID)
|
void OnlineProfileServers::eventCallback(Widget* widget, const std::string& name, const int playerID)
|
||||||
{
|
{
|
||||||
OnlineProfileBase::eventCallback( widget, name, playerID);
|
if (name == "back")
|
||||||
|
|
||||||
if (name == "lan")
|
|
||||||
{
|
{
|
||||||
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);
|
StateManager::get()->popMenu();
|
||||||
std::string selection = ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
return;
|
||||||
if (selection == "create_lan_server")
|
|
||||||
{
|
|
||||||
NetworkConfig::get()->setIsLAN();
|
|
||||||
NetworkConfig::get()->setIsServer(true);
|
|
||||||
CreateServerScreen::getInstance()->push();
|
|
||||||
// TODO: create lan server
|
|
||||||
}
|
|
||||||
else if (selection == "find_lan_server")
|
|
||||||
{
|
|
||||||
NetworkConfig::get()->setIsLAN();
|
|
||||||
NetworkConfig::get()->setIsServer(false);
|
|
||||||
ServerSelection::getInstance()->push();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (name == "wan")
|
if (name == "wan")
|
||||||
{
|
{
|
||||||
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);
|
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);
|
||||||
std::string selection = ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
std::string selection = ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
@ -176,6 +160,6 @@ void OnlineProfileServers::doQuickPlay()
|
|||||||
bool OnlineProfileServers::onEscapePressed()
|
bool OnlineProfileServers::onEscapePressed()
|
||||||
{
|
{
|
||||||
NetworkConfig::get()->unsetNetworking();
|
NetworkConfig::get()->unsetNetworking();
|
||||||
return OnlineProfileBase::onEscapePressed();
|
return true;
|
||||||
} // onEscapePressed
|
} // onEscapePressed
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace GUIEngine { class Widget; }
|
|||||||
* \brief Online profiel overview screen
|
* \brief Online profiel overview screen
|
||||||
* \ingroup states_screens
|
* \ingroup states_screens
|
||||||
*/
|
*/
|
||||||
class OnlineProfileServers : public OnlineProfileBase, public GUIEngine::ScreenSingleton<OnlineProfileServers>
|
class OnlineProfileServers : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OnlineProfileServers>
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
OnlineProfileServers();
|
OnlineProfileServers();
|
||||||
|
200
src/states_screens/online_screen.cpp
Normal file
200
src/states_screens/online_screen.cpp
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2009-2015 Marianne Gagnon
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
|
#include "states_screens/main_menu_screen.hpp"
|
||||||
|
|
||||||
|
#include "config/player_manager.hpp"
|
||||||
|
#include "config/user_config.hpp"
|
||||||
|
#include "graphics/irr_driver.hpp"
|
||||||
|
#include "guiengine/scalable_font.hpp"
|
||||||
|
#include "guiengine/widgets/label_widget.hpp"
|
||||||
|
#include "guiengine/widgets/list_widget.hpp"
|
||||||
|
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||||
|
#include "input/device_manager.hpp"
|
||||||
|
#include "input/input_manager.hpp"
|
||||||
|
#include "input/keyboard_device.hpp"
|
||||||
|
#include "io/file_manager.hpp"
|
||||||
|
#include "main_loop.hpp"
|
||||||
|
#include "network/network_config.hpp"
|
||||||
|
#include "online/request_manager.hpp"
|
||||||
|
#include "states_screens/online_lan.hpp"
|
||||||
|
#include "states_screens/online_profile_achievements.hpp"
|
||||||
|
#include "states_screens/online_profile_servers.hpp"
|
||||||
|
#include "states_screens/online_screen.hpp"
|
||||||
|
#include "states_screens/state_manager.hpp"
|
||||||
|
#include "states_screens/user_screen.hpp"
|
||||||
|
#include "states_screens/dialogs/message_dialog.hpp"
|
||||||
|
#include "tracks/track_manager.hpp"
|
||||||
|
#include "utils/string_utils.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace GUIEngine;
|
||||||
|
using namespace Online;
|
||||||
|
|
||||||
|
DEFINE_SCREEN_SINGLETON( OnlineScreen );
|
||||||
|
|
||||||
|
bool OnlineScreen::m_enable_online = true;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
OnlineScreen::OnlineScreen() : Screen("online/online.stkgui")
|
||||||
|
{
|
||||||
|
m_online_string = _("Your profile");
|
||||||
|
//I18N: Used as a verb, appears on the main networking menu (login button)
|
||||||
|
m_login_string = _("Login");
|
||||||
|
} // OnlineScreen
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::loadedFromFile()
|
||||||
|
{
|
||||||
|
} // loadedFromFile
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::beforeAddingWidget()
|
||||||
|
{
|
||||||
|
bool is_logged_in = false;
|
||||||
|
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
||||||
|
if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_GUEST ||
|
||||||
|
PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN)
|
||||||
|
{
|
||||||
|
is_logged_in = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IconButtonWidget* wan = getWidget<IconButtonWidget>("wan");
|
||||||
|
wan->setActive(is_logged_in);
|
||||||
|
wan->setVisible(is_logged_in);
|
||||||
|
} // beforeAddingWidget
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
void OnlineScreen::init()
|
||||||
|
{
|
||||||
|
Screen::init();
|
||||||
|
|
||||||
|
m_online = getWidget<IconButtonWidget>("online");
|
||||||
|
|
||||||
|
if (!m_enable_online)
|
||||||
|
m_online->setActive(false);
|
||||||
|
|
||||||
|
m_user_id = getWidget<ButtonWidget>("user-id");
|
||||||
|
assert(m_user_id);
|
||||||
|
|
||||||
|
RibbonWidget* r = getWidget<RibbonWidget>("menu_toprow");
|
||||||
|
r->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
|
} // init
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::onUpdate(float delta)
|
||||||
|
{
|
||||||
|
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
||||||
|
if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_GUEST ||
|
||||||
|
PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN)
|
||||||
|
{
|
||||||
|
m_online->setActive(true);
|
||||||
|
m_online->setLabel(m_online_string);
|
||||||
|
m_user_id->setText(player->getLastOnlineName() + "@stk");
|
||||||
|
}
|
||||||
|
else if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_OUT)
|
||||||
|
{
|
||||||
|
m_online->setActive(true);
|
||||||
|
m_online->setLabel(m_login_string);
|
||||||
|
m_user_id->setText(player->getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// now must be either logging in or logging out
|
||||||
|
m_online->setActive(false);
|
||||||
|
m_user_id->setText(player->getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_online->setLabel(PlayerManager::getCurrentOnlineId() ? m_online_string
|
||||||
|
: m_login_string);
|
||||||
|
} // onUpdate
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::eventCallback(Widget* widget, const std::string& name,
|
||||||
|
const int playerID)
|
||||||
|
{
|
||||||
|
if (name == "user-id")
|
||||||
|
{
|
||||||
|
UserScreen::getInstance()->push();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (name == "back")
|
||||||
|
{
|
||||||
|
StateManager::get()->popMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);
|
||||||
|
if (ribbon == NULL) return; // what's that event??
|
||||||
|
|
||||||
|
// ---- A ribbon icon was clicked
|
||||||
|
std::string selection =
|
||||||
|
ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
|
if (selection == "lan")
|
||||||
|
{
|
||||||
|
OnlineLanScreen::getInstance()->push();
|
||||||
|
}
|
||||||
|
else if (selection == "wan")
|
||||||
|
{
|
||||||
|
OnlineProfileServers::getInstance()->push();
|
||||||
|
}
|
||||||
|
else if (selection == "online")
|
||||||
|
{
|
||||||
|
if (UserConfigParams::m_internet_status != RequestManager::IPERM_ALLOWED)
|
||||||
|
{
|
||||||
|
new MessageDialog(_("You can not play online without internet access. "
|
||||||
|
"If you want to play online, go to options, select "
|
||||||
|
" tab 'User Interface', and edit "
|
||||||
|
"\"Connect to the Internet\"."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PlayerManager::getCurrentOnlineId())
|
||||||
|
{
|
||||||
|
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
|
||||||
|
TabOnlineProfileAchievements::getInstance()->push();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UserScreen::getInstance()->push();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // eventCallback
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::tearDown()
|
||||||
|
{
|
||||||
|
} // tearDown
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OnlineScreen::onDisabledItemClicked(const std::string& item)
|
||||||
|
{
|
||||||
|
} // onDisabledItemClicked
|
73
src/states_screens/online_screen.hpp
Normal file
73
src/states_screens/online_screen.hpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
|
// Copyright (C) 2009-2015 Marianne Gagnon
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation; either version 3
|
||||||
|
// of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#ifndef HEADER_ONLINE_SCREEN_HPP
|
||||||
|
#define HEADER_ONLINE_SCREEN_HPP
|
||||||
|
|
||||||
|
#include "guiengine/screen.hpp"
|
||||||
|
|
||||||
|
namespace GUIEngine { class Widget; class ListWidget;
|
||||||
|
class ButtonWidget; class IconButtonWidget; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Handles the networking main menu
|
||||||
|
* \ingroup states_screens
|
||||||
|
*/
|
||||||
|
class OnlineScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OnlineScreen>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
friend class GUIEngine::ScreenSingleton<OnlineScreen>;
|
||||||
|
|
||||||
|
core::stringw m_online_string;
|
||||||
|
|
||||||
|
core::stringw m_login_string;
|
||||||
|
|
||||||
|
/** Keep the widget to to the user name. */
|
||||||
|
GUIEngine::ButtonWidget *m_user_id;
|
||||||
|
|
||||||
|
/** Keep the widget to avoid looking it up every frame. */
|
||||||
|
GUIEngine::IconButtonWidget* m_online;
|
||||||
|
|
||||||
|
OnlineScreen();
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Temporary disable the online menu while it is being worked at. */
|
||||||
|
static bool m_enable_online;
|
||||||
|
|
||||||
|
virtual void onUpdate(float delta) OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void loadedFromFile() OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void beforeAddingWidget() OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
|
||||||
|
const int playerID) OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void init() OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void tearDown() OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
virtual void onDisabledItemClicked(const std::string& item) OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -400,6 +400,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
|
|||||||
*/
|
*/
|
||||||
void BaseUserScreen::closeScreen()
|
void BaseUserScreen::closeScreen()
|
||||||
{
|
{
|
||||||
|
// TODO: return user to where they come from
|
||||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||||
} // closeScreen
|
} // closeScreen
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user