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


C++ CN3UIBase::Load方法代码示例

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


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

示例1: sizeof

bool CN3UIBase::Load(HANDLE hFile)
{
	CN3BaseFileAccess::Load(hFile);
	DWORD dwRWC = NULL;

	// children 정보
	int iCC = 0;
	if(m_iVersion == N3FORMAT_VER_1298) {
		//char temp[0xFF];

		short sCC, sIdk0;
		ReadFile(hFile, &sCC, sizeof(short), &dwRWC, NULL); // children count
		ReadFile(hFile, &sIdk0, sizeof(short), &dwRWC, NULL);
		iCC = (int) sCC;

		//sprintf(temp, "sIdk0 = %d\n", sIdk0);
		//OutputDebugString(temp);
	} else {
		ReadFile(hFile, &iCC, sizeof(iCC), &dwRWC, NULL); // children count
	}

	eUI_TYPE eChildUIType;
	for(int i = 0; i < iCC; i++)
	{
		CN3UIBase* pChild = NULL;
		ReadFile(hFile, &eChildUIType, sizeof(eChildUIType), &dwRWC, NULL); // child의 ui type

		switch(eChildUIType)
		{
		case UI_TYPE_BASE:			pChild = new CN3UIBase();			break;
		case UI_TYPE_IMAGE:			pChild = new CN3UIImage();			break;
		case UI_TYPE_STRING:		pChild = new CN3UIString();			break;
		case UI_TYPE_BUTTON:		pChild = new CN3UIButton();			break;
		case UI_TYPE_STATIC:		pChild = new CN3UIStatic();			break;
		case UI_TYPE_PROGRESS:		pChild = new CN3UIProgress();		break;
		case UI_TYPE_SCROLLBAR:		pChild = new CN3UIScrollBar();		break;
		case UI_TYPE_TRACKBAR:		pChild = new CN3UITrackBar();		break;
		case UI_TYPE_EDIT:			pChild = new CN3UIEdit();			break;
		case UI_TYPE_AREA:			pChild = new CN3UIArea();			break;
#ifdef _REPENT
		case UI_TYPE_ICONSLOT:		pChild = new CN3UIIconSlot();		break;
#endif
		case UI_TYPE_LIST:			pChild = new CN3UIList();			break;
		}
		__ASSERT(pChild, "Unknown type UserInterface!!!");
		pChild->Init(this);
		pChild->Load(hFile);
	}

	// base 정보
	int iIDLen = 0;
	ReadFile(hFile, &iIDLen, sizeof(iIDLen), &dwRWC, NULL);				// ui id length
	if (iIDLen>0)
	{
		std::vector<char> buffer(iIDLen+1, NULL);
		ReadFile(hFile, &buffer[0], iIDLen, &dwRWC, NULL);			// ui id
		m_szID = &buffer[0];
	}
	else
	{
		m_szID = "";
	}
	ReadFile(hFile, &m_rcRegion, sizeof(m_rcRegion), &dwRWC, NULL);		// m_rcRegion
	ReadFile(hFile, &m_rcMovable, sizeof(m_rcMovable), &dwRWC, NULL);	// m_rcMovable
	ReadFile(hFile, &m_dwStyle, sizeof(m_dwStyle), &dwRWC, NULL);		// style
	ReadFile(hFile, &m_dwReserved, sizeof(m_dwReserved), &dwRWC, NULL);	//	m_dwReserved

	int iTooltipLen;
	ReadFile(hFile, &iTooltipLen, sizeof(iTooltipLen), &dwRWC, NULL);		//	tooltip문자열 길이
	if (iTooltipLen>0)
	{
		std::vector<char> buffer(iTooltipLen+1, NULL);
		ReadFile(hFile, &buffer[0], iTooltipLen, &dwRWC, NULL);
		m_szToolTip = &buffer[0];
	}

	// 이전 uif파일을 컨버팅 하려면 사운드 로드 하는 부분 막기
	int iSndFNLen = 0;
	ReadFile(hFile, &iSndFNLen, sizeof(iSndFNLen), &dwRWC, NULL);		//	사운드 파일 문자열 길이
	if (iSndFNLen>0)
	{
		std::vector<char> buffer(iSndFNLen+1, NULL);
		ReadFile(hFile, &buffer[0], iSndFNLen, &dwRWC, NULL);

		__ASSERT(NULL == m_pSnd_OpenUI, "memory leak");
		m_pSnd_OpenUI = s_SndMgr.CreateObj(&buffer[0], SNDTYPE_2D);
	}

	ReadFile(hFile, &iSndFNLen, sizeof(iSndFNLen), &dwRWC, NULL);		//	사운드 파일 문자열 길이
	if (iSndFNLen>0)
	{
		std::vector<char> buffer(iSndFNLen+1, NULL);
		ReadFile(hFile, &buffer[0], iSndFNLen, &dwRWC, NULL);

		__ASSERT(NULL == m_pSnd_CloseUI, "memory leak");
		m_pSnd_CloseUI = s_SndMgr.CreateObj(&buffer[0], SNDTYPE_2D);
	}

	return true;
}
开发者ID:VincentKO,项目名称:KnightOnline,代码行数:100,代码来源:N3UIBase.cpp


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