本文整理汇总了C++中PlayerProfile类的典型用法代码示例。如果您正苦于以下问题:C++ PlayerProfile类的具体用法?C++ PlayerProfile怎么用?C++ PlayerProfile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlayerProfile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pthread_attr_init
/** Start the actual network thread. This can not be done as part of
* the constructor, since the assignment to the global network_http
* variable has not been assigned at that stage, and the thread might
* use network_http - a very subtle race condition. So the thread can
* only be started after the assignment (in main) has been done.
* \pre PlayerManager was created and has read the main data for each
* player so that all data for automatic login is
* availale.
*/
void RequestManager::startNetworkThread()
{
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
// Should be the default, but just in case:
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
//pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
m_thread_id.setAtomic(new pthread_t());
int error = pthread_create(m_thread_id.getData(), &attr,
&RequestManager::mainLoop, this);
if (error)
{
m_thread_id.lock();
delete m_thread_id.getData();
m_thread_id.unlock();
m_thread_id.setAtomic(0);
Log::error("HTTP Manager", "Could not create thread, error=%d.",
errno);
}
pthread_attr_destroy(&attr);
// In case that login id was not saved (or first start of stk),
// current player would not be defined at this stage.
PlayerProfile *player = PlayerManager::getCurrentPlayer();
if (player && player->wasOnlineLastTime() &&
!UserConfigParams::m_always_show_login_screen)
{
PlayerManager::resumeSavedSession();
}
} // startNetworkThread
示例2: getSelectedPlayer
/** Make the entry fields either visible or invisible.
* \param online Online state, which dicates if the entry fields are
* visible (true) or not.
*/
void BaseUserScreen::makeEntryFieldsVisible()
{
#ifdef GUEST_ACCOUNTS_ENABLED
getWidget<LabelWidget>("label_guest")->setVisible(online);
getWidget<CheckBoxWidget>("guest")->setVisible(online);
#endif
bool online = m_online_cb->getState();
getWidget<LabelWidget>("label_username")->setVisible(online);
m_username_tb->setVisible(online);
getWidget<LabelWidget>("label_remember")->setVisible(online);
getWidget<CheckBoxWidget>("remember-user")->setVisible(online);
PlayerProfile *player = getSelectedPlayer();
if(player && player->hasSavedSession() && online)
{
// If we show the online login fields, but the player has a
// saved session, don't show the password field.
getWidget<LabelWidget>("label_password")->setVisible(false);
m_password_tb->setVisible(false);
}
else
{
getWidget<LabelWidget>("label_password")->setVisible(online);
m_password_tb->setVisible(online);
}
} // makeEntryFieldsVisible
示例3: getSelectedPlayer
/** Make the entry fields either visible or invisible.
* \param online Online state, which dicates if the entry fields are
* visible (true) or not.
*/
void BaseUserScreen::makeEntryFieldsVisible()
{
#ifdef GUEST_ACCOUNTS_ENABLED
getWidget<LabelWidget>("label_guest")->setVisible(online);
getWidget<CheckBoxWidget>("guest")->setVisible(online);
#endif
bool online = m_online_cb->getState();
getWidget<LabelWidget>("label_username")->setVisible(online);
m_username_tb->setVisible(online);
getWidget<LabelWidget>("label_remember")->setVisible(online);
getWidget<CheckBoxWidget>("remember-user")->setVisible(online);
PlayerProfile *player = getSelectedPlayer();
// Don't show the password fields if the player wants to be online
// and either is the current player and logged in (no need to enter a
// password then) or has a saved session.
if(player && online &&
(player->hasSavedSession() ||
(player==PlayerManager::getCurrentPlayer() && player->isLoggedIn() )
)
)
{
// If we show the online login fields, but the player has a
// saved session, don't show the password field.
getWidget<LabelWidget>("label_password")->setVisible(false);
m_password_tb->setVisible(false);
}
else
{
getWidget<LabelWidget>("label_password")->setVisible(online);
m_password_tb->setVisible(online);
}
} // makeEntryFieldsVisible
示例4: getSelectedPlayer
/** Called when a player will be deleted.
*/
void BaseUserScreen::deletePlayer()
{
// Check that there is at least one player left: we need to have a
// valid current player, so the last player can not be deleted.
if(PlayerManager::get()->getNumNonGuestPlayers()==1)
{
m_info_widget->setText("You can't delete the only player.", true);
m_info_widget->setErrorColor();
return;
}
PlayerProfile *player = getSelectedPlayer();
irr::core::stringw message =
//I18N: In the player info dialog (when deleting)
_("Do you really want to delete player '%s' ?", player->getName(true/*ignoreRTL*/));
class ConfirmServer : public MessageDialog::IConfirmDialogListener
{
BaseUserScreen *m_parent_screen;
public:
virtual void onConfirm()
{
m_parent_screen->doDeletePlayer();
} // onConfirm
// ------------------------------------------------------------
ConfirmServer(BaseUserScreen *parent)
{
m_parent_screen = parent;
}
}; // ConfirmServer
new MessageDialog(message, MessageDialog::MESSAGE_DIALOG_CONFIRM,
new ConfirmServer(this), true);
} // deletePlayer
示例5: enforceCurrentPlayer
/** This function makes sure that a current player is defined. This is called
* when a screen skipping command line option is given (-N, -R, ...), in
* which case there might not be a current player (if no default player is
* set in players.xml, i.e. the 'remember be' option was not picked ). Since
* a lot of code depends on having a local player, just set the most
* frequently used non-guest to be the current player.
*/
void PlayerManager::enforceCurrentPlayer()
{
if (m_current_player) return;
PlayerProfile* player;
for_in(player, m_all_players)
{
if (!player->isGuestAccount())
{
Log::info("PlayerManager", "Enfocring current player '%ls'.",
player->getName().c_str() );
m_current_player = player;
return;
}
} // for player in m_all_players
// This shouldn't happen - but just in case: add the default players
// again, and search again for a non-guest player.
addDefaultPlayer();
for_in(player, m_all_players)
{
if (!player->isGuestAccount())
{
Log::info("PlayerManager", "Enfocring current player '%s'.",
player->getName().c_str());
m_current_player = player;
return;
}
} // for player in m_all_players
// Now this really really should not happen.
Log::fatal("PlayerManager", "Failed to find a non-guest player.");
} // enforceCurrentPlayer
示例6: _
// ----------------------------------------------------------------------------
void MainMenuScreen::onUpdate(float delta)
{
PlayerProfile *player = PlayerManager::getCurrentPlayer();
if(PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_GUEST ||
PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN)
{
m_user_id->setText(player->getLastOnlineName() + "@stk");
m_online->setActivated();
m_online->setLabel( _("Online"));
}
else if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_OUT)
{
m_online->setActivated();
m_online->setLabel( _("Login" ));
m_user_id->setText(player->getName());
}
else
{
// now must be either logging in or logging out
m_online->setDeactivated();
m_user_id->setText(player->getName());
}
m_online->setLabel(PlayerManager::getCurrentOnlineId() ? _("Online")
: _("Login" ) );
IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons");
if (addons_icon != NULL)
{
if (addons_manager->wasError())
{
addons_icon->setActivated();
addons_icon->resetAllBadges();
addons_icon->setBadge(BAD_BADGE);
}
else if (addons_manager->isLoading() && UserConfigParams::m_internet_status
== Online::RequestManager::IPERM_ALLOWED)
{
// Addons manager is still initialising/downloading.
addons_icon->setDeactivated();
addons_icon->resetAllBadges();
addons_icon->setBadge(LOADING_BADGE);
}
else
{
addons_icon->setActivated();
addons_icon->resetAllBadges();
}
// maybe add a new badge when not allowed to access the net
}
LabelWidget* w = getWidget<LabelWidget>("info_addons");
w->update(delta);
if(w->scrolledOff())
{
const core::stringw &news_text = NewsManager::get()->getNextNewsMessage();
w->setText(news_text, true);
}
} // onUpdate
示例7: getName
// ----------------------------------------------------------------------------
bool KartProperties::operator<(const KartProperties &other) const
{
PlayerProfile *p = PlayerManager::getCurrentPlayer();
bool this_is_locked = p->isLocked(getIdent());
bool other_is_locked = p->isLocked(other.getIdent());
if (this_is_locked == other_is_locked)
{
return getName() < other.getName();
}
else
return other_is_locked;
return true;
} // operator<
示例8: if
void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
}
else if (name == "back")
{
StateManager::get()->escapePressed();
}
else if (name == "addplayer")
{
new EnterPlayerNameDialog(this, 0.5f, 0.4f);
}
else if (name == "players")
{
// Find which player in the list was clicked
ListWidget* players = this->getWidget<ListWidget>("players");
assert(players != NULL);
core::stringw selectedPlayer = players->getSelectionLabel();
const int player_amount = PlayerManager::get()->getNumPlayers();
for (int i=0; i<player_amount; i++)
{
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
if (selectedPlayer == translations->fribidize(player->getName()))
{
if (!(player->isGuestAccount()))
{
new PlayerInfoDialog( player, 0.5f, 0.6f );
}
return;
}
} // end for
}
else if (name == "playername")
{
race_manager->clearKartLastPositionOnOverworld();
PlayerManager::get()->setCurrentPlayer(NULL,false);
StateManager::get()->pushScreen(StoryModeLobbyScreen::getInstance());
}
} // eventCallback
示例9: findWhatWasUnlocked
void FeatureUnlockedCutScene::findWhatWasUnlocked(RaceManager::Difficulty difficulty)
{
PlayerProfile *player = PlayerManager::getCurrentPlayer();
int points_before = player->getPoints();
int points_now = points_before + CHALLENGE_POINTS[difficulty];
std::vector<std::string> tracks;
std::vector<std::string> gps;
player->computeActive();
unlock_manager->findWhatWasUnlocked(points_before, points_now, tracks, gps);
for (unsigned int i = 0; i < tracks.size(); i++)
{
addUnlockedTrack(track_manager->getTrack(tracks[i]));
}
for (unsigned int i = 0; i < gps.size(); i++)
{
addUnlockedGP(grand_prix_manager->getGrandPrix(gps[i]));
}
}
示例10: _
/** Called once every frame. It will replace this screen with the main menu
* screen if a successful login happened.
*/
void BaseUserScreen::onUpdate(float dt)
{
if (!m_options_widget->isActivated())
{
core::stringw message = (m_state & STATE_LOGOUT)
? _(L"Signing out '%s'",m_sign_out_name.c_str())
: _(L"Signing in '%s'", m_sign_in_name.c_str());
m_info_widget->setText(StringUtils::loadingDots(message.c_str()),
false );
}
PlayerProfile *player = getSelectedPlayer();
if(player)
{
// If the player changes the online name, clear the saved session
// flag, and make the password field visible again.
if (m_username_tb->getText()!=player->getLastOnlineName())
{
player->clearSession();
makeEntryFieldsVisible();
}
}
} // onUpdate
示例11: selectUser
/** Called when a user is selected. It updates the online checkbox and
* entry fields.
*/
void BaseUserScreen::selectUser(int index)
{
PlayerProfile *profile = PlayerManager::get()->getPlayer(index);
assert(profile);
// Only set focus in case of non-tabbed version (so that keyboard
// or gamepad navigation with tabs works as expected, i.e. you can
// select the next tab without having to go up to the tab list first.
bool focus_it = !getWidget<RibbonWidget>("options_choice");
m_players->setSelection(StringUtils::toString(index), PLAYER_ID_GAME_MASTER,
focus_it);
if (!m_new_registered_data)
m_username_tb->setText(profile->getLastOnlineName(true/*ignoreRTL*/));
if (!m_new_registered_data)
{
// Delete a password that might have been typed for another user
m_password_tb->setText("");
}
getWidget<CheckBoxWidget>("remember-user")->setState(
profile->rememberPassword());
// Last game was not online, so make the offline settings the default
// (i.e. unckeck online checkbox, and make entry fields invisible).
if (!profile->wasOnlineLastTime() || profile->getLastOnlineName() == "")
{
if (!m_new_registered_data)
m_online_cb->setState(false);
makeEntryFieldsVisible();
return;
}
// Now last use was with online --> Display the saved data
if (UserConfigParams::m_internet_status == Online::RequestManager::IPERM_NOT_ALLOWED)
m_online_cb->setState(false);
else
m_online_cb->setState(true);
makeEntryFieldsVisible();
m_username_tb->setActive(profile->getLastOnlineName().size() == 0);
// And make the password invisible if the session is saved (i.e
// the user does not need to enter a password).
if (profile->hasSavedSession())
{
m_password_tb->setVisible(false);
getWidget<LabelWidget>("label_password")->setVisible(false);
getWidget<ButtonWidget>("password_reset")->setVisible(false);
}
} // selectUser
示例12: selectUser
/** Called when a user is selected. It updates the online checkbox and
* entrye fields.
*/
void BaseUserScreen::selectUser(int index)
{
PlayerProfile *profile = PlayerManager::get()->getPlayer(index);
assert(profile);
m_players->setSelection(StringUtils::toString(index), PLAYER_ID_GAME_MASTER,
/*focusIt*/ true);
m_username_tb->setText(profile->getLastOnlineName());
// Delete a password that might have been typed for another user
m_password_tb->setText("");
// Last game was not online, so make the offline settings the default
// (i.e. unckeck online checkbox, and make entry fields invisible).
if (!profile->wasOnlineLastTime() || profile->getLastOnlineName() == "")
{
m_online_cb->setState(false);
makeEntryFieldsVisible();
return;
}
// Now last use was with online --> Display the saved data
m_online_cb->setState(true);
makeEntryFieldsVisible();
getWidget<CheckBoxWidget>("remember-user")->setState(
profile->rememberPassword());
if(profile->getLastOnlineName().size()>0)
m_username_tb->setDeactivated();
else
m_username_tb->setActivated();
// And make the password invisible if the session is saved (i.e
// the user does not need to enter a password).
if (profile->hasSavedSession())
{
m_password_tb->setVisible(false);
getWidget<LabelWidget>("label_password")->setVisible(false);
}
} // selectUser
示例13: if
//.........这里部分代码省略.........
race_manager->setNumKarts( 1 );
race_manager->setTrack( "tutorial" );
race_manager->setDifficulty(RaceManager::DIFFICULTY_EASY);
race_manager->setReverseTrack(false);
// Use keyboard 0 by default (FIXME: let player choose?)
InputDevice* device = input_manager->getDeviceManager()->getKeyboard(0);
// Create player and associate player with keyboard
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(),
device);
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
{
Log::warn("MainMenuScreen", "Cannot find kart '%s', will revert to default",
UserConfigParams::m_default_kart.c_str());
UserConfigParams::m_default_kart.revertToDefaults();
}
race_manager->setPlayerKart(0, UserConfigParams::m_default_kart);
// ASSIGN should make sure that only input from assigned devices
// is read.
input_manager->getDeviceManager()->setAssignMode(ASSIGN);
input_manager->getDeviceManager()
->setSinglePlayer( StateManager::get()->getActivePlayer(0) );
StateManager::get()->enterGameState();
race_manager->setupPlayerKartInfo();
race_manager->startNew(false);
}
else if (selection == "story")
{
NetworkConfig::get()->unsetNetworking();
PlayerProfile *player = PlayerManager::getCurrentPlayer();
if (player->isFirstTime())
{
CutsceneWorld::setUseDuration(true);
StateManager::get()->enterGameState();
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
race_manager->setNumKarts( 0 );
race_manager->setNumPlayers(0);
race_manager->startSingleRace("introcutscene", 999, false);
std::vector<std::string> parts;
parts.push_back("introcutscene");
parts.push_back("introcutscene2");
((CutsceneWorld*)World::getWorld())->setParts(parts);
//race_manager->startSingleRace("introcutscene2", 999, false);
return;
}
else
{
const std::string default_kart = UserConfigParams::m_default_kart;
if (player->isLocked(default_kart))
{
KartSelectionScreen *next = OfflineKartSelectionScreen::getInstance();
next->setGoToOverworldNext();
next->setMultiplayer(false);
StateManager::get()->resetAndGoToScreen(next);
return;
}
OverWorld::enterOverWorld();
}
}
else if (selection == "online")
{
示例14: newLap
/** Is called by check structures if a kart starts a new lap.
* \param kart_index Index of the kart.
*/
void LinearWorld::newLap(unsigned int kart_index)
{
KartInfo &kart_info = m_kart_info[kart_index];
AbstractKart *kart = m_karts[kart_index];
// Reset reset-after-lap achievements
StateManager::ActivePlayer *c = kart->getController()->getPlayer();
PlayerProfile *p = PlayerManager::getCurrentPlayer();
if (c && c->getConstProfile() == p)
{
p->getAchievementsStatus()->onLapEnd();
}
// Only update the kart controller if a kart that has already finished
// the race crosses the start line again. This avoids 'fastest lap'
// messages if the end controller does a fastest lap, but especially
// allows the end controller to switch end cameras
if(kart->hasFinishedRace())
{
kart->getController()->newLap(kart_info.m_race_lap);
return;
}
const int lap_count = race_manager->getNumLaps();
// Only increase the lap counter and set the new time if the
// kart hasn't already finished the race (otherwise the race_gui
// will begin another countdown).
if(kart_info.m_race_lap+1 <= lap_count)
{
assert(kart->getWorldKartId()==kart_index);
kart_info.m_time_at_last_lap=getTime();
kart_info.m_race_lap++;
m_kart_info[kart_index].m_overall_distance =
m_kart_info[kart_index].m_race_lap * m_track->getTrackLength()
+ getDistanceDownTrackForKart(kart->getWorldKartId());
}
// Last lap message (kart_index's assert in previous block already)
if (raceHasLaps() && kart_info.m_race_lap+1 == lap_count)
{
m_race_gui->addMessage(_("Final lap!"), kart,
3.0f, video::SColor(255, 210, 100, 50), true);
if(!m_last_lap_sfx_played && lap_count > 1)
{
if (UserConfigParams::m_music)
{
m_last_lap_sfx->play();
m_last_lap_sfx_played = true;
m_last_lap_sfx_playing = true;
// In case that no music is defined
if(music_manager->getCurrentMusic() &&
music_manager->getMasterMusicVolume() > 0.2f)
{
music_manager->setTemporaryVolume(0.2f);
}
}
else
{
m_last_lap_sfx_played = true;
m_last_lap_sfx_playing = false;
}
}
}
else if (raceHasLaps() && kart_info.m_race_lap > 0 &&
kart_info.m_race_lap+1 < lap_count)
{
m_race_gui->addMessage(_("Lap %i", kart_info.m_race_lap+1),
kart, 3.0f, video::SColor(255, 210, 100, 50),
true);
}
// The race positions must be updated here: consider the situation where
// the first kart does not cross the finish line in its last lap, instead
// it passes it, the kart reverses and crosses the finishing line
// backwards. Just before crossing the finishing line the kart will be on
// the last lap, but with a distance along the track close to zero.
// Therefore its position will be wrong. If the race position gets updated
// after increasing the number of laps (but before tagging the kart to have
// finished the race) the position will be correct (since the kart now
// has one additional lap it will be ahead of the other karts).
// Without this call the incorrect position for this kart would remain
// (since a kart that has finished the race does not get its position
// changed anymore), potentially resulting in a duplicated race position
// (since the first kart does not have position 1, no other kart can get
// position 1, so one rank will be duplicated).
// Similarly the situation can happen if the distance along track should
// go back to zero before actually crossing the finishing line. While this
// should not happen, it could potentially be caused by floating point
// errors. In this case the call to updateRacePosition will avoid
// duplicated race positions as well.
updateRacePosition();
// Race finished
if(kart_info.m_race_lap >= race_manager->getNumLaps() && raceHasLaps())
{
kart->finishedRace(getTime());
//.........这里部分代码省略.........
示例15: if
void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
Screen *screen = NULL;
if (selection == "tab_audio")
screen = OptionsScreenAudio::getInstance();
else if (selection == "tab_video")
screen = OptionsScreenVideo::getInstance();
else if (selection == "tab_players")
screen = TabbedUserScreen::getInstance();
else if (selection == "tab_controls")
screen = OptionsScreenInput::getInstance();
//else if (selection == "tab_ui")
// screen = OptionsScreenUI::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if(name == "back")
{
StateManager::get()->escapePressed();
}
else if (name == "skinchoice")
{
GUIEngine::SpinnerWidget* skinSelector = getWidget<GUIEngine::SpinnerWidget>("skinchoice");
assert( skinSelector != NULL );
const core::stringw selectedSkin = skinSelector->getStringValue();
UserConfigParams::m_skin_file = core::stringc(selectedSkin.c_str()).c_str() + std::string(".stkskin");
GUIEngine::reloadSkin();
}
else if (name == "showfps")
{
CheckBoxWidget* fps = getWidget<CheckBoxWidget>("showfps");
assert( fps != NULL );
UserConfigParams::m_display_fps = fps->getState();
}
else if (name=="enable-internet")
{
CheckBoxWidget* internet = getWidget<CheckBoxWidget>("enable-internet");
assert( internet != NULL );
UserConfigParams::m_internet_status =
internet->getState() ? RequestManager::IPERM_ALLOWED
: RequestManager::IPERM_NOT_ALLOWED;
// If internet gets enabled, re-initialise the addon manager (which
// happens in a separate thread) so that news.xml etc can be
// downloaded if necessary.
CheckBoxWidget *stats = getWidget<CheckBoxWidget>("enable-hw-report");
LabelWidget *stats_label = getWidget<LabelWidget>("label-hw-report");
if(internet->getState())
{
NewsManager::get()->init(false);
stats->setVisible(true);
stats_label->setVisible(true);
stats->setState(UserConfigParams::m_hw_report_enable);
}
else
{
stats->setVisible(false);
stats_label->setVisible(false);
PlayerProfile* profile = PlayerManager::getCurrentPlayer();
if (profile != NULL && profile->isLoggedIn())
profile->requestSignOut();
}
}
else if (name=="enable-hw-report")
{
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
UserConfigParams::m_hw_report_enable = stats->getState();
if(stats->getState())
HardwareStats::reportHardwareStats();
}
else if (name=="show-login")
{
CheckBoxWidget* show_login = getWidget<CheckBoxWidget>("show-login");
assert( show_login != NULL );
UserConfigParams::m_always_show_login_screen = show_login->getState();
}
else if (name=="perPlayerDifficulty")
{
CheckBoxWidget* difficulty = getWidget<CheckBoxWidget>("perPlayerDifficulty");
assert( difficulty != NULL );
UserConfigParams::m_per_player_difficulty = difficulty->getState();
}
else if (name == "language")
{
ListWidget* list_widget = getWidget<ListWidget>("language");
std::string selection = list_widget->getSelectionInternalName();
delete translations;
if (selection == "system")
{
#ifdef WIN32
_putenv("LANGUAGE=");
#else
unsetenv("LANGUAGE");
#endif
//.........这里部分代码省略.........