📄 dlggroup.cpp
字号:
m_GroupBtn2.ChangeImage ( "Button196" ) ;
}
else
{
m_uTeamMode = TEAM_MODE_NONE ;
m_GroupBtn1.ChangeImage ( "Button190" ) ;
m_GroupBtn2.ChangeImage ( "Button191" ) ;
}
}
void CDlgGroup::CreateTeamOk()
{
if ( g_objHero.IsTeamLeader () )
{
m_MenuGroup.m_GroupChkMoney.SetCheckValue( 1 ) ;
m_MenuGroup.m_GroupChkItem.SetCheckValue( 0 ) ;
m_MenuGroup.m_GroupChkStop.SetCheckValue( 0 ) ;
m_MenuGroup.m_GroupChkJoin.SetCheckValue( 0 ) ;
g_objHero.SetTeamMoneyAccess ( m_MenuGroup.m_GroupChkMoney.GetCheckValue () ) ;
g_objHero.SetTeamItemAccess ( m_MenuGroup.m_GroupChkItem.GetCheckValue () ) ;
g_objHero.SetTeamGemAccess( m_MenuGroup.m_GroupChkStop.GetCheckValue() ) ;
g_objHero.TeamOpen();
}
}
void CDlgGroup::OnGroupBtn1()
{
DXPlaySound("Sound/Dlg_Ok.wav");
switch ( m_uTeamMode )
{
case TEAM_MODE_NONE:
if (g_objHero.TestStatus(USERSTATUS_GHOST))
{
g_objGameMsg.AddMsg(g_objGameDataSet.GetStr(10700));
CDlgGroup::EnableWindow(false);
return;
}
g_objHero.TeamCreate () ;
m_MenuGroup.m_bCreate = true ;
m_MenuGroup.ResetChecks();
m_GroupBtn5.EnableWindow(true);
break ;
case TEAM_MODE_LEADER:
if (g_objHero.TestStatus(USERSTATUS_GHOST))
{
g_objGameMsg.AddMsg(g_objGameDataSet.GetStr(10706));
CDlgGroup::EnableWindow(false);
return;
}
if (g_objHero.IsTeamClosed())
{
g_objGameMsg.AddMsg(g_objGameDataSet.GetStr(100112));
return;
}
g_objGameMsg.AddMsg(g_objGameDataSet.GetStr(10701));//请选择您想邀请的对象
CDlgGroup::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_GROUP_INVITE ) ;
break ;
case TEAM_MODE_MEMBER:
g_objHero.TeamLeave () ;
CDlgGroup::EnableWindow(false);
break ;
}
}
void CDlgGroup::OnGroupBtn2()
{
DXPlaySound("Sound/Dlg_Ok.wav");
switch ( m_uTeamMode )
{
case TEAM_MODE_NONE:
if (g_objHero.IsDead())
{
g_objGameMsg.AddMsg(g_objGameDataSet.GetStr(10705));//亡灵状态下不能申请入队
CDlgGroup::EnableWindow(false);
}
else
{
g_objGameMsg.AddMsg(g_objGameDataSet.GetStr(10702));//请选择您想加入的队伍
CDlgGroup::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_GROUP_JOIN ) ;
}
break ;
case TEAM_MODE_LEADER:
CDlgGroup::GetParent()->PostMessage(WM_MY_MESSAGE,ON_TEAM_DISMISS);
break ;
case TEAM_MODE_MEMBER:
if(!g_objHero.IsDead ())
g_objHero.TeamFollow () ;
break ;
}
}
void CDlgGroup::OnGroupChk3()
{
DXPlaySound("Sound/Dlg_Ok.wav");
switch ( m_uTeamMode )
{
case TEAM_MODE_NONE:
break ;
case TEAM_MODE_LEADER:
if ( !m_MenuGroup.m_bShow )
{
CDlgGroup::GetParent()->PostMessage(WM_MY_MESSAGE,ON_GROUP_SETUP);
}
else
m_MenuGroup.EnableWindow( false ) ;
break ;
case TEAM_MODE_MEMBER:
break ;
}
}
void CDlgGroup::OnGroupBtn4()
{
DXPlaySound("Sound/Dlg_Ok.wav");
switch ( m_uTeamMode )
{
case TEAM_MODE_NONE:
break ;
case TEAM_MODE_LEADER:
{
if ( m_uFocusPlayer != 0 )
{
g_objHero.TeamKickOut ( m_PlayerID[m_uFocusPlayer - 1] ) ;
m_uFocusPlayer = 0;
m_dwFocusTime = 0;
}
else
{
g_objGameMsg.AddMsg(g_objGameDataSet.GetStr(10709));//请选择你要踢出队伍的对象
}
}
break ;
case TEAM_MODE_MEMBER:
break ;
}
}
void CDlgGroup::OnGroupImg1()
{
DXPlaySound("Sound/Dlg_Ok.wav");
if ( m_GroupImg1.GetImageLoadState () && m_uTeamMode == TEAM_MODE_LEADER )
{
SetFocusPlayer(1);
}
}
void CDlgGroup::OnGroupImg2()
{
DXPlaySound("Sound/Dlg_Ok.wav");
if ( m_GroupImg2.GetImageLoadState () && m_uTeamMode == TEAM_MODE_LEADER )
{
SetFocusPlayer(2);
}
}
void CDlgGroup::OnGroupImg3()
{
DXPlaySound("Sound/Dlg_Ok.wav");
if ( m_GroupImg3.GetImageLoadState () && m_uTeamMode == TEAM_MODE_LEADER )
{
SetFocusPlayer(3);
}
}
void CDlgGroup::OnGroupImg4()
{
DXPlaySound("Sound/Dlg_Ok.wav");
if ( m_GroupImg4.GetImageLoadState () && m_uTeamMode == TEAM_MODE_LEADER )
{
SetFocusPlayer(4);
}
}
void CDlgGroup::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
LPARAM lParam ;
lParam = MAKELONG( point.x + m_Pnt.x, point.y + m_Pnt.y ) ;
CDlgGroup::GetParent()->PostMessage( WM_MOUSEMOVE, nFlags, lParam ) ;
CDlgGroup::GetParent()->PostMessage(WM_MY_MESSAGE, ON_MSGDLG_HIDE);
CDialog::OnMouseMove(nFlags, point);
}
void CDlgGroup::OnLButtonDown(UINT nFlags, CPoint point)
{
LPARAM lParam ;
lParam = MAKELONG( point.x + m_Pnt.x, point.y + m_Pnt.y ) ;
CDlgGroup::GetParent()->PostMessage( WM_LBUTTONDOWN, nFlags, lParam ) ;
CDialog::OnLButtonDown(nFlags, point);
}
void CDlgGroup::OnLButtonUp(UINT nFlags, CPoint point)
{
LPARAM lParam ;
lParam = MAKELONG( point.x + m_Pnt.x, point.y + m_Pnt.y ) ;
CDlgGroup::GetParent()->PostMessage( WM_LBUTTONUP, nFlags, lParam ) ;
CDialog::OnLButtonDown(nFlags, point);
}
void CDlgGroup::OnRButtonDown(UINT nFlags, CPoint point)
{
LPARAM lParam ;
lParam = MAKELONG( point.x + m_Pnt.x, point.y + m_Pnt.y ) ;
CDlgGroup::GetParent()->PostMessage( WM_RBUTTONDOWN, nFlags, lParam ) ;
CDialog::OnLButtonDown(nFlags, point);
}
void CDlgGroup::OnRButtonUp(UINT nFlags, CPoint point)
{
LPARAM lParam ;
lParam = MAKELONG( point.x + m_Pnt.x, point.y + m_Pnt.y ) ;
CDlgGroup::GetParent()->PostMessage( WM_RBUTTONUP, nFlags, lParam ) ;
CDialog::OnLButtonDown(nFlags, point);
}
void CDlgGroup::OnGroupBtn5()
{
// TODO: Add your control notification handler code here
DXPlaySound("Sound/Dlg_Ok.wav");
CDlgGroup::GetParent()->PostMessage(WM_MY_MESSAGE,ON_TEAMMAGIC_OPEN );
}
void CDlgGroup::ShowTeamMemberPosition(int nIndex,CPoint posPosition)
{
TeamMemberInfo *pInfo = g_objHero.GetTeamMemberInfo(nIndex);
if (pInfo != NULL)
{
// if (pInfo->id != g_objHero.GetTeamMemberFlashID())
if(nIndex != 0)
g_objHero.QueryTeamMemberPos(pInfo->id);
CAni* ShowAni = g_objGameDataSet.GetDataAni ( ( char * )g_strControlAni,
"Position",
EXIGENCE_IMMEDIATE ) ;
if (ShowAni != NULL)
{
CPlayer* pPlayer = g_objPlayerSet.GetPlayer(pInfo->id);
if (pPlayer != NULL)
{
int nFrame = -1;
CMyPos posTeamCell, posTeamBg, posTeamWorld;
pPlayer->GetPos(posTeamCell);
g_objGameMap.Cell2World(posTeamCell.x, posTeamCell.y, posTeamWorld.x, posTeamWorld.y);
g_objGameMap.World2Bg(posTeamWorld.x, posTeamWorld.y, posTeamBg.x, posTeamBg.y);
CMyPos posHeroCell, posHeroBg, posHeroWorld;
g_objHero.GetPos(posHeroCell);
g_objGameMap.Cell2World(posHeroCell.x, posHeroCell.y, posHeroWorld.x, posHeroWorld.y);
g_objGameMap.World2Bg(posHeroWorld.x, posHeroWorld.y, posHeroBg.x, posHeroBg.y);
if (posTeamBg.x < posHeroBg.x
&& posTeamBg.y == posHeroBg.y)
{
nFrame = 0; //Left
}
else if (posTeamBg.x > posHeroBg.x
&& posTeamBg.y == posHeroBg.y)
{
nFrame = 1; //right
}
else if (posTeamBg.x == posHeroBg.x
&& posTeamBg.y < posHeroBg.y)
{
nFrame = 2; //Down
}
else if (posTeamBg.x == posHeroBg.x
&& posTeamBg.y > posHeroBg.y)
{
nFrame = 3; //Up
}
else if (posTeamBg.x > posHeroBg.x
&& posTeamBg.y < posHeroBg.y)
{
nFrame = 4;
}
else if (posTeamBg.x < posHeroBg.x
&& posTeamBg.y < posHeroBg.y)
{
nFrame = 5;
}
else if (posTeamBg.x > posHeroBg.x
&& posTeamBg.y > posHeroBg.y)
{
nFrame = 6;
}
else if (posTeamBg.x < posHeroBg.x
&& posTeamBg.y > posHeroBg.y)
{
nFrame = 7;
}
if (nFrame != -1)
ShowAni->Show(nFrame,posPosition.x ,//m_MsgDlgPnt.x - 34,
posPosition.y );//m_MsgDlgPnt.y + 20);
}
}
}
}
void CDlgGroup::ShowMemberName()
{
int nYPos = 0;
if ( m_GroupImg1.GetImageLoadState() )
{
nYPos = 0 ;
int nIndex = 0 ;
if ( m_btOwnerPos <= 0 )
{
nIndex++ ;
}
TeamMemberInfo *pInfo = g_objHero.GetTeamMemberInfo( nIndex ) ;
if ( pInfo )
{
CPoint point;
::GetCursorPos(&point);
CRect rect;
m_GroupImg1.GetWindowRect(rect);
if (rect.PtInRect(point))
{
CMySize FontSize;
CMyBitmap::GetFontSize(FontSize);
int nXPos = _SCR_WIDTH - strlen(pInfo->szName)*FontSize.iWidth;
CMyBitmap::ShowString( nXPos,
m_Pnt.y + nYPos + 66,
0xffffffff,
pInfo->szName ) ;
}
}
}
if ( m_GroupImg2.GetImageLoadState() )
{
nYPos += 64 ;
int nIndex = 1 ;
if ( m_btOwnerPos <= 1 )
{
nIndex++ ;
}
TeamMemberInfo *pInfo = g_objHero.GetTeamMemberInfo( nIndex ) ;
if ( pInfo )
{
CPoint point;
::GetCursorPos(&point);
CRect rect;
m_GroupImg2.GetWindowRect(rect);
if (rect.PtInRect(point))
{
CMySize FontSize;
CMyBitmap::GetFontSize(FontSize);
int nXPos = _SCR_WIDTH - strlen(pInfo->szName)*FontSize.iWidth;
CMyBitmap::ShowString( nXPos,
m_Pnt.y + nYPos + 66,
0xffffffff,
pInfo->szName ) ;
}
}
}
if ( m_GroupImg3.GetImageLoadState() )
{
nYPos += 64 ;
int nIndex = 2 ;
if ( m_btOwnerPos <= 2 )
{
nIndex++ ;
}
TeamMemberInfo *pInfo = g_objHero.GetTeamMemberInfo( nIndex ) ;
if ( pInfo )
{
CPoint point;
::GetCursorPos(&point);
CRect rect;
m_GroupImg3.GetWindowRect(rect);
if (rect.PtInRect(point))
{
CMySize FontSize;
CMyBitmap::GetFontSize(FontSize);
int nXPos = _SCR_WIDTH - strlen(pInfo->szName)*FontSize.iWidth;
CMyBitmap::ShowString( nXPos,
m_Pnt.y + nYPos + 66,
0xffffffff,
pInfo->szName ) ;
}
}
}
if ( m_GroupImg4.GetImageLoadState() )
{
nYPos += 64 ;
int nIndex = 3 ;
if ( m_btOwnerPos <= 3 )
{
nIndex++ ;
}
TeamMemberInfo *pInfo = g_objHero.GetTeamMemberInfo( nIndex ) ;
if ( pInfo )
{
CPoint point;
::GetCursorPos(&point);
CRect rect;
m_GroupImg4.GetWindowRect(rect);
if (rect.PtInRect(point))
{
CMySize FontSize;
CMyBitmap::GetFontSize(FontSize);
int nXPos = _SCR_WIDTH - strlen(pInfo->szName)*FontSize.iWidth;
CMyBitmap::ShowString( nXPos,
m_Pnt.y + nYPos + 66,
0xffffffff,
pInfo->szName ) ;
}
}
}
}
void CDlgGroup::TeamDismiss()
{
if ( m_uTeamMode == TEAM_MODE_LEADER )
{
g_objHero.TeamDismiss () ;
m_GroupBtn5.EnableWindow(false);
if ( m_MenuGroup.m_bShow )
{
m_MenuGroup.EnableWindow( false ) ;
}
CDlgGroup::EnableWindow(false);
}
}
OBJID CDlgGroup::GetMouseInMember()
{
if ( m_GroupImg1.GetImageLoadState() )
{
int nIndex = 0 ;
if ( m_btOwnerPos <= 0 )
{
nIndex++ ;
}
TeamMemberInfo *pInfo = g_objHero.GetTeamMemberInfo( nIndex ) ;
if ( pInfo )
{
CPoint point;
::GetCursorPos(&point);
CRect rect;
m_GroupImg1.GetWindowRect(rect);
if (rect.PtInRect(point))
{
return pInfo->id;
}
}
}
if ( m_GroupImg2.GetImageLoadState() )
{
int nIndex = 1 ;
if ( m_btOwnerPos <= 1 )
{
nIndex++ ;
}
TeamMemberInfo *pInfo = g_objHero.GetTeamMemberInfo( nIndex ) ;
if ( pInfo )
{
CPoint point;
::GetCursorPos(&point);
CRect rect;
m_GroupImg2.GetWindowRect(rect);
if (rect.PtInRect(point))
{
return pInfo->id;
}
}
}
if ( m_GroupImg3.GetImageLoadState() )
{
int nIndex = 2 ;
if ( m_btOwnerPos <= 2 )
{
nIndex++ ;
}
TeamMemberInfo *pInfo = g_objHero.GetTeamMemberInfo( nIndex ) ;
if ( pInfo )
{
CPoint point;
::GetCursorPos(&point);
CRect rect;
m_GroupImg3.GetWindowRect(rect);
if (rect.PtInRect(point))
{
return pInfo->id;
}
}
}
if ( m_GroupImg4.GetImageLoadState() )
{
int nIndex = 3 ;
if ( m_btOwnerPos <= 3 )
{
nIndex++ ;
}
TeamMemberInfo *pInfo = g_objHero.GetTeamMemberInfo( nIndex ) ;
if ( pInfo )
{
CPoint point;
::GetCursorPos(&point);
CRect rect;
m_GroupImg4.GetWindowRect(rect);
if (rect.PtInRect(point))
{
return pInfo->id;
}
}
}
return 0;
}
void CDlgGroup::SetFocusPlayer(int nIndex)
{
m_uFocusPlayer = nIndex;
m_dwFocusTime = ::TimeGet();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -