当前位置: 首页>>代码示例>>C++>>正文


C++ IBattle::Leave方法代码示例

本文整理汇总了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 );
}
开发者ID:jgleesawn,项目名称:springlobby,代码行数:25,代码来源:battlelisttab.cpp

示例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));
}
开发者ID:spike-spb,项目名称:springlobby,代码行数:36,代码来源:battlelisttab.cpp


注:本文中的IBattle::Leave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。