Files
2026-06-01 12:46:52 +02:00

198 lines
4.4 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 "KUIControl.h"
#include "KUIControlEdit.h"
#include "SUIInvitationWnd.h"
namespace
{
const int g_LimitText = 20; // Edit 컨트롤 최대 텍스트.
}
SUIInvitationWnd::SUIInvitationWnd( SGameManager * pGameManager ) :
SUIWnd( pGameManager ),
m_EditName( NULL )
{
}
SUIInvitationWnd::~SUIInvitationWnd()
{
Release();
}
void SUIInvitationWnd::Release()
{
}
SUIWnd* SUIInvitationWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
return this;
}
bool SUIInvitationWnd::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;
return SUIWnd::InitControls( kPos );
}
void SUIInvitationWnd::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 );
////// Edit.
//if( m_EditName )
// m_EditName->SetFocus( true );
}
else
{
if( m_EditName )
m_EditName->SetText( "" );
m_EditName->SetFocus( false );
}
SUIWnd::OnNotifyUIWindowOpen( bOpen, bLimitWnd );
}
void SUIInvitationWnd::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;
}
}
void SUIInvitationWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK :
// close.
if( !::_stricmp( lpszControlID, "button_close_trim_01" ) || !::_stricmp( lpszControlID, "button_cancel" ) ) //servantes 2016.06.29
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_INVITATION, false ) );
}
// 확인.
else if( !::_stricmp( lpszControlID, "button_ok" ) ) //servantes 2011.06.29
{
//// 길드원 초대 메세지 전송.
//SMSG_CHATTING_REQUEST msg;
//msg.type = CHAT_TYPE::CHAT_NORMAL;
//msg.strText = "/길드추방 ";
//msg.strText.append( pStrMember );
//m_pGameManager->ProcMsgAtStatic( &msg );
std::string strName = m_EditName->GetText();
if( strName.size() < 1 || strName == "" )
{
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S(1931) ) ); // stringDB 필요.
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_GUILD_YES, S(1931) ) ); // stringDB 필요.
}
else
{
/// 2011.05.16 ProcMsgAtStatic는 정적 입력 변수이다 - prodongi
//m_pGameManager->ProcMsgAtStatic( new SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_INVITATION, strName ) );
m_pGameManager->ProcMsgAtStatic( &SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_INVITATION, strName ) );
m_EditName->SetText( "" ); // 에디트창 클리어.
}
}
break;
// 윈도우 이동
case KUI_MESSAGE::KGENWND_MOVE:
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
DWORD SUIInvitationWnd::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);
}