457 lines
11 KiB
C++
457 lines
11 KiB
C++
|
|
#include "stdafx.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include "KUIListControl.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlScroll.h"
|
|
#include "SGameManager.h"
|
|
#include "SGameMessage.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SMessengerMgr.h"
|
|
#include "SStringDB.h"
|
|
#include "SJobDB.h"
|
|
#include "SUIGuildApplicantTab.h"
|
|
|
|
SUIGuildApplicantTab::SUIGuildApplicantTab( SGameManager * pGameManager ) :
|
|
SUIWnd( pGameManager ),
|
|
m_pListGuild( NULL ),
|
|
m_pScrollBar( NULL ),
|
|
m_pSelectedControl( NULL ),
|
|
m_nScrollPos( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
SUIGuildApplicantTab::~SUIGuildApplicantTab()
|
|
{
|
|
Release();
|
|
}
|
|
|
|
void SUIGuildApplicantTab::Release()
|
|
{
|
|
SAFE_DELETE( m_pListGuild );
|
|
}
|
|
|
|
|
|
bool SUIGuildApplicantTab::InitControls( KPoint kPos )
|
|
{
|
|
// 선택된 아이템의 활성화 비쥬얼용 컨트롤.
|
|
m_pSelectedControl = GetChild( "select_orange" );
|
|
m_pSelectedControl->SetShow( false );
|
|
|
|
|
|
//
|
|
// ListControl 생성.
|
|
// SAFE_DELETE( m_pListGuild );
|
|
m_pListGuild = new KUIListControl( this, "listcontrol01", "header_base", "item_base", 10 );
|
|
|
|
//// Header column
|
|
m_pListGuild->AddStringHeaderColumn( "header_button_connection_state" );
|
|
m_pListGuild->AddStringHeaderColumn( "header_button_job" );
|
|
m_pListGuild->AddStringHeaderColumn( "header_button_level" );
|
|
m_pListGuild->AddStringHeaderColumn( "header_button_id" );
|
|
m_pListGuild->AddStringHeaderColumn( "header_button_agree" );
|
|
m_pListGuild->AddStringHeaderColumn( "header_button_refusal" );
|
|
|
|
// Item column
|
|
m_pListGuild->AddStringItemColumn( "item_icon_connection_state" );
|
|
m_pListGuild->AddStringItemColumn( "header_icon_job" );
|
|
m_pListGuild->AddStringItemColumn( "item_static_level" );
|
|
m_pListGuild->AddStringItemColumn( "item_static_id" );
|
|
m_pListGuild->AddStringItemColumn( "item_button_agree" );
|
|
m_pListGuild->AddStringItemColumn( "item_button_refusal" );
|
|
|
|
// Create
|
|
m_pListGuild->Create();
|
|
|
|
//// nui에서 설정된 윈도우 위치좌표.
|
|
//KRect rt = this->GetRect();
|
|
//kPos.x = rt.left; kPos.y = rt.top;
|
|
|
|
|
|
GetChild( "mark_sort_up_02" )->SetShow( false );
|
|
GetChild( "mark_sort_up_03" )->SetShow( false );
|
|
GetChild( "mark_sort_up_01" )->SetShow( false );
|
|
GetChild( "mark_sort_up_04" )->SetShow( false );
|
|
|
|
|
|
// 스크롤바.
|
|
// 2010.09.20 - prodongi
|
|
m_pScrollBar = dynamicCast< KUIControlVScrollEx* >(GetChild( "scrollbar_guild_list" ));
|
|
//m_pScrollBar = static_cast< KUIControlVScroll* >(GetChild( "scrollbar_guild_list" ));
|
|
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
|
|
void SUIGuildApplicantTab::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
void SUIGuildApplicantTab::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch(pMsg->nType)
|
|
{
|
|
case MSG_CHANGE_NAME :
|
|
{
|
|
//RefreshMember( m_nScrollPos );
|
|
//RefreshStatic();
|
|
}
|
|
break;
|
|
|
|
case IMSG_UI_SEND_DATA:
|
|
{
|
|
SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg;
|
|
|
|
//if( this->IsShow() )
|
|
//{
|
|
// if( pData->m_strString == "guild_update" )
|
|
// {
|
|
// // 길드원 업데이트.
|
|
// UpdateGuildMember();
|
|
// }
|
|
//}
|
|
UpdateGuildMember(); // AziaMafia UpdateGuildMember();
|
|
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
void SUIGuildApplicantTab::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
if( this->IsShow() )
|
|
{
|
|
switch( nMessage )
|
|
{
|
|
|
|
case KUI_MESSAGE::KBUTTON_CLICK :
|
|
|
|
// close.
|
|
if( !::_stricmp( lpszControlID, "button_close" ) )
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_MAINWND, false ) );
|
|
|
|
break;
|
|
|
|
|
|
// Scroll
|
|
case KUI_MESSAGE::KSCROLL_SELECT :
|
|
|
|
{
|
|
m_nScrollPos = max( (int)lparam, 0 );
|
|
|
|
// 스크롤이 계속 내려가는걸 방지.
|
|
int nMembersSize = m_GuildMgr.GetMemberCount();
|
|
if( ( nMembersSize + m_pListGuild->GetExtendItemCount() ) < m_pListGuild->GetListConut() ) // + m_pListGuild->GetExtendItemCount() ) )
|
|
m_nScrollPos = 0;
|
|
|
|
// 길드원정보 재설정.
|
|
RefreshListMember( m_nScrollPos );
|
|
|
|
// 스크롤바 조절.
|
|
RefreshScrollbar();
|
|
|
|
// 선택된 아이템 활성화 비쥬얼 처리.
|
|
//RevitalizeSelectItem();
|
|
}
|
|
break;
|
|
|
|
|
|
case KUI_MESSAGE::KLIST_ITEM_LBUTTON_UP :
|
|
|
|
break;
|
|
|
|
case KUI_MESSAGE::KLIST_ITEM_LBUTTON_DOWN :
|
|
|
|
// ** MSG_LISTCONTROL msg = *( (MSG_LISTCONTROL *)( &pumpMsg ) );
|
|
{
|
|
MSG_LISTCONTROL msg = *( (MSG_LISTCONTROL *)( &lparam ) );
|
|
|
|
//
|
|
// ListControl 을 선택.
|
|
KUIControl * pControl;
|
|
if( m_pListGuild && m_pListGuild->GetControl( pControl, ( ITEMTYPE )msg.type, msg.itemIndex, msg.columnIndex ) )
|
|
{
|
|
//
|
|
// 헤더
|
|
//
|
|
if( ITEMTYPE::TYPE_HEADER_Base == msg.type || ITEMTYPE::TYPE_HEADER_Column == msg.type )
|
|
{
|
|
}
|
|
//
|
|
// 아이템
|
|
//
|
|
else if( ITEMTYPE::TYPE_ITEM_Base == msg.type || ITEMTYPE::TYPE_ITEM_Column == msg.type )
|
|
{
|
|
//--------------------------------------
|
|
// 선택된 아이템 활성화.
|
|
|
|
// 아이템 상태배열에 선택활성화 여부 설정.
|
|
m_pListGuild->SetSelectItem( m_nScrollPos, msg.itemIndex );
|
|
|
|
// 선택된 아이템 활성화 비쥬얼 처리.
|
|
//RevitalizeSelectItem();
|
|
//---------------------------------------
|
|
}
|
|
|
|
}// if
|
|
}
|
|
|
|
break;
|
|
|
|
case KUI_MESSAGE::KLIST_ITEM_LBUTTON_DBCLICK :
|
|
|
|
break;
|
|
case KUI_MESSAGE::KLIST_ITEM_RBUTTON_UP :
|
|
|
|
break;
|
|
case KUI_MESSAGE::KLIST_ITEM_RBUTTON_DOWN :
|
|
|
|
break;
|
|
}
|
|
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
}
|
|
|
|
|
|
// 스크롤바 설정.
|
|
void SUIGuildApplicantTab::RefreshScrollbar()
|
|
{
|
|
if( m_pScrollBar && m_pListGuild )
|
|
{
|
|
m_pScrollBar->SetScrollRange( m_pListGuild->GetListConutMAX(), m_GuildMgr.GetMemberCount() );
|
|
}
|
|
}
|
|
|
|
DWORD SUIGuildApplicantTab::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
if( dwMessage == KLBUTTON_DOWN )
|
|
{
|
|
// ListControl 의 Mouse Event 처리.
|
|
if( m_pListGuild )
|
|
m_pListGuild->OnMouseMessage( dwMessage, x, y );
|
|
}
|
|
|
|
return SUIWnd::OnMouseMessage(dwMessage, x, y);
|
|
}
|
|
|
|
|
|
void SUIGuildApplicantTab::RefreshListMember( int nScroll )
|
|
{
|
|
if( m_pListGuild == NULL )
|
|
return;
|
|
|
|
// 길드원 정보 배열.
|
|
vector< SPlayerSlot * > arrGuildMembers = m_GuildMgr.GetMemberList();
|
|
int nMembersSize = 0; // arrGuildMembers.size(); 길드신청자 리스트로 바뀌어야한다. 현재 미구현. 2010.04.21
|
|
|
|
int crrSize = m_pListGuild->GetListConut(); // 리스트 현재 개수.
|
|
int maxSize = m_pListGuild->GetListConutMAX(); // 리스트 최대개수.
|
|
|
|
SPlayerSlot * pPlayer;
|
|
int memberIndex = 0;
|
|
bool bIsLogin = false;
|
|
for( int i=0; i<maxSize; i++ )
|
|
{
|
|
// ListControl 의 Item.
|
|
KUIListItem * pItem = m_pListGuild->GetItem( i );
|
|
|
|
if( pItem )
|
|
{
|
|
// index가 길드맴버수 이하인동안 Refresh.
|
|
if( i + nScroll < nMembersSize )
|
|
{
|
|
|
|
// 길드원.
|
|
memberIndex = i + nScroll;
|
|
pPlayer = arrGuildMembers[ memberIndex ];
|
|
bIsLogin = pPlayer->IsLogin();
|
|
|
|
// 각 컨트롤에 정보 맵핑.
|
|
DataMapping( pItem, pPlayer );
|
|
|
|
////-------------------------------
|
|
//// ** 해당 아이템을 확장 or 축소(원본크기) 한다.
|
|
m_pListGuild->SetResize( i, memberIndex, 1 );
|
|
}
|
|
}
|
|
|
|
}// for
|
|
|
|
////-------------------------------
|
|
//// ** 리스트정보 최종 업데이트.
|
|
m_pListGuild->RefreshList( m_nScrollPos );
|
|
|
|
}
|
|
|
|
|
|
// 멤버리스트 초기화.
|
|
void SUIGuildApplicantTab::InitMemberList()
|
|
{
|
|
// 선택된 아이템의 활성화 비쥬얼용 컨트롤.
|
|
if( m_pSelectedControl )
|
|
m_pSelectedControl->SetShow( false );
|
|
|
|
// 리스트의 각 아이템의 상태정보.
|
|
if( m_pListGuild )
|
|
{
|
|
int size = m_GuildMgr.GetMemberCount();
|
|
m_pListGuild->RefreshItemState( size );
|
|
}
|
|
|
|
// Scroll bar
|
|
RefreshScrollbar();
|
|
|
|
// 길드원정보 갱신.
|
|
RefreshListMember( m_nScrollPos );
|
|
}
|
|
|
|
// 길드원 업데이트.
|
|
void SUIGuildApplicantTab::UpdateGuildMember()
|
|
{
|
|
// 멤버리스트 초기화.
|
|
InitMemberList();
|
|
}
|
|
|
|
//강제 프로세스
|
|
void SUIGuildApplicantTab::ForcedProcess(DWORD dwTime)
|
|
{
|
|
m_nScrollPos = 0; // scroll bar의 변경 정보.
|
|
|
|
|
|
//// 테스트용.
|
|
//static bool bFirst = true;
|
|
//if( bFirst )
|
|
//{
|
|
// for( int i=0; i<30; ++i )
|
|
// this->m_GuildMgr.AddMember( CStringUtil::StringFormat( "캬캬캬캬캬캬캬캬?캬캬캬캬캬%03d", i ).c_str() );
|
|
// bFirst = false;
|
|
//}
|
|
|
|
// 맴버리스트 초기화.
|
|
InitMemberList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 선택한 아이템의 활성화 비쥬얼 처리.
|
|
bool SUIGuildApplicantTab::SelectedControl( KUIControl * pSelectionControl )
|
|
{
|
|
if( m_pSelectedControl && pSelectionControl )
|
|
{
|
|
if( pSelectionControl->IsShow() )
|
|
{
|
|
KRect rtSelCtrl = pSelectionControl->GetRect();
|
|
|
|
// 위치 이동.
|
|
m_pSelectedControl->MovePos( rtSelCtrl.left, rtSelCtrl.top );
|
|
|
|
// 보임.
|
|
m_pSelectedControl->SetShow( true );
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
// 선택된 아이템 활성화 비쥬얼 처리.
|
|
void SUIGuildApplicantTab::RevitalizeSelectItem()
|
|
{
|
|
bool bShow = false;
|
|
|
|
// 선택된 아이템 인덱스.
|
|
int selectIndex = m_pListGuild->GetSelectedIndex();
|
|
|
|
// 보이는 마지막 아이템의 인덱스.
|
|
int endIndex = m_pListGuild->GetIndexOfVisibleEndItem() + m_nScrollPos;
|
|
|
|
if( selectIndex > -1 && endIndex >= selectIndex )
|
|
{
|
|
selectIndex -= m_nScrollPos;
|
|
if( selectIndex > -1 )
|
|
{
|
|
KUIListItem * pItem = m_pListGuild->GetItem( selectIndex );
|
|
if( pItem )
|
|
{
|
|
// 해당 컨트롤 위치에 활성화 컨트롤 출력.
|
|
bShow = SelectedControl( pItem->GetBaseControl() );
|
|
}
|
|
}
|
|
}
|
|
|
|
// 숨김.
|
|
if( !bShow )
|
|
m_pSelectedControl->SetShow( false );
|
|
}
|
|
|
|
|
|
// ListControl 의 해당 아이템열의 각 컨트롤에 Player의 정보 맵핑
|
|
void SUIGuildApplicantTab::DataMapping( KUIListItem * pItem, SPlayerSlot * pPlayer )
|
|
{
|
|
if( pItem && pPlayer )
|
|
{
|
|
KUIControl * pControl;
|
|
bool bIsLogin = pPlayer->IsLogin();
|
|
|
|
// 접속 컨트롤.
|
|
if( pItem->GetControl( pControl, "item_static_connection_state" ) )
|
|
{
|
|
KUIControlStatic* ctrl = dynamicCast< KUIControlStatic * >( pControl );
|
|
if (ctrl)
|
|
ctrl->SetAniName( ( bIsLogin ? "common_mark_titanium_online" : "common_mark_titanium_offline") );
|
|
}
|
|
|
|
// 직업 컨트롤.
|
|
if( pItem->GetControl( pControl, "item_icon_member_job_icon" ) )
|
|
{
|
|
string jobName = GetJobDB().GetJobIconName( pPlayer->GetJobID() );
|
|
KUIControlStatic* ctrl = dynamicCast< KUIControlStatic * >( pControl );
|
|
if (ctrl)
|
|
ctrl->SetAniName( ( bIsLogin ? jobName.c_str() : jobName.append("_off").c_str() ) );
|
|
}
|
|
|
|
// Level 컨트롤
|
|
if( pItem->GetControl( pControl, "item_static_member_level" ) )
|
|
{
|
|
pControl->SetCaption( CStringUtil::StringFormat(
|
|
( bIsLogin ? "%s<size:%d><hcenter><vcenter>%d" : "%s<size:%d><#4d4d4d><hcenter><vcenter>%d" ),
|
|
S(6425), pControl->GetFontSize(), pPlayer->GetLevel() ).c_str()
|
|
);
|
|
}
|
|
|
|
// 아이디 컨트롤
|
|
if( pItem->GetControl( pControl, "item_static_member_name" ) )
|
|
{
|
|
pControl->SetCaption( CStringUtil::StringFormat(
|
|
( bIsLogin ? "%s<size:%d><hcenter><vcenter>%s" : "%s<size:%d><#4d4d4d><hcenter><vcenter>%s" ),
|
|
S(6425), pControl->GetFontSize(), pPlayer->GetName() ).c_str()
|
|
);
|
|
}
|
|
|
|
if( pItem->GetControl( pControl, "item_static_member_point" ) )
|
|
{
|
|
pControl->SetCaption( CStringUtil::StringFormat(
|
|
( bIsLogin ? "%s<size:%d><#675359><hcenter><vcenter>%s" : "%s<size:%d><#4d4d4d><hcenter><vcenter>%s" ),
|
|
S(6425), pControl->GetFontSize(), expToString( pPlayer->GetPoint() ).c_str() ).c_str()
|
|
);
|
|
}
|
|
|
|
|
|
// 메모텍스트
|
|
if( pItem->GetControl( pControl, "guild_memo_text_01" ) )
|
|
{
|
|
pControl->SetCaption( CStringUtil::StringFormat( "%s<left>", "메모" ).c_str() );
|
|
}
|
|
}
|
|
}
|