Better default focus for network dialog

This commit is contained in:
Benau 2018-03-23 10:06:04 +08:00
parent 2cabf3594f
commit ef15a1881c
2 changed files with 9 additions and 5 deletions

View File

@ -36,8 +36,6 @@ using namespace Online;
// ----------------------------------------------------------------------------
void NetworkUserDialog::beforeAddingWidgets()
{
m_options_widget = getWidget<RibbonWidget>("options");
assert(m_options_widget != NULL);
m_name_widget = getWidget<LabelWidget>("name");
assert(m_name_widget != NULL);
m_name_widget->setText(m_name, false);
@ -54,7 +52,11 @@ void NetworkUserDialog::beforeAddingWidgets()
m_cancel_widget = getWidget<IconButtonWidget>("cancel");
assert(m_cancel_widget != NULL);
m_cancel_widget->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
m_options_widget = getWidget<RibbonWidget>("options");
assert(m_options_widget != NULL);
m_options_widget->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
m_options_widget->select("cancel", PLAYER_ID_GAME_MASTER);
getWidget<IconButtonWidget>("accept")->setVisible(false);
getWidget<IconButtonWidget>("remove")->setVisible(false);

View File

@ -72,13 +72,15 @@ void SplitscreenPlayerDialog::beforeAddingWidgets()
{
m_available_players.clear();
}
m_options_widget->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
if (m_available_players.empty())
{
getWidget("name-text")->setVisible(false);
getWidget("handicap-row")->setVisible(false);
m_add->setVisible(false);
m_profiles->setVisible(false);
m_connect->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
m_options_widget->select("connect", PLAYER_ID_GAME_MASTER);
}
else
{
@ -86,9 +88,9 @@ void SplitscreenPlayerDialog::beforeAddingWidgets()
getWidget("handicap-row")->setVisible(true);
m_add->setVisible(true);
m_profiles->setVisible(true);
m_add->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
m_handicap->setState(false);
m_handicap->setActive(UserConfigParams::m_per_player_difficulty);
m_options_widget->select("add", PLAYER_ID_GAME_MASTER);
}
input_manager->getDeviceManager()->setAssignMode(NO_ASSIGN);