📄 dlgfriend.cpp
字号:
// DlgFriend.cpp : implementation file
//
#include "stdafx.h"
#include "MyShell.h"
#include "DlgFriend.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#ifdef _SOUND_DISABLE
#define DXPlaySound //
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgFriend dialog
CDlgFriend::CDlgFriend(CWnd* pParent /*=NULL*/)
: CDialog(CDlgFriend::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgFriend)
m_bShow = false ;
m_fFrameStep = 0.0f ;
m_nFrameMode = 0 ;
m_nPntX = 0 ;
m_nCurIndex = 0 ;
m_btSortType = 0 ;
m_nOnlineAmount = 0 ;
//}}AFX_DATA_INIT
}
void CDlgFriend::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgFriend)
DDX_Control(pDX, IDC_IMG_HEAD1, m_ImgHead1);
DDX_Control(pDX, IDC_STA_STIRPS1, m_StaStirps1);
DDX_Control(pDX, IDC_STA_SEX1, m_StaSex1);
DDX_Control(pDX, IDC_STA_PRO1, m_StaPro1);
DDX_Control(pDX, IDC_STA_NAME1, m_StaName1);
DDX_Control(pDX, IDC_STA_LEV1, m_StaLev1);
DDX_Control(pDX, IDC_BTN_MSG1, m_BtnMsg1);
DDX_Control(pDX, IDC_BTN_DEL1, m_BtnDel1);
DDX_Control(pDX, IDC_IMG_HEAD2, m_ImgHead2);
DDX_Control(pDX, IDC_STA_STIRPS2, m_StaStirps2);
DDX_Control(pDX, IDC_STA_SEX2, m_StaSex2);
DDX_Control(pDX, IDC_STA_PRO2, m_StaPro2);
DDX_Control(pDX, IDC_STA_NAME2, m_StaName2);
DDX_Control(pDX, IDC_STA_LEV2, m_StaLev2);
DDX_Control(pDX, IDC_BTN_MSG2, m_BtnMsg2);
DDX_Control(pDX, IDC_BTN_DEL2, m_BtnDel2);
DDX_Control(pDX, IDC_IMG_HEAD3, m_ImgHead3);
DDX_Control(pDX, IDC_STA_STIRPS3, m_StaStirps3);
DDX_Control(pDX, IDC_STA_SEX3, m_StaSex3);
DDX_Control(pDX, IDC_STA_PRO3, m_StaPro3);
DDX_Control(pDX, IDC_STA_NAME3, m_StaName3);
DDX_Control(pDX, IDC_STA_LEV3, m_StaLev3);
DDX_Control(pDX, IDC_BTN_MSG3, m_BtnMsg3);
DDX_Control(pDX, IDC_BTN_DEL3, m_BtnDel3);
DDX_Control(pDX, IDC_BTN_SORTONLINE, m_BtnSortOnline);
DDX_Control(pDX, IDC_BTN_SORTNAME, m_BtnSortName);
DDX_Control(pDX, IDC_BTN_SORT, m_BtnSort);
DDX_Control(pDX, IDC_BTN_RIGHT, m_BtnRight);
DDX_Control(pDX, IDC_BTN_LEFT, m_BtnLeft);
DDX_Control(pDX, IDC_FRIEND_BTN_RESUME, m_FriendBtnResume);
DDX_Control(pDX, IDC_FRIEND_BTN_ADD, m_FriendBtnAdd ) ;
DDX_Control(pDX, IDC_FRIEND_BTN_CLOSE, m_FriendBtnClose ) ;
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgFriend, CDialog)
//{{AFX_MSG_MAP(CDlgFriend)
ON_WM_CTLCOLOR()
ON_WM_MOVE()
ON_BN_CLICKED(IDC_FRIEND_BTN_CLOSE, OnFriendBtnClose)
ON_BN_CLICKED(IDC_BTN_HELP, OnBtnHelp)
ON_BN_CLICKED(IDC_FRIEND_BTN_ADD, OnFriendBtnAdd)
ON_BN_CLICKED(IDC_FRIEND_BTN_RESUME, OnFriendBtnResume)
ON_BN_CLICKED(IDC_BTN_MSG1, OnBtnMsg1)
ON_BN_CLICKED(IDC_BTN_MSG2, OnBtnMsg2)
ON_BN_CLICKED(IDC_BTN_MSG3, OnBtnMsg3)
ON_BN_CLICKED(IDC_BTN_SORT, OnBtnSort)
ON_BN_CLICKED(IDC_BTN_RIGHT, OnBtnRight)
ON_BN_CLICKED(IDC_BTN_LEFT, OnBtnLeft)
ON_BN_CLICKED(IDC_BTN_DEL1, OnBtnDel1)
ON_BN_CLICKED(IDC_BTN_DEL2, OnBtnDel2)
ON_BN_CLICKED(IDC_BTN_DEL3, OnBtnDel3)
ON_BN_CLICKED(IDC_BTN_SORTONLINE, OnBtnSortonline)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgFriend message handlers
LRESULT CDlgFriend::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch ( message )
{
case WM_ENABLE:
m_bShow = wParam ;
if ( wParam == false )
{
DXPlaySound ( "Sound/DlgClose.wav" ) ;
}
else
{
m_dwLastShowTime = TimeGet() ;
m_nFrameMode = 1 ;
CRect rect ;
CDlgFriend::GetWindowRect( rect ) ;
m_nPntX = _SCR_WIDTH ;
}
break ;
case WM_COMMAND:
if ( wParam == 1 )
{
return true ;
}
else if ( wParam == 2 )
{
CDlgFriend::OnFriendBtnClose () ;
return true ;
}
break ;
}
return CDialog::WindowProc(message, wParam, lParam);
}
HBRUSH CDlgFriend::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
pDC->SetBkMode ( TRANSPARENT ) ;
return g_StockBrush;
}
BOOL CDlgFriend::OnInitDialog()
{
CDialog::OnInitDialog();
CRect rect ;
CDlgFriend::GetWindowRect ( rect ) ;
m_fFrameStep = ( float ) rect.Width () / DLG_FRAME_AMOUNT ;
// Init the image
m_ImgHead1.Init ( rect.left, rect.top, NULL, FACE_IMAGE ) ;
m_ImgHead2.Init ( rect.left, rect.top, NULL, FACE_IMAGE ) ;
m_ImgHead3.Init ( rect.left, rect.top, NULL, FACE_IMAGE ) ;
// Init the static
m_StaStirps1.Init ( rect.left, rect.top ) ;
m_StaSex1.Init ( rect.left, rect.top ) ;
m_StaPro1.Init ( rect.left, rect.top ) ;
m_StaName1.Init ( rect.left, rect.top ) ;
m_StaLev1.Init ( rect.left, rect.top ) ;
m_StaStirps2.Init ( rect.left, rect.top ) ;
m_StaSex2.Init ( rect.left, rect.top ) ;
m_StaPro2.Init ( rect.left, rect.top ) ;
m_StaName2.Init ( rect.left, rect.top ) ;
m_StaLev2.Init ( rect.left, rect.top ) ;
m_StaStirps3.Init ( rect.left, rect.top ) ;
m_StaSex3.Init ( rect.left, rect.top ) ;
m_StaPro3.Init ( rect.left, rect.top ) ;
m_StaName3.Init ( rect.left, rect.top ) ;
m_StaLev3.Init ( rect.left, rect.top ) ;
// Init the button
m_FriendBtnAdd.Init ( rect.left, rect.top, "Button170" );
m_FriendBtnClose.Init ( rect.left, rect.top, "Button540" );
m_FriendBtnResume.Init ( rect.left, rect.top, "Button175" ) ;
m_BtnSortOnline.Init ( rect.left, rect.top, "Button176" ) ;
m_BtnSortOnline.EnableWindow( false ) ;
// m_BtnSortName.Init ( rect.left, rect.top, "Button177" ) ;
m_BtnSortName.EnableWindow( false ) ;
m_BtnSort.Init ( rect.left, rect.top, "Button178" ) ;
m_BtnRight.Init ( rect.left, rect.top, "Button61" ) ;
m_BtnLeft.Init ( rect.left, rect.top, "Button60" ) ;
m_BtnMsg1.Init ( rect.left, rect.top, "Button179" ) ;
m_BtnDel1.Init ( rect.left, rect.top, "Button1710" ) ;
m_BtnMsg2.Init ( rect.left, rect.top, "Button179" ) ;
m_BtnDel2.Init ( rect.left, rect.top, "Button1710" ) ;
m_BtnMsg3.Init ( rect.left, rect.top, "Button179" ) ;
m_BtnDel3.Init ( rect.left, rect.top, "Button1710" ) ;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgFriend::OnMove(int x, int y)
{
CDialog::OnMove(x, y);
m_nPntX = x ;
m_Pnt.y = y ;
}
void CDlgFriend::OnFriendBtnClose()
{
DXPlaySound ( "Sound/BtnClick.wav" ) ;
CDlgFriend::EnableWindow( false ) ;
}
void CDlgFriend::Show()
{
if ( m_bShow )
{
if ( m_nFrameMode != 0 )
{
if ( TimeGet() - m_dwLastShowTime <= 300 )
{
m_Pnt.x = m_nPntX - ( TimeGet() - m_dwLastShowTime ) / 15 * m_fFrameStep;
}
else
{
CRect rect ;
CDlgFriend::GetWindowRect( rect ) ;
m_Pnt.x = _SCR_WIDTH - rect.Width();
m_nFrameMode = 0 ;
}
}
// Show the owner
CAni* ShowAni = g_objGameDataSet.GetDataAni ( ( char * )g_strControlAni,
"Dialog17",
EXIGENCE_IMMEDIATE ) ;
if ( ShowAni != NULL )
ShowAni->Show ( 0,
m_Pnt.x,
m_Pnt.y ) ;
else
return ;
// Show the image
m_StaName1.Show ( m_Pnt.x, m_Pnt.y ) ;
if ( m_ImgHead1.GetImageLoadState() )
{
m_ImgHead1.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaStirps1.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaSex1.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaPro1.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaLev1.Show ( m_Pnt.x, m_Pnt.y ) ;
}
m_StaName2.Show ( m_Pnt.x, m_Pnt.y ) ;
if ( m_ImgHead2.GetImageLoadState() )
{
m_ImgHead2.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaStirps2.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaSex2.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaPro2.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaLev2.Show ( m_Pnt.x, m_Pnt.y ) ;
}
m_StaName3.Show ( m_Pnt.x, m_Pnt.y ) ;
if ( m_ImgHead3.GetImageLoadState() )
{
m_ImgHead3.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaStirps3.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaSex3.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaPro3.Show ( m_Pnt.x, m_Pnt.y ) ;
m_StaLev3.Show ( m_Pnt.x, m_Pnt.y ) ;
}
// Show the button
m_FriendBtnAdd.Show ( m_Pnt.x, m_Pnt.y ) ;
m_FriendBtnClose.Show ( m_Pnt.x, m_Pnt.y ) ;
if ( m_BtnSortOnline.IsWindowEnabled() )
m_BtnSortOnline.Show ( m_Pnt.x, m_Pnt.y ) ;
// if ( m_BtnSortName.IsWindowEnabled() )
// m_BtnSortName.Show ( m_Pnt.x, m_Pnt.y ) ;
m_BtnSort.Show ( m_Pnt.x, m_Pnt.y ) ;
m_BtnRight.Show ( m_Pnt.x, m_Pnt.y ) ;
m_BtnLeft.Show ( m_Pnt.x, m_Pnt.y ) ;
m_BtnMsg1.Show ( m_Pnt.x, m_Pnt.y ) ;
m_BtnDel1.Show ( m_Pnt.x, m_Pnt.y ) ;
m_BtnMsg2.Show ( m_Pnt.x, m_Pnt.y ) ;
m_BtnDel2.Show ( m_Pnt.x, m_Pnt.y ) ;
m_BtnMsg3.Show ( m_Pnt.x, m_Pnt.y ) ;
m_BtnDel3.Show ( m_Pnt.x, m_Pnt.y ) ;
}
}
void CDlgFriend::OnBtnHelp()
{
CDlgFriend::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_HELPDLG_SHOW, DLG_FRIEND ) ;
}
void CDlgFriend::OnFriendBtnAdd()
{
CDlgFriend::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_FRIEND_ADD ) ;
}
void CDlgFriend::SetFriendList()
{
// Test the online friend num
CDlgFriend::ClearFriendList() ;
int i = 0 ;
int nAmount = ( g_objHero.GetFriendAmount() > m_nCurIndex + 3 ) ? m_nCurIndex + 3 : g_objHero.GetFriendAmount() ;
switch ( m_btSortType )
{
case 0:// not sort
for ( i = m_nCurIndex; i < nAmount; i++ )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -