Add initial seelct identity screen
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10357 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
b384f71c7e
commit
bd36a57164
@ -2,7 +2,7 @@
|
||||
|
||||
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
|
||||
|
||||
<header text_align="center" width="80%" align="center" text="Select a Game Slot"/>
|
||||
<header text_align="center" width="80%" align="center" text="Select a Player"/>
|
||||
<spacer height="15" width="10"/>
|
||||
|
||||
<list id="gameslots" proportion="5" width="75%" align="center"/>
|
||||
@ -10,11 +10,9 @@
|
||||
|
||||
<button id="creategame" x="20"
|
||||
I18N="In story mode 'select a game slot' menu"
|
||||
text="Create a new game" align="center"/>
|
||||
text="Create a new player" align="center"/>
|
||||
|
||||
<spacer width="20" height="15"/>
|
||||
</div>
|
||||
|
||||
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
|
||||
|
||||
</stkgui>
|
||||
|
@ -172,7 +172,7 @@
|
||||
#include "race/highscore_manager.hpp"
|
||||
#include "race/history.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "states_screens/main_menu_screen.hpp"
|
||||
#include "states_screens/story_mode_lobby.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -1194,7 +1194,7 @@ int main(int argc, char *argv[] )
|
||||
addons_manager->checkInstalledAddons();
|
||||
if(!UserConfigParams::m_no_start_screen)
|
||||
{
|
||||
StateManager::get()->pushScreen(MainMenuScreen::getInstance());
|
||||
StateManager::get()->pushScreen(StoryModeLobbyScreen::getInstance());
|
||||
if(UserConfigParams::m_internet_status ==
|
||||
NetworkHttp::IPERM_NOT_ASKED)
|
||||
{
|
||||
|
@ -274,7 +274,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
{
|
||||
StateManager::get()->pushScreen(HelpScreen1::getInstance());
|
||||
}
|
||||
else if (selection == "challenges")
|
||||
else if (selection == "story")
|
||||
{
|
||||
StateManager::get()->pushScreen(ChallengesScreen::getInstance());
|
||||
}
|
||||
|
@ -17,7 +17,10 @@
|
||||
|
||||
#include "states_screens/story_mode_lobby.hpp"
|
||||
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "guiengine/widgets/list_widget.hpp"
|
||||
#include "states_screens/dialogs/story_mode_new.hpp"
|
||||
#include "states_screens/main_menu_screen.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
||||
|
||||
@ -43,6 +46,22 @@ void StoryModeLobbyScreen::init()
|
||||
{
|
||||
Screen::init();
|
||||
|
||||
ListWidget* list = getWidget<ListWidget>("gameslots");
|
||||
list->clear();
|
||||
|
||||
PtrVector<PlayerProfile>& players = UserConfigParams::m_all_players;
|
||||
for (int n=0; n<players.size(); n++)
|
||||
{
|
||||
if (players[n].isGuestAccount()) continue;
|
||||
|
||||
// FIXME: we're using a trunacted ascii version of the player name as
|
||||
// identifier, let's hope this causes no issues...
|
||||
list->addItem(core::stringc(players[n].getName().c_str()).c_str(),
|
||||
players[n].getName() );
|
||||
}
|
||||
|
||||
list->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
} // init
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -66,7 +85,28 @@ void StoryModeLobbyScreen::eventCallback(Widget* widget, const std::string& name
|
||||
}
|
||||
else if (name == "gameslots")
|
||||
{
|
||||
// TODO
|
||||
ListWidget* list = getWidget<ListWidget>("gameslots");
|
||||
|
||||
bool slot_found = false;
|
||||
|
||||
PtrVector<PlayerProfile>& players = UserConfigParams::m_all_players;
|
||||
for (int n=0; n<players.size(); n++)
|
||||
{
|
||||
if (list->getSelectionLabel() == players[n].getName())
|
||||
{
|
||||
unlock_manager->setCurrentSlot(n);
|
||||
slot_found = true;
|
||||
break;;
|
||||
}
|
||||
}
|
||||
|
||||
if (!slot_found)
|
||||
{
|
||||
fprintf(stderr, "[StoryModeLobbyScreen] ERROR: cannot find player corresponding to slot '%s'\n",
|
||||
core::stringc(list->getSelectionLabel().c_str()).c_str());
|
||||
}
|
||||
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
}
|
||||
} // eventCallback
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user