示例#1
0
BOOL CGate::InitProperty(CGateList::tagGate *p)
{
	SetName(p->cName);//名字
	SetLenth(p->wLenth);//长		
	SetWidth(p->wWidth);//宽
	SetLevel(p->wLevel);//等级
	SetGraphicsID(p->dwModelId);//模型ID
	SetMaxHP(p->wMaxHp);//最大HP
	SetHP(p->wMaxHp);	//当前HP
	SetUnAttack(p->bIsunbeatable);//是否无敌
	SetBlockType(p->byBlockType);//阻挡类型
	SetDef(p->lDef);//物防	
	SetMagicDef(p->lMagicDef);//魔防
	SetNameColor(p->wNameColor);//名字颜色
	SetHitSound(string(p->cHitSound));//击中音效
	SetDestorySound(string(p->cDestorySound));//损毁音效
	SetOpenSound(string(p->cOpenSound));//打开音效
	SetCloseSound(string(p->cCloseSound));//关闭音效
	return TRUE;
}
示例#2
0
void cMsgBox::MsgBox(LONG lId, eMBType nMBType, LPCTSTR strMsg, cbFUNC cbMBFunc)
{
	if( !strMsg ) return ;

	m_nMBType = nMBType;
	SHORT_RECT rect = {0};
	WORD value = 0;
	g_pExecutive->GetRenderer()->GetClientRect(
		&rect,
		&value,
		&value);
	
	const SIZE buttonSize = {64, 23};
	const POINT textPoint = {15, 42};
	int nMsgBoxWidth = GetWidth();
	int nMsgBoxHeight = GetHeight();
	int nBtn1_Y	= 78;
	int nBtn2_Y	= 78;
	int nTextLine = 0;

	SCRIPTMGR->GetImage( 30, &m_DlgImg ) ;										// 기본 배경. AUTOSIZE 타입의 메세지 박스 출력 후에 항상 필요하기 때문에 여기서

	//--------------------------------------------------------------------------
	// Setting Text area.
	m_pMsg = new cTextArea ;													// 텍스트 라인 수를 구하기 위해 텍스트 먼저 처리

	int  nTextWidth	= nMsgBoxWidth - textPoint.x ;
	RECT rtText		= { 0, 0, 196 - textPoint.x * 2, 200 } ;

	m_pMsg->SetFontIdx( 0 ) ;
	m_pMsg->SetFontColor( RGB(96, 98, 1) );
	m_pMsg->Init(
		textPoint.x,
		textPoint.y,
		WORD(nTextWidth),
		200,
		0);
	m_pMsg->InitTextArea(
		&rtText,
		256);
	m_pMsg->SetAlpha((BYTE)m_alpha) ;
	m_pMsg->SetScriptText( strMsg ) ;
	m_pMsg->SetActive(m_bActive) ;	

	nTextLine = m_pMsg->GetIMEex()->GetTotalLine() ;

	//--------------------------------------------------------------------------
	// Setting Dialog info.
	cImageRect* pRect = NULL ;

	cImage middleBg ;

	WORD wWidth	 = 0 ;
	WORD wHeight = 0 ;

	//--------------------------------------------------------------------------
	// ..상단 이미지
	SCRIPTMGR->GetImage( 119, &m_DlgImg ) ;
	pRect = m_DlgImg.GetImageRect() ;

	nMsgBoxHeight = (int)(pRect->bottom - pRect->top) ;

	//--------------------------------------------------------------------------
	// ..중간 이미지 - 상단 이미지, 중간 이미지, 텍스트 출력 y 좌표가 서로 딱 맞아 떨어지지가 않기 때문에 줄 수에 정확히 맞추기 위해서 따로 추가..
   	cStatic* pMiddle01Bg = new cStatic ;

	SCRIPTMGR->GetImage( 120, &middleBg ) ;
	pRect = middleBg.GetImageRect() ;

	wWidth  = (WORD)(pRect->right-pRect->left) ;
	wHeight = (WORD)(pRect->bottom-pRect->top) ;

	pMiddle01Bg->Init( 0, nMsgBoxHeight, wWidth, wHeight, &middleBg, -1 ) ;
	cImageScale scale0 = {1.0f, 3.0f} ;
 	pMiddle01Bg->SetScale(&scale0) ;
 	Add( pMiddle01Bg ) ;

	nMsgBoxHeight += (int)((pRect->bottom-pRect->top-1)*scale0.y) ;

	//--------------------------------------------------------------------------
	// ..중간 이미지 - 텍스트 공간 만큼의 크기로 설정
   	cStatic* pMiddle02Bg = new cStatic ;

	SCRIPTMGR->GetImage( 120, &middleBg ) ;
	pRect = middleBg.GetImageRect() ;

	wWidth  = (WORD)(pRect->right-pRect->left) ;
	wHeight = (WORD)(pRect->bottom-pRect->top) ;

	pMiddle02Bg->Init( 0, nMsgBoxHeight, wWidth, wHeight, &middleBg, -1 ) ;
	cImageScale scale = {1.0f, 4.0f} ;
	scale.y *= nTextLine ;
 	pMiddle02Bg->SetScale(&scale) ;
 	Add( pMiddle02Bg ) ;

	nMsgBoxHeight += (int)((pRect->bottom-pRect->top-1)*scale.y) ;

	nBtn1_Y = nMsgBoxHeight-7 ;
	nBtn2_Y = nMsgBoxHeight-7 ;

	//--------------------------------------------------------------------------
	// ..하단 이미지
	cStatic* pBottomBg = new cStatic ;

	SCRIPTMGR->GetImage( 121, &middleBg) ;
	pRect = middleBg.GetImageRect() ;

	wWidth  = (WORD)(pRect->right-pRect->left) ;
	wHeight = (WORD)(pRect->bottom-pRect->top) ;

	pBottomBg->Init( 0, nMsgBoxHeight, wWidth, wHeight, &middleBg, -1 );
	Add( pBottomBg ) ;

	nMsgBoxHeight += (int)(pRect->bottom-pRect->top) ;

	switch(nMBType)
	{
	case MBT_OK:
	case MBT_OK_EXIT_PROGRAM:
		{
			m_pButton[0] = new cButton;
			m_pButton[0]->Init(
				(nMsgBoxWidth - buttonSize.cx) / 2,
				nBtn1_Y,
				WORD(buttonSize.cx),
				WORD(buttonSize.cy),
				&m_BtnImgBasic,
				&m_BtnImgOver,
				&m_BtnImgPress,
				0,
				MBI_OK);
			m_pButton[0]->SetText( m_BtnText[MB_BTN_OK], m_dwColor[0], m_dwColor[1], m_dwColor[2] );
			m_pButton[0]->SetTextXY(0, 6) ;
			m_pButton[0]->SetAlign( TXT_CENTER );
			m_pButton[0]->SetActive( m_bActive );
			m_pButton[0]->SetAlpha( (BYTE)m_alpha );
			Add( m_pButton[0] );

			SetOpenSound(
				1256);
			SetCloseSound(
				1257);
		}
		break;

	case MBT_YESNO:
	case MBT_YESNO_EXIT_PROGRAM:
		{
			m_pButton[0] = new cButton;
			m_pButton[0]->Init(
				24,
				nBtn2_Y,
				WORD(buttonSize.cx),
				WORD(buttonSize.cy),
				&m_BtnImgBasic,
				&m_BtnImgOver,
				&m_BtnImgPress,
				0,
				MBI_YES);
			m_pButton[0]->SetText( m_BtnText[MB_BTN_YES], m_dwColor[0], m_dwColor[1], m_dwColor[2] );
			m_pButton[0]->SetTextXY(0, 6) ;
			m_pButton[0]->SetAlign( TXT_CENTER );
			m_pButton[0]->SetActive( m_bActive );
			m_pButton[0]->SetAlpha( (BYTE)m_alpha );
			Add( m_pButton[0] );

			m_pButton[1] = new cButton;
			m_pButton[1]->Init(
				111,
				nBtn1_Y,
				WORD(buttonSize.cx),
				WORD(buttonSize.cy),
				&m_BtnImgBasic,
				&m_BtnImgOver,
				&m_BtnImgPress,
				0,
				MBI_NO);
			m_pButton[1]->SetText( m_BtnText[MB_BTN_NO], m_dwColor[0], m_dwColor[1], m_dwColor[2] );
			m_pButton[1]->SetTextXY(0, 6) ;
			m_pButton[1]->SetAlign( TXT_CENTER );
			m_pButton[1]->SetActive( m_bActive );
			m_pButton[1]->SetAlpha( (BYTE)m_alpha );
			Add( m_pButton[1] );

			SetOpenSound(
				1256);
			SetCloseSound(
				1257);
		}
		break;

	case MBT_CANCEL:
	case MBT_CANCEL_EXIT_PROGRAM:
		{
			m_pButton[0] = new cButton;
			m_pButton[0]->Init(
				(nMsgBoxWidth - buttonSize.cx) / 2,
				nBtn1_Y,
				WORD(buttonSize.cx),
				WORD(buttonSize.cy),
				&m_BtnImgBasic,
				&m_BtnImgOver,
				&m_BtnImgPress,
				0,
				MBI_CANCEL);
			m_pButton[0]->SetText( m_BtnText[MB_BTN_CANCEL], m_dwColor[0], m_dwColor[1], m_dwColor[2] );
			m_pButton[0]->SetTextXY(0, 6) ;
			m_pButton[0]->SetAlign( TXT_CENTER );
			m_pButton[0]->SetActive( m_bActive );
			m_pButton[0]->SetAlpha( (BYTE)m_alpha );
			Add( m_pButton[0] );

			SetOpenSound(
				1256);
			SetCloseSound(
				1257);
		}
		break;
	}

	// ..배경을 먼저 출력해야 하기 때문에 텍스트 추가는 여기서
	Add( m_pMsg );
	cDialog::Init(
		0,
		0,
		GetWidth(),
		GetHeight(),
		&m_DlgImg,
		lId);
	// 100302 LUJ, 위치를 원하는대로 배치하려면 SetAbsXY()를 사용해야한다
	SetAbsXY(
		(rect.right - GetWidth()) / 2,
		(rect.bottom - GetHeight()) / 2);
	SetMovable(TRUE);
	RECT rtCaption = { 0, 0, GetWidth(), 20 };
	SetCaptionRect(&rtCaption);

	m_cbMBFunc = cbMBFunc;
	
	cStatic* pStatic = new cStatic;
	pStatic->Init( 15, 16, 0, 0, NULL, -1 );
	pStatic->SetStaticText( RESRCMGR->GetMsg( 261 ) );
	pStatic->SetShadow( TRUE );
	pStatic->SetFontIdx( 0 );
	pStatic->SetAlign( TXT_LEFT );
	Add( pStatic );

	mCounterStatic = new cStatic;
	mCounterStatic->Init(
		GetWidth() - 30,
		16,
		0,
		0,
		0,
		-1);
	mCounterStatic->SetShadow(TRUE);
	mCounterStatic->SetFontIdx(0);
	mCounterStatic->SetAlign(TXT_RIGHT);
	mCounterStatic->SetActive(FALSE);
	Add(mCounterStatic);
	m_bActive = FALSE;
}