127 lines
3.2 KiB
C++
127 lines
3.2 KiB
C++
|
|
#include "stdafx.h"
|
|
#include "KUITabControl.h"
|
|
#include "SGameManager.h"
|
|
#include "SUICommunityCut.h"
|
|
#include "SGameMessage.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SStringDB.h"
|
|
#include "KUIControlList.h"
|
|
#include "SMessengerMgr.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
|
|
SUICommunityCut::~SUICommunityCut()
|
|
{
|
|
|
|
}
|
|
|
|
bool SUICommunityCut::InitControls( KPoint kPos )
|
|
{
|
|
// 커스텀 윈도우 move 영역 설정
|
|
KUIControIStringList* pList = dynamicCast<KUIControIStringList*>(GetChild("list"));
|
|
if( pList )
|
|
{
|
|
pList->SetItemGap(26);
|
|
pList->SetScroll(true);
|
|
pList->ShowOutLine(false);
|
|
}
|
|
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
|
|
bool SUICommunityCut::InitData( bool bReload /*= false*/ )
|
|
{
|
|
return SUIWnd::InitData( bReload );
|
|
}
|
|
|
|
void SUICommunityCut::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch( nMessage )
|
|
{
|
|
case KUI_MESSAGE::KBUTTON_CLICK:
|
|
{
|
|
if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
|
|
{
|
|
}
|
|
//servantes 2010.10.13
|
|
else if( ::_stricmp( lpszControlID, "button_add" ) == 0 )
|
|
{
|
|
CheckAddCutName();
|
|
}
|
|
//servantes 2010.10.13
|
|
else if( ::_stricmp( lpszControlID, "button_clear" ) == 0 )
|
|
{
|
|
ReqDelCut();
|
|
}
|
|
}
|
|
break;
|
|
case KUI_MESSAGE::KGENWND_MOVE:
|
|
{
|
|
LimitMoveWnd();
|
|
}
|
|
break;
|
|
}
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
void SUICommunityCut::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
|
|
}
|
|
|
|
void SUICommunityCut::CutUpdate()
|
|
{
|
|
KUIControIStringList* pList = dynamicCast<KUIControIStringList*>(GetChild("list"));
|
|
if( !pList ) return;
|
|
pList->ClearItem();
|
|
m_vacCutName.clear();
|
|
|
|
std::vector<SPlayerSlot*>& MemberList = m_CutMgr.GetMemberList();
|
|
for( int i(0); i<MemberList.size() && MemberList[i]; ++i )
|
|
{
|
|
std::string strName = CStringUtil::StringFormat( "<#fbe8ad><hcenter><vcenter>%s", MemberList[i]->GetName() ).c_str();
|
|
pList->AddItem( _STRITEM( strName.c_str() ) );
|
|
m_vacCutName.push_back(MemberList[i]->GetName());
|
|
}
|
|
}
|
|
|
|
void SUICommunityCut::CheckAddCutName()
|
|
{
|
|
const char* lpName = m_PlayerInfoMgr.GetTargetName();
|
|
bool bLocal = m_PlayerInfoMgr.IsLocalPlayer( m_PlayerInfoMgr.GetTarget() );
|
|
if( !bLocal && lpName && ::strlen(lpName) > 0 )
|
|
{
|
|
ReqAddCut(lpName);
|
|
return;
|
|
}
|
|
|
|
//타겟 없음 /*"이름 입력해 주세요"*/
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTTEXT( SIMSG_UI_REQ_INPUTTEXT::USAGE_ADD_CUTNAME, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_COMMUNITY, S(6789), 6780, 6791, 20, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CUT ) ); // [sonador][7.0.6] Mantis 0002624
|
|
}
|
|
|
|
void SUICommunityCut::ReqAddCut( const char* lpName )
|
|
{
|
|
SMSG_FRIEND_COMMAND* pMsg = new SMSG_FRIEND_COMMAND(SMSG_FRIEND_COMMAND::CUT_ADD, lpName);
|
|
m_pGameManager->PostMsgAtDynamic( pMsg );
|
|
}
|
|
|
|
void SUICommunityCut::ReqDelCut()
|
|
{
|
|
std::string SelectUserName;
|
|
GetSelectPlayerName( SelectUserName );
|
|
|
|
SMSG_FRIEND_COMMAND* pMsg = new SMSG_FRIEND_COMMAND(SMSG_FRIEND_COMMAND::CUT_DELETE, SelectUserName.c_str());
|
|
m_pGameManager->PostMsgAtDynamic( pMsg );
|
|
}
|
|
|
|
void SUICommunityCut::GetSelectPlayerName( std::string& rPlayerName )
|
|
{
|
|
KUIControIStringList* pList = dynamicCast<KUIControIStringList*>(GetChild("list"));
|
|
if( !pList ) return;
|
|
int nIndex( pList->GetIndex() );
|
|
|
|
if( m_vacCutName.size() > nIndex )
|
|
rPlayerName = m_vacCutName[nIndex];
|
|
}
|