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

230 lines
5.3 KiB
C++

#include "stdafx.h"
#include "SUICommunity.h"
#include "SUICommunityFriend.h"
#include "SUICommunityCut.h"
#include "SUICommunityGuild.h"
#include "KUITabControl.h"
#include "SStringDB.h"
#include "SMessage.h"
//#include "SGameMessageUI.h"
#include "SGameManager.h"
#include "SGameMessage.h"
#include "SMessengerMgr.h"
namespace
{
enum { // 탭 타입
TAB_FRIEND = 0,
TAB_CUT,
// TAB_GUILD,
};
};
//
// bintitle. 2010.06.18.
// [ 길드UI ] 가 추가되었으므로 기존에 커뮤니티에 포함된 [ 길드 ] 탭은 제거합니다.
//
SUICommunityWnd::SUICommunityWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUIWnd( pGameManager ), m_nTabType(-1), m_pFriendChild(NULL), m_pCutChild(NULL), m_pGuildChild(NULL), m_pDisplayInfo( pDisplayInfo )
{
}
SUICommunityWnd::~SUICommunityWnd()
{
}
SUIWnd* SUICommunityWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
//친구
SUICommunityFriend* pFriend = new SUICommunityFriend( m_pGameManager, m_pDisplayInfo );
pFriend->CreateWnd( "window_messenger_friend.nui", pWndManager, KPoint(kPos.x, kPos.y+40) );
pFriend->SetParent(this);
//차단
SUICommunityCut* pCut = new SUICommunityCut( m_pGameManager, m_pDisplayInfo );
pCut->CreateWnd( "window_messenger_cut.nui", pWndManager, KPoint(kPos.x, kPos.y+40) );
pCut->SetParent(this);
////길드
//SUICommunityGuild* pGuild = new SUICommunityGuild( m_pGameManager, m_pDisplayInfo );
//pGuild->CreateWnd( "window_messenger_guild.nui", pWndManager, KPoint(kPos.x, kPos.y+40) );
//pGuild->SetParent(this);
AddChild(pFriend); m_pFriendChild = pFriend;
AddChild(pCut); m_pCutChild = pCut;
// AddChild(pGuild); m_pGuildChild = pGuild;
#ifdef ONLYGUILD
ShowTabChild(TAB_GUILD);
#else
ShowTabChild(TAB_FRIEND);
#endif
return this;
}
bool SUICommunityWnd::InitControls( KPoint kPos )
{
// 커스텀 윈도우 move 영역 설정
SetCustomMovingRect( KRect( 0,0,215,20 ) );
KUISimpleTabControl* pTab = dynamicCast<KUISimpleTabControl*>(GetChild( "tab00" ));
if( NULL != pTab )
{
//TODO : 하드 코딩
pTab->SetTabProperty( 0, false, 2 );
pTab->AddTabItem( S(6365), S(6365) ); //친구
pTab->AddTabItem( S(6367), S(6367) ); //차단
// pTab->AddTabItem( S(6366), S(6366) ); //길드
//#ifdef ONLYGUILD
// pTab->SetSelectedItem( 2 );
// //본섭에는 친구기능을 아야 하기 때문에 여기서 Disable
// pTab->Disable();
//#else
// pTab->SetSelectedItem( 0 );
//#endif
pTab->SetSelectedItem( 0 );
}
return SUIWnd::InitControls( kPos );
}
bool SUICommunityWnd::InitData( bool bReload /*= false*/ )
{
return SUIWnd::InitData( bReload );
}
void SUICommunityWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_COMMUNITY, false) );
}
}
break;
case KUI_MESSAGE::KSCROLL_SELECT: // 스크롤 선택
{
}
break;
case KUI_MESSAGE::KFOCUS_ACTIVATED :
{
}
break;
case KUI_MESSAGE::KGENWND_MOVE:
{
LimitMoveWnd();
}
break;
case KUI_MESSAGE::KTAB_SELECT: // 탭 변경
#ifndef ONLYGUILD
//본섭에는 친구 기능 막는다. 항상 디폴트로 길드탭만 보여지게 한다.
ShowTabChild((int)lparam);
#endif
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUICommunityWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch(pMsg->nType)
{
case MSG_CHANGE_NAME :
{
}
break;
case IMSG_UI_SEND_DATA:
{
SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg;
// AziaMafia Fix guild
if( pData->m_strString == "guild_update" )
{
m_pGuildChild->GuildUpdate();
}
//
if( pData->m_strString == "friend_update" )
{
m_pFriendChild->FriendUpdate();
}
else if( pData->m_strString == "cut_update" )
{
m_pCutChild->CutUpdate();
}
}
break;
case IMSG_UI_FRIEND_UPDATE:
{
SIMSG_UI_FRIEND_UPDATE* pUpdateMsg = (SIMSG_UI_FRIEND_UPDATE*)pMsg;
m_pFriendChild->FriendStatusChange( pUpdateMsg->strCharName.c_str() );
}
break;
case IMSG_UI_INPUTTEXT:
{
SIMSG_UI_INPUTTEXT *pTextInput = dynamicCast<SIMSG_UI_INPUTTEXT *>(pMsg);
if( pTextInput->m_strText.length() <= 0 ) return;
if( pTextInput->m_Sender == SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FRIEND )
{
m_pFriendChild->ReqAddFriend( false, pTextInput->m_strText.c_str() );
}
else if( pTextInput->m_Sender == SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CUT )
{
m_pCutChild->ReqAddCut( pTextInput->m_strText.c_str() );
}
}
break;
}
}
void SUICommunityWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd /* = true*/ )
{
if( bOpen )
{
m_pGameManager->StartSound( "ui_popup_window01.wav" );
}
else
{
}
SUIWnd::OnNotifyUIWindowOpen( bOpen, bLimitWnd );
}
void SUICommunityWnd::ShowTabChild( int nTabType )
{
if( nTabType == m_nTabType ) return;
m_nTabType = nTabType;
SetChildShow( "window_messenger_friend", ( TAB_FRIEND == m_nTabType ) );
SetChildShow( "window_messenger_cut", ( TAB_CUT == m_nTabType ) );
// SetChildShow( "window_messenger_guild", ( TAB_GUILD == m_nTabType ) );
switch( m_nTabType )
{
case TAB_FRIEND:
{}
break;
case TAB_CUT:
{
}
break;
//case TAB_GUILD:
// {
// }
// break;
}
}