本文整理汇总了C++中DynamicRibbonWidget类的典型用法代码示例。如果您正苦于以下问题:C++ DynamicRibbonWidget类的具体用法?C++ DynamicRibbonWidget怎么用?C++ DynamicRibbonWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DynamicRibbonWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setFocusOnTrack
void ArenasScreen::setFocusOnTrack(const std::string& trackName)
{
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("tracks");
assert( w != NULL );
w->setSelection(trackName, PLAYER_ID_GAME_MASTER, true);
} // setFOxuOnTrack
示例3: buildTrackList
void ArenasScreen::init()
{
Screen::init();
buildTrackList();
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("tracks");
// select something by default for the game master
assert( w != NULL );
w->setSelection(w->getItems()[0].m_code_name, PLAYER_ID_GAME_MASTER, true);
} // init
示例4: renumberKarts
void KartSelectionScreen::renumberKarts()
{
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
assert( w != NULL );
Widget* fullarea = getWidget("playerskarts");
int splitWidth = fullarea->m_w / m_kart_widgets.size();
if (m_kart_widgets.size() == 1)
splitWidth /= 2;
for (unsigned int n=0; n < m_kart_widgets.size(); n++)
{
m_kart_widgets[n].setPlayerID(n);
m_kart_widgets[n].move( fullarea->m_x + splitWidth*n, fullarea->m_y,
splitWidth, fullarea->m_h );
}
w->updateItemDisplay();
} // renumberKarts
示例5: selectTrack
// -----------------------------------------------------------------------------
void EditTrackScreen::selectTrack(const std::string& id)
{
DynamicRibbonWidget* tracks = getWidget<DynamicRibbonWidget>("tracks");
assert(tracks != NULL);
LabelWidget* selected_track = getWidget<LabelWidget>("selected_track");
assert(selected_track != NULL);
SpinnerWidget* laps = getWidget<SpinnerWidget>("laps");
assert(laps != NULL);
LabelWidget* label_reverse = getWidget<LabelWidget>("reverse_label");
assert(label_reverse != NULL);
CheckBoxWidget* reverse = getWidget<CheckBoxWidget>("reverse");
assert(reverse != NULL);
ButtonWidget* ok_button = getWidget<ButtonWidget>("ok");
assert(ok_button != NULL);
m_track = track_manager->getTrack(id);
if (m_track != NULL)
{
tracks->setSelection(m_track->getIdent(), PLAYER_ID_GAME_MASTER, true);
selected_track->setText(m_track->getName(), true);
laps->setValue(m_laps);
reverse->setVisible(m_track->reverseAvailable());
label_reverse->setVisible(m_track->reverseAvailable());
ok_button->setActivated();
}
else
{
tracks->setSelection("", PLAYER_ID_GAME_MASTER, true);
selected_track->setText(_("Select a track"), true);
// We can't set a better default for number of laps. On the other
// hand, if a track is selected, the number of laps will be updated.
laps->setValue(3);
reverse->setVisible(true);
reverse->setState(false);
ok_button->setDeactivated();
}
}
示例6: assert
void KartSelectionScreen::beforeAddingWidget()
{
// Dynamically add tabs
RibbonWidget* tabs = getWidget<RibbonWidget>("kartgroups");
assert( tabs != NULL );
m_last_widget = tabs;
tabs->clearAllChildren();
const std::vector<std::string>& groups =
kart_properties_manager->getAllGroups();
const int group_amount = (int)groups.size();
// add all group first
if (group_amount > 1)
{
//I18N: name of the tab that will show tracks from all groups
tabs->addTextChild( _("All") , ALL_KART_GROUPS_ID);
}
// Make group names being picked up by gettext
#define FOR_GETTEXT_ONLY(x)
//I18N: kart group name
FOR_GETTEXT_ONLY( _("standard") )
//I18N: kart group name
FOR_GETTEXT_ONLY( _("Add-Ons") )
// add others after
for (int n=0; n<group_amount; n++)
{
// try to translate group names
tabs->addTextChild( _(groups[n].c_str()) , groups[n]);
} // for n<group_amount
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
assert( w != NULL );
w->setItemCountHint( kart_properties_manager->getNumberOfKarts() );
} // beforeAddingWidget
示例7: if
// -----------------------------------------------------------------------------
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();
}
}
示例8: _
void OptionsScreenVideo::init()
{
Screen::init();
RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
if (ribbon != NULL) ribbon->select( "tab_video", PLAYER_ID_GAME_MASTER );
ribbon->getRibbonChildren()[1].setTooltip( _("Audio") );
ribbon->getRibbonChildren()[2].setTooltip( _("User Interface") );
ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );
GUIEngine::ButtonWidget* applyBtn =
getWidget<GUIEngine::ButtonWidget>("apply_resolution");
assert( applyBtn != NULL );
GUIEngine::SpinnerWidget* gfx =
getWidget<GUIEngine::SpinnerWidget>("gfx_level");
assert( gfx != NULL );
GUIEngine::CheckBoxWidget* vsync =
getWidget<GUIEngine::CheckBoxWidget>("vsync");
assert( vsync != NULL );
vsync->setState( UserConfigParams::m_vsync );
// ---- video modes
DynamicRibbonWidget* res = getWidget<DynamicRibbonWidget>("resolutions");
assert( res != NULL );
CheckBoxWidget* full = getWidget<CheckBoxWidget>("fullscreen");
assert( full != NULL );
full->setState( UserConfigParams::m_fullscreen );
CheckBoxWidget* rememberWinpos = getWidget<CheckBoxWidget>("rememberWinpos");
rememberWinpos->setState(UserConfigParams::m_remember_window_location);
if (UserConfigParams::m_fullscreen) rememberWinpos->setDeactivated();
else rememberWinpos->setActivated();
// --- get resolution list from irrlicht the first time
if (!m_inited)
{
res->clearItems();
const std::vector<IrrDriver::VideoMode>& modes =
irr_driver->getVideoModes();
const int amount = (int)modes.size();
bool found_config_res = false;
// for some odd reason, irrlicht sometimes fails to report the good
// old standard resolutions
// those are always useful for windowed mode
// allow 800x600 only for debug mode
#ifdef DEBUG
bool found_800_600 = false;
#endif
bool found_1024_640 = false;
bool found_1024_768 = false;
for (int n=0; n<amount; n++)
{
const int w = modes[n].getWidth();
const int h = modes[n].getHeight();
const float ratio = (float)w / h;
if (w == UserConfigParams::m_width &&
h == UserConfigParams::m_height)
{
found_config_res = true;
}
if (w == 800 && h == 600)
{
#ifdef DEBUG
found_800_600 = true;
#else
continue;
#endif
}
else if (w == 1024 && h == 640)
{
found_1024_640 = true;
}
else if (w == 1024 && h == 768)
{
found_1024_768 = true;
}
char name[32];
sprintf( name, "%ix%i", w, h );
core::stringw label;
label += w;
label += L"\u00D7";
label += h;
#define ABOUT_EQUAL(a , b) (fabsf( a - b ) < 0.01)
//.........这里部分代码省略.........
示例9: playerQuit
bool KartSelectionScreen::playerQuit(StateManager::ActivePlayer* player)
{
int player_id = -1;
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
if (w == NULL)
{
Log::error("KartSelectionScreen", "playerQuit() called "
"outside of kart selection screen, "
"or the XML file for this screen was changed without "
"adapting the code accordingly");
return false;
}
// If last player quits, return to main menu
if (m_kart_widgets.size() <= 1)
{
StateManager::get()->escapePressed();
return true;
}
std::map<PlayerKartWidget*, std::string> selections;
// Find the player ID associated to this player
for (unsigned int n=0; n<m_kart_widgets.size(); n++)
{
if (m_kart_widgets[n].getAssociatedPlayer() == player)
{
// Check that this player has not already confirmed,
// then they can't back out
if (m_kart_widgets[n].isReady())
{
SFXManager::get()->quickSound( "anvil" );
return true;
}
player_id = n;
}
else
{
selections[m_kart_widgets.get(n)] =
m_kart_widgets[n].getKartInternalName();
}
}
if (player_id == -1)
{
Log::warn("KartSelectionScreen", "playerQuit cannot find "
"passed player");
return false;
}
if(UserConfigParams::logGUI())
Log::info("KartSelectionScreen", "playerQuit(%d)", player_id);
// Just a cheap way to check if there is any discrepancy
// between m_kart_widgets and the active player array
assert( m_kart_widgets.size() == StateManager::get()->activePlayerCount());
// unset selection of this player
GUIEngine::focusNothingForPlayer(player_id);
// delete a previous removed widget that didn't have time to fully shrink
// yet.
// TODO: handle multiple shrinking widgets gracefully?
if (m_removed_widget != NULL)
{
manualRemoveWidget(m_removed_widget);
delete m_removed_widget;
m_removed_widget = NULL;
}
// keep the removed kart a while, for the 'disappear' animation
// to take place
m_removed_widget = m_kart_widgets.remove(player_id);
// Tell the StateManager to remove this player
StateManager::get()->removeActivePlayer(player_id);
addMultiplayerMessage();
// Karts count changed, maybe order too, so renumber them.
renumberKarts();
// Tell the removed widget to perform the shrinking animation (which will
// be updated in onUpdate, and will stop when the widget has disappeared)
Widget* fullarea = getWidget("playerskarts");
m_removed_widget->move(m_removed_widget->m_x + m_removed_widget->m_w/2,
fullarea->m_y + fullarea->m_h, 0, 0);
// update selections
const unsigned int amount = m_kart_widgets.size();
for (unsigned int n=0; n<amount; n++)
{
const std::string& selectedKart = selections[m_kart_widgets.get(n)];
if (selectedKart.size() > 0)
{
//std::cout << m_kart_widgets[n].getAssociatedPlayer()
// ->getProfile()->getName() << " selected "
// << selectedKart.c_str() << "\n";
const bool success = w->setSelection(selectedKart, n, true);
//.........这里部分代码省略.........
示例10: assert
void OptionsScreenVideo::init()
{
Screen::init();
RibbonWidget* ribbon = getWidget<RibbonWidget>("options_choice");
assert(ribbon != NULL);
ribbon->select( "tab_video", PLAYER_ID_GAME_MASTER );
ribbon->getRibbonChildren()[1].setTooltip( _("Audio") );
ribbon->getRibbonChildren()[2].setTooltip( _("User Interface") );
ribbon->getRibbonChildren()[3].setTooltip( _("Players") );
ribbon->getRibbonChildren()[4].setTooltip( _("Controls") );
GUIEngine::ButtonWidget* applyBtn =
getWidget<GUIEngine::ButtonWidget>("apply_resolution");
assert( applyBtn != NULL );
GUIEngine::SpinnerWidget* gfx =
getWidget<GUIEngine::SpinnerWidget>("gfx_level");
assert( gfx != NULL );
GUIEngine::CheckBoxWidget* vsync =
getWidget<GUIEngine::CheckBoxWidget>("vsync");
assert( vsync != NULL );
vsync->setState( UserConfigParams::m_vsync );
// ---- video modes
DynamicRibbonWidget* res = getWidget<DynamicRibbonWidget>("resolutions");
assert( res != NULL );
CheckBoxWidget* full = getWidget<CheckBoxWidget>("fullscreen");
assert( full != NULL );
full->setState( UserConfigParams::m_fullscreen );
CheckBoxWidget* rememberWinpos = getWidget<CheckBoxWidget>("rememberWinpos");
rememberWinpos->setState(UserConfigParams::m_remember_window_location);
rememberWinpos->setActive(UserConfigParams::m_fullscreen);
// --- get resolution list from irrlicht the first time
if (!m_inited)
{
res->clearItems();
const std::vector<IrrDriver::VideoMode>& modes =
irr_driver->getVideoModes();
const int amount = (int)modes.size();
std::vector<Resolution> resolutions;
Resolution r;
bool found_config_res = false;
// for some odd reason, irrlicht sometimes fails to report the good
// old standard resolutions
// those are always useful for windowed mode
bool found_1024_768 = false;
for (int n=0; n<amount; n++)
{
r.width = modes[n].getWidth();
r.height = modes[n].getHeight();
resolutions.push_back(r);
if (r.width == UserConfigParams::m_width &&
r.height == UserConfigParams::m_height)
{
found_config_res = true;
}
if (r.width == 1024 && r.height == 768)
{
found_1024_768 = true;
}
}
if (!found_config_res)
{
r.width = UserConfigParams::m_width;
r.height = UserConfigParams::m_height;
resolutions.push_back(r);
if (r.width == 1024 && r.height == 768)
{
found_1024_768 = true;
}
} // next found resolution
// Add default resolutions that were not found by irrlicht
if (!found_1024_768)
{
r.width = 1024;
r.height = 768;
resolutions.push_back(r);
}
// Sort resolutions by size
std::sort(resolutions.begin(), resolutions.end());
//.........这里部分代码省略.........
示例11: assert
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();
}
}
示例12: 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
示例13: validateKartChoices
bool KartSelectionScreen::validateKartChoices()
{
bool ok = true;
const unsigned int amount = m_kart_widgets.size();
// reset all marks, we'll re-add them next if errors are still there
for (unsigned int n=0; n<amount; n++)
{
m_kart_widgets[n].m_model_view->unsetBadge(BAD_BADGE);
}
// Check if we have enough karts for everybody. If there are more
// players than karts then just allow duplicates
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
assert( w != NULL );
const unsigned int availableKartCount = (unsigned int)w->getItems().size();
if (amount > availableKartCount) return true;
// Check everyone for duplicates
for (unsigned int n=0; n<amount; n++)
{
for (unsigned int m=n+1; m<amount; m++)
{
// check if 2 players took the same name
if (sameKart(m_kart_widgets[n], m_kart_widgets[m]))
{
if (UserConfigParams::logGUI())
{
Log::warn("KartSelectionScreen", "Kart conflict!!");
Log::warn("KartSelectionScreen", " Player %u chose %s",n,
m_kart_widgets[n].getKartInternalName().c_str());
Log::warn("KartSelectionScreen", " Player %u chose %s",m,
m_kart_widgets[m].getKartInternalName().c_str());
}
// two players took the same kart. check if one is ready
if (!m_kart_widgets[n].isReady() &&
m_kart_widgets[m].isReady())
{
if (UserConfigParams::logGUI())
Log::info("KartSelectionScreen", " --> Setting red badge on player %u", n);
// player m is ready, so player n should not choose
// this name
m_kart_widgets[n].m_model_view->setBadge(BAD_BADGE);
}
else if (m_kart_widgets[n].isReady() &&
!m_kart_widgets[m].isReady())
{
if (UserConfigParams::logGUI())
Log::info("KartSelectionScreen", " --> Setting red badge on player %u",m);
// player n is ready, so player m should not
// choose this name
m_kart_widgets[m].m_model_view->setBadge(BAD_BADGE);
}
else if (m_kart_widgets[n].isReady() &&
m_kart_widgets[m].isReady())
{
// it should be impossible for two players to confirm
// they're ready with the same kart
assert(false);
}
// we know it's not ok (but don't stop right now, all bad
// ones need red badges)
ok = false;
}
} // end for
}
return ok;
} // validateKartChoices
示例14: buildTrackList
void ArenasScreen::buildTrackList()
{
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("tracks");
assert( w != NULL );
// Re-build track list everytime (accounts for locking changes, etc.)
w->clearItems();
RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups");
assert( tabs != NULL );
const std::string curr_group_name = tabs->getSelectionIDString(0);
bool soccer_mode = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
bool arenas_have_navmesh = false;
if (curr_group_name == ALL_ARENA_GROUPS_ID)
{
const int track_amount = (int)track_manager->getNumberOfTracks();
for (int n=0; n<track_amount; n++)
{
Track* curr = track_manager->getTrack(n);
if (soccer_mode)
{
if(curr->isSoccer() && curr->hasNavMesh() && !arenas_have_navmesh)
arenas_have_navmesh = true;
if(!curr->isSoccer() ||
(!(curr->hasNavMesh() ||
race_manager->getNumLocalPlayers() > 1 ||
UserConfigParams::m_artist_debug_mode)))
{
if (curr->isSoccer())
m_unsupported_arena.insert(n);
continue;
}
}
else
{
if(curr->isArena() && curr->hasNavMesh() && !arenas_have_navmesh)
arenas_have_navmesh = true;
if(!curr->isArena() ||
(!(curr->hasNavMesh() ||
race_manager->getNumLocalPlayers() > 1 ||
UserConfigParams::m_artist_debug_mode)))
{
if (curr->isArena())
m_unsupported_arena.insert(n);
continue;
}
}
if (PlayerManager::getCurrentPlayer()->isLocked(curr->getIdent()))
{
w->addItem( _("Locked : solve active challenges to gain access to more!"),
"locked", curr->getScreenshotFile(), LOCKED_BADGE );
}
else
{
w->addItem( translations->fribidize(curr->getName()), curr->getIdent(), curr->getScreenshotFile(), 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
}
}
}
else
{
const std::vector<int>& currArenas = track_manager->getArenasInGroup(curr_group_name, soccer_mode);
const int track_amount = (int)currArenas.size();
for (int n=0; n<track_amount; n++)
{
Track* curr = track_manager->getTrack(currArenas[n]);
if (soccer_mode)
{
if(curr->isSoccer() && curr->hasNavMesh() && !arenas_have_navmesh)
arenas_have_navmesh = true;
if(!curr->isSoccer() ||
(!(curr->hasNavMesh() ||
race_manager->getNumLocalPlayers() > 1 ||
UserConfigParams::m_artist_debug_mode)))
{
if (curr->isSoccer())
m_unsupported_arena.insert(currArenas[n]);
continue;
}
}
else
{
if(curr->isArena() && curr->hasNavMesh() && !arenas_have_navmesh)
arenas_have_navmesh = true;
if(!curr->isArena() ||
(!(curr->hasNavMesh() ||
race_manager->getNumLocalPlayers() > 1 ||
UserConfigParams::m_artist_debug_mode)))
{
if (curr->isArena())
//.........这里部分代码省略.........
示例15: assignDifficulty
// -----------------------------------------------------------------------------
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