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

📄 dlgcoverlist.cpp

📁 网络游戏魔域源代码 测试可以完整变异
💻 CPP
字号:
// DlgCoverList.cpp : implementation file
//

#include "stdafx.h"
#include "Architect.h"
#include "DlgCoverList.h"

#include "3dGamemap.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgCoverList dialog


CDlgCoverList::CDlgCoverList(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgCoverList::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgCoverList)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDlgCoverList::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgCoverList)
	DDX_Control(pDX, IDC_LIST_COVER, m_CoverList);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgCoverList, CDialog)
	//{{AFX_MSG_MAP(CDlgCoverList)
	ON_BN_CLICKED(IDC_BUTTON_RESET, OnButtonReset)
	ON_BN_CLICKED(IDC_BUTTON_LOOKON, OnButtonLookon)
	ON_LBN_DBLCLK(IDC_LIST_COVER, OnDblclkListCover)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgCoverList message handlers

LRESULT CDlgCoverList::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (message == WM_SHOWWINDOW) 
	{
		if (wParam) 
		{
			SetCoverList();
		}
	}
	else if (message == WM_COMMAND) 
	{
		if (wParam == 1|| wParam == 2) 
			return TRUE;
	}
	return CDialog::WindowProc(message, wParam, lParam);
}


void CDlgCoverList::SetCoverList()
{
	m_CoverList.ResetContent ();
	CInteractiveLayer* pInteractiveLayer = g_objGameMap.GetInteractiveLayer();
	int nIndex = 0;
	if(pInteractiveLayer)
	{
		int nAmount = pInteractiveLayer->GetObjAmount ();
		for(int i=0;i<nAmount;i++)
		{
			CMapObj* pMapObj = pInteractiveLayer->GetObjByIndex (i);
			if (pMapObj) 
			{
				switch(pMapObj->GetObjType ()) 
				{
				case MAP_COVER:
					{
						C2DMapCoverObj* pCoverObj = (C2DMapCoverObj*)pMapObj;
						char szInfo[64]="";
						CMyPos posObj;
						pCoverObj->GetPos (posObj);
						sprintf(szInfo, "%s %d %d",pCoverObj->GetAniTitle (),posObj.x, posObj.y);
						m_CoverList.InsertString (nIndex,szInfo);
						nIndex++;
					}
					break;
				default:
					break;
				}
			}
		}
	}
}
void CDlgCoverList::OnButtonReset() 
{
	// TODO: Add your control notification handler code here
	CDlgCoverList::SetCoverList ();
}

void CDlgCoverList::OnButtonLookon() 
{
	// TODO: Add your control notification handler code here
	int nIndex = this->m_CoverList.GetCurSel();
	
	if(nIndex < 0)
		return;
		
	CMyPos posCell={0, 0};
	char strIndex[128];
	m_CoverList.GetText(nIndex, strIndex);	
	
	char szName[64]="";
	sscanf (strIndex,"%s %d %d",&szName,&posCell.x, &posCell.y);

	CMyPos posView;
	g_objGameMap.Cell2World(posCell.x, posCell.y, posView.x, posView.y);
	posView.x -= _SCR_WIDTH/2;
	posView.y -= _SCR_HEIGHT/2;
	g_objGameMap.SetViewPos(posView);
}

void CDlgCoverList::OnDblclkListCover() 
{
	// TODO: Add your control notification handler code here
	CDlgCoverList::OnButtonLookon();
}

⌨️ 快捷键说明

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