⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgmpcbooth.cpp

📁 网络游戏魔域源代码 测试可以完整变异
💻 CPP
📖 第 1 页 / 共 2 页
字号:
					break ;
				case 3:
					m_MpcBoothImaGood4.InsertImage ( strName ,0,0,true) ;
					m_StaPrice4.SetWindowText ( strPrice ) ;
					break ;
				case 4:
					m_MpcBoothImaGood5.InsertImage ( strName ,0,0,true) ;
					m_StaPrice5.SetWindowText ( strPrice ) ;
					break ;
				case 5:
					m_MpcBoothImaGood6.InsertImage ( strName ,0,0,true) ;
					m_StaPrice6.SetWindowText ( strPrice ) ;
					break ;
				}
			}
		}
	}
}

void CDlgMpcBooth::OnMpcboothBtnDown() 
{
	DXPlaySound("Sound/up_Page.wav");
	int nAmount = g_objHero.m_objBoothManager.GetItemAmount () ;
	if ( nAmount >= m_nCurBase + 6 )
	{
		CDlgMpcBooth::ClearMpcBooteh () ;
		m_nCurBase += 6 ;
		nAmount = ( nAmount > m_nCurBase + 6 ) ? m_nCurBase + 6 : nAmount ;
		for ( int i = m_nCurBase; i < nAmount; i++ )
		{
			CItem* pItem = g_objHero.m_objBoothManager.GetItemByIndex ( i ) ;
			if ( pItem )
			{
				char strName[32] ;
				char strPrice[32] ;
				sprintf ( strName, "Item%u", pItem->GetTypeID () ) ;
				itoa ( pItem->GetBoothSellPrice (), strPrice, 10 ) ;
				strcpy ( strPrice, CMyShellApp::StringChange ( strPrice, 2 ) ) ;

				switch ( i - m_nCurBase ) 
				{
				case 0:
					m_MpcBoothImaGood1.InsertImage ( strName ,0,0,true) ;
					m_StaPrice1.SetWindowText ( strPrice ) ;
					break ;
				case 1:
					m_MpcBoothImaGood2.InsertImage ( strName ,0,0,true) ;
					m_StaPrice2.SetWindowText ( strPrice ) ;
					break ;
				case 2:
					m_MpcBoothImaGood3.InsertImage ( strName ,0,0,true) ;
					m_StaPrice3.SetWindowText ( strPrice ) ;
					break ;
				case 3:
					m_MpcBoothImaGood4.InsertImage ( strName ,0,0,true) ;
					m_StaPrice4.SetWindowText ( strPrice ) ;
					break ;
				case 4:
					m_MpcBoothImaGood5.InsertImage ( strName ,0,0,true) ;
					m_StaPrice5.SetWindowText ( strPrice ) ;
					break ;
				case 5:
					m_MpcBoothImaGood6.InsertImage ( strName ,0,0,true) ;
					m_StaPrice6.SetWindowText ( strPrice ) ;
					break ;
				}
			}
		}
	}
}


void CDlgMpcBooth::OnMpcboothBtnHawk() 
{

	DXPlaySound("Sound/Dlg_Ok.wav");
	CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_HAWK ) ;		
}

/*void CDlgMpcBooth::OnMpcboothBtnChange1() 
{
	if ( m_MpcBoothImaGood1.GetImageLoadState () )
	{
		m_nCurChangeIndex = m_nCurBase ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_CHANGE ) ;
	}
}*/

void CDlgMpcBooth::OnMpcboothBtnGetback1() 
{
	DXPlaySound("Sound/Dlg_Ok.wav");
	if ( m_MpcBoothImaGood1.GetImageLoadState () )
	{
		CItem* pItem = g_objHero.m_objBoothManager.GetItemByIndex ( m_nCurBase ) ;
		if ( pItem )
			g_objHero.m_objBoothManager.DelItem ( pItem->GetID () ) ;
	}
}


void CDlgMpcBooth::OnMpcboothBtnGetback2() 
{
	DXPlaySound("Sound/Dlg_Ok.wav");
	if ( m_MpcBoothImaGood1.GetImageLoadState () )
	{
		CItem* pItem = g_objHero.m_objBoothManager.GetItemByIndex ( m_nCurBase + 1 ) ;
		if ( pItem )
			g_objHero.m_objBoothManager.DelItem ( pItem->GetID () ) ;
	}
}


