📄 dlgrolecreate.cpp
字号:
}
void CDlgRoleCreate::OnRolecreateBtnOk()
{
DXPlaySound ( "Sound/Dlg_Ok.wav" ) ;
if ( m_strAccount[0] == 0 )
{
CDlgRoleCreate::GetParent()->PostMessage( WM_MY_MESSAGE, ON_MSG_WARNING, 10035 ) ;
return;
}
if ( m_strPassword[0] == 0 )
{
CDlgRoleCreate::GetParent()->PostMessage( WM_MY_MESSAGE, ON_MSG_WARNING, 10036 ) ;
return;
}
m_RoleCreateNameEdt.GetWindowText ( m_strRoleName, 16 ) ;
if(!StringCheck(m_strRoleName))
{
g_objGameMsg.AddMsg(g_objGameDataSet.GetStr(100500));
return;
}
if ( m_strRoleName[0] == 0 || strlen ( m_strRoleName ) < 4 )
{
CDlgRoleCreate::GetParent()->PostMessage( WM_MY_MESSAGE, ON_MSG_WARNING, 10037 ) ;
return;
}
CDlgRoleCreate::GetParent()->PostMessage( WM_MY_MESSAGE, ON_ROLECREATE_CREATE ) ;
}
void CDlgRoleCreate::SetAcnAndPsw(const char *strAccount, const char *strPassword)
{
strcpy ( m_strAccount, strAccount ) ;
strcpy ( m_strPassword, strPassword ) ;
}
void CDlgRoleCreate::ReInit()
{
m_ShowRoleA.Reset();
m_ShowRoleB.Reset();
m_ShowRoleC.Reset();
m_RoleZoom = 120;
m_RolePos.x = 0;
m_RolePos.y = 0;
m_bSelected = false;
EnableCreate(false);
m_nRoleSelIndex = 0;
m_nLookIndex = 0;
m_btSex = 1;
m_StaSex.SetWindowText((char*)g_objGameDataSet.GetStr(10031));
m_ImgFace.RemoveImage();
m_ImgFace.InsertImage(NULL,m_nLookIndex ,m_btSex , true);
SetRoleFace();
m_bSelRoleOk = false;
}
void CDlgRoleCreate::OnRolecreateBtnExit()
{
DXPlaySound ( "Sound/Dlg_Ok.wav" ) ;
CreateExit();
}
void CDlgRoleCreate::OnRolechooseMimg1()
{
m_Img1.EnableWindow(false);
m_Img2.EnableWindow(false);
m_Img3.EnableWindow(false);
m_nRoleSelIndex = 1;
m_RoleCreateDataSta.SetWindowText((char*)g_objGameDataSet.GetStr(10383)); //职业介绍-魔法师
m_RolePos.x = 330;
m_RolePos.y = 650;
SetRoleFace();
}
void CDlgRoleCreate::OnRolechooseMimg2()
{
m_Img1.EnableWindow(false);
m_Img2.EnableWindow(false);
m_Img3.EnableWindow(false);
m_nRoleSelIndex = 2;
m_RoleCreateDataSta.SetWindowText((char*)g_objGameDataSet.GetStr(10384)); //职业介绍-战士
m_RolePos.x = 510;
m_RolePos.y = 630;
SetRoleFace();
CDlgRoleCreate::SetFocus();
}
void CDlgRoleCreate::CreateRole()
{
extern UINT g_uStatus ;
g_uStatus = _STATUS_REGISTER ;
switch(m_nRoleSelIndex)
{
case 0:
return;
break;
case 1:
m_btPro = PROFESSIONAL_ENCHANTER; //法师 10
break;
case 2:
m_btPro = PROFESSIONAL_WARRIOR; // 战士 = 20
break;
case 3:
m_btPro = PROFESSIONAL_KORADJI; // 异能者
break;
default:
break;
}
DWORD dwRealLook;
dwRealLook = (m_nLookIndex+1) * 10000 + m_btSex; // male = 1,female = 2 m_cLength = 1;
m_cFat = 1;
CMsgRegister msg;
if ( msg.Create( m_strAccount,
m_strRoleName,
m_strPassword,
dwRealLook,
m_btPro,
g_objHero.m_idAccount,
m_cLength,
m_cFat))
msg.Send();
DXPlaySound ( "Sound/Role_CreateO.wav" ) ;
CDlgRoleCreate::EnableWindow(false);
m_RoleCreateNameEdt.SetWindowText ( NULL ) ;
}
void CDlgRoleCreate::CreateReset()
{
m_btSex = 1;
m_StaSex.SetWindowText((char*)g_objGameDataSet.GetStr(10031));
m_nLookIndex = 0;
m_ImgFace.RemoveImage();
m_ImgFace.InsertImage(NULL,m_nLookIndex ,m_btSex , true);
m_bSelected = true;
SetRoleFace();
EnableCreate(false);
CDlgRoleCreate::SetFocus();
}
void CDlgRoleCreate::CreateExit()
{
CDlgRoleCreate::EnableWindow(false) ;
CDlgRoleCreate::GetParent ()->PostMessage ( WM_MY_MESSAGE, ON_ROLECHOOSE_RETURN ) ;
}
void CDlgRoleCreate::OnRolecreateBtnReset()
{
// TODO: Add your control notification handler code here
DXPlaySound ( "Sound/Dlg_Ok.wav" ) ;
CreateReset();
}
void CDlgRoleCreate::OnRolechooseMimg3()
{
// TODO: Add your control notification handler code here
this->MessageBox( g_objGameDataSet.GetStr ( 10039 ), g_objGameDataSet.GetStr ( 10040 ) ) ; //这个职业未开放!
return;
m_Img1.EnableWindow(false);
m_Img2.EnableWindow(false);
m_Img3.EnableWindow(false);
m_nRoleSelIndex = 3;
m_RoleCreateDataSta.SetWindowText((char*)g_objGameDataSet.GetStr(10385)); //职业介绍-异能者
SetRoleFace();
m_RolePos.x = 690;
m_RolePos.y = 650;
CDlgRoleCreate::SetFocus();
}
void CDlgRoleCreate::EnableCreate(BOOL bFlag)
{
// Init the button
m_RoleCreateOkBtn.EnableWindow(bFlag);
m_RoleCreateExitBtn.EnableWindow(bFlag);
m_BtnReset.EnableWindow(bFlag);
m_BtnRight1.EnableWindow(bFlag);
m_BtnLeft1.EnableWindow(bFlag) ;
m_BtnChgFace.EnableWindow(bFlag);
m_BtnRight2.EnableWindow(bFlag) ;
m_BtnLeft2.EnableWindow(bFlag) ;
m_BtnChgBody.EnableWindow(bFlag);
m_BtnRight3.EnableWindow(bFlag) ;
m_BtnLeft3.EnableWindow(bFlag) ;
if(bFlag)
m_RoleCreateNameEdt.SetFocus();
else
CDlgRoleCreate::SetFocus();
}
void CDlgRoleCreate::OnBtnLeft3()
{
// TODO: Add your control notification handler code here
DXPlaySound("Sound/up_Page.wav");
if (m_btSex == 2)
{
m_btSex = 1;
m_StaSex.SetWindowText((char*)g_objGameDataSet.GetStr(10031));
}
else
{
m_btSex = 2;
m_StaSex.SetWindowText((char*)g_objGameDataSet.GetStr(10030));
}
m_nLookIndex = 0;
SetRoleFace();
m_ImgFace.RemoveImage();
m_ImgFace.InsertImage(NULL,m_nLookIndex ,m_btSex , true);
}
void CDlgRoleCreate::OnBtnRight3()
{
// TODO: Add your control notification handler code here
DXPlaySound("Sound/up_Page.wav");
if (m_btSex == 2)
{
m_btSex = 1;
m_StaSex.SetWindowText((char*)g_objGameDataSet.GetStr(10031));
}
else
{
m_btSex = 2;
m_StaSex.SetWindowText((char*)g_objGameDataSet.GetStr(10030));
}
m_nLookIndex = 0;
SetRoleFace();
m_ImgFace.RemoveImage();
m_ImgFace.InsertImage(NULL,m_nLookIndex ,m_btSex , true);
}
void CDlgRoleCreate::ProcessRoleShow(BOOL bBack)
{
if (!bBack)
{
switch(m_nRoleSelIndex)
{
case 1:
if (m_RoleZoom <= 150)
m_RoleZoom++;
if (m_RolePos.x <= 510)
m_RolePos.x +=2;
break;
case 2:
if (m_RoleZoom <= 150)
m_RoleZoom++;
break;
case 3:
if (m_RoleZoom <= 150)
m_RoleZoom++;
if (m_RolePos.x >= 510)
m_RolePos.x-=2;
break;
default:
break;
}
}
}
void CDlgRoleCreate::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnLButtonDown(nFlags, point);
}
void CDlgRoleCreate::OnBtnChgbody()
{
// TODO: Add your control notification handler code here
DXPlaySound("Sound/Dlg_Ok.wav");
}
void CDlgRoleCreate::OnBtnChgface()
{
// TODO: Add your control notification handler code here
DXPlaySound("Sound/Dlg_Ok.wav");
}
void CDlgRoleCreate::OnBtnLeft1()
{
// TODO: Add your control notification handler code here
DXPlaySound("Sound/up_Page.wav");
int nAmount = g_obj3DRoleData.GetMaleFaceAmount();
if (m_btSex == 2)
nAmount = g_obj3DRoleData.GetFemaleFaceAmount();
if (m_nLookIndex >0)
{
m_nLookIndex--;
}
else
{
m_nLookIndex = nAmount-1;
}
m_ImgFace.RemoveImage();
m_ImgFace.InsertImage(NULL,m_nLookIndex ,m_btSex , true);
SetRoleFace();
}
void CDlgRoleCreate::OnBtnRight1()
{
// TODO: Add your control notification handler code here
DXPlaySound("Sound/up_Page.wav");
int nAmount = g_obj3DRoleData.GetMaleFaceAmount();
if (m_btSex == 2)
nAmount = g_obj3DRoleData.GetFemaleFaceAmount();
if (m_nLookIndex < nAmount - 1)
{
m_nLookIndex++;
}
else
{
m_nLookIndex = 0;
}
m_ImgFace.RemoveImage();
m_ImgFace.InsertImage(NULL,m_nLookIndex ,m_btSex , true);
SetRoleFace();
}
void CDlgRoleCreate::SetRoleFace()
{
switch(m_nRoleSelIndex)
{
case 0:
m_ShowRoleA.SetLook(m_btSex);
m_ShowRoleA.SetHead(m_nLookIndex);
m_ShowRoleB.SetLook(m_btSex);
m_ShowRoleB.SetHead(m_nLookIndex);
m_ShowRoleC.SetLook(m_btSex);
m_ShowRoleC.SetHead(m_nLookIndex);
break;
case 1:
m_ShowRoleA.SetLook(m_btSex);
m_ShowRoleA.SetHead(m_nLookIndex);
break;
case 2:
m_ShowRoleB.SetLook(m_btSex);
m_ShowRoleB.SetHead(m_nLookIndex);
break;
case 3:
m_ShowRoleC.SetLook(m_btSex);
m_ShowRoleC.SetHead(m_nLookIndex);
break;
default:
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -