Adjust based on auria's feedback
This commit is contained in:
parent
dd3a544834
commit
4379244f3e
@ -25,7 +25,8 @@
|
||||
<spacer height="20" width="50"/>
|
||||
<div width="80%" align="center" layout="vertical-row" height="fit" >
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label id="error-message" proportion="1" text_align="left"/>
|
||||
<label id="message-label" proportion="1" text_align="left" I18N="Splitscreen player in network"
|
||||
text="Press the 'All players ready' button after the player list is ready."/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -33,11 +34,13 @@
|
||||
|
||||
<buttonbar id="options" width="90%" height="20%" align="center">
|
||||
<icon-button id="add" width="64" height="64" icon="gui/blue_plus.png"
|
||||
I18N="Splitscreen player in network" text="Add" label_location="bottom"/>
|
||||
I18N="Splitscreen player in network" text="Add player" label_location="bottom"/>
|
||||
<icon-button id="connect" width="64" height="64" icon="gui/green_check.png"
|
||||
I18N="Splitscreen player in network" text="Connect" label_location="bottom"/>
|
||||
I18N="Splitscreen player in network" text="All players ready" label_location="bottom"/>
|
||||
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
|
||||
I18N="Splitscreen player in network" text="Cancel" label_location="bottom"/>
|
||||
<icon-button id="reset" width="64" height="64" icon="gui/remove.png"
|
||||
I18N="Splitscreen player in network" text="Clear added player" label_location="bottom"/>
|
||||
</buttonbar>
|
||||
</div>
|
||||
</stkgui>
|
||||
|
@ -714,6 +714,9 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
|
||||
{
|
||||
if (NetworkConfig::get()->isAddingNetworkPlayers())
|
||||
{
|
||||
// Ignore release event
|
||||
if (value == 0)
|
||||
return;
|
||||
InputDevice *device = NULL;
|
||||
if (type == Input::IT_KEYBOARD)
|
||||
{
|
||||
@ -791,7 +794,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
|
||||
// Prevent null pointer crash
|
||||
return;
|
||||
}
|
||||
Log::info("","%s",StringUtils::wideToUtf8(player->getProfile()->getName()).c_str());
|
||||
|
||||
// Find the corresponding PlayerKart from our ActivePlayer instance
|
||||
AbstractKart* pk = player->getKart();
|
||||
|
||||
|
@ -32,18 +32,6 @@
|
||||
|
||||
using namespace GUIEngine;
|
||||
using namespace irr;
|
||||
using namespace irr::gui;
|
||||
using namespace Online;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
SplitscreenPlayerDialog::~SplitscreenPlayerDialog()
|
||||
{
|
||||
if (!m_connect_now)
|
||||
{
|
||||
input_manager->getDeviceManager()->setAssignMode(DETECT_NEW);
|
||||
input_manager->getDeviceManager()->mapFireToSelect(true);
|
||||
}
|
||||
} // ~SplitscreenPlayerDialog
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void SplitscreenPlayerDialog::beforeAddingWidgets()
|
||||
@ -52,7 +40,7 @@ void SplitscreenPlayerDialog::beforeAddingWidgets()
|
||||
for (unsigned i = 0; i < PlayerManager::get()->getNumPlayers(); i++)
|
||||
m_profiles->addLabel(PlayerManager::get()->getPlayer(i)->getName());
|
||||
|
||||
m_error_message = getWidget<LabelWidget>("error-message");
|
||||
m_message = getWidget<LabelWidget>("message-label");
|
||||
|
||||
m_handicap = getWidget<CheckBoxWidget>("handicap");
|
||||
m_handicap->setState(false);
|
||||
@ -67,6 +55,8 @@ void SplitscreenPlayerDialog::beforeAddingWidgets()
|
||||
assert(m_connect != NULL);
|
||||
m_cancel = getWidget<IconButtonWidget>("cancel");
|
||||
assert(m_cancel != NULL);
|
||||
m_reset = getWidget<IconButtonWidget>("reset");
|
||||
assert(m_reset != NULL);
|
||||
|
||||
input_manager->getDeviceManager()->setAssignMode(NO_ASSIGN);
|
||||
input_manager->getDeviceManager()->mapFireToSelect(false);
|
||||
@ -97,8 +87,9 @@ GUIEngine::EventPropagation
|
||||
else
|
||||
{
|
||||
//I18N: in splitscreen player dialog for network game
|
||||
m_error_message->setErrorColor();
|
||||
m_error_message->setText(_("Player already exists."), false);
|
||||
m_message->setErrorColor();
|
||||
m_message->setText(_("Player or input device already exists."),
|
||||
false);
|
||||
}
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
@ -108,14 +99,13 @@ GUIEngine::EventPropagation
|
||||
{
|
||||
NetworkConfig::get()->doneAddingNetworkPlayers();
|
||||
NetworkingLobby::getInstance()->finishAddingPlayers();
|
||||
m_connect_now = true;
|
||||
m_self_destroy = true;
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
//I18N: in splitscreen player dialog for network game
|
||||
m_error_message->setErrorColor();
|
||||
m_error_message->setText(_("No player available to connect."),
|
||||
false);
|
||||
m_message->setErrorColor();
|
||||
m_message->setText(
|
||||
_("No player available for connecting to server."), false);
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
else if(selection == m_cancel->m_properties[PROP_ID])
|
||||
@ -123,6 +113,13 @@ GUIEngine::EventPropagation
|
||||
m_self_destroy = true;
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
else if(selection == m_reset->m_properties[PROP_ID])
|
||||
{
|
||||
NetworkConfig::get()->cleanNetworkPlayers();
|
||||
NetworkingLobby::getInstance()->cleanAddedPlayers();
|
||||
m_self_destroy = true;
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
}
|
||||
return GUIEngine::EVENT_LET;
|
||||
} // processEvent
|
||||
|
@ -38,9 +38,7 @@ private:
|
||||
|
||||
bool m_self_destroy;
|
||||
|
||||
bool m_connect_now;
|
||||
|
||||
GUIEngine::LabelWidget* m_error_message;
|
||||
GUIEngine::LabelWidget* m_message;
|
||||
|
||||
GUIEngine::SpinnerWidget* m_profiles;
|
||||
|
||||
@ -54,15 +52,16 @@ private:
|
||||
|
||||
GUIEngine::IconButtonWidget* m_cancel;
|
||||
|
||||
GUIEngine::IconButtonWidget* m_reset;
|
||||
|
||||
public:
|
||||
SplitscreenPlayerDialog(InputDevice* device)
|
||||
: ModalDialog(0.8f,0.8f), m_device(device), m_self_destroy(false),
|
||||
m_connect_now(false)
|
||||
: ModalDialog(0.8f,0.8f), m_device(device), m_self_destroy(false)
|
||||
{
|
||||
loadFromFile("online/splitscreen_player_dialog.stkgui");
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
~SplitscreenPlayerDialog();
|
||||
~SplitscreenPlayerDialog() {}
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void beforeAddingWidgets();
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -130,8 +130,6 @@ void NetworkingLobby::init()
|
||||
if (NetworkConfig::get()->getNetworkPlayers().empty())
|
||||
{
|
||||
m_state = LS_ADD_PLAYERS;
|
||||
input_manager->getDeviceManager()->mapFireToSelect(true);
|
||||
input_manager->getDeviceManager()->setAssignMode(DETECT_NEW);
|
||||
}
|
||||
else if (NetworkConfig::get()->isClient())
|
||||
{
|
||||
@ -222,6 +220,11 @@ void NetworkingLobby::onUpdate(float delta)
|
||||
"join the game"), true);
|
||||
m_start_button->setVisible(false);
|
||||
m_exit_widget->setVisible(false);
|
||||
if (!GUIEngine::ModalDialog::isADialogActive())
|
||||
{
|
||||
input_manager->getDeviceManager()->setAssignMode(DETECT_NEW);
|
||||
input_manager->getDeviceManager()->mapFireToSelect(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -345,7 +348,6 @@ void NetworkingLobby::tearDown()
|
||||
if (!NetworkConfig::get()->isClient())
|
||||
return;
|
||||
input_manager->getDeviceManager()->mapFireToSelect(false);
|
||||
assert(!NetworkConfig::get()->isAddingNetworkPlayers());
|
||||
StateManager::get()->resetActivePlayers();
|
||||
for (auto& p : NetworkConfig::get()->getNetworkPlayers())
|
||||
{
|
||||
@ -416,3 +418,11 @@ void NetworkingLobby::finishAddingPlayers()
|
||||
getWidget("send")->setActive(true);
|
||||
}
|
||||
} // finishAddingPlayers
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void NetworkingLobby::cleanAddedPlayers()
|
||||
{
|
||||
if (!m_player_list)
|
||||
return;
|
||||
m_player_list->clear();
|
||||
} // cleanAddedPlayers
|
||||
|
@ -117,6 +117,7 @@ public:
|
||||
uint32_t/*online id*/, core::stringw/*player name*/,
|
||||
int/*icon id*/> >& p);
|
||||
void addSplitscreenPlayer(irr::core::stringw name);
|
||||
void cleanAddedPlayers();
|
||||
|
||||
}; // class NetworkingLobby
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user