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

194 lines
4.1 KiB
C++

#include "stdafx.h"
#include <toolkit/XStringUtil.h>
#include "SGameManager.h"
#include "SGameMessage.h"
//#include "SGameMessageUI.h"
#include "SMessengerMgr.h"
#include "SChatType.h"
//#include "KUIControl.h"
#include "KUIControlEdit.h"
#include "SUITeamWnd.h"
#include "Arena\\ArenaSystem.h"
#include "Arena\\ArenaJoinSituationChecker.h"
#include "SStringDB.h"
#include "SGameSystem.h"
extern SGameSystem* g_pCurrentGameSystem;
namespace
{
const int g_LimitText = 16; // Edit 컨트롤 최대 텍스트.
}
SUITeamWnd::SUITeamWnd( SGameManager * pGameManager ) :
SUIWnd( pGameManager ),
m_EditName( NULL )
{
}
SUITeamWnd::~SUITeamWnd()
{
Release();
}
void SUITeamWnd::Release()
{
}
SUIWnd* SUITeamWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
int k=0;
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
return this;
}
bool SUITeamWnd::InitControls( KPoint kPos )
{
// 에디트 박스 리밋
/// 2011.10.13 - prodongi
KUIControlEdit * pEdit = dynamicCast< KUIControlEdit * >( GetChild( "box_edit_01" ) );
if( pEdit )
{
pEdit->SetLimitation( g_LimitText );
pEdit->SetLineChange( false );
pEdit->SetText("");
pEdit->SetCaption("");
pEdit->UseEmoticonFilter( false );
pEdit->SetFont( "font_02" );
pEdit->SetSpaceLimit( true ); // 2011. 11. 2 - marine 스페이스 금지
pEdit->SetPasteLimit( true ); // 2011. 11. 2 - marine 붙여넣기 금지
}
m_EditName = pEdit;
return SUIWnd::InitControls( kPos );
}
void SUITeamWnd::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 );
setDefaultPartyName(); /// 2011.10.13 - prodongi
}
SUIWnd::OnNotifyUIWindowOpen( bOpen, bLimitWnd );
}
void SUITeamWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
MovePos( pMoveMsg->m_nX - GetRect().GetWidth() / 2, pMoveMsg->m_nY - GetRect().GetHeight() / 2 );
pMsg->bUse = true;
}
break;
case IMSG_SHOW_UIWINDOW:
pMsg->bUse = true;
break;
//case IMSG_UI_GUILD_TEAM: //공격대결성.
//
// pMsg->bUse = true;
// break;
}
}
void SUITeamWnd::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" ) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM, false ) );
}
// 확인.
else if( !::_stricmp( lpszControlID, "button_ok" ) )
{
// 공대결성 메세지 전송.
SMSG_CHATTING_REQUEST msg;
msg.type = CHAT_TYPE::CHAT_NORMAL;
msg.strText = "/rpcreate ";
msg.strText.append( m_EditName->GetText() );
m_pGameManager->ProcMsgAtStatic( &msg );
//m_pGameManager->ProcMsgAtStatic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID::MSGBOX_ITEMDROPCHECK, m_EditName->GetText() ) ); // 텍스트 확인용
/// 2011.10.13 - prodongi
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM, false ) );
}
break;
// 윈도우 이동
case KUI_MESSAGE::KGENWND_MOVE:
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
DWORD SUITeamWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
{
switch( dwMessage )
{
case KLBUTTON_DOWN :
// Edit.
if( m_EditName->GetRect().IsInRect( x, y ) )
m_EditName->SetFocus( true );
break;
}
return SUIWnd::OnMouseMessage(dwMessage, x, y);
}
void SUITeamWnd::setDefaultPartyName()
{
char const* guildName = m_GuildMgr.GetGuildName();
m_EditName->setGhostText(guildName);
}