📄 dlgrolecreate.cpp
字号:
// DlgRoleCreate.cpp : implementation file
//
#include "stdafx.h"
#include "MyShell.h"
#include "DlgRoleCreate.h"
#include "3DRoleData.h"
#include "allmsg.h"
#include "Hero.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#ifdef _SOUND_DISABLE
#define DXPlaySound //
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgRoleCreate dialog
CDlgRoleCreate::CDlgRoleCreate(CWnd* pParent /*=NULL*/)
: CDialog(CDlgRoleCreate::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgRoleCreate)
m_bShow = false ;
m_bSelRoleOk = false;
m_bSelected = false;
m_btSex = 1 ;
m_btPro = 0 ;
m_nRoleSelIndex = 0;
m_nLookIndex = 0;
m_nSexRole = 1;
//}}AFX_DATA_INIT
}
void CDlgRoleCreate::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgRoleCreate)
DDX_Control(pDX, IDC_ROLECREATE_BTN_RESET, m_BtnReset);
DDX_Control(pDX, IDC_BTN_CHGFACE, m_BtnChgFace);
DDX_Control(pDX, IDC_BTN_CHGBODY, m_BtnChgBody);
DDX_Control(pDX, IDC_STA_SEX, m_StaSex);
DDX_Control(pDX, IDC_IMG_FACE, m_ImgFace);
DDX_Control(pDX, IDC_IMG_DATABK, m_ImgDataBk);
DDX_Control(pDX, IDC_BTN_RIGHT3, m_BtnRight3);
DDX_Control(pDX, IDC_BTN_RIGHT2, m_BtnRight2);
DDX_Control(pDX, IDC_BTN_RIGHT1, m_BtnRight1);
DDX_Control(pDX, IDC_BTN_LEFT3, m_BtnLeft3);
DDX_Control(pDX, IDC_BTN_LEFT2, m_BtnLeft2);
DDX_Control(pDX, IDC_BTN_LEFT1, m_BtnLeft1);
DDX_Control(pDX, IDC_ROLECHOOSE_MIMG3, m_Img3);
DDX_Control(pDX, IDC_IMG_FACESEL, m_ImgFaceSelBk);
DDX_Control(pDX, IDC_IMG_ROLESEL, m_ImgRoleSel);
DDX_Control(pDX, IDC_ROLECHOOSE_MIMG2, m_Img2);
DDX_Control(pDX, IDC_ROLECHOOSE_MIMG1, m_Img1);
DDX_Control(pDX, IDC_ROLECREATE_BTN_EXIT, m_RoleCreateExitBtn);
DDX_Control(pDX, IDC_ROLECREATE_STA_DATA, m_RoleCreateDataSta ) ;
DDX_Control(pDX, IDC_ROLECREATE_EDT_NAME, m_RoleCreateNameEdt ) ;
DDX_Control(pDX, IDC_ROLECREATE_BTN_OK,m_RoleCreateOkBtn );
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgRoleCreate, CDialog)
//{{AFX_MSG_MAP(CDlgRoleCreate)
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_ROLECREATE_BTN_OK, OnRolecreateBtnOk)
ON_BN_CLICKED(IDC_ROLECREATE_BTN_EXIT, OnRolecreateBtnExit)
ON_BN_CLICKED(IDC_ROLECHOOSE_MIMG1, OnRolechooseMimg1)
ON_BN_CLICKED(IDC_ROLECHOOSE_MIMG2, OnRolechooseMimg2)
ON_BN_CLICKED(IDC_ROLECREATE_BTN_RESET, OnRolecreateBtnReset)
ON_BN_CLICKED(IDC_ROLECHOOSE_MIMG3, OnRolechooseMimg3)
ON_BN_CLICKED(IDC_BTN_LEFT3, OnBtnLeft3)
ON_BN_CLICKED(IDC_BTN_RIGHT3, OnBtnRight3)
ON_WM_LBUTTONDOWN()
ON_BN_CLICKED(IDC_BTN_CHGBODY, OnBtnChgbody)
ON_BN_CLICKED(IDC_BTN_CHGFACE, OnBtnChgface)
ON_BN_CLICKED(IDC_BTN_LEFT1, OnBtnLeft1)
ON_BN_CLICKED(IDC_BTN_RIGHT1, OnBtnRight1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgRoleCreate message handlers
LRESULT CDlgRoleCreate::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if ( message == WM_ENABLE )
{
m_bShow = wParam ;
if ( m_bShow )
{
CDlgRoleCreate::ReInit();
m_RoleCreateNameEdt.SetFocus() ;
}
}
else if ( message == WM_COMMAND )
{
if ( wParam == 1 )
{
return true ;
}
else if ( wParam == 2 )
{
DXPlaySound("Sound/window_close.wav");
if (CDlgRoleCreate::IsSelRoleOk())
CDlgRoleCreate::CreateReset();
else
CDlgRoleCreate::CreateExit();
return true ;
}
}
return CDialog::WindowProc(message, wParam, lParam);
}
HBRUSH CDlgRoleCreate::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
pDC->SetBkMode ( TRANSPARENT ) ;
return g_StockBrush;
}
BOOL CDlgRoleCreate::OnInitDialog()
{
CDialog::OnInitDialog();
// Init the Image
m_ImgRoleSel.Init(0,0,"Image30",BG_IMAGE);
m_ImgFaceSelBk.Init(0,0,"Image31",BG_IMAGE);
m_ImgDataBk.Init(0,0,"Image32",BG_IMAGE);
// Init the edit
m_RoleCreateNameEdt.Init( 0, 0, false,NULL, 0x000000, 0xffffff );
m_RoleCreateNameEdt.SetLimitText( 15 ) ;
m_RoleCreateNameEdt.SetOffset( CPoint ( 4, 6 ) ) ;
// Init the button
m_RoleCreateOkBtn.Init( 0, 0, "Button30" );
m_RoleCreateExitBtn.Init( 0, 0, "Button31" );
m_BtnReset.Init(0,0,"Button32");
m_BtnRight1.Init( 0, 0, "Button61" ) ;
m_BtnLeft1.Init( 0, 0, "Button60" ) ;
m_BtnChgFace.Init(0,0,"Button33");
m_BtnRight2.Init( 0, 0, "Button61" ) ;
m_BtnLeft2.Init( 0, 0, "Button60" ) ;
m_BtnChgBody.Init(0,0,"Button34");
m_BtnRight3.Init( 0, 0, "Button61" ) ;
m_BtnLeft3.Init( 0, 0, "Button60" ) ;
// Init the statics
m_RoleCreateDataSta.Init(0,0,2);
m_ImgFace.Init(0,0,NULL,FACE_IMAGE);
m_StaSex.Init(0,0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgRoleCreate::ShowRoleInfo()
{
CPoint mousePoint;
::GetCursorPos(&mousePoint);
CRect rect;
m_Img1.GetWindowRect(rect);
if (rect.PtInRect(mousePoint))
{
CAni* ShowAni = g_objGameDataSet.GetDataAni ( ( char * )g_strControlAni,
"Image24",
EXIGENCE_IMMEDIATE ) ;
if (ShowAni == NULL)
return;
else
{
ShowAni->Show(0,303,390);
return;
}
}
m_Img2.GetWindowRect(rect);
if (rect.PtInRect(mousePoint))
{
CAni* ShowAni = g_objGameDataSet.GetDataAni ( ( char * )g_strControlAni,
"Image25",
EXIGENCE_IMMEDIATE ) ;
if (ShowAni == NULL)
return;
else
{
ShowAni->Show(0,488,364);
return;
}
}
m_Img3.GetWindowRect(rect);
if (rect.PtInRect(mousePoint))
{
CAni* ShowAni = g_objGameDataSet.GetDataAni ( ( char * )g_strControlAni,
"Image26",
EXIGENCE_IMMEDIATE ) ;
if (ShowAni == NULL)
return;
else
{
ShowAni->Show(0,666,391);
return;
}
}
}
void CDlgRoleCreate::Show()
{
if ( m_bShow )
{
// Show the owner
CAni* ShowAni = g_objGameDataSet.GetDataAni ( ( char * )g_strControlAni,
"Image3",
EXIGENCE_IMMEDIATE ) ;
if ( ShowAni != NULL )
ShowAni->Show ( 0, 0, 0 );
else
return ;
// Show the simple role
CMyPos posA = { 330, 650 } ;
CMyPos posB = { 510, 630 } ;
CMyPos posC = { 690, 650 } ;
if (m_nRoleSelIndex!=0 && m_bSelRoleOk !=TRUE)
{
ProcessRoleShow(m_bSelected);
}
switch(m_nRoleSelIndex)
{
case 0:
if (!m_Img1.IsWindowEnabled())
m_Img1.EnableWindow();
if (!m_Img2.IsWindowEnabled())
m_Img2.EnableWindow();
if (!m_Img3.IsWindowEnabled())
m_Img3.EnableWindow();
m_ShowRoleA.ShowRole( _MALE_ROLE_A, posA, 120, 0, 1 ) ;
m_ShowRoleB.ShowRole( _MALE_ROLE_B, posB, 120, 0, 1 ) ;
m_ShowRoleC.ShowRole( _MALE_ROLE_C, posC, 120, 0, 1 ) ;
ShowRoleInfo();
break;
case 1:
{
if (m_bSelected)
{
if(m_ShowRoleA.ShowRole(_MALE_ROLE_A,m_RolePos,m_RoleZoom,0,3))
ReInit();
}
else
{
int nIndex = 2;
if (m_btSex == 2)
nIndex = 1;
BOOL bShowOk = m_ShowRoleA.ShowRole ( _MALE_ROLE_A+(m_btSex-1)*3, m_RolePos, m_RoleZoom, 0, nIndex );
if (bShowOk && !m_bSelRoleOk)
{
m_bSelRoleOk = true;
EnableCreate(true);
}
}
}
break;
case 2:
{
if (m_bSelected)
{
if(m_ShowRoleB.ShowRole(_MALE_ROLE_B,m_RolePos,m_RoleZoom,0,3))
ReInit();
}
else
{
int nIndex = 2;
if (m_btSex == 2)
nIndex = 1;
BOOL bShowOk = m_ShowRoleB.ShowRole ( _MALE_ROLE_B+(m_btSex-1)*3, m_RolePos, m_RoleZoom, 0, nIndex );
if (bShowOk && !m_bSelRoleOk)
{
m_bSelRoleOk = true;
EnableCreate(true);
}
}
}
break;
case 3:
{
if (m_bSelected)
{
if(m_ShowRoleC.ShowRole(_MALE_ROLE_C,m_RolePos,m_RoleZoom,0,3))
ReInit();
}
else
{
int nIndex = 2;
if (m_btSex == 2)
nIndex = 1;
BOOL bShowOk = m_ShowRoleC.ShowRole ( _MALE_ROLE_C+(m_btSex-1)*3, m_RolePos, m_RoleZoom, 0, nIndex );
if (bShowOk && !m_bSelRoleOk)
{
m_bSelRoleOk = true;
EnableCreate(true);
}
}
}
break;
default:
break;
}
if (m_nRoleSelIndex!=0 && m_bSelRoleOk)
{
m_ImgRoleSel.Show(0,0);
m_ImgFaceSelBk.Show(0,0);
m_ImgDataBk.Show(0,0);
// Show the edit
m_RoleCreateNameEdt.Show ( -1, -3 ) ;
// Show the button
m_BtnRight1.Show ( 0, 0 ) ;
m_BtnLeft1.Show ( 0, 0 ) ;
m_BtnChgFace.Show(0,0);
m_ImgFace.Show(0,0);
m_BtnRight2.Show ( 0, 0 ) ;
m_BtnLeft2.Show ( 0, 0 ) ;
m_BtnChgBody.Show(0,0);
m_BtnRight3.Show ( 0, 0 ) ;
m_BtnLeft3.Show ( 0, 0 ) ;
m_RoleCreateOkBtn.Show ( 0, 0 ) ;
m_RoleCreateExitBtn.Show ( 0, 0 ) ;
m_BtnReset.Show(0,0);
// Show the statics
m_RoleCreateDataSta.Show(0,0);
m_StaSex.Show(0,0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -