|
C++传奇3EI3.0客户端 Mir3Ei ClientEx客户端源代码
#include "StdAfx.h"
CChatPopWnd::CChatPopWnd()
{
Init();
}
CChatPopWnd::~CChatPopWnd()
{
Destroy();
}
VOID CChatPopWnd::Init()
{
CGameWnd::Init();
m_nCanScrlCnt = 0;
m_nCurrStartChatLine = 0;
SetRect(&m_rcChatPopFrame, 0, 0, 0, 0);
SetRect(&m_rcEditBoxFrame, 0, 0, 0, 0);
m_xChatPopBtn.Init();
}
VOID CChatPopWnd::Destroy()
{
m_xstrDividedChat.ClearAllNodes();
Init();
}
VOID CChatPopWnd::CreateChatPopWnd(INT nID, CWHWilImageData* pxWndImage, INT nFrameImgIdx, INT nStartX, INT nStartY, INT nWidth, INT nHeight, BOOL bCanMove)
{
CreateGameWnd(nID, pxWndImage, nFrameImgIdx, bCanMove, nStartX, nStartY, nWidth, nHeight);
SetRect(&m_rcChatPopFrame, 10, 40, 490, 308);
SetRect(&m_rcEditBoxFrame, 36, 312, 535, 328);
m_xChatPopBtn.CreateGameBtn(pxWndImage, 1168, 1168, nStartX+619, nStartY+6);
}
BOOL CChatPopWnd::MsgAdd(DWORD dwFontColor, DWORD dwFontBackColor, CHAR* szMsg)
{
CHAR szChatMsg[MAX_PATH];
if ( szMsg != NULL )
{
strcpy(szChatMsg, szMsg);
if ( szChatMsg[0] != NULL )
{
INT nLineCnt;
CHAR szDivied[MAX_PATH*2];
CHAR szArg[5][MAX_PATH];
ZeroMemory(szDivied, MAX_PATH*2);
ZeroMemory(&szArg[0], MAX_PATH*5);
g_xMainWnd.StringDivide(m_rcChatPopFrame.right-m_rcChatPopFrame.left-10, nLineCnt, szChatMsg, szDivied);
sscanf(szDivied, "%[^`]%*c %[^`]%*c %[^`]%*c %[^`]%*c %[^`]%*c", szArg[0], szArg[1], szArg[2], szArg[3], szArg[4]);
if ( nLineCnt > 5 ) nLineCnt = 5;
for ( INT nCnt = 0; nCnt < nLineCnt; nCnt++ )
{
if ( m_nCanScrlCnt )
m_nCurrStartChatLine = m_nCanScrlCnt;
if ( m_xstrDividedChat.GetCounter() >= _MAX_CHATLINE_POPUP )
{
m_nCurrStartChatLine++;
m_nCanScrlCnt++;
}
CHATSTRING stChatStr;
stChatStr.dwFontColor = dwFontColor;
stChatStr.dwFontBackColor = dwFontBackColor;
stChatStr.strChat = szArg[nCnt];
m_xstrDividedChat.AddNode(stChatStr);
}
}
return TRUE;
}
return FALSE;
}
VOID CChatPopWnd::ShowChatPopWnd()
{
ShowGameWnd();
// 盲泼 府胶飘甫 焊咯霖促.
if ( !m_xstrDividedChat.CheckEmpty() )
{
m_xstrDividedChat.MoveCurrentToTop();
m_xstrDividedChat.MoveNode(m_nCurrStartChatLine);
INT nLine = 0;
INT nMaxLine;
if ( !m_nCurrStartChatLine )
{
if ( !m_nCanScrlCnt )
nMaxLine = m_xstrDividedChat.GetCounter();
else
nMaxLine = _MAX_CHATLINE_POPUP;
}
else
nMaxLine = (m_nCurrStartChatLine+_MAX_CHATLINE_POPUP) > m_xstrDividedChat.GetCounter() ?
m_xstrDividedChat.GetCounter() : m_nCurrStartChatLine+_MAX_CHATLINE_POPUP;
for ( INT nCnt = m_nCurrStartChatLine; nCnt < nMaxLine; nCnt++ )
{
LPCHATSTRING pstChatString;
pstChatString = m_xstrDividedChat.GetCurrentData();
g_xMainWnd.PutsHan(g_xMainWnd.GetBackBuffer(),
m_rcWnd.left+m_rcChatPopFrame.left, m_rcWnd.top+m_rcChatPopFrame.top+nLine*14,
pstChatString->dwFontBackColor, pstChatString->dwFontColor, (char*)pstChatString->strChat.c_str());
m_xstrDividedChat.MoveNextNode();
nLine++;
}
}
m_xChatPopBtn.ShowGameBtn();
}
BOOL CChatPopWnd::OnLButtonUp(POINT ptMouse)
{
MoveWindow(g_xChatEditBox.GetSafehWnd(), g_xMainWnd.m_rcWindow.left + m_rcWnd.left + m_rcEditBoxFrame.left,
g_xMainWnd.m_rcWindow.top + m_rcWnd.top + m_rcEditBoxFrame.top,
m_rcEditBoxFrame.right - m_rcEditBoxFrame.left,
m_rcEditBoxFrame.bottom - m_rcEditBoxFrame.top, TRUE);
if ( m_xChatPopBtn.OnLButtonUp(ptMouse) ) return TRUE;
return FALSE;
}
BOOL CChatPopWnd::OnLButtonDown(POINT ptMouse)
{
if ( m_xChatPopBtn.OnLButtonDown(ptMouse) ) return TRUE;
return FALSE;
}
VOID CChatPopWnd::OnMouseMove(POINT ptMouse)
{
m_xChatPopBtn.ChangeRect(m_rcWnd.left+542, m_rcWnd.top+353);
m_xChatPopBtn.OnMouseMove(ptMouse);
}
VOID CChatPopWnd::OnScrollDown()
{
if ( m_nCurrStartChatLine > 0 ) m_nCurrStartChatLine--;
}
VOID CChatPopWnd::OnScrollUp()
{
if ( m_nCurrStartChatLine < m_xstrDividedChat.GetCounter()-_MAX_CHATLINE_POPUP ) m_nCurrStartChatLine++;
}
VOID CChatPopWnd::SetStatusBtnInit()
{
m_xChatPopBtn.SetBtnState(_BTN_STATE_NORMAL);
分享名称:C++传奇3EI3.0客户端 Mir3Ei ClientEx客户端源代码.zip
分享链接:http://pan.zxdll.cn:188/#s/9iw3y-KA
访问密码:
|
上一篇:传奇3C++版服务端源代码+客户端源码官方泄露版下一篇:Gom引擎全套源码传奇引擎GOM源代码首发
|