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

📄 mugongdialog_backup.cpp

📁 墨香最新私服
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// MugongDialog.cpp: implementation of the CMugongDialog class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"

#ifdef _MUGONGDLGBACKUP_

#include "MugongDialog.h"
#include "GameResourceManager.h"
#include "MugongManager.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
#include "WindowIDEnum.h"
#include ".\Interface\cWindowManager.h"
#include "Item.h"
#include "ObjectManager.h"
#include "ItemManager.h"
#include "SkillManager_Client.h"
#include "SkillInfo.h"

CMugongDialog::CMugongDialog()
{
	m_type = WT_MUGONGDIALOG;
	
	m_pMugongDlg1_1 = NULL;
	m_pMugongDlg1_2 = NULL;
	m_pMugongSpreadBtn = NULL;
	/*
	for(int j=0;j<3;j++)
	for(int i=0;i<6;i++)
		pWearedMugongInfo[j].pStatic[i] = NULL;
	*/
}

CMugongDialog::~CMugongDialog()
{
	m_pMugongDlg1_1 = NULL;
	m_pMugongDlg1_2 = NULL;
	
	m_pMugongSpreadBtn = NULL;			// window manager俊辑 昏力窃
	DeleteIconAll();
}

void CMugongDialog::Linking()
{
	pWearedMugongInfo[0][MGI_NAME] = (cStatic *)GetWindowForID(MGI_GENERICMUGONG_NAME);
	pWearedMugongInfo[0][MGI_ATTR] = (cStatic *)GetWindowForID(MGI_GENERICMUGONG_ATTR);
	pWearedMugongInfo[0][MGI_TYPE] = (cStatic *)GetWindowForID(MGI_GENERICMUGONG_TYPE);
	pWearedMugongInfo[0][MGI_KIND] = (cStatic *)GetWindowForID(MGI_GENERICMUGONG_KIND);
	pWearedMugongInfo[0][MGI_SUNG] = (cStatic *)GetWindowForID(MGI_GENERICMUGONG_SUNG);
	pWearedMugongInfo[0][MGI_EXPPOINT] = (cStatic *)GetWindowForID(MGI_GENERICMUGONG_EXPPOINT);
}

void CMugongDialog::Init(LONG x, LONG y, WORD wid, WORD hei, cImage * basicImage, LONG ID)
{
	cIconDialog::Init(x,y,wid,hei,basicImage,ID);
	m_type = WT_MUGONGDIALOG;
}

DWORD CMugongDialog::ActionEvent(CMouse * mouseInfo)
{
	DWORD we = WE_NULL;
	if( !m_bActive ) return we;
	
	we = cIconDialog::ActionEvent(mouseInfo);
	
	if(m_pMugongSpreadBtn->IsPushed())				//眠啊 : 荐沥
	{
		m_pMugongDlg1_1->SetActive(FALSE);
		m_pMugongDlg1_2->SetActive(TRUE);
		m_pGuageBar->SetActive(FALSE);
	}
	else
	{
		m_pMugongDlg1_1->SetActive(TRUE);
		m_pMugongDlg1_2->SetActive(FALSE);
		m_pGuageBar->SetActive(TRUE);
	}
	return we;
}

void CMugongDialog::Add(cWindow * window)
{
	if(window->GetID() == MGI_MUGONGDLG1_1)
	{
		m_pMugongDlg1_1 = (cIconDialog *)window;
	}
	else if(window->GetID() == MGI_MUGONGDLG1_2)
	{
		m_pMugongDlg1_2 = (cIconGridDialog *)window;
	}
	else if(window->GetID() == MGI_PUSHUPBTN)
	{
		m_pMugongSpreadBtn = (cPushupButton *)window;
	}
	cDialog::Add(window);
}

void CMugongDialog::Render()
{
	cIconDialog::Render();
}

void CMugongDialog::SetAbsXY(LONG x, LONG y)
{
	ASSERT(m_pMugongDlg1_1);
	ASSERT(m_pMugongDlg1_2);
	m_pMugongDlg1_1->SetAbsXY(m_pMugongDlg1_1->GetRelX()+m_absPos.x, m_pMugongDlg1_1->GetRelY()+m_absPos.y);
	m_pMugongDlg1_2->SetAbsXY(m_pMugongDlg1_2->GetRelX()+m_absPos.x, m_pMugongDlg1_2->GetRelY()+m_absPos.y);
	
	cIconDialog::SetAbsXY(x,y);
}
void CMugongDialog::SetActive(BOOL val)
{
	cIconDialog::SetActive(val);
	m_pMugongDlg1_1->SetActive(val);
	m_pMugongDlg1_2->SetActive(val);

	if(m_pMugongSpreadBtn->IsPushed())
	{
		m_pMugongDlg1_1->SetActive(FALSE);
		m_pMugongDlg1_2->SetActive(TRUE);
		m_pGuageBar->SetActive(FALSE);
	}
	else
	{
		m_pMugongDlg1_1->SetActive(TRUE);
		m_pMugongDlg1_2->SetActive(FALSE);
		m_pGuageBar->SetActive(TRUE);
	}
	
}
void CMugongDialog::UpdateData(MUGONG_TYPE type)
{
	switch(type)
	{
	case ALL:
		{
			UpdateData(MUGONG);
			UpdateData(NAEGONG);
			UpdateData(KYUNGGONG);
		}
		break;
	case MUGONG:
		{
			/*
			pWearedMugongInfo[0].pStatic[0]->SetStaticText(pWearedMugongInfo[0].name);
			for(int i = 1 ;i < 6 ; i++)
				pWearedMugongInfo[0].pStatic[i]->SetStaticValue(pWearedMugongInfo[0].numeric[i]);
				*/
		}
		break;
	case NAEGONG:
		{
			/*
			pWearedMugongInfo[1].pStatic[0]->SetStaticText(pWearedMugongInfo[1].name);
			for(int i = 1 ;i < 6 ; i++)
				pWearedMugongInfo[1].pStatic[i]->SetStaticValue(pWearedMugongInfo[1].numeric[i]);
				*/
		}
		break;
	case KYUNGGONG:
		{
			/*
			pWearedMugongInfo[2].pStatic[0]->SetStaticText(pWearedMugongInfo[2].name);
			for(int i = 1 ;i < 6 ; i++)
				pWearedMugongInfo[2].pStatic[i]->SetStaticValue(pWearedMugongInfo[2].numeric[i]);
				*/
		}
		break;
	}
}
/*
void CMugongDialog::FakeAddIcon(LONG mouseX, LONG mouseY, cIcon * icon)
{
	if(!IsAcceptable(icon->GetIconType()))
		return;
	
	WORD pos;
	if(!GetPositionForXYRef(mouseX, mouseY, pos))
		return ;
	MSG_MUGONG_ADDINVDEL_SYN msg;
	msg.Category = MP_MUGONG;
	msg.Protocol = MP_MUGONG_ADDNITEMDELETE_SYN;
	msg.dwObjectID = HEROID;
	msg.bMugongType = pos;
	msg.wItemPosition = ((CItem *)icon)->GetPosition();
	msg.dwItemDBIdx = ((CItem *)icon)->GetDBIdx();
	NETWORK->Send(&msg, sizeof(MSG_MUGONG_ADDINVDEL_SYN));
}
*/
BOOL CMugongDialog::GetBlankPositionRef(BYTE type, WORD & absPos)
{
	switch(type)
	{
	case eMUGONGBOOK:
		{
			for(int i =0 ; i < GetCellNum() ; ++i)
			{
				if(IsAddable(i))
				{
					absPos = MUGONG_STARTPOSITION + i;
					return TRUE;
				}
			}
			for(i = 0 ; i < m_pMugongDlg1_2->GetCellNum() ; ++i)
			{
				if(m_pMugongDlg1_2->IsAddable(i))
				{
					absPos = MUGONG1_2_STARTPOSITION + i;
					return TRUE;
				}
			}
		}
		break;
	case eNAEGONGBOOK:
		{
			if(m_pMugongDlg1_1->IsAddable(0))
			{
				absPos = MUGONG1_1_STARTPOSITION + 0;
				return TRUE;
			}
			
		}
		break;
	case eKYUNGGONGBOOK:
		{
			if(m_pMugongDlg1_1->IsAddable(1))
			{
				absPos = MUGONG1_1_STARTPOSITION + 1;
				return TRUE;
			}
		}
		break;
	}
	
	return FALSE;
}

