Remove waiting for other screen now that you can instantly know votes
This commit is contained in:
parent
f8f77edc47
commit
cf898c2795
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<stkgui>
|
||||
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
|
||||
|
||||
<header id="title" width="96%" height="fit" text_align="center" I18N="Networking screen" text="Waiting for the others..."/>
|
||||
|
||||
<spacer height="40" width="50"/>
|
||||
|
||||
<label proportion="1" width="100%" text_align="left" id="lblDetails"/>
|
||||
</div>
|
||||
</stkgui>
|
@ -38,7 +38,6 @@
|
||||
#include "online/online_profile.hpp"
|
||||
#include "states_screens/networking_lobby.hpp"
|
||||
#include "states_screens/network_kart_selection.hpp"
|
||||
#include "states_screens/tracks_screen.hpp"
|
||||
#include "states_screens/race_result_gui.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -260,9 +259,6 @@ void ClientLobby::update(float dt)
|
||||
screen->setAvailableKartsFromServer(m_available_karts);
|
||||
screen->push();
|
||||
m_state = SELECTING_KARTS;
|
||||
// Todo: add max lap
|
||||
TracksScreen::getInstance()->setNetworkTracks();
|
||||
TracksScreen::getInstance()->setMaxLap(3);
|
||||
std::make_shared<LatencyProtocol>()->requestStart();
|
||||
Log::info("LobbyProtocol", "LatencyProtocol started.");
|
||||
}
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "race/race_manager.hpp"
|
||||
#include "states_screens/networking_lobby.hpp"
|
||||
#include "states_screens/race_result_gui.hpp"
|
||||
#include "states_screens/waiting_for_others.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
@ -567,10 +566,9 @@ void ServerLobby::startSelection(const Event *event)
|
||||
delete ns;
|
||||
|
||||
m_state = SELECTING;
|
||||
// 30 seconds for clients to choose kart and track
|
||||
// will be increased later if there is grand prix
|
||||
m_timeout = StkTime::getRealTime() + 30.0f;
|
||||
WaitingForOthersScreen::getInstance()->push();
|
||||
|
||||
// Will be changed after the first vote received
|
||||
m_timeout = std::numeric_limits<float>::max();
|
||||
|
||||
std::make_shared<LatencyProtocol>()->requestStart();
|
||||
Log::info("LobbyProtocol", "LatencyProtocol started.");
|
||||
@ -985,6 +983,14 @@ void ServerLobby::kartSelectionRequested(Event* event)
|
||||
*/
|
||||
void ServerLobby::playerVote(Event* event)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_connection_mutex);
|
||||
if (m_state != SELECTING)
|
||||
{
|
||||
Log::warn("ServerLobby", "Received track vote while in state %d.",
|
||||
m_state.load());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!checkDataSize(event, 4) ||
|
||||
event->getPeer()->getPlayerProfiles().empty())
|
||||
return;
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "states_screens/race_setup_screen.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "states_screens/tracks_screen.hpp"
|
||||
#include "states_screens/waiting_for_others.hpp"
|
||||
|
||||
static const char ID_LOCKED[] = "locked/";
|
||||
|
||||
@ -151,6 +150,7 @@ void NetworkKartSelectionScreen::playerConfirm(const int playerID)
|
||||
input_manager->getDeviceManager()->setAssignMode(ASSIGN);
|
||||
// Remove kart screen
|
||||
StateManager::get()->popMenu();
|
||||
TracksScreen::getInstance()->setNetworkTracks();
|
||||
TracksScreen::getInstance()->push();
|
||||
}
|
||||
} // playerConfirm
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "states_screens/track_info_screen.hpp"
|
||||
#include "states_screens/gp_info_screen.hpp"
|
||||
#include "states_screens/waiting_for_others.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "network/stk_host.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "states_screens/track_info_screen.hpp"
|
||||
#include "states_screens/waiting_for_others.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
@ -49,7 +48,13 @@ static const char ALL_TRACK_GROUPS_ID[] = "all";
|
||||
DEFINE_SCREEN_SINGLETON( TracksScreen );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void TracksScreen::loadedFromFile()
|
||||
{
|
||||
getWidget<CheckBoxWidget>("reverse")->setState(false);
|
||||
getWidget<SpinnerWidget>("lap-spinner")->setValue(1);
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
const int playerID)
|
||||
{
|
||||
@ -99,7 +104,6 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
.addUInt8(
|
||||
getWidget<CheckBoxWidget>("reverse")->getState());
|
||||
STKHost::get()->sendToServer(&vote, true);
|
||||
WaitingForOthersScreen::getInstance()->push();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -200,35 +204,18 @@ void TracksScreen::init()
|
||||
STKTexManager::getInstance()->unsetTextureErrorMessage();
|
||||
if (!m_network_tracks)
|
||||
{
|
||||
getWidget("lap-text")->setActive(false);
|
||||
getWidget("lap-text")->setVisible(false);
|
||||
getWidget("lap-spinner")->setActive(false);
|
||||
getWidget("lap-spinner")->setVisible(false);
|
||||
getWidget("reverse-text")->setActive(false);
|
||||
getWidget("reverse-text")->setVisible(false);
|
||||
getWidget("reverse")->setActive(false);
|
||||
getWidget("reverse")->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
getWidget("lap-text")->setActive(true);
|
||||
getWidget("lap-text")->setVisible(true);
|
||||
getWidget("lap-spinner")->setActive(true);
|
||||
getWidget("lap-spinner")->setVisible(true);
|
||||
getWidget<SpinnerWidget>("lap-spinner")->setMin(1);
|
||||
getWidget<SpinnerWidget>("lap-spinner")->setMax(m_max_lap);
|
||||
getWidget<SpinnerWidget>("lap-spinner")->setValue(1);
|
||||
getWidget("reverse-text")->setActive(true);
|
||||
getWidget("reverse-text")->setVisible(true);
|
||||
getWidget("reverse")->setActive(true);
|
||||
getWidget("reverse")->setVisible(true);
|
||||
getWidget<CheckBoxWidget>("reverse")->setState(false);
|
||||
}
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void TracksScreen::onUpdate(float dt)
|
||||
{
|
||||
if (NetworkConfig::get()->isAutoConnect() && m_network_tracks)
|
||||
{
|
||||
assert(!m_random_track_list.empty());
|
||||
@ -236,9 +223,8 @@ void TracksScreen::onUpdate(float dt)
|
||||
vote.addUInt8(LobbyProtocol::LE_VOTE);
|
||||
vote.encodeString(m_random_track_list[0]).addUInt8(1).addUInt8(0);
|
||||
STKHost::get()->sendToServer(&vote, true);
|
||||
WaitingForOthersScreen::getInstance()->push();
|
||||
}
|
||||
} // onUpdate
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Rebuild the list of tracks. This need to be recomputed e.g. to
|
||||
|
@ -36,11 +36,9 @@ private:
|
||||
TracksScreen() : Screen("tracks.stkgui")
|
||||
{
|
||||
m_network_tracks = false;
|
||||
m_max_lap = 0;
|
||||
}
|
||||
|
||||
bool m_network_tracks;
|
||||
unsigned m_max_lap;
|
||||
|
||||
/** adds the tracks from the current track group into the tracks ribbon */
|
||||
void buildTrackList();
|
||||
@ -50,7 +48,7 @@ private:
|
||||
public:
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE {};
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void eventCallback(GUIEngine::Widget* widget,
|
||||
@ -66,16 +64,12 @@ public:
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void tearDown() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void onUpdate(float dt) OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual bool onEscapePressed() OVERRIDE;
|
||||
|
||||
void setFocusOnTrack(const std::string& trackName);
|
||||
|
||||
void setNetworkTracks() { m_network_tracks = true; }
|
||||
void setMaxLap(unsigned lap) { m_max_lap = lap; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,53 +0,0 @@
|
||||
// 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/waiting_for_others.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( WaitingForOthersScreen );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
WaitingForOthersScreen::WaitingForOthersScreen()
|
||||
: Screen("online/waiting_for_others.stkgui")
|
||||
{
|
||||
} // WaitingForOthersScreen
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void WaitingForOthersScreen::loadedFromFile()
|
||||
{
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void WaitingForOthersScreen::eventCallback(Widget* widget,
|
||||
const std::string& name,
|
||||
const int player_id)
|
||||
{
|
||||
} // eventCallback
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void WaitingForOthersScreen::init()
|
||||
{
|
||||
Screen::init();
|
||||
} //init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void WaitingForOthersScreen::onUpdate(float dt)
|
||||
{
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
// 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_WAITING_FOR_OTHERS_HPP
|
||||
#define HEADER_WAITING_FOR_OTHERS_HPP
|
||||
|
||||
#include "guiengine/screen.hpp"
|
||||
|
||||
namespace GUIEngine { class Widget; }
|
||||
|
||||
/**
|
||||
* \brief Help screen, part 1
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class WaitingForOthersScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<WaitingForOthersScreen>
|
||||
{
|
||||
friend class GUIEngine::ScreenSingleton<WaitingForOthersScreen>;
|
||||
WaitingForOthersScreen();
|
||||
|
||||
public:
|
||||
|
||||
/** \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 void onUpdate(float dt) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user