Files
Leviathan/Client/Game/game/Interface/SUIPartyMatchingWnd.cpp
T
2026-06-01 12:46:52 +02:00

549 lines
18 KiB
C++

#include "stdafx.h"
#include "SUIPartyMatchingWnd.h"
#include "SUIPartyMatchingRegisterWnd.h"
#include "SUIDisplayInfo.h"
#include "KUITabControl.h"
#include "SStringDB.h"
#include "SMessage.h"
//#include "SGameMessageUI.h"
#include "SGameManager.h"
#include "SGameMessage.h"
#include "SMessengerMgr.h"
STRUCT_PARTYMATCH_ROOM m_pPartyList[PARTYMATCH_ROOM_PAGE];
int s_SelectParty = -1;
bool s_bRegister = false;
SUIPartyMatchingWnd::SUIPartyMatchingWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUIWnd( pGameManager ), m_pDisplayInfo( pDisplayInfo ), m_pListParty(NULL), m_nCurrentPage(1), m_nMaxPage(1),
m_bRegister(FALSE), m_nSelectLocalType(0), m_bCheckButtonCL(FALSE)
{
s_LocalList[1] = S(2623);
s_LocalList[2] = S(2624);
s_LocalList[3] = S(2625);
s_LocalList[4] = S(2626);
s_LocalList[5] = S(2627);
s_LocalList[6] = S(2628);
s_LocalList[7] = S(2629);
s_LocalList[8] = S(2630);
s_LocalList[9] = S(2631);
}
SUIPartyMatchingWnd::~SUIPartyMatchingWnd()
{
}
SUIWnd* SUIPartyMatchingWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
return this;
}
bool SUIPartyMatchingWnd::InitControls( KPoint kPos )
{
// 커스텀 윈도우 move 영역 설정
SetCustomMovingRect( KRect( 0,0,466,20 ) );
KUIControlCombo * pCombo = dynamicCast<KUIControlCombo *>(GetChild("combo_00_01")); //Dungeon List
if( pCombo )
{
pCombo->SetEnableColor( "<#ffffff>" );
//for( int i(0); 6>i; i++ )
//pCombo->AddItem( CStringUtil::StringFormat( "%s%s", S(6425), S(6332+i) ).c_str() );
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),S(6369) ).c_str() ); // 전체
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),s_LocalList[1] ).c_str() ); // 일반
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),s_LocalList[2] ).c_str() ); // 큐브릭
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),s_LocalList[3] ).c_str() ); // 메마른 달빛 지하기지
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),s_LocalList[4] ).c_str() ); // 발모어 탄광 지하기지
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),s_LocalList[5] ).c_str() ); // 수정계곡 지하기지
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),s_LocalList[6] ).c_str() ); // 팔미르 유적 지하기지
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),s_LocalList[7] ).c_str() ); // 붉은 거미 서커스장
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),s_LocalList[8] ).c_str() ); // 패러렐 월드(레이드)
pCombo->AddItem( CStringUtil::StringFormat( "%s%s",S(6425),s_LocalList[9] ).c_str() ); // 패러렐 월드(퀘스트)
SetChildTooltip( "combo_00_01",
CStringUtil::StringFormat( "%s<br>%s<br>%s<br>%s<br>%s<br>%s<br>%s<br>%s<br>%s<br>%s",
S(6369),S(6370),S(80030000),S(80040000),S(80041001),S(80042001),S(80043001),S(80050000),S(2611),S(2620) ).c_str() );
pCombo->SetCurSel(0);
}
if( !m_pListParty )
{
m_pListParty = new KUIListControl( this, "listcontrol01", "", "item_base", 10 );
//m_pListParty = new KUIListControl( this, "listcontrol01", "", "item_base", 10, true, 0, 2 );
m_pListParty->AddStringItemColumn( "list_party_name" );
m_pListParty->AddStringItemColumn( "list_party_local" );
m_pListParty->AddStringItemColumn( "list_party_lv00" );
m_pListParty->AddStringItemColumn( "list_party_lv00_value" );
m_pListParty->AddStringItemColumn( "list_party_member" );
m_pListParty->RefreshItemState( 10 );
m_pListParty->Create();
}
// 선택된 아이템의 활성화 비쥬얼용 컨트롤.
m_pSelectedControl = GetChild( "select_red_01" );
m_pSelectedControl->SetShow( false );
clearList ();
SetChildAsTop("combo_00_01");
return SUIWnd::InitControls( kPos );
}
bool SUIPartyMatchingWnd::InitData( bool bReload /*= false*/ )
{
return SUIWnd::InitData( bReload );
}
void SUIPartyMatchingWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( ::_stricmp( lpszControlID, "button_research" ) == 0 )
{
//sendAction(0,1,0);
//KUIControlCombo * pCombo = dynamicCast<KUIControlCombo *>(GetChild("combo_00_01"));
//m_nSelectLocalType = pCombo->GetCurSel();
research(m_nSelectLocalType, 1);
} else
if( ::_stricmp( lpszControlID, "button_party" ) == 0 )
{
SPartyMgr *pParty = NULL;
pParty = m_PartyMgr.GetParty();
if ( pParty->IsPartyLeader() )
{
if ( m_bRegister )
{
SMSG_PARTYMATCH_ACTION msg; // 등록취소
msg.nAction = 3;
msg.nPage = 0;
msg.nMaster = 0;
msg.stRoom.nRoom = m_pPartyList[s_SelectParty].nRoom;
m_pGameManager->ProcMsgAtStatic(&msg);
m_bRegister = false;
//m_pGameManager->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, false) );
KUIControlCombo * pCombo = dynamicCast<KUIControlCombo *>(GetChild("combo_00_01")); //Dungeon List
if( pCombo ) pCombo->SetCurSel(0);
research(0, 1);
m_nSelectLocalType = 0;
s_bRegister = FALSE;
} else
{ s_bRegister = TRUE;
s_SelectParty = -1;
m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING, false ));
m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, false ));
}
m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, true ));
}else
{
m_pDisplayInfo->AddSystemMessage(S(480), 99);
}
} else
if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
{ m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING, false) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, false) );
} else
if( (::_stricmp( lpszControlID, "list_down00" ) == 0) && m_nCurrentPage > 1 )
{ research ( m_nSelectLocalType, m_nCurrentPage-1 );
} else
if( ::_stricmp( lpszControlID, "list_up00" ) == 0 && m_nCurrentPage+1 <= m_nMaxPage )
{ research ( m_nSelectLocalType, m_nCurrentPage+1 );
}
}
break;
case KUI_MESSAGE::KCOMBO_CLICK:
{
if( ::_stricmp( lpszControlID, "combo_00_01" ) == 0 ) m_bCheckButtonCL = !m_bCheckButtonCL;
}
break;
case KUI_MESSAGE::KCOMBO_SELECT:
{
m_pGameManager->StartSound( "ui_button_click.wav" );
if( ::_stricmp( lpszControlID, "combo_00_01" ) == 0 ) // 지역 리스트 콤보박스 클릭시 처리합니다.
{ if( m_nSelectLocalType == (int)lparam ) return;
m_nSelectLocalType = (int)lparam;
research ( m_nSelectLocalType, m_nCurrentPage );
m_bCheckButtonCL = FALSE;
}
}
break;
case KUI_MESSAGE::KSCROLL_SELECT: // 스크롤 선택
{
}
break;
case KUI_MESSAGE::KFOCUS_ACTIVATED :
{
}
break;
case KUI_MESSAGE::KGENWND_MOVE:
{
LimitMoveWnd();
SUIWnd* pWnd = m_pGameManager->GetSUI(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER);
if( pWnd && pWnd->IsShow() )
{ m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, GetRect().right, GetRect().top ) ); // 장비창
}
}
break;
case KUI_MESSAGE::KLIST_ITEM_LBUTTON_DOWN :
// ** MSG_LISTCONTROL msg = *( (MSG_LISTCONTROL *)( &pumpMsg ) );
{
PumpUpMsgLBtnClick(lparam);
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIPartyMatchingWnd::PumpUpMsgLBtnClick( DWORD lparam )
{
MSG_LISTCONTROL msg = *( (MSG_LISTCONTROL *)( &lparam ) );
//
// ListControl 을 선택.
KUIControl * pControl;
if( m_pListParty && m_pListParty->GetControl( pControl, ( ITEMTYPE )msg.type, msg.itemIndex, msg.columnIndex ) )
{
//if( ITEMTYPE::TYPE_ITEM_Base == msg.type || ITEMTYPE::TYPE_ITEM_Column == msg.type )
m_pListParty->SetSelectItem( 0, msg.itemIndex );
RevitalizeSelectItem();
}
}
// 선택된 아이템 활성화 비쥬얼 처리.
void SUIPartyMatchingWnd::RevitalizeSelectItem()
{
bool bShow = false;
// 선택된 아이템 인덱스.
int selectIndex = m_pListParty->GetSelectedIndex();
// 보이는 마지막 아이템의 인덱스.
int endIndex = m_pListParty->GetIndexOfVisibleEndItem();
if( selectIndex > -1 && endIndex >= selectIndex && !m_bCheckButtonCL )
{
if( selectIndex > -1 )
{
KUIListItem * pItem = m_pListParty->GetItem( selectIndex );
if( pItem && m_pPartyList[selectIndex].nRoom ) // 클릭한 버튼에 방이 존재할 경우입니다.
{
// 해당 컨트롤 위치에 활성화 컨트롤 출력.
bShow = SelectedControl( pItem->GetBaseControl() );
SMSG_PARTYMATCH_ACTION msg;
msg.nAction = 1;
msg.nPage = 0;
msg.nMaster = 0;
msg.stRoom.nRoom = m_pPartyList[selectIndex].nRoom;
s_SelectParty = selectIndex;
m_pGameManager->ProcMsgAtStatic(&msg);
s_bRegister = FALSE;
m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, true ));
}
else m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, false ));
research ( m_nSelectLocalType, m_nCurrentPage );
}
}
// 숨김.
if( !bShow )
m_pSelectedControl->SetShow( false );
}
// 선택한 아이템의 활성화 비쥬얼 처리.
bool SUIPartyMatchingWnd::SelectedControl( KUIControl * pSelectionControl )
{
if( m_pSelectedControl && pSelectionControl && !m_bCheckButtonCL )
{
m_pSelectedControl->SetShow( false ); // 이전 셀렉트 숨김.
if( m_pSelectedControl )
{
// Item_Base 보다 위에 뜨게 해야한다. 툴상의 LayOut 이 제대로 적용되지 않는 문제때문...
std::list<KUIWnd*>::iterator it_itembase = std::find( m_listChild.begin(), m_listChild.end(), static_cast< KUIWnd * >( pSelectionControl ) ); // ItemBase 위치.
std::list<KUIWnd*>::iterator it_select = std::find( m_listChild.begin(), m_listChild.end(), static_cast< KUIWnd * >( m_pSelectedControl ) ); // SelectControl.
if( it_itembase != m_listChild.end() && it_select != m_listChild.end() )
{
m_listChild.erase( it_select );
m_listChild.insert( ( ++it_itembase ), m_pSelectedControl ); // insert는 iterator의 앞쪽에 추가되므로 + 1 한다.
}
KRect rtSelCtrl = pSelectionControl->GetRect();
// 크기 변환.
m_pSelectedControl->Resize( rtSelCtrl );
// 위치 이동.
m_pSelectedControl->MovePos( rtSelCtrl.left, rtSelCtrl.top );
// 보임.
m_pSelectedControl->SetShow( true );
return true;
}
}
return false;
}
void SUIPartyMatchingWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch(pMsg->nType)
{
case MSG_PARTYMATCH_LIST:
{
SMSG_PARTYMATCH_LIST* pRMsg( static_cast<SMSG_PARTYMATCH_LIST*>( pMsg ) );
memcpy ( m_pPartyList, pRMsg->pRoom, sizeof (STRUCT_PARTYMATCH_ROOM)*PARTYMATCH_ROOM_PAGE );
m_nCurrentPage = pRMsg->nPage;
m_nMaxPage = pRMsg->nRoomTotal/10+1;
refresh ();
//SPartyMgr *pParty = NULL;
//pParty = m_PartyMgr.GetParty();
//int nSelect = -1;
//for ( int i = 0; i < PARTYMATCH_ROOM_PAGE; i++ )
//{
// if ( pParty->GetPartyID() && m_pPartyList[i].nParty == pParty->GetPartyID() )
// {
// nSelect = i;
// break;
// }
//}
//if ( nSelect != -1 )
//{
// //s_SelectParty = nSelect;
// SMSG_PARTYMATCH_ACTION msg;
// msg.nAction = 1;
// msg.nPage = 0;
// msg.nMaster = 0;
// msg.stRoom.nRoom = m_pPartyList[nSelect].nRoom;
// m_pGameManager->ProcMsgAtStatic(&msg);
// m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, true ));
//}
m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING, true ));
//m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, false ));
//m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, true ));
// research();
}
break;
}
}
void SUIPartyMatchingWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd /* = true*/ )
{
if( bOpen )
{
s_bRegister = FALSE;
m_bCheckButtonCL = FALSE;
m_pSelectedControl->SetShow( false );
m_pGameManager->StartSound( "ui_popup_window01.wav" );
KUIControlCombo * pCombo = dynamicCast<KUIControlCombo *>(GetChild("combo_00_01")); //Dungeon List
if( pCombo ) pCombo->SetCurSel(0);
research ( 0, 1 );
SPartyMgr *pParty = NULL;
pParty = m_PartyMgr.GetParty();
int nSelect = -1;
for ( int i = 0; i < PARTYMATCH_ROOM_PAGE; i++ )
{
if ( pParty->GetPartyID() && m_pPartyList[i].nParty == pParty->GetPartyID() )
{
nSelect = i;
break;
}
}
if ( nSelect != -1 )
{
s_SelectParty = nSelect; // 처음에 파티찾기창을 열때 등록되어있는 창을 열기 위해 셋팅합니다.
SMSG_PARTYMATCH_ACTION msg;
msg.nAction = 1;
msg.nPage = 0;
msg.nMaster = 0;
msg.stRoom.nRoom = m_pPartyList[nSelect].nRoom;
m_pGameManager->ProcMsgAtStatic(&msg);
m_pGameManager->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, true ));
}
}
else
{
}
SUIWnd::OnNotifyUIWindowOpen( bOpen, bLimitWnd );
}
DWORD SUIPartyMatchingWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
{
switch( dwMessage )
{
case KLBUTTON_DOWN :
case KRBUTTON_DOWN :
m_ptMouseDown.x = x;
m_ptMouseDown.y = y;
// ListControl 의 Mouse Event 처리.
//if( m_GuildMgr.GetMemberCount() > 0 && m_pListGuild )
m_pListParty->OnMouseMessage( dwMessage, x, y );
break;
}
return SUIWnd::OnMouseMessage(dwMessage, x, y);
}
void SUIPartyMatchingWnd::refresh ()
{
SPartyMgr *pParty = NULL;
pParty = m_PartyMgr.GetParty();
if( m_pListParty )
{
clearList ();
//m_pListMember->RefreshItemState( 6 );
int maxSize = m_pListParty->GetListConutMAX(); // 리스트 최대개수.
for( int i=0; i<maxSize; ++i )
{
if ( !m_pPartyList[i].nRoom )
continue;
KUIListItem * pItem = m_pListParty->GetItem( i );
KUIControl * pControl;
//KUIControlStatic * pControlStatic;
if( pItem->GetControl( pControl, "list_party_name" ) )
{
std::string str = CStringUtil::StringFormat( "<font:font_02><size:%d><hcenter><vcenter>%s", pControl->GetFontSize(), m_pPartyList[i].szText );
//if( m_bFirstDataMapping || str != pControl->GetCaption() )
pControl->SetCaption( str.c_str());
}
if( pItem->GetControl( pControl, "list_party_local" ) )
{
if ( m_pPartyList[i].nArea > 0 )
{
std::string str = CStringUtil::StringFormat( "<font:font_02><size:%d><hcenter><vcenter>%s", pControl->GetFontSize(), s_LocalList[m_pPartyList[i].nArea] );
//if( m_bFirstDataMapping || str != pControl->GetCaption() )
pControl->SetCaption( str.c_str());
}
else
pControl->SetCaption( "" );
}
if( pItem->GetControl( pControl, "list_party_lv00_value" ) )
{
std::string str = CStringUtil::StringFormat( "<font:font_02><size:%d><hcenter><vcenter>%d", pControl->GetFontSize(), m_pPartyList[i].nLevel );
//if( m_bFirstDataMapping || str != pControl->GetCaption() )
if ( m_pPartyList[i].nLevel > 0 )
{
pControl->SetCaption( str.c_str());
if( pItem->GetControl( pControl, "list_party_lv00" ) ) // 레벨 스트링 표시안되도록 합니다.
pControl->SetCaption( "<font:font_01><size:9><#fecb00><$6610:Lv>" );
}
else
{
//pControl->SetCaption( "" );
pControl->SetCaption( S(6369) );
if( pItem->GetControl( pControl, "list_party_lv00" ) ) // 레벨 스트링 표시안되도록 합니다.
pControl->SetCaption( "" );
}
}
if( pItem->GetControl( pControl, "list_party_member" ) )
{
std::string str = CStringUtil::StringFormat( "<font:font_02><size:%d><hcenter><vcenter>%d/%d", pControl->GetFontSize(), m_pPartyList[i].nMember, m_pPartyList[i].nMaxMember );
//if( m_bFirstDataMapping || str != pControl->GetCaption() )
if ( m_pPartyList[i].nMember )
pControl->SetCaption( str.c_str());
else
pControl->SetCaption( "" );
}
if ( m_pPartyList[i].nParty == pParty->GetPartyID() )
{
m_bRegister = TRUE;
}
}
}
if ( pParty->IsPartyLeader() )
{
if (m_bRegister) SetChildCaption( "button_party", "<font:font_default><hcenter><vcenter><size:10><#242424><$2609:등록취소>" );
else SetChildCaption( "button_party", "<font:font_default><hcenter><vcenter><size:10><#242424><$2602:파티등록>" );
}else SetChildCaption( "button_party", "<font:font_default><hcenter><vcenter><size:10><#242424><$2602:파티등록>" );
SetChildCaption( "page_info00", CStringUtil::StringFormat( "<font:돋움><right>%d /", m_nCurrentPage ).c_str() );
SetChildCaption( "page_info00_max", CStringUtil::StringFormat( "<font:돋움><left>%d", m_nMaxPage ).c_str() );
}
void SUIPartyMatchingWnd::clearList ()
{
if( m_pListParty )
{
//m_pListMember->RefreshItemState( 6 );
int maxSize = m_pListParty->GetListConutMAX(); // 리스트 최대개수.
for( int i=0; i<maxSize; ++i )
{
KUIListItem * pItem = m_pListParty->GetItem( i );
KUIControl * pControl;
if( pItem->GetControl( pControl, "list_party_name" ) ) pControl->SetCaption( "" );
if( pItem->GetControl( pControl, "list_party_local" ) ) pControl->SetCaption( "" );
if( pItem->GetControl( pControl, "list_party_lv00" ) ) pControl->SetCaption( "" );
if( pItem->GetControl( pControl, "list_party_lv00_value" ) ) pControl->SetCaption( "" );
if( pItem->GetControl( pControl, "list_party_member" ) ) pControl->SetCaption( "" );
}
}
}
void SUIPartyMatchingWnd::research( int nType, int nPage )
{
SMSG_PARTYMATCH_ACTION msg;
msg.nAction = 0;
msg.nPage = nPage;
msg.nMaster = 0;
msg.stRoom.nArea = nType;
m_pGameManager->ProcMsgAtStatic(&msg);
}