本文整理汇总了C++中DynamicRibbonWidget::getSelectionIDString方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicRibbonWidget::getSelectionIDString方法的具体用法?C++ DynamicRibbonWidget::getSelectionIDString怎么用?C++ DynamicRibbonWidget::getSelectionIDString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicRibbonWidget
的用法示例。
在下文中一共展示了DynamicRibbonWidget::getSelectionIDString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: playerConfirm
void NetworkKartSelectionScreen::playerConfirm(const int playerID)
{
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
assert(w != NULL);
const std::string selection = w->getSelectionIDString(playerID);
if (StringUtils::startsWith(selection, ID_LOCKED))
{
unlock_manager->playLockSound();
return;
}
if (playerID == PLAYER_ID_GAME_MASTER)
{
UserConfigParams::m_default_kart = selection;
}
if (m_kart_widgets[playerID].getKartInternalName().size() == 0)
{
SFXManager::get()->quickSound( "anvil" );
return;
}
if(playerID == PLAYER_ID_GAME_MASTER) // self
{
ClientLobbyRoomProtocol* protocol = static_cast<ClientLobbyRoomProtocol*>(
ProtocolManager::getInstance()->getProtocol(PROTOCOL_LOBBY_ROOM));
protocol->requestKartSelection(selection);
}
}
示例2: eventCallback
// -----------------------------------------------------------------------------
void EditTrackScreen::eventCallback(GUIEngine::Widget* widget, const std::string& name,
const int playerID)
{
if (name == "ok")
{
m_result = true;
StateManager::get()->popMenu();
}
else if (name == "cancel")
{
m_result = false;
StateManager::get()->popMenu();
}
else if (name == "tracks")
{
DynamicRibbonWidget* tracks = getWidget<DynamicRibbonWidget>("tracks");
assert(tracks != NULL);
selectTrack(tracks->getSelectionIDString(PLAYER_ID_GAME_MASTER));
}
else if (name == "trackgroups")
{
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
assert(tabs != NULL);
m_track_group = tabs->getSelectionIDString(PLAYER_ID_GAME_MASTER);
loadTrackList();
}
else if (name == "laps")
{
SpinnerWidget* laps = getWidget<SpinnerWidget>("laps");
assert(laps != NULL);
m_laps = laps->getValue();
}
else if (name == "reverse")
{
CheckBoxWidget* reverse = getWidget<CheckBoxWidget>("reverse");
assert(reverse != NULL);
m_reverse = reverse->getState();
}
}
示例3: playerConfirm
void KartSelectionScreen::playerConfirm(const int player_id)
{
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
assert(w != NULL);
const std::string selection = w->getSelectionIDString(player_id);
if (StringUtils::startsWith(selection, ID_LOCKED) && !m_multiplayer)
{
unlock_manager->playLockSound();
return;
}
if (player_id == PLAYER_ID_GAME_MASTER)
{
UserConfigParams::m_default_kart = selection;
}
if (m_kart_widgets[player_id].getKartInternalName().size() == 0 ||
m_kart_widgets[player_id].getKartInternalName() == RibbonWidget::NO_ITEM_ID)
{
SFXManager::get()->quickSound( "anvil" );
return;
}
const int amount = m_kart_widgets.size();
// Check if we have enough karts for everybody. If there are more players
// than karts then just allow duplicates
const int available_kart_count = (int) w->getItems().size();
const bool will_need_duplicates = (amount > available_kart_count);
// make sure no other player selected the same identity or kart
for (int n=0; n<amount; n++)
{
if (n == player_id) continue; // don't check a kart against itself
const bool player_ready = m_kart_widgets[n].isReady();
const bool ident_conflict =
!m_kart_widgets[n].getAssociatedPlayer()->getProfile()
->isGuestAccount() &&
m_kart_widgets[n].getAssociatedPlayer()->getProfile() ==
m_kart_widgets[player_id].getAssociatedPlayer()->getProfile();
const bool kart_conflict = sameKart(m_kart_widgets[n],
m_kart_widgets[player_id]);
if (player_ready && (ident_conflict || kart_conflict) &&
!will_need_duplicates)
{
if (UserConfigParams::logGUI())
Log::warn("KartSelectionScreen", "You can't select this identity "
"or kart, someone already took it!!");
SFXManager::get()->quickSound( "anvil" );
return;
}
// If two PlayerKart entries are associated to the same ActivePlayer,
// something went wrong
assert(m_kart_widgets[n].getAssociatedPlayer() !=
m_kart_widgets[player_id].getAssociatedPlayer());
}
// Mark this player as ready to start
m_kart_widgets[player_id].markAsReady();
if (player_id == PLAYER_ID_GAME_MASTER)
{
m_game_master_confirmed = true;
RibbonWidget* tabs = getWidget<RibbonWidget>("kartgroups");
assert( tabs != NULL );
tabs->setActive(false);
}
// validate choices to notify player of duplicates
const bool names_ok = validateIdentChoices();
const bool karts_ok = validateKartChoices();
if (!names_ok || !karts_ok) return;
// check if all players are ready
bool allPlayersReady = true;
for (int n=0; n<amount; n++)
{
if (!m_kart_widgets[n].isReady())
{
allPlayersReady = false;
break;
}
}
if (allPlayersReady && (!m_multiplayer || amount > 1)) allPlayersDone();
} // playerConfirm
示例4: eventCallback
void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "difficulty")
{
RibbonWidget* w = dynamic_cast<RibbonWidget*>(widget);
assert(w != NULL);
const std::string& selection = w->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "novice")
{
UserConfigParams::m_difficulty = RaceManager::DIFFICULTY_EASY;
race_manager->setDifficulty(RaceManager::DIFFICULTY_EASY);
}
else if (selection == "intermediate")
{
UserConfigParams::m_difficulty = RaceManager::DIFFICULTY_MEDIUM;
race_manager->setDifficulty(RaceManager::DIFFICULTY_MEDIUM);
}
else if (selection == "expert")
{
UserConfigParams::m_difficulty = RaceManager::DIFFICULTY_HARD;
race_manager->setDifficulty(RaceManager::DIFFICULTY_HARD);
}
}
else if (name == "gamemode")
{
DynamicRibbonWidget* w = dynamic_cast<DynamicRibbonWidget*>(widget);
const std::string& selectedMode = w->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selectedMode == IDENT_STD)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_NORMAL_RACE);
UserConfigParams::m_game_mode = CONFIG_CODE_NORMAL;
StateManager::get()->pushScreen( TracksScreen::getInstance() );
}
else if (selectedMode == IDENT_TTRIAL)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_TIME_TRIAL);
UserConfigParams::m_game_mode = CONFIG_CODE_TIMETRIAL;
StateManager::get()->pushScreen( TracksScreen::getInstance() );
}
else if (selectedMode == IDENT_FTL)
{
// Make sure there are at least three karts, otherwise FTL doesn't
if(race_manager->getNumberOfKarts()<3)
race_manager->setNumKarts(3);
race_manager->setMinorMode(RaceManager::MINOR_MODE_FOLLOW_LEADER);
UserConfigParams::m_game_mode = CONFIG_CODE_FTL;
StateManager::get()->pushScreen( TracksScreen::getInstance() );
}
else if (selectedMode == IDENT_STRIKES)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
UserConfigParams::m_game_mode = CONFIG_CODE_3STRIKES;
race_manager->setNumKarts( race_manager->getNumLocalPlayers() ); // no AI karts;
StateManager::get()->pushScreen( ArenasScreen::getInstance() );
}
else if (selectedMode == "locked")
{
unlock_manager->playLockSound();
}
}
else if (name == "aikartamount")
{
SpinnerWidget* w = dynamic_cast<SpinnerWidget*>(widget);
race_manager->setNumKarts( race_manager->getNumLocalPlayers() + w->getValue() );
UserConfigParams::m_num_karts = race_manager->getNumLocalPlayers() + w->getValue();
}
else if (name == "back")
{
StateManager::get()->escapePressed();
}
}
示例5: eventCallback
// -----------------------------------------------------------------------------
void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name,
const int playerID)
{
if (name == "difficulty")
{
assignDifficulty();
}
else if (name == "gamemode")
{
assignDifficulty();
DynamicRibbonWidget* w = dynamic_cast<DynamicRibbonWidget*>(widget);
const std::string& selectedMode = w->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selectedMode == IDENT_STD)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_NORMAL_RACE);
UserConfigParams::m_game_mode = CONFIG_CODE_NORMAL;
TracksAndGPScreen::getInstance()->push();
}
else if (selectedMode == IDENT_TTRIAL)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_TIME_TRIAL);
UserConfigParams::m_game_mode = CONFIG_CODE_TIMETRIAL;
TracksAndGPScreen::getInstance()->push();
}
else if (selectedMode == IDENT_FTL)
{
// Make sure there are at least three karts, otherwise FTL doesn't
if(race_manager->getNumberOfKarts()<3)
race_manager->setNumKarts(3);
race_manager->setMinorMode(RaceManager::MINOR_MODE_FOLLOW_LEADER);
UserConfigParams::m_game_mode = CONFIG_CODE_FTL;
TracksAndGPScreen::getInstance()->push();
}
else if (selectedMode == IDENT_STRIKES)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
UserConfigParams::m_game_mode = CONFIG_CODE_3STRIKES;
ArenasScreen::getInstance()->push();
}
else if (selectedMode == IDENT_EASTER)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_EASTER_EGG);
UserConfigParams::m_game_mode = CONFIG_CODE_EASTER;
race_manager->setNumKarts( race_manager->getNumLocalPlayers() ); // no AI karts;
EasterEggScreen::getInstance()->push();
}
else if (selectedMode == IDENT_SOCCER)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_SOCCER);
UserConfigParams::m_game_mode = CONFIG_CODE_SOCCER;
SoccerSetupScreen::getInstance()->push();
}
else if (selectedMode == IDENT_GHOST)
{
race_manager->setMinorMode(RaceManager::MINOR_MODE_TIME_TRIAL);
UserConfigParams::m_game_mode = CONFIG_CODE_GHOST;
GhostReplaySelection::getInstance()->push();
}
else if (selectedMode == "locked")
{
unlock_manager->playLockSound();
}
}
else if (name == "back")
{
StateManager::get()->escapePressed();
}
} // eventCallback