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


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

本文整理汇总了C++中IBattle::GetNumBots方法的典型用法代码示例。如果您正苦于以下问题:C++ IBattle::GetNumBots方法的具体用法?C++ IBattle::GetNumBots怎么用?C++ IBattle::GetNumBots使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IBattle的用法示例。


在下文中一共展示了IBattle::GetNumBots方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wxDialog

AddBotDialog::AddBotDialog( wxWindow* parent, IBattle& battle , bool singleplayer)
	: wxDialog( parent, wxID_ANY, _("Add bot"), wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE ),
	WindowAttributesPickle( _T("ADDBOTDIALOG"), this, wxSize(-1, 255) ),
	m_battle( battle ),
	m_sp(singleplayer)
{
  //this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	if(battle.GetNumBots()>=2)
		SetTitle(_("Add bot: high nimber of bots can cause performance problems"));

	m_main_sizer = new wxBoxSizer( wxVERTICAL );

	wxBoxSizer* m_nick_sizer;
	m_nick_sizer = new wxBoxSizer( wxHORIZONTAL );

	m_nick_lbl = new wxStaticText( this, wxID_ANY, _("Nickname:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_nick_sizer->Add( m_nick_lbl, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );

	int bot = 1;
	wxString botname = wxString::Format( _T("Bot%d"), bot );
	while ( m_battle.UserExists( botname ) )
	{
		bot++;
		botname = wxString::Format( _T("Bot%d"), bot );
	}

	m_nick = new wxTextCtrl( this, wxID_ANY, botname, wxDefaultPosition, wxDefaultSize, 0 );
	m_nick_sizer->Add( m_nick, 2, wxALL, 5 );

	m_main_sizer->Add( m_nick_sizer, 0, wxEXPAND, 5 );

	wxBoxSizer* m_ai_sizer;
	m_ai_sizer = new wxBoxSizer( wxHORIZONTAL );

	m_ai_lbl = new wxStaticText( this, wxID_ANY, _("AI:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_ai_sizer->Add( m_ai_lbl, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );

	m_ai = new wxChoice( this, ADDBOT_AI );
	m_ai->SetToolTip( TE(_("Choose the AI library to use with this bot.") ) );

	m_ai_sizer->Add( m_ai, 2, wxALL, 5 );

	m_main_sizer->Add( m_ai_sizer, 0, wxEXPAND, 5 );

	if ( LSL::usync().VersionSupports( LSL::USYNC_GetSkirmishAI ) )
	{
		m_ai_infos_lst = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER );
		wxListItem col;
		col.SetText( _("property") );
		col.SetImage( -1 );
		m_ai_infos_lst->InsertColumn( 0, col );
		wxListItem col2;
		col2.SetText( _("value") );
		col2.SetImage( -1 );
		m_ai_infos_lst->InsertColumn( 1, col2 );

		m_opts_list = new wxListCtrl( this, ADDBOT_OPTIONLIST, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER );
		wxListItem col3;
		col3.SetText( _("property") );
		col3.SetImage( -1 );
		m_opts_list->InsertColumn( 0, col3 );
		wxListItem col4;
		col4.SetText( _("value") );
		col4.SetImage( -1 );
		m_opts_list->InsertColumn( 1, col4 );

		m_info_sizer = new wxBoxSizer(wxVERTICAL);
		m_info_sizer->Add( m_ai_infos_lst, 1, wxALL|wxEXPAND );
		m_info_sizer->Add( m_opts_list, 1, wxALL|wxEXPAND );
		m_main_sizer->Add( m_info_sizer, 1, wxALL|wxEXPAND );

	}
	else
	{
		 m_main_sizer->AddStretchSpacer();
	}

	m_buttons_sep = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	m_main_sizer->Add( m_buttons_sep, 0, wxALL|wxEXPAND );

	wxBoxSizer* m_buttons_sizer;
	m_buttons_sizer = new wxBoxSizer( wxHORIZONTAL );

	m_cancel_btn = new wxButton( this, ADDBOT_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(-1,CONTROL_HEIGHT), 0 );
	m_buttons_sizer->Add( m_cancel_btn, 0, wxALL );

	m_buttons_sizer->Add( 0, 0, 1, wxEXPAND );

	m_add_btn = new wxButton( this, ADDBOT_ADD, _("Add Bot"), wxDefaultPosition, wxSize(-1,CONTROL_HEIGHT), 0 );
	m_buttons_sizer->Add( m_add_btn, 0, wxALL );

	m_main_sizer->Add( m_buttons_sizer, 0, wxEXPAND );

	this->SetSizer( m_main_sizer );
	this->Layout();
	ReloadAIList();
	m_add_btn->SetFocus();
}
开发者ID:N0U,项目名称:springlobby,代码行数:98,代码来源:addbotdialog.cpp


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