void CDlgMpcBooth::OnMpcboothBtnGetback3() 
{
	DXPlaySound("Sound/Dlg_Ok.wav");
	if ( m_MpcBoothImaGood1.GetImageLoadState () )
	{
		CItem* pItem = g_objHero.m_objBoothManager.GetItemByIndex ( m_nCurBase + 2 ) ;
		if ( pItem )
			g_objHero.m_objBoothManager.DelItem ( pItem->GetID () ) ;
	}	
}


void CDlgMpcBooth::OnMpcboothBtnGetback4() 
{
	DXPlaySound("Sound/Dlg_Ok.wav");
	if ( m_MpcBoothImaGood1.GetImageLoadState () )
	{
		CItem* pItem = g_objHero.m_objBoothManager.GetItemByIndex ( m_nCurBase + 3 ) ;
		if ( pItem )
			g_objHero.m_objBoothManager.DelItem ( pItem->GetID () ) ;
	}
}


void CDlgMpcBooth::OnMpcboothBtnGetback5() 
{
	DXPlaySound("Sound/Dlg_Ok.wav");
	if ( m_MpcBoothImaGood1.GetImageLoadState () )
	{
		CItem* pItem = g_objHero.m_objBoothManager.GetItemByIndex ( m_nCurBase + 4 ) ;
		if ( pItem )
			g_objHero.m_objBoothManager.DelItem ( pItem->GetID () ) ;
	}	
}



void CDlgMpcBooth::OnMpcboothBtnGetback6() 
{
	DXPlaySound("Sound/Dlg_Ok.wav");
	if ( m_MpcBoothImaGood1.GetImageLoadState () )
	{
		CItem* pItem = g_objHero.m_objBoothManager.GetItemByIndex ( m_nCurBase + 5 ) ;
		if ( pItem )
			g_objHero.m_objBoothManager.DelItem ( pItem->GetID () ) ;
	}	
}

void CDlgMpcBooth::OnMpcboothImaGood1() 
{
	if ( g_bPickUp && !m_MpcBoothImaGood1.GetImageLoadState () )
	{
		m_nCurRealID = m_nIconRealID ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_ADDITEM ) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_ICON_DROP,  DLG_ALL) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, CMD_FLASHITEM ) ;
	}
}

void CDlgMpcBooth::OnMpcboothImaGood2() 
{
	if ( g_bPickUp && !m_MpcBoothImaGood2.GetImageLoadState () )
	{
		m_nCurRealID = m_nIconRealID ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_ADDITEM ) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_ICON_DROP,  DLG_ALL) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, CMD_FLASHITEM ) ;
	}
}

void CDlgMpcBooth::OnMpcboothImaGood3() 
{
	if ( g_bPickUp && !m_MpcBoothImaGood3.GetImageLoadState () )
	{
		m_nCurRealID = m_nIconRealID ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_ADDITEM ) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_ICON_DROP,  DLG_ALL) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, CMD_FLASHITEM ) ;
	}
}

void CDlgMpcBooth::OnMpcboothImaGood4() 
{
	if ( g_bPickUp && !m_MpcBoothImaGood4.GetImageLoadState () )
	{
		m_nCurRealID = m_nIconRealID ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_ADDITEM ) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_ICON_DROP,  DLG_ALL) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, CMD_FLASHITEM ) ;
	}
}

void CDlgMpcBooth::OnMpcboothImaGood5() 
{
	if ( g_bPickUp && !m_MpcBoothImaGood5.GetImageLoadState () )
	{
		m_nCurRealID = m_nIconRealID ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_ADDITEM ) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_ICON_DROP,  DLG_ALL) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, CMD_FLASHITEM ) ;
	}
}

void CDlgMpcBooth::OnMpcboothImaGood6() 
{
	if ( g_bPickUp && !m_MpcBoothImaGood6.GetImageLoadState () )
	{
		m_nCurRealID = m_nIconRealID ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_ADDITEM ) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_ICON_DROP,  DLG_ALL) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, CMD_FLASHITEM ) ;
	}
}

void CDlgMpcBooth::SetPickUpState(BOOL bPickUp,OBJID nIconRealID)
{
	m_bPickUp = bPickUp;
	m_nIconRealID = nIconRealID;
}