void CMugongDialog::AddMugong(MUGONGBASE * mugongBase)
{
	if(mugongBase->dwDBIdx > 0)
	{
		if(IsAddMugong(mugongBase->Position))
		{
			CMugongBase * mugong = MUGONGMGR->NewMugongIcon(mugongBase);
			
			AddMugong(mugongBase->Position, mugong);
		}
	}
}

BOOL CMugongDialog::IsAddMugong(POSTYPE pos)
{
	switch(ConvAbs2Rel(pos))
	{
	case WINDOW_STD:
		{
			pos -= MUGONG_STARTPOSITION;
			return IsAddable(pos);		
		}
		break;
	case WINDOW_EXTEND:
		{
			pos -= MUGONG1_2_STARTPOSITION;
			return m_pMugongDlg1_2->IsAddable(pos);		
		}
		break;
	case WINDOW_DOWN:
		{
			pos -= MUGONG1_1_STARTPOSITION;
			return m_pMugongDlg1_1->IsAddable(pos);		
		}
		break;
	default:
		ASSERT(0);
	}

	return FALSE;
}

void SetSkillInfoStatic(cStatic** pMugongInfoStatic,SKILLINFO* pSkillInfo,MUGONGBASE * mugongBase)
{
	pMugongInfoStatic[MGI_NAME]->SetStaticText(pSkillInfo->SkillName);
	pMugongInfoStatic[MGI_ATTR]->SetStaticValue(0);
	pMugongInfoStatic[MGI_TYPE]->SetStaticValue(pSkillInfo->WeaponKind);
	pMugongInfoStatic[MGI_KIND]->SetStaticValue(pSkillInfo->SkillKind);
	pMugongInfoStatic[MGI_SUNG]->SetStaticValue(mugongBase->Sung);
	pMugongInfoStatic[MGI_EXPPOINT]->SetStaticValue(mugongBase->ExpPoint);
}

void CMugongDialog::AddMugong(POSTYPE pos/*abs pos*/, CMugongBase * mugong)
{
	ASSERT(mugong);
	
	switch(ConvAbs2Rel(pos))
	{
	case WINDOW_STD:
		{
			pos -= MUGONG_STARTPOSITION;
			if(pos == MUGONG_POSITION) mugong->SetWeared(1);
			if(mugong->IsWeared()) 
			{
				
				MUGONGBASE * mugongBase = mugong->GetMugongBase();
				CSkillInfo* pSkillInfo = SKILLMGR->GetSkillInfo(mugongBase->wIconIdx);
				SetSkillInfoStatic(pWearedMugongInfo[0],pSkillInfo->GetSkillInfo(),mugongBase);
			}
			//test
			//char buf[100];
			//wsprintf(buf, "  己:%s  ", mugong->GetMugongBase()->Sung);
			//mugong->SetToolTip(buf);

			if(AddIcon(pos, (cIcon *)mugong))
				return ;
			else
				return ;
		}
		break;
	case WINDOW_EXTEND:
		{
			pos -= MUGONG1_2_STARTPOSITION;
			//test
			//char buf[100];
			//wsprintf(buf, "  己:%s  ", mugong->GetMugongBase()->Sung);
			//mugong->SetToolTip(buf);
			if(m_pMugongDlg1_2->AddIcon(pos, (cIcon *)mugong))
				return ;
			else
				return ;
		}
		break;
	case WINDOW_DOWN:
		{
			pos -= MUGONG1_1_STARTPOSITION;
			switch(pos) 
			{
			case 0:
				{
					MUGONGBASE * mugongBase = mugong->GetMugongBase();
					CSkillInfo* pSkillInfo = SKILLMGR->GetSkillInfo(mugongBase->wIconIdx);
					SetSkillInfoStatic(pWearedMugongInfo[1],pSkillInfo->GetSkillInfo(),mugongBase);
				}
			case 1:
				{
					MUGONGBASE * mugongBase = mugong->GetMugongBase();
					CSkillInfo* pSkillInfo = SKILLMGR->GetSkillInfo(mugongBase->wIconIdx);
					SetSkillInfoStatic(pWearedMugongInfo[2],pSkillInfo->GetSkillInfo(),mugongBase);
				}
			}
			//test
			//char buf[100];
			//wsprintf(buf, "  己:%s  ", mugong->GetMugongBase()->Sung);
			//mugong->SetToolTip(buf);
			mugong->SetWeared(1);

⌨️ 快捷键说明

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