📄 channeldialog.cpp
字号:
// ChannelDialog.cpp: implementation of the CChannelDialog class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ChannelDialog.h"
#include "WindowIDEnum.h"
#include "CharSelect.h"
#include "cRItemEx.h"
#include "ChatManager.h"
#include "MainGame.h"
#ifdef _GMTOOL_
#include "GMToolManager.h"
#endif
int gChannelNum;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CChannelDialog::CChannelDialog()
{
gChannelNum = -1;
m_bInit = FALSE;
m_SelectRowIdx = 0;
m_BaseChannelIndex = 0;
}
CChannelDialog::~CChannelDialog()
{
}
void CChannelDialog::Linking()
{
m_pChannelLCtrl = (cListCtrl*)GetWindowForID(CHA_CHANNELLIST);
}
DWORD CChannelDialog::ActionEvent(CMouse* mouseInfo)
{
DWORD we = WE_NULL;
if( !m_bActive ) return we;
we = cDialog::ActionEvent(mouseInfo);
int rowidx = m_pChannelLCtrl->GetSelectedRowIdx();
if(we & WE_ROWCLICK)
{
SelectChannel(rowidx);
}
else if( we & WE_ROWDBLCLICK )
{
OnConnect();
}
return we;
}
void CChannelDialog::SetChannelList(MSG_CHANNEL_INFO* pInfo)
{
m_pChannelLCtrl->DeleteAllItems();
char temp[MAX_CHANNEL_NAME+4] = {0, };
int len = strlen(temp);
char num[2] = {0, };
BYTE Count = 0;
WORD LowCrowd = 1000;
int rowidx = 0;
m_BaseChannelIndex = 0;
//////////////////////////////////////////////////////////////////////////
// For Close Beta (Chinese Channel)
BYTE UserLevel = MAINGAME->GetUserLevel();
if(UserLevel == 7) //Chinese
{
m_BaseChannelIndex = pInfo->Count -1;
pInfo->Count = 1;
strcpy(pInfo->ChannelName,"China Channel");
pInfo->PlayerNum[0] = pInfo->PlayerNum[m_BaseChannelIndex];
}
else if(UserLevel == 6)
{
m_BaseChannelIndex = 0;
pInfo->Count = pInfo->Count -1;
}
//////////////////////////////////////////////////////////////////////////
for(int i=0; i<pInfo->Count; ++i)
{
cRITEMEx *ritem = new cRITEMEx(2);
sprintf(temp, "%s %d", pInfo->ChannelName, i+1);
strcpy(ritem->pString[0], temp);
//Crowd Level
if(pInfo->PlayerNum[i] < 200)
strcpy(ritem->pString[1], CHATMGR->GetChatMsg(211) );
else if(200 <= pInfo->PlayerNum[i] && pInfo->PlayerNum[i] < 300)
strcpy(ritem->pString[1], CHATMGR->GetChatMsg(212) );
else
{
strcpy(ritem->pString[1], CHATMGR->GetChatMsg(213) );
ritem->rgb[1] = RGBA_MAKE(255,0,0,255);
}
ritem->dwID = pInfo->PlayerNum[i];
m_pChannelLCtrl->InsertItem(i, ritem);
Count++;
if(LowCrowd == 0)
continue;
if(LowCrowd > pInfo->PlayerNum[i])
{
LowCrowd = pInfo->PlayerNum[i];
rowidx = i;
}
}
rowidx = 0;
cRITEMEx* pRItem = (cRITEMEx*)m_pChannelLCtrl->GetRItem(rowidx);
pRItem->rgb[0] = RGBA_MAKE(255,234,0,255);
gChannelNum = rowidx+m_BaseChannelIndex;
m_SelectRowIdx = rowidx;
SetActive(TRUE);
#ifdef _GMTOOL_
GMTOOLMGR->SetChannelCount( Count );
#endif
}
void CChannelDialog::SetActive(BOOL val)
{
cDialog::SetActive(val);
}
void CChannelDialog::OnConnect()
{
cRITEMEx * pRItem = (cRITEMEx*)m_pChannelLCtrl->GetRItem(m_SelectRowIdx);
if(pRItem)
{
if(gChannelNum == -1)
{
CHARSELECT->DisplayNotice(279);
}
else if( CHARSELECT->EnterGame() == FALSE )
{
CHARSELECT->DisplayNotice(18);
}
}
}
void CChannelDialog::SelectChannel(int rowidx)
{
cRITEMEx * pRItem = (cRITEMEx *)m_pChannelLCtrl->GetRItem(rowidx);
if(pRItem != NULL)
{
if(m_SelectRowIdx != rowidx)
{
pRItem->rgb[0] = RGBA_MAKE(255,234,0,255);
pRItem = (cRITEMEx*)m_pChannelLCtrl->GetRItem(m_SelectRowIdx);
pRItem->rgb[0] = RGBA_MAKE( 255, 255 ,255 ,255);
cRITEMEx* pRItem = (cRITEMEx*)m_pChannelLCtrl->GetRItem(rowidx);
if(pRItem->dwID >= 300)
gChannelNum = -1;
else
gChannelNum = rowidx + m_BaseChannelIndex;
m_SelectRowIdx = rowidx;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -