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

📄 playerguagedlg.cpp

📁 墨香最新私服
💻 CPP
字号:
// PlayerGuageDlg.cpp: implementation of the CPlayerGuageDlg class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "PlayerGuageDlg.h"
#include "ObjectGuagen.h"
#include "WindowIDEnum.h"
#include "./Interface/cStatic.h"
#include "Player.h"
#include "GameResourceStruct.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CPlayerGuageDlg::CPlayerGuageDlg()
{
	m_pName = NULL;
	m_pLifeText = NULL;
	m_pLifeGuage = NULL;
	m_pShieldText = NULL;
	m_pShieldGuage = NULL;
	//m_type = WT_PLAYERGUAGEDLG;
	m_pCurPlayer = NULL;
}

CPlayerGuageDlg::~CPlayerGuageDlg()
{
	m_pCurPlayer = NULL;
}


void CPlayerGuageDlg::Linking()
{
	m_pName			= (cStatic *)GetWindowForID(CG_PLAYERGUAGENAME);
	m_pLifeText		= (cStatic *)GetWindowForID(CG_PLAYERGUAGELIFETEXT);
	m_pLifeGuage	= (CObjectGuagen *)GetWindowForID(CG_PLAYERGUAGELIFE);
//	m_pShieldText	= (cStatic *)GetWindowForID(CG_MONSTERGUAGELIFETEXT);
	m_pShieldGuage	= (CObjectGuagen *)GetWindowForID(CG_PLAYERGUAGESHIELD);
}

void CPlayerGuageDlg::SetPlayerName( char * szMonsterName )
{
	if( m_pName )
	m_pName->SetStaticText(szMonsterName);
}
void CPlayerGuageDlg::SetPlayerLife( CPlayer * pPlayer )
{
	//if( pMonster->GetSInfo() )
	SetPlayerLife( pPlayer->GetLife(), pPlayer->GetMaxLife(), 0 );

	m_pCurPlayer = pPlayer;
}
void CPlayerGuageDlg::SetPlayerLife( DWORD curVal, DWORD maxVal, int type )
{
	ASSERT(maxVal>0);

	char szValue[50];
	sprintf( szValue, "%d / %d", curVal, maxVal );

	if( m_pLifeText )
	{
		m_pLifeText->SetStaticText(szValue);
	}
	if( m_pLifeGuage )
	{
		if(type == 0)
			m_pLifeGuage->SetValue((float)curVal/(float)maxVal, 0);
		else
			m_pLifeGuage->SetValue((float)curVal/(float)maxVal, (1500/maxVal)*curVal);
	}
}

void CPlayerGuageDlg::SetPlayerShield( CPlayer * pPlayer )
{
	SetPlayerShield( pPlayer->GetShield(), pPlayer->GetMaxShield(), 0 );

	m_pCurPlayer = pPlayer;
}
void CPlayerGuageDlg::SetPlayerShield( DWORD curVal, DWORD maxVal, int type )
{
	ASSERT(maxVal>0);

	char szValue[50];
	sprintf( szValue, "%d / %d", curVal, maxVal );

	if( m_pShieldText )
	{
//		m_pShieldText->SetStaticText(szValue);
	}
	if( m_pShieldGuage )
	{
		if(type == 0)
			m_pShieldGuage->SetValue((float)curVal/(float)maxVal, 0);
		else
			m_pShieldGuage->SetValue((float)curVal/(float)maxVal, (1500/maxVal)*curVal);
	}
}

⌨️ 快捷键说明

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