Some work on new login screen, though wip atm.
This commit is contained in:
parent
2f17264f39
commit
812da3e0c0
@ -1,32 +1,47 @@
|
|||||||
<stkgui>
|
<stkgui>
|
||||||
|
|
||||||
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
|
<div x="2%" y="2%" width="96%" height="97%" layout="vertical-row" >
|
||||||
|
|
||||||
<spacer height="15" width="10"/>
|
<spacer height="15" width="10"/>
|
||||||
<header text_align="center" width="80%" align="center" text="Select a Local Player"/>
|
<header text_align="center" width="80%" align="center" text="Select a Local Player"/>
|
||||||
<spacer height="15" width="10"/>
|
<spacer height="15" width="10"/>
|
||||||
|
|
||||||
<scrollable_toolbar id="local" height="175" y="10" x="10" width="98%" align="center" label_location="each"
|
<scrollable_ribbon id="local" height="220" y="10" x="10" width="98%" align="center" label_location="each"
|
||||||
square_items="true" child_width="160" child_height="120" />
|
square_items="true" child_width="160" child_height="120" />
|
||||||
|
|
||||||
|
<spacer height="15" width="10"/>
|
||||||
|
<div width="80%" align="center" layout="vertical-row" height="fit">
|
||||||
|
<div width="100%" height="fit" layout="horizontal-row" >
|
||||||
|
<label proportion="1" height="100%" text_align="left" I18N="In the login screen" text="Online"/>
|
||||||
|
<checkbox id="online" I18N="In the login screen"/>
|
||||||
|
</div>
|
||||||
|
<div width="100%" height="fit" layout="horizontal-row" >
|
||||||
|
<label proportion="1" height="100%" id="label_username" text_align="left"
|
||||||
|
I18N="In the login screen" text="Username"/>
|
||||||
|
<textbox proportion="2" height="fit" id="username" I18N="In the registration dialog"/>
|
||||||
|
</div>
|
||||||
|
<spacer height="20" width="20"/>
|
||||||
|
|
||||||
<header text_align="center" width="80%" align="center" text="Select an Online Player"/>
|
<div width="100%" height="fit" layout="horizontal-row" >
|
||||||
<spacer height="15" width="10"/>
|
<label proportion="1" height="100%" id="label_password" text_align="left"
|
||||||
<scrollable_toolbar id="online" height="175" y="10" x="10" width="98%" align="center" label_location="each"
|
I18N="In the registration dialog" text="Password"/>
|
||||||
square_items="true" child_width="160" child_height="120" />
|
<textbox proportion="2" height="fit" id="password" I18N="In the registration dialog"/>
|
||||||
|
</div>
|
||||||
<spacer width="20" height="25"/>
|
</div>
|
||||||
<buttonbar id="options" width="90%" height="13%" align="bottom">
|
|
||||||
<icon-button id="ok" width="64" height="64" icon="gui/green_check.png"
|
|
||||||
I18N="Login dialog" text="OK" label_location="bottom"/>
|
|
||||||
<icon-button id="ok_and_save" width="64" height="64" icon="gui/main_help.png"
|
|
||||||
I18N="Login dialog" text="OK and Save" label_location="bottom"/>
|
|
||||||
|
|
||||||
<icon-button id="cancel" width="64" height="64" icon="gui/main_help.png"
|
|
||||||
I18N="Login dialog" text="Cancel" label_location="bottom"/>
|
|
||||||
</buttonbar>
|
|
||||||
|
|
||||||
<spacer width="20" height="15"/>
|
<spacer width="20" height="25"/>
|
||||||
</div>
|
<buttonbar id="options" width="90%" height="13%" align="bottom">
|
||||||
|
<icon-button id="ok" width="64" height="64" icon="gui/green_check.png"
|
||||||
|
I18N="Login dialog" text="OK" label_location="bottom"/>
|
||||||
|
<icon-button id="ok_and_save" width="64" height="64" icon="gui/main_help.png"
|
||||||
|
I18N="Login dialog" text="OK and Save" label_location="bottom"/>
|
||||||
|
<icon-button id="new_user" width="64" height="64" icon="gui/main_help.png"
|
||||||
|
I18N="Login dialog" text="Create new user" label_location="bottom"/>
|
||||||
|
<icon-button id="cancel" width="64" height="64" icon="gui/main_help.png"
|
||||||
|
I18N="Login dialog" text="Cancel" label_location="bottom"/>
|
||||||
|
</buttonbar>
|
||||||
|
|
||||||
|
<spacer width="20" height="15"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
</stkgui>
|
</stkgui>
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
<stkgui>
|
|
||||||
|
|
||||||
<div x="5%" y="5%" width="90%" height="90%" layout="vertical-row" >
|
|
||||||
|
|
||||||
<header width="80%" text="New Game" align="center" text_align="center" />
|
|
||||||
|
|
||||||
<spacer proportion="1" width="25"/>
|
|
||||||
|
|
||||||
<div layout="horizontal-row" width="100%" height="50" align="center">
|
|
||||||
<label proportion="1" height="100%"
|
|
||||||
I18N="In the new story mode game dialog" text="Select your identity" text_align="right" />
|
|
||||||
<spacer width="50" height="25"/>
|
|
||||||
<spinner id="identity" proportion="1" height="100%" min_value="0" wrap_around="true"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<spacer proportion="1" width="25"/>
|
|
||||||
|
|
||||||
<ribbon id="difficulty" height="135" width="85%" align="center">
|
|
||||||
<icon-button id="novice" width="128" height="128" icon="gui/difficulty_easy.png"
|
|
||||||
I18N="Difficulty" text="Novice"/>
|
|
||||||
<icon-button id="intermediate" width="128" height="128" icon="gui/difficulty_medium.png"
|
|
||||||
I18N="Difficulty" text="Intermediate"/>
|
|
||||||
<icon-button id="expert" width="128" height="128" icon="gui/difficulty_hard.png"
|
|
||||||
I18N="Difficulty" text="Expert"/>
|
|
||||||
</ribbon>
|
|
||||||
|
|
||||||
<spacer width="25" proportion="1"/>
|
|
||||||
|
|
||||||
<button id="startgame" text="Start Game" align="center"/>
|
|
||||||
|
|
||||||
<spacer width="25" height="5"/>
|
|
||||||
|
|
||||||
<button id="cancel" text="Cancel" align="center"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</stkgui>
|
|
@ -114,7 +114,8 @@ void PlayerManager::resumeSavedSession()
|
|||||||
*/
|
*/
|
||||||
void PlayerManager::onSTKQuit()
|
void PlayerManager::onSTKQuit()
|
||||||
{
|
{
|
||||||
getCurrentPlayer()->onSTKQuit();
|
if (getCurrentPlayer())
|
||||||
|
getCurrentPlayer()->onSTKQuit();
|
||||||
} // onSTKQuit
|
} // onSTKQuit
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -48,6 +48,7 @@ PlayerProfile::PlayerProfile(const core::stringw& name, bool is_guest)
|
|||||||
m_saved_session = false;
|
m_saved_session = false;
|
||||||
m_saved_token = "";
|
m_saved_token = "";
|
||||||
m_saved_user_id = 0;
|
m_saved_user_id = 0;
|
||||||
|
m_last_online_name = "";
|
||||||
m_achievements_status = NULL;
|
m_achievements_status = NULL;
|
||||||
m_story_mode_status = NULL;
|
m_story_mode_status = NULL;
|
||||||
} // PlayerProfile
|
} // PlayerProfile
|
||||||
@ -71,17 +72,19 @@ PlayerProfile::PlayerProfile(const XMLNode* node)
|
|||||||
m_saved_session = false;
|
m_saved_session = false;
|
||||||
m_saved_token = "";
|
m_saved_token = "";
|
||||||
m_saved_user_id = 0;
|
m_saved_user_id = 0;
|
||||||
|
m_last_online_name = "";
|
||||||
m_story_mode_status = NULL;
|
m_story_mode_status = NULL;
|
||||||
m_achievements_status = NULL;
|
m_achievements_status = NULL;
|
||||||
|
|
||||||
node->get("name", &m_local_name );
|
node->get("name", &m_local_name );
|
||||||
node->get("guest", &m_is_guest_account);
|
node->get("guest", &m_is_guest_account);
|
||||||
node->get("use-frequency", &m_use_frequency );
|
node->get("use-frequency", &m_use_frequency );
|
||||||
node->get("unique-id", &m_unique_id );
|
node->get("unique-id", &m_unique_id );
|
||||||
node->get("is-default", &m_is_default );
|
node->get("is-default", &m_is_default );
|
||||||
node->get("saved-session", &m_saved_session );
|
node->get("saved-session", &m_saved_session );
|
||||||
node->get("saved-user", &m_saved_user_id );
|
node->get("saved-user", &m_saved_user_id );
|
||||||
node->get("saved-token", &m_saved_token );
|
node->get("saved-token", &m_saved_token );
|
||||||
|
node->get("last-online-name", &m_last_online_name);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
m_magic_number = 0xABCD1234;
|
m_magic_number = 0xABCD1234;
|
||||||
@ -138,8 +141,8 @@ void PlayerProfile::save(UTFWriter &out)
|
|||||||
<< L"\" saved-session=\"" << m_saved_session << L"\"\n";
|
<< L"\" saved-session=\"" << m_saved_session << L"\"\n";
|
||||||
|
|
||||||
out << L" saved-user=\"" << m_saved_user_id
|
out << L" saved-user=\"" << m_saved_user_id
|
||||||
<< L"\" saved-token=\"" << m_saved_token << L"\">\n";
|
<< L"\" saved-token=\"" << m_saved_token << L"\"\n";
|
||||||
|
out << L" last-online-name=\"" << m_last_online_name<< L"\">\n";
|
||||||
{
|
{
|
||||||
if(m_story_mode_status)
|
if(m_story_mode_status)
|
||||||
m_story_mode_status->save(out);
|
m_story_mode_status->save(out);
|
||||||
|
@ -95,6 +95,9 @@ private:
|
|||||||
/** The token of the saved session. */
|
/** The token of the saved session. */
|
||||||
std::string m_saved_token;
|
std::string m_saved_token;
|
||||||
|
|
||||||
|
/** The online user name used last (empty if not used online). */
|
||||||
|
core::stringw m_last_online_name;
|
||||||
|
|
||||||
/** The complete challenge state. */
|
/** The complete challenge state. */
|
||||||
StoryModeStatus *m_story_mode_status;
|
StoryModeStatus *m_story_mode_status;
|
||||||
|
|
||||||
@ -161,6 +164,18 @@ public:
|
|||||||
return m_is_guest_account;
|
return m_is_guest_account;
|
||||||
} // isGuestAccount
|
} // isGuestAccount
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns the last used online name. */
|
||||||
|
const core::stringw& getLastOnlineName() const
|
||||||
|
{
|
||||||
|
return m_last_online_name;
|
||||||
|
} // getLastOnlineName
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Sets the last used online name. */
|
||||||
|
void setLastOnlineName(const core::stringw &name)
|
||||||
|
{
|
||||||
|
m_last_online_name = name;
|
||||||
|
} // setLastOnlineName
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the unique id of this player. */
|
/** Returns the unique id of this player. */
|
||||||
unsigned int getUniqueID() const { return m_unique_id; }
|
unsigned int getUniqueID() const { return m_unique_id; }
|
||||||
|
@ -170,6 +170,7 @@ namespace Online
|
|||||||
int username_fetched = input->get("username", &username);
|
int username_fetched = input->get("username", &username);
|
||||||
uint32_t userid(0);
|
uint32_t userid(0);
|
||||||
int userid_fetched = input->get("userid", &userid);
|
int userid_fetched = input->get("userid", &userid);
|
||||||
|
PlayerManager::getCurrentPlayer()->setLastOnlineName(username);
|
||||||
m_profile = new OnlineProfile(userid, username, true);
|
m_profile = new OnlineProfile(userid, username, true);
|
||||||
assert(token_fetched && username_fetched && userid_fetched);
|
assert(token_fetched && username_fetched && userid_fetched);
|
||||||
m_online_state = OS_SIGNED_IN;
|
m_online_state = OS_SIGNED_IN;
|
||||||
|
@ -21,8 +21,10 @@
|
|||||||
#include "config/player_manager.hpp"
|
#include "config/player_manager.hpp"
|
||||||
#include "guiengine/widgets/check_box_widget.hpp"
|
#include "guiengine/widgets/check_box_widget.hpp"
|
||||||
#include "guiengine/widgets/dynamic_ribbon_widget.hpp"
|
#include "guiengine/widgets/dynamic_ribbon_widget.hpp"
|
||||||
|
#include "guiengine/widgets/label_widget.hpp"
|
||||||
#include "guiengine/widgets/list_widget.hpp"
|
#include "guiengine/widgets/list_widget.hpp"
|
||||||
#include "states_screens/dialogs/enter_player_name_dialog.hpp"
|
#include "states_screens/dialogs/enter_player_name_dialog.hpp"
|
||||||
|
#include "states_screens/login_screen.hpp"
|
||||||
#include "states_screens/main_menu_screen.hpp"
|
#include "states_screens/main_menu_screen.hpp"
|
||||||
#include "states_screens/state_manager.hpp"
|
#include "states_screens/state_manager.hpp"
|
||||||
|
|
||||||
@ -41,12 +43,21 @@ StoryModeLobbyScreen::StoryModeLobbyScreen() : Screen("story_mode_lobby.stkgui")
|
|||||||
|
|
||||||
void StoryModeLobbyScreen::loadedFromFile()
|
void StoryModeLobbyScreen::loadedFromFile()
|
||||||
{
|
{
|
||||||
|
|
||||||
} // loadedFromFile
|
} // loadedFromFile
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void StoryModeLobbyScreen::init()
|
void StoryModeLobbyScreen::init()
|
||||||
{
|
{
|
||||||
|
m_online_cb = getWidget<CheckBoxWidget>("online");
|
||||||
|
assert(m_online_cb);
|
||||||
|
m_username_tb = getWidget<TextBoxWidget >("username");
|
||||||
|
assert(m_username_tb);
|
||||||
|
m_password_tb = getWidget<TextBoxWidget >("password");
|
||||||
|
assert(m_password_tb);
|
||||||
|
//m_password_tb->setPasswordBox(true, L'*');
|
||||||
|
|
||||||
Screen::init();
|
Screen::init();
|
||||||
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
||||||
if (player)
|
if (player)
|
||||||
@ -55,28 +66,6 @@ void StoryModeLobbyScreen::init()
|
|||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CheckBoxWidget* cb = getWidget<CheckBoxWidget>("rememberme");
|
|
||||||
//cb->setState(false);
|
|
||||||
|
|
||||||
ListWidget* list = getWidget<ListWidget>("gameslots");
|
|
||||||
|
|
||||||
//PtrVector<PlayerProfile>& players = UserConfigParams::m_all_players;
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
if (UserConfigParams::m_default_player.toString().size() > 0)
|
|
||||||
{
|
|
||||||
for (unsigned int n=0; n<players.size(); n++)
|
|
||||||
{
|
|
||||||
if (players[n].getName() == UserConfigParams::m_default_player.toString())
|
|
||||||
{
|
|
||||||
unlock_manager->setCurrentSlot(players[n].getUniqueID());
|
|
||||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DynamicRibbonWidget* local = getWidget<DynamicRibbonWidget>("local");
|
DynamicRibbonWidget* local = getWidget<DynamicRibbonWidget>("local");
|
||||||
assert( local != NULL );
|
assert( local != NULL );
|
||||||
|
|
||||||
@ -85,30 +74,12 @@ void StoryModeLobbyScreen::init()
|
|||||||
const PlayerProfile *player = PlayerManager::get()->getPlayer(n);
|
const PlayerProfile *player = PlayerManager::get()->getPlayer(n);
|
||||||
if (player->isGuestAccount()) continue;
|
if (player->isGuestAccount()) continue;
|
||||||
std::string s = StringUtils::toString(n);
|
std::string s = StringUtils::toString(n);
|
||||||
local->addItem(player->getName(), s, "", 0, IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
|
local->addItem(player->getName(), s, "", 0,
|
||||||
|
IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
local->addItem("Create new user", "local_new",
|
|
||||||
"karts/sara/icon-sara.png", 0,
|
|
||||||
IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
|
|
||||||
local->updateItemDisplay();
|
|
||||||
|
|
||||||
DynamicRibbonWidget* online = this->getWidget<DynamicRibbonWidget>("online");
|
|
||||||
assert( online != NULL );
|
|
||||||
const std::vector<core::stringw> &online_ids =
|
|
||||||
PlayerManager::get()->getAllOnlineIds();
|
|
||||||
for (unsigned int i = 0; i < online_ids.size(); i++)
|
|
||||||
{
|
|
||||||
std::string s = StringUtils::toString(i);
|
|
||||||
online->addItem(online_ids[i], s, "karts/nolok/nolokicon.png", 0,
|
|
||||||
IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
|
|
||||||
|
|
||||||
}
|
|
||||||
online->addItem("Create new online user", "online_new",
|
|
||||||
"karts/sara/icon-sara.png", 0,
|
|
||||||
IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
|
|
||||||
online->updateItemDisplay();
|
|
||||||
|
|
||||||
|
update();
|
||||||
|
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
@ -120,14 +91,43 @@ void StoryModeLobbyScreen::tearDown()
|
|||||||
} // tearDown
|
} // tearDown
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
void StoryModeLobbyScreen::update()
|
||||||
|
{
|
||||||
|
bool online = m_online_cb->getState();
|
||||||
|
getWidget<LabelWidget>("label_username")->setVisible(online);
|
||||||
|
m_username_tb->setVisible(online);
|
||||||
|
getWidget<LabelWidget>("label_password")->setVisible(online);
|
||||||
|
m_password_tb->setVisible(online);
|
||||||
|
} // update
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
void StoryModeLobbyScreen::eventCallback(Widget* widget,
|
void StoryModeLobbyScreen::eventCallback(Widget* widget,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const int player_id)
|
const int player_id)
|
||||||
{
|
{
|
||||||
if (name == "local")
|
if (name == "local")
|
||||||
{
|
{
|
||||||
// FIXME nothing to do
|
// Clicked on a name --> Find the corresponding online data
|
||||||
|
// and display them
|
||||||
|
const std::string &s_index = getWidget<DynamicRibbonWidget>("local")
|
||||||
|
->getSelectionIDString(player_id);
|
||||||
|
if (s_index == "") return; // can happen if the list is empty
|
||||||
|
|
||||||
|
unsigned int id;
|
||||||
|
StringUtils::fromString(s_index, id);
|
||||||
|
PlayerProfile *profile = PlayerManager::get()->getPlayer(id);
|
||||||
|
assert(profile);
|
||||||
|
getWidget<TextBoxWidget >("username")->setText(profile
|
||||||
|
->getLastOnlineName());
|
||||||
|
// In case of a saved session, remove the password field,
|
||||||
|
// since it is not necessary to display it.
|
||||||
|
getWidget<TextBoxWidget >("password")->setVisible(profile
|
||||||
|
->hasSavedSession());
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (name == "online")
|
||||||
|
{
|
||||||
|
update(); // This will make the fields (in)visible
|
||||||
}
|
}
|
||||||
else if (name == "options")
|
else if (name == "options")
|
||||||
{
|
{
|
||||||
@ -151,6 +151,7 @@ void StoryModeLobbyScreen::eventCallback(Widget* widget,
|
|||||||
} // button==ok || ok_and_save
|
} // button==ok || ok_and_save
|
||||||
} // options
|
} // options
|
||||||
|
|
||||||
|
update();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,18 +24,35 @@
|
|||||||
#include "guiengine/screen.hpp"
|
#include "guiengine/screen.hpp"
|
||||||
#include "states_screens/dialogs/enter_player_name_dialog.hpp"
|
#include "states_screens/dialogs/enter_player_name_dialog.hpp"
|
||||||
|
|
||||||
namespace GUIEngine { class Widget; }
|
namespace GUIEngine
|
||||||
|
{
|
||||||
|
class CheckBoxWidget;
|
||||||
|
class TextBoxWidget;
|
||||||
|
class Widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Audio options screen
|
* \brief Audio options screen
|
||||||
* \ingroup states_screens
|
* \ingroup states_screens
|
||||||
*/
|
*/
|
||||||
class StoryModeLobbyScreen : public GUIEngine::Screen, public EnterPlayerNameDialog::INewPlayerListener,
|
class StoryModeLobbyScreen : public GUIEngine::Screen,
|
||||||
public GUIEngine::ScreenSingleton<StoryModeLobbyScreen>
|
public EnterPlayerNameDialog::INewPlayerListener,
|
||||||
|
public GUIEngine::ScreenSingleton<StoryModeLobbyScreen>
|
||||||
{
|
{
|
||||||
StoryModeLobbyScreen();
|
StoryModeLobbyScreen();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** Online check box. */
|
||||||
|
GUIEngine::CheckBoxWidget *m_online_cb;
|
||||||
|
|
||||||
|
/** User name entry field. */
|
||||||
|
GUIEngine::TextBoxWidget *m_username_tb;
|
||||||
|
|
||||||
|
/** Password widget. */
|
||||||
|
GUIEngine::TextBoxWidget *m_password_tb;
|
||||||
|
|
||||||
|
void update();
|
||||||
public:
|
public:
|
||||||
friend class GUIEngine::ScreenSingleton<StoryModeLobbyScreen>;
|
friend class GUIEngine::ScreenSingleton<StoryModeLobbyScreen>;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user