void CDlgMpcBooth::SetMpcBooth()
{
	CDlgMpcBooth::ClearMpcBooteh () ;
	int nAmount = g_objHero.m_objBoothManager.GetItemAmount () ;
	nAmount = ( nAmount > m_nCurBase + 6 ) ? m_nCurBase + 6 : nAmount ;
	for ( int i = m_nCurBase; i < nAmount; i++ )
	{
		CItem* pItem = g_objHero.m_objBoothManager.GetItemByIndex ( i ) ;
		if ( pItem )
		{
			char strName[32] ;
			char strPrice[32] ;
			sprintf ( strName, "Item%u", pItem->GetTypeID () ) ;
			itoa ( pItem->GetBoothSellPrice (), strPrice, 10 ) ;
			strcpy ( strPrice, CMyShellApp::StringChange ( strPrice, 2 ) ) ;

			switch ( i - m_nCurBase ) 
			{
			case 0:
				m_MpcBoothImaGood1.InsertImage ( strName ,pItem->GetID (),pItem->GetTypeID (),true ) ;
				m_StaPrice1.SetWindowText ( strPrice ) ;
				break ;
			case 1:
				m_MpcBoothImaGood2.InsertImage ( strName,pItem->GetID (),pItem->GetTypeID (),true ) ;
				m_StaPrice2.SetWindowText ( strPrice ) ;
				break ;
			case 2:
				m_MpcBoothImaGood3.InsertImage ( strName ,pItem->GetID (),pItem->GetTypeID (),true ) ;
				m_StaPrice3.SetWindowText ( strPrice ) ;
				break ;
			case 3:
				m_MpcBoothImaGood4.InsertImage ( strName ,pItem->GetID (),pItem->GetTypeID (),true ) ;
				m_StaPrice4.SetWindowText ( strPrice ) ;
				break ;
			case 4:
				m_MpcBoothImaGood5.InsertImage ( strName ,pItem->GetID (),pItem->GetTypeID (),true ) ;
				m_StaPrice5.SetWindowText ( strPrice ) ;
				break ;
			case 5:
				m_MpcBoothImaGood6.InsertImage ( strName ,pItem->GetID (),pItem->GetTypeID (),true ) ;
				m_StaPrice6.SetWindowText ( strPrice ) ;
				break ;
			}
		}
	}
}

void CDlgMpcBooth::ClearMpcBooteh()
{
	m_MpcBoothImaGood1.RemoveImage () ;
	m_MpcBoothImaGood2.RemoveImage () ;
	m_MpcBoothImaGood3.RemoveImage () ;
	m_MpcBoothImaGood4.RemoveImage () ;
	m_MpcBoothImaGood5.RemoveImage () ;
	m_MpcBoothImaGood6.RemoveImage () ;
	m_StaPrice1.SetWindowText ( NULL ) ;
	m_StaPrice2.SetWindowText ( NULL ) ;
	m_StaPrice3.SetWindowText ( NULL ) ;
	m_StaPrice4.SetWindowText ( NULL ) ;
	m_StaPrice5.SetWindowText ( NULL ) ;
	m_StaPrice6.SetWindowText ( NULL ) ;
}

int CDlgMpcBooth::GetMouseMoveIndex()
{
	if ( m_MpcBoothImaGood1.m_bMouseMove )
		return m_nCurBase ;
	if ( m_MpcBoothImaGood2.m_bMouseMove )
		return m_nCurBase + 1;
	if ( m_MpcBoothImaGood3.m_bMouseMove )
		return m_nCurBase + 2;
	if ( m_MpcBoothImaGood4.m_bMouseMove )
		return m_nCurBase + 3;
	if ( m_MpcBoothImaGood5.m_bMouseMove )
		return m_nCurBase + 4;
	if ( m_MpcBoothImaGood6.m_bMouseMove )
		return m_nCurBase + 5;

	return -1 ;
}

void CDlgMpcBooth::OnBtnClosebooth() 
{
	// TODO: Add your control notification handler code here
//	g_objHero.m_objBoothManager.Close();
	CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_HIDE ) ;
}

void CDlgMpcBooth::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	if (g_bPickUp 
		&&( !m_MpcBoothImaGood1.GetImageLoadState () 
		|| !m_MpcBoothImaGood2.GetImageLoadState ()
		|| !m_MpcBoothImaGood3.GetImageLoadState ()
		|| !m_MpcBoothImaGood4.GetImageLoadState ()
		|| !m_MpcBoothImaGood5.GetImageLoadState ()
		|| !m_MpcBoothImaGood6.GetImageLoadState ()))
	{
		m_nCurRealID = m_nIconRealID ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_MPCBOOTH_ADDITEM ) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_ICON_DROP,  DLG_ALL) ;
		CDlgMpcBooth::GetParent ()->PostMessage ( WM_MY_MESSAGE, CMD_FLASHITEM ) ;
	}
	CDialog::OnLButtonDown(nFlags, point);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -