本文整理汇总了C++中IBattle::Leave方法的典型用法代码示例。如果您正苦于以下问题:C++ IBattle::Leave方法的具体用法?C++ IBattle::Leave怎么用?C++ IBattle::Leave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBattle
的用法示例。
在下文中一共展示了IBattle::Leave方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnHost
void BattleListTab::OnHost( wxCommandEvent& /*unused*/ )
{
if ( !ui().IsConnected() )
{
wxLogWarning( _T( "Trying to host while offline" ) );
customMessageBoxNoModal( SL_MAIN_ICON, _( "You cannot host a game while being offline. Please connect to a lobby server." ), _( "Not Online." ), wxOK );
ui().ShowConnectWindow();
return;
}
IBattle* battle = ui().mw().GetJoinTab().GetCurrentBattle();
if ( battle != 0 )
{
if ( ui().Ask( _( "Already in a battle" ), _( "You are already in a battle.\n\nDo you want to leave current battle to start a new?" ) ) ) {
battle->Leave();
ui().mw().GetJoinTab().LeaveCurrentBattle();
}
else
{
return;
}
}
SL::RunHostBattleDialog( this );
}
示例2: DoJoin
void BattleListTab::DoJoin(IBattle& battle)
{
wxString password = wxEmptyString;
IBattle* curbattle = ui().mw().GetJoinTab().GetCurrentBattle();
if (curbattle != 0 && curbattle->GetID() == battle.GetID()) {
ui().mw().ShowTab(MainWindow::PAGE_JOIN);
return;
}
if (curbattle != 0) {
if (ui().Ask(_("Already in another battle"), _("You are already in a battle.\n\nDo you want to leave your current battle and join this one?"))) {
curbattle->Leave();
ui().mw().GetJoinTab().LeaveCurrentBattle();
} else {
return;
}
}
if (battle.IsPassworded()) {
wxPasswordEntryDialog pw(this, _("Battle password"), _("Enter password (spaces will be stripped)"));
pw.SetFocus();
if (pw.ShowModal() != wxID_OK) {
return;
}
password = pw.GetValue();
password.Replace(_T(" "), wxEmptyString);
}
if (!ui().DownloadArchives(battle)) {
return;
}
battle.Join(STD_STRING(password));
}