395 lines
11 KiB
C++
395 lines
11 KiB
C++
|
|
#include "stdafx.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include "SStringDB.h"
|
|
#include "SGameManager.h"
|
|
#include "SGameMessage.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SMessengerMgr.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
//#include "KUIControl.h"
|
|
#include "KUIControlEdit.h"
|
|
#include "SUIClassManageWnd.h"
|
|
|
|
namespace
|
|
{
|
|
const int g_LimitText = 20; // Edit 컨트롤 최대 텍스트.
|
|
}
|
|
|
|
|
|
SUIClassManageWnd::SUIClassManageWnd( SGameManager * pGameManager ) :
|
|
SUIWnd( pGameManager ),
|
|
m_EditName( NULL ),
|
|
m_pClassName( NULL ),
|
|
m_nClass( 0 )
|
|
{
|
|
}
|
|
|
|
|
|
SUIClassManageWnd::~SUIClassManageWnd()
|
|
{
|
|
Release();
|
|
}
|
|
|
|
void SUIClassManageWnd::Release()
|
|
{
|
|
|
|
}
|
|
|
|
SUIWnd* SUIClassManageWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
|
|
{
|
|
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
|
|
|
|
|
|
return this;
|
|
}
|
|
|
|
|
|
bool SUIClassManageWnd::InitControls( KPoint kPos )
|
|
{
|
|
// 에디트 박스 리밋
|
|
KUIControlEdit * pEdit = dynamicCast< KUIControlEdit * >( GetChild( "text_02" ) );
|
|
if( pEdit )
|
|
{
|
|
pEdit->SetLimitation( g_LimitText );
|
|
pEdit->SetLineChange( false );
|
|
pEdit->SetText("");
|
|
pEdit->SetFontSize( 9 );
|
|
pEdit->SetCaption("");
|
|
pEdit->UseEmoticonFilter( false );
|
|
pEdit->SetFont( "font_02" );
|
|
}
|
|
m_EditName = pEdit;
|
|
|
|
// 길드 등급명 컨트롤.
|
|
m_pClassName = dynamicCast< KUIControl * >( GetChild( "text_01" ) );
|
|
|
|
// 등급명의 텍스트 데코레이션 뽑아내기.
|
|
string strOrg( m_pClassName->GetCaption() );
|
|
std::string::size_type sizeEnd = strOrg.find_last_of( ">" );
|
|
if( sizeEnd != std::string::npos )
|
|
m_strDecoClassName = strOrg.substr( 0, ++sizeEnd );
|
|
|
|
m_pBtnOpenMenu = GetChild( "button_sub_menu_02" ); // 등급명 팝업 메뉴 오픈 버튼.
|
|
|
|
//m_strDecoClassName;
|
|
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
|
|
void SUIClassManageWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
|
|
{
|
|
// Open.
|
|
if( bOpen )
|
|
{
|
|
/* if( m_EditName )
|
|
m_EditName->SetText( " " );
|
|
if( m_pClassName )
|
|
m_pClassName->SetCaption( " " );*/
|
|
|
|
this->SetShow( true );
|
|
|
|
// 기존 포커스 제거.
|
|
this->m_pManager->RemoveWnd( this );
|
|
|
|
// wnd 출력 리스트의 최하단에 추가. ( wnd 들중 가장 상위에 뜨게 된다. )
|
|
this->m_pManager->AddWnd( this );
|
|
|
|
// 가장위에 뜨도록 한다.
|
|
this->m_pManager->SetFocus( this );
|
|
|
|
// Edit.
|
|
//m_EditName->SetFocus( true );
|
|
//static_cast< KUIControlEdit * >( GetChild( "text_02" ) )->SetFocus( true );
|
|
|
|
// Open 을 길드관리_길드원관리 패널에 알린다.
|
|
//m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_GUILD_WNDMSG( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_MAINWND, IMSG_UI_GUILD_MEMBERCLASS_SETUP )
|
|
|
|
}
|
|
// Close.
|
|
else
|
|
{
|
|
m_EditName->SetFocus( false );
|
|
|
|
/*if( m_EditName )
|
|
m_EditName->SetText( " " );
|
|
if( m_pClassName )
|
|
m_pClassName->SetCaption( " " );*/
|
|
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, "닫기호출" ) ); // 텍스트 확인용
|
|
|
|
// 등급팝업닫기.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUBMENU_CLASS_RIGHTCLICK, false ) );
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void SUIClassManageWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch( pMsg->nType )
|
|
{
|
|
case IMSG_UI_MOVE:
|
|
{
|
|
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
|
|
|
|
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
|
|
case IMSG_SHOW_UIWINDOW:
|
|
pMsg->bUse = true;
|
|
break;
|
|
|
|
// 길드등급명 반환.
|
|
case IMSG_UI_GUILD_CLASSNAME :
|
|
{
|
|
SIMSG_UI_GUILD_WNDMSG * pData = dynamicCast< SIMSG_UI_GUILD_WNDMSG * >( pMsg );
|
|
|
|
m_nClass = pData->nData; // 등급.
|
|
|
|
// 등급 수정. 왜?!!
|
|
// 서버는 부길마가 6 등급, UI 상에선 부길마가 1등급.... 이니까!!!!!!!. 부디 헷갈리지않길...
|
|
m_nClass = _PERMISSION::PERMISSION_LEADER - m_nClass;
|
|
|
|
|
|
// Edit 의 데코에 맞게 텍스트 변형
|
|
std::string strOrg( pData->strData.c_str() );
|
|
ModifyText( strOrg );
|
|
m_pClassName->SetCaption( strOrg.c_str() ); // 길드등급명 적용.
|
|
m_pClassName->CutCaptionNTooltip();
|
|
}
|
|
break;
|
|
|
|
|
|
// 길드맴버 팝업메뉴( 등급관리 ) -> 길드원관리패널( 길드원등급 팝업 오픈 )
|
|
case IMSG_UI_GUILD_MEMBERCLASS_SETUP :
|
|
{
|
|
SIMSG_UI_GUILD_WNDMSG * pMsgData = dynamicCast< SIMSG_UI_GUILD_WNDMSG * >( pMsg );
|
|
|
|
// 데코 제외 순수 텍스트만 뽑아내기.
|
|
std::string strOrg( pMsgData->strData );
|
|
std::string::size_type size = strOrg.find_last_of( ">" );
|
|
if( size != std::string::npos )
|
|
strOrg = strOrg.substr( ++size );
|
|
|
|
if( strOrg.size() > 0 && strOrg != "" )
|
|
{
|
|
//::MessageBox( NULL, strOrg.c_str(), "NAME", MB_OK );
|
|
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES,
|
|
// strOrg.c_str() ) ); // 텍스트 확인용
|
|
|
|
// 캐릭터명 설정.
|
|
m_EditName->SetText( ( strOrg ).c_str() );
|
|
|
|
// 등급명.
|
|
if( pMsgData->strData_2 == "" )
|
|
{
|
|
// 길드원 이름으로 길드원의 등급명 얻기.
|
|
SPlayerSlot * pPlayer = m_GuildMgr.GetPlayerByName( strOrg.c_str() );
|
|
if( pPlayer )
|
|
{
|
|
int nClass = pPlayer->GetAuthority();
|
|
if( nClass == 7 ) // 길드장.
|
|
strOrg = S(3508);
|
|
else
|
|
strOrg = m_GuildMgr.GetAuthorityClassName( nClass - 1 );
|
|
}
|
|
}
|
|
else
|
|
strOrg = pMsgData->strData_2;
|
|
|
|
size = strOrg.find_last_of( ">" );
|
|
if( size != std::string::npos )
|
|
strOrg = strOrg.substr( ++size );
|
|
|
|
m_pClassName->SetCaption( ( m_strDecoClassName + strOrg ).c_str() );
|
|
m_pClassName->CutCaptionNTooltip();
|
|
}
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void SUIClassManageWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch( nMessage )
|
|
{
|
|
|
|
case KUI_MESSAGE::KBUTTON_CLICK :
|
|
|
|
// close.
|
|
//servantes 2010.10.13
|
|
if( !::_stricmp( lpszControlID, "button_close" ) || !::_stricmp( lpszControlID, "button_cancel" ))
|
|
{
|
|
if( m_EditName )
|
|
m_EditName->SetText( "" );
|
|
if( m_pClassName )
|
|
m_pClassName->SetCaption( " " );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_CLASS, false ) );
|
|
}
|
|
|
|
|
|
// 확인.
|
|
else if( !::_stricmp( lpszControlID, "button_ok" ) )
|
|
{
|
|
ConfirmationButton();
|
|
}
|
|
|
|
// 등급 팝업 오픈용 버튼.
|
|
else if( !::_stricmp( lpszControlID, "button_sub_menu_02" ) )
|
|
{
|
|
//-----------------------
|
|
// 등급 팝업 메뉴.
|
|
|
|
// 위치이동.
|
|
KRect posButton_ok = m_pBtnOpenMenu->GetRect();
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUBMENU_CLASS_RIGHTCLICK,
|
|
posButton_ok.right, posButton_ok.top ) );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUBMENU_CLASS_RIGHTCLICK ) );
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
// 윈도우 이동
|
|
case KUI_MESSAGE::KGENWND_MOVE:
|
|
|
|
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
|
|
|
|
// 등급명 팝업 메뉴 이동.
|
|
KRect posButton_ok = m_pBtnOpenMenu->GetRect();
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUBMENU_CLASS_RIGHTCLICK,
|
|
posButton_ok.right, posButton_ok.top ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
|
|
|
|
|
|
DWORD SUIClassManageWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
switch( dwMessage )
|
|
{
|
|
case KLBUTTON_DOWN :
|
|
|
|
//// Edit.
|
|
//if( m_EditName->GetRect().IsInRect( x, y ) )
|
|
// m_EditName->SetFocus( true );
|
|
|
|
// Edit.
|
|
if( m_EditName && !m_EditName->GetRect().IsInRect( x, y ) )
|
|
{
|
|
m_EditName->SetFocus( false );
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return SUIWnd::OnMouseMessage(dwMessage, x, y);
|
|
}
|
|
|
|
|
|
// 확인버튼.
|
|
void SUIClassManageWnd::ConfirmationButton()
|
|
{
|
|
const char * pEditText = m_EditName->GetText();
|
|
SPlayerSlot * pPlayer = m_GuildMgr.FindMember( pEditText );
|
|
|
|
// 캐릭터명 검사.
|
|
if( pEditText == NULL || !::_stricmp( pEditText, " " ) || !::_stricmp( pEditText, "" ) )
|
|
{
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 622 ) ) );
|
|
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S(1931) ) );
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S(1931) ) );
|
|
return;
|
|
}
|
|
|
|
// 길드원.
|
|
if( pPlayer )
|
|
{
|
|
// 내정보.
|
|
SPlayerInfo pSelf = m_PlayerInfoMgr.GetPlayerInfo();
|
|
SPlayerSlot * pSelfSlot = this->m_GuildMgr.FindMember( pSelf.GetName() );
|
|
|
|
int nClass = pSelfSlot->GetAuthority();
|
|
|
|
// 길드장의 경우 변경 불가.
|
|
if( pPlayer->GetAuthority() == _PERMISSION::PERMISSION_LEADER )
|
|
{
|
|
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S(1919) ) ); // stringdb string db 필요.
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S(1919) ) ); // stringdb string db 필요.
|
|
return;
|
|
}
|
|
|
|
|
|
// 등급비교. 자신보다 등급이 높은경우 등급변경 불가.
|
|
if( nClass > pPlayer->GetAuthority() )
|
|
{
|
|
// 등급설정처리.
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES,
|
|
// CStringUtil::StringFormat( "등급:%d, %s, %s", m_nClass, pEditText, m_pClassName->GetCaption() ).c_str() ) ); // 텍스트 확인용
|
|
|
|
// 등급명 검사.
|
|
std::string strClassName( m_pClassName->GetCaption() );
|
|
if( strClassName.empty() || strClassName == " " || strClassName == m_strDecoClassName )
|
|
{
|
|
// 메세지 출력 필요.
|
|
// 등급명을 선택하시오. stringDB 필요.
|
|
return;
|
|
}
|
|
|
|
// 등급변경 요청.
|
|
m_pGameManager->PostMsgAtDynamic( new SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_AUTHORITY, std::string( pEditText ), m_nClass ) );
|
|
|
|
// 에디트창 클리어.
|
|
m_EditName->SetText( "" );
|
|
}
|
|
else
|
|
{
|
|
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1917 ) ) ); // stringdb string db 필요.
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1917 ) ) ); // stringdb string db 필요.
|
|
}
|
|
|
|
}
|
|
// 비길드원 or 비존재캐릭터.
|
|
else
|
|
{
|
|
std::string strMsg( S( 1905 ) );
|
|
CStringUtil::ReplacePhrase( strMsg, "#@user_name@#", m_EditName->GetText() );
|
|
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, strMsg.c_str() ) ); // 텍스트 확인용
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, strMsg.c_str() ) ); // 텍스트 확인용
|
|
}
|
|
}
|
|
|
|
|
|
// Edit 의 데코에 맞게 텍스트 변형
|
|
void SUIClassManageWnd::ModifyText( std::string & strOrg )
|
|
{
|
|
// 데코 제외 순수 텍스트만 뽑아내기.
|
|
std::string::size_type size = strOrg.find_last_of( ">" );
|
|
|
|
// Edit 의 데코에 맞게 텍스트 변형
|
|
if( size != std::string::npos )
|
|
strOrg = m_strDecoClassName + strOrg.substr( ++size );
|
|
strOrg = m_strDecoClassName + strOrg;
|
|
} |