233 lines
6.0 KiB
C++
233 lines
6.0 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 "KUIControlButton.h"
|
|
#include "SUIClassPopupWnd.h"
|
|
|
|
SUIClassPopupWnd::SUIClassPopupWnd( SGameManager * pGameManager ) :
|
|
SUIWnd( pGameManager ),
|
|
m_nBtnCount( 0 ) // 버튼개수.
|
|
{
|
|
}
|
|
|
|
|
|
SUIClassPopupWnd::~SUIClassPopupWnd()
|
|
{
|
|
Release();
|
|
}
|
|
|
|
void SUIClassPopupWnd::Release()
|
|
{
|
|
// 버튼컨트롤 배열.
|
|
SAFE_DELETE_ARRAY( m_arrBtnControl );
|
|
}
|
|
|
|
SUIWnd* SUIClassPopupWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
|
|
{
|
|
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
|
|
|
|
|
|
return this;
|
|
}
|
|
|
|
|
|
bool SUIClassPopupWnd::InitControls( KPoint kPos )
|
|
{
|
|
// 등급명의 텍스트 데코레이션 뽑아내기.
|
|
string strOrg( GetChild( "guild_sub_menu_list_01" )->GetCaption() );
|
|
std::string::size_type sizeEnd = strOrg.find_last_of( ">" );
|
|
m_TextDecoration = strOrg.substr( 0, ++sizeEnd );
|
|
|
|
|
|
//
|
|
// 버튼컨트롤 포인터 로드.
|
|
|
|
m_nBtnCount = 6;//SGuildMgr::E_AUTHORITY::AUTHORITY_MAX - 1; // 버튼개수.
|
|
m_arrBtnControl = new KUIControl *[ m_nBtnCount ]; // 버튼컨트롤 배열.
|
|
|
|
for( int i=0; i<m_nBtnCount; ++i )
|
|
{
|
|
m_arrBtnControl[ i ] = dynamicCast< KUIControl * >( GetChild( CStringUtil::StringFormat( "guild_sub_menu_list_0%d", (i+1) ).c_str() ) );
|
|
KUIControlButton * pBtn = dynamicCast< KUIControlButton * >( m_arrBtnControl[ i ] );
|
|
pBtn->SetEnableColor( "<#ffffff>" );
|
|
pBtn->Enable();
|
|
}
|
|
|
|
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
|
|
void SUIClassPopupWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
|
|
{
|
|
if( bOpen )
|
|
{
|
|
this->SetShow( true );
|
|
|
|
// 기존 포커스 제거.
|
|
this->m_pManager->RemoveWnd( this );
|
|
|
|
// wnd 출력 리스트의 최하단에 추가. ( wnd 들중 가장 상위에 뜨게 된다. )
|
|
this->m_pManager->AddWnd( this );
|
|
|
|
// 가장위에 뜨도록 한다.
|
|
this->m_pManager->SetFocus( this );
|
|
|
|
|
|
// 등급명 설정.
|
|
SetClassName();
|
|
}
|
|
}
|
|
|
|
|
|
void SUIClassPopupWnd::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 );
|
|
|
|
if( this->IsShow() )
|
|
{
|
|
// 기존 포커스 제거.
|
|
this->m_pManager->RemoveWnd( this );
|
|
|
|
// wnd 출력 리스트의 최하단에 추가. ( wnd 들중 가장 상위에 뜨게 된다. )
|
|
this->m_pManager->AddWnd( this );
|
|
}
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
void SUIClassPopupWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch( nMessage )
|
|
{
|
|
|
|
case KUI_MESSAGE::KBUTTON_CLICK :
|
|
|
|
{
|
|
// 여러 등급중 하나 선택.
|
|
string strID( lpszControlID );
|
|
if( strID.npos != strID.find( "guild_sub_menu_list" ) )
|
|
{
|
|
// 등급.
|
|
std::string::size_type strIndex = strID.find_last_of("_");
|
|
int nClass = ::atoi( strID.substr( ++strIndex ).c_str() );
|
|
|
|
// 내정보.
|
|
SPlayerInfo pSelf = m_PlayerInfoMgr.GetPlayerInfo();
|
|
SPlayerSlot * pSelfSlot = this->m_GuildMgr.FindMember( pSelf.GetName() );
|
|
|
|
//// 등급비교. 자신보다 등급이 높은경우 등급변경 불가. 낮은게 높음.
|
|
//if( nClass < pSelfSlot->GetAuthority() )
|
|
//{
|
|
// m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S( 1918 ) ) ); // stringdb string db 필요.
|
|
//}
|
|
//else
|
|
//{
|
|
// 등급설정처리.
|
|
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES,
|
|
//CStringUtil::StringFormat( "%d", nClass ).c_str() ) ); // 텍스트 확인용
|
|
|
|
|
|
// 길드원등급 설정 팝업 윈도우에 메세지 전송.( 등급명 )
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_GUILD_WNDMSG( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_CLASS, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_CLASS,
|
|
IMSG_UI_GUILD_CLASSNAME,
|
|
//std::string( GetChild( lpszControlID )->GetCaption() ), // 등급명.
|
|
std::string( m_GuildMgr.GetAuthorityClassName( _PERMISSION::PERMISSION_LEADER - nClass - 1 ) ),
|
|
nClass ) // 등급.
|
|
);
|
|
|
|
|
|
|
|
// }
|
|
|
|
// Close.
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUBMENU_CLASS_RIGHTCLICK, false ) );
|
|
}
|
|
}
|
|
|
|
|
|
//// 확인.
|
|
//if( !::_stricmp( lpszControlID, "button_ok" ) )
|
|
//{
|
|
//
|
|
//}
|
|
|
|
break;
|
|
|
|
|
|
// 윈도우 이동
|
|
case KUI_MESSAGE::KGENWND_MOVE:
|
|
|
|
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
|
|
|
|
|
|
DWORD SUIClassPopupWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
/*switch( dwMessage )
|
|
{
|
|
case KLBUTTON_DOWN :
|
|
|
|
|
|
break;
|
|
|
|
}*/
|
|
|
|
return SUIWnd::OnMouseMessage(dwMessage, x, y);
|
|
}
|
|
|
|
|
|
// 등급명 설정.
|
|
void SUIClassPopupWnd::SetClassName()
|
|
{
|
|
//int nClass = _PERMISSION::PERMISSION_MEMBER_MAX;
|
|
//for( int i=0; i<m_nBtnCount; ++i, nClass-- )
|
|
//{
|
|
// /*std::string strCaption( m_TextDecoration );
|
|
// strCaption.append( m_GuildMgr.GetAuthorityClassName( i ) );
|
|
// m_arrBtnControl[ i ]->SetCaption( strCaption.c_str() );*/
|
|
|
|
// //m_arrBtnControl
|
|
|
|
// m_arrBtnControl[ i ]->SetCaption( CStringUtil::StringFormat( "<size:7><hcenter><left>%d <#ffffff><$1854:등급> %s",
|
|
// i+1, m_GuildMgr.GetAuthorityClassName( nClass - 1 ) ).c_str() );
|
|
//}
|
|
|
|
int nClass = _PERMISSION::PERMISSION_MEMBER_MAX;
|
|
KUIControl * pControl;
|
|
for( int i=0; i<m_nBtnCount; ++i, nClass-- )
|
|
{
|
|
pControl = m_arrBtnControl[ i ];
|
|
if( pControl )
|
|
{
|
|
pControl->SetCaption( CStringUtil::StringFormat( "<font:font_02><size:%d><hcenter><left>%d <#ffffff><$1854:등급> %s",
|
|
pControl->GetFontSize(), i+1, m_GuildMgr.GetAuthorityClassName( nClass - 1 ) ).c_str() );
|
|
pControl->CutCaptionNTooltip();
|
|
}
|
|
}
|
|
} |