553 lines
15 KiB
C++
553 lines
15 KiB
C++
|
|
#include "stdafx.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include "SGameManager.h"
|
|
#include "SGameMessage.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SMessengerMgr.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlPanel.h"
|
|
#include "KUIControlButton.h"
|
|
#include "SUIClass1PanelWnd.h" // Panel Wnd
|
|
#include "SUIGuildSubMasterTabManage.h"
|
|
|
|
//---------------------------------------------------------------------------------------------
|
|
//---------------------------------------------------------------------------------------------
|
|
//
|
|
// class SUIGuildSubMasterTabManage
|
|
//
|
|
// TAB 길드 등급 관리 설정.
|
|
//
|
|
//
|
|
//---------------------------------------------------------------------------------------------
|
|
|
|
|
|
#define UI_REFRESH_OK 9998 // UI갱신.
|
|
|
|
|
|
namespace
|
|
{
|
|
std::string textDecorateTitle_L( "<font:font_02><size:8><hcenter><left>" ); // 타이틀바.
|
|
std::string textDecorateTitle_R( " <$1854:등급> " ); // 타이틀바.
|
|
|
|
}
|
|
|
|
|
|
|
|
SUIGuildSubMasterTabManage::SUIGuildSubMasterTabManage( SGameManager * pGameManager ) :
|
|
SUIWnd( pGameManager ),
|
|
m_pPanelManager( NULL ),
|
|
m_pCrrOpenPanel( NULL ),
|
|
m_PanelCount( 6 ),
|
|
m_bUIRefresh( true ),
|
|
m_bRefresh( GUILD_UPDATE::GUILD_UPDATE_NONE )
|
|
{
|
|
|
|
}
|
|
|
|
SUIGuildSubMasterTabManage::~SUIGuildSubMasterTabManage()
|
|
{
|
|
Release();
|
|
}
|
|
|
|
void SUIGuildSubMasterTabManage::Release()
|
|
{
|
|
SAFE_DELETE( m_pPanelManager ); // Panel Manager.
|
|
}
|
|
|
|
|
|
SUIWnd* SUIGuildSubMasterTabManage::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
|
|
{
|
|
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
|
|
|
|
// Panel Control 이 들어갈 영역 지정용 컨트롤.
|
|
KUIControl * pPanelOutline = ( KUIControl * )( GetChild( "listcontrol01" ) );
|
|
|
|
|
|
//----------------------------------
|
|
// Panel Manager 생성.
|
|
//
|
|
if( !m_pPanelManager )
|
|
{
|
|
m_pPanelManager = new KUIControlPanelManager( this, pPanelOutline, 0 );
|
|
|
|
// 패널들을 생성하여 등록한다.
|
|
for( int i=0; i<m_PanelCount; ++i )
|
|
{
|
|
RegisterPanel( pWndManager, new SUIClass1PanelWnd( m_pGameManager, m_pPanelManager, i ),
|
|
"window_guild_sub_master_tab_class_manage_panel_class.nui", kPos ); // Panel 등급
|
|
}
|
|
}
|
|
|
|
|
|
//-----------------------------
|
|
// 2010.11.26. 길드정보 변경시 UI 갱신방식 => 길드윈도우 open 시 UI 갱신 으로 변경.
|
|
|
|
m_bUIRefresh = true; // 길드윈도우 open 시에 UI를 갱신할지 여부.
|
|
|
|
//-----------------------------
|
|
|
|
return this;
|
|
}
|
|
|
|
|
|
// 패널 등록.
|
|
void SUIGuildSubMasterTabManage::RegisterPanel( KUIWndManager* pWndManager, KUIControlPanel * pPanel, char * strNUI, KPoint & kPos )
|
|
{
|
|
// 패널 설정.
|
|
pPanel->SetUseCutCaption();
|
|
pPanel->CreateWnd( strNUI, pWndManager, kPos );
|
|
pPanel->SetParent( this );
|
|
this->AddChild( pPanel );
|
|
|
|
// Enable/Disable Color 설정.
|
|
KUIControlStatic * pStatic = dynamicCast< KUIControlStatic * >( pPanel->GetChild( "guild_master_menu_01" ) );
|
|
pStatic->SetEnableColor( "<#ffffff>" );
|
|
pStatic->SetDisableColor( "<#a0a0a0>" );
|
|
|
|
// Panel Manager에 등록.
|
|
m_pPanelManager->AddPanel( pPanel );
|
|
}
|
|
|
|
bool SUIGuildSubMasterTabManage::InitControls( KPoint kPos )
|
|
{
|
|
|
|
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
|
|
|
|
void SUIGuildSubMasterTabManage::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
|
|
{
|
|
if( bOpen )
|
|
{
|
|
m_pPanelManager->SetShow( true );
|
|
|
|
m_pCrrOpenPanel = m_pPanelManager->GetCrrOpenPanel();
|
|
|
|
if( m_bUIRefresh )
|
|
{
|
|
// 패널의 타이틀( 등급 등급명 ) 설정.
|
|
if( ( m_bRefresh & GUILD_UPDATE_GPERMISSION ) || /// 2010.12.14 or 연산 수정 - prodongi
|
|
( m_bRefresh & GUILD_UPDATE_CHANGE_PERMISSION_NAME ) ||
|
|
( m_bRefresh & GUILD_UPDATE_CHANGE_PERMISSION ) ||
|
|
( m_bRefresh & GUILD_UPDATE_CHANGE_PERMISSION_SET )
|
|
)
|
|
{
|
|
SetPanelTitle();
|
|
}
|
|
|
|
// 권한처리.
|
|
if( ( m_bRefresh & GUILD_UPDATE_GPERMISSION ) ||
|
|
( m_bRefresh & GUILD_UPDATE_CHANGE_PERMISSION_NAME ) ||
|
|
( m_bRefresh & GUILD_UPDATE_CHANGE_PERMISSION_SET)
|
|
)
|
|
{
|
|
AuthorityProcess();
|
|
}
|
|
|
|
// 권한셋 변경.
|
|
if( m_bRefresh & GUILD_UPDATE::GUILD_UPDATE_CHANGE_PERMISSION_SET )
|
|
{
|
|
const vector< KUIControlPanel * > & arrPanel = m_pPanelManager->GetPanelControls();
|
|
int size = arrPanel.size();
|
|
for( int i=0; i<size; i++ )
|
|
arrPanel[ i ]->ProcMsgAtStatic( &m_BeforeMsgData );
|
|
|
|
m_BeforeMsgData.m_strString = "";
|
|
}
|
|
|
|
m_bUIRefresh = false;
|
|
m_bRefresh = GUILD_UPDATE::GUILD_UPDATE_NONE; // 갱신조건 클리어.
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
m_pPanelManager->SetShow( false );
|
|
|
|
|
|
m_bUIRefresh = false;
|
|
m_bRefresh = GUILD_UPDATE::GUILD_UPDATE_NONE; // 갱신조건 클리어.
|
|
m_BeforeMsgData.m_strString = "";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void SUIGuildSubMasterTabManage::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch( pMsg->nType )
|
|
{
|
|
case IMSG_UI_SEND_DATA:
|
|
{
|
|
SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg;
|
|
|
|
if( pData->m_strString == "guild_update" )
|
|
{
|
|
pData->bUse = true;
|
|
|
|
// bintitle. 2010.11.26.
|
|
if( this->IsShow() )
|
|
{
|
|
// 패널의 타이틀( 등급 등급명 ) 설정.
|
|
if( ( pData->m_dwData & GUILD_UPDATE_GPERMISSION ) || /// 2010.12.14 or 연산 수정 - prodongi
|
|
( pData->m_dwData & GUILD_UPDATE_CHANGE_PERMISSION_NAME ) ||
|
|
( pData->m_dwData & GUILD_UPDATE_CHANGE_PERMISSION ) ||
|
|
( pData->m_dwData & GUILD_UPDATE_CHANGE_PERMISSION_SET )
|
|
)
|
|
{
|
|
SetPanelTitle();
|
|
}
|
|
|
|
// 권한처리.
|
|
if( ( pData->m_dwData & GUILD_UPDATE_GPERMISSION ) || /// 2010.12.14 or 연산 수정 - prodongi
|
|
( pData->m_dwData & GUILD_UPDATE_CHANGE_PERMISSION_NAME ) ||
|
|
( pData->m_dwData & GUILD_UPDATE_CHANGE_PERMISSION_SET)
|
|
)
|
|
{
|
|
AuthorityProcess();
|
|
}
|
|
|
|
// 권한셋 변경.
|
|
if( (pData->m_dwData & GUILD_UPDATE::GUILD_UPDATE_GPERMISSION ) || /// 2010.12.14 or 연산 수정 - prodongi
|
|
(pData->m_dwData & GUILD_UPDATE::GUILD_UPDATE_CHANGE_PERMISSION_SET) )
|
|
{
|
|
const vector< KUIControlPanel * > & arrPanel = m_pPanelManager->GetPanelControls();
|
|
int size = arrPanel.size();
|
|
for( int i=0; i<size; i++ )
|
|
arrPanel[ i ]->ProcMsgAtStatic( pMsg );
|
|
}
|
|
|
|
m_bUIRefresh = false; // UI갱신X.
|
|
m_bRefresh = GUILD_UPDATE::GUILD_UPDATE_NONE; // 갱신조건 클리어.
|
|
}
|
|
else
|
|
{
|
|
// 권한셋 변경.
|
|
if( pData->m_dwData & GUILD_UPDATE::GUILD_UPDATE_CHANGE_PERMISSION_SET )
|
|
{
|
|
m_BeforeMsgData.m_strString = pData->m_strString;
|
|
m_BeforeMsgData.m_dwData = pData->m_dwData;
|
|
}
|
|
|
|
m_bUIRefresh = true; // 갱신.
|
|
m_bRefresh |= pData->m_dwData; // UI open 시에 비교하기위해 갱신조건 누적.
|
|
}
|
|
|
|
}
|
|
//
|
|
// 길드장 변경.
|
|
else if( pData->m_strString == "change_guild_master" )
|
|
{
|
|
pData->bUse = true;
|
|
|
|
// Panel ProcMsgAtStatic.
|
|
PanelProcMsg( pMsg );
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 패널 윈도우들의 ProcMsgAtStatic.
|
|
void SUIGuildSubMasterTabManage::PanelProcMsg( SGameMessage * pMsg )
|
|
{
|
|
const vector< KUIControlPanel * > & arrPanel = m_pPanelManager->GetPanelControls();
|
|
|
|
int size = arrPanel.size();
|
|
for( int i=0; i<size; i++ )
|
|
arrPanel[ i ]->ProcMsgAtStatic( pMsg );
|
|
}
|
|
|
|
|
|
//강제 프로세스
|
|
void SUIGuildSubMasterTabManage::ForcedProcess(DWORD dwTime)
|
|
{
|
|
//
|
|
// Panel Manager 초기설정.
|
|
m_pPanelManager->Initialize();
|
|
|
|
// Panel Wnd 의 ForcedProcess() 호출.
|
|
const vector< KUIControlPanel * > & arrPanels = m_pPanelManager->GetPanelControls();
|
|
int size = arrPanels.size();
|
|
for( int i=0; i<size; i++ )
|
|
arrPanels[ i ]->ForcedProcess( 0 );
|
|
|
|
// 패널의 타이틀( 등급 등급명 ) 설정.
|
|
SetPanelTitle( true );
|
|
|
|
//
|
|
MovePosOffset( 0, 0 );
|
|
|
|
// 한개패널 오픈.
|
|
if( m_pPanelManager )
|
|
{
|
|
KUIControlPanel * pPanel;
|
|
if( m_pPanelManager->FindPanelByIndex( pPanel, 0 ) )
|
|
pPanel->OpenPanel();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void SUIGuildSubMasterTabManage::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch( nMessage )
|
|
{
|
|
// 윈도우 이동
|
|
case KUI_MESSAGE::KGENWND_MOVE:
|
|
{
|
|
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
|
|
|
|
// lparam, wparam 에 이동전 위치가 넘어온다. ** KUIGenWnd 의 OnMouseMessage() 에서 넘겨줌.
|
|
KRect rtCrr = GetRect();
|
|
rtCrr.left -= lparam;
|
|
rtCrr.top -= wparam;
|
|
|
|
// Panel Manager 부모윈도우의 이동.
|
|
m_pPanelManager->MovedParentWnd( rtCrr.left, rtCrr.top );
|
|
}
|
|
break;
|
|
|
|
|
|
case KUI_MESSAGE::KBUTTON_CLICK :
|
|
|
|
// 길드권한등급비트셋 저장.
|
|
if( !::_stricmp( lpszControlID, "button_save" ) )
|
|
{
|
|
//// 길드마스터인가?
|
|
//if( GetIsMaster() )
|
|
SaveAuthorityClassBitSet();
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
|
|
// 길드권한등급비트셋 저장.
|
|
void SUIGuildSubMasterTabManage::SaveAuthorityClassBitSet()
|
|
{
|
|
const std::vector< KUIControlPanel * > arrPanels = m_pPanelManager->GetPanelControls();
|
|
int size = arrPanels.size();
|
|
|
|
KUIControlPanel * pPanel;
|
|
int nClass = _PERMISSION::PERMISSION_MEMBER_MAX;
|
|
int index = 0;
|
|
for( ; index<size; index++, nClass-- )
|
|
{
|
|
pPanel = arrPanels[ index ];
|
|
|
|
//// 해당 등급의 권한세트 변경 요청.
|
|
//m_pGameManager->PostMsgAtDynamic( new SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_AUTHORITY_SET,
|
|
// (index + 1), // 등급.
|
|
// pPanel->GetNumberData() ) );// 등급비트셋.
|
|
|
|
// 해당 등급의 권한세트 변경 요청.
|
|
m_pGameManager->PostMsgAtDynamic( new SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_AUTHORITY_SET,
|
|
nClass, // 등급.
|
|
pPanel->GetNumberData() ) );// 등급비트셋.
|
|
}
|
|
}
|
|
|
|
|
|
//// 패널의 타이틀( 등급 등급명 ) 설정.
|
|
//void SUIGuildSubMasterTabManage::SetPanelTitle()
|
|
//{
|
|
// std::string strTitle;
|
|
// vector< KUIControlPanel * > arrPanels = m_pPanelManager->GetPanelControls();
|
|
// std::string strDeco;
|
|
// /*if( arrPanels.size() > 0 )
|
|
// {
|
|
// textDecorateTitle_L = CStringUtil::GetTextDecoration( arrPanels[ 0 ]->GetChild( "guild_master_menu_01" )->GetCaption() );
|
|
// }*/
|
|
// int nClass = _PERMISSION::PERMISSION_MEMBER_MAX;
|
|
// int size = arrPanels.size();
|
|
// for( int i=0; i<size; i++, nClass-- )
|
|
// {
|
|
// strTitle = textDecorateTitle_L + CStringUtil::StringFormat("%d", i+1) + textDecorateTitle_R;
|
|
// strTitle.append( m_GuildMgr.GetAuthorityClassName( nClass - 1 ) );
|
|
// arrPanels[ i ]->GetChild( "guild_master_menu_01" )->SetCaption( strTitle.c_str() );
|
|
//
|
|
// // 등급 픽토그램 이미지.
|
|
// static_cast< KUIControlIconStatic * >( arrPanels[ i ]->GetChild( "mark_guild_class_01" ) )->SetIcon(
|
|
// "ui_frame.spr",
|
|
// CStringUtil::StringFormat( "common_mark_titanium_guild_class_0%d", i+1 ).c_str()
|
|
// );
|
|
//
|
|
// }
|
|
//}
|
|
|
|
// 패널의 타이틀( 등급 등급명 ) 설정.
|
|
void SUIGuildSubMasterTabManage::SetPanelTitle( bool bClassAni )
|
|
{
|
|
std::string strTitle;
|
|
const vector< KUIControlPanel * > & arrPanels = m_pPanelManager->GetPanelControls();
|
|
std::string strDeco;
|
|
/*if( arrPanels.size() > 0 )
|
|
{
|
|
textDecorateTitle_L = CStringUtil::GetTextDecoration( arrPanels[ 0 ]->GetChild( "guild_master_menu_01" )->GetCaption() );
|
|
}*/
|
|
KUIControl * pControl;
|
|
int nClass = _PERMISSION::PERMISSION_MEMBER_MAX;
|
|
int size = arrPanels.size();
|
|
for( int i=0; i<size; i++, nClass-- )
|
|
{
|
|
pControl = dynamicCast< KUIControl * >( arrPanels[ i ]->GetChild( "guild_master_menu_01" ) );
|
|
|
|
std::string strDeco( textDecorateTitle_L );
|
|
XStringUtil::Replace( strDeco, "<size:8>", CStringUtil::StringFormat("<size:%d>", pControl->GetFontSize() ) );
|
|
|
|
strTitle = strDeco + CStringUtil::StringFormat("%d", i+1) + textDecorateTitle_R;
|
|
strTitle.append( m_GuildMgr.GetAuthorityClassName( nClass - 1 ) );
|
|
|
|
pControl->SetCaption( strTitle.c_str() );
|
|
pControl->CutCaptionNTooltip();
|
|
|
|
// 등급 픽토그램 이미지.
|
|
if( bClassAni )
|
|
{
|
|
dynamicCast< KUIControlStatic * >( arrPanels[ i ]->GetChild( "mark_guild_class_01" ) )->SetAniName(CStringUtil::StringFormat( "common_mark_titanium_guild_class_0%d", i+1 ).c_str());
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// 길드마스터인가?
|
|
bool SUIGuildSubMasterTabManage::GetIsMaster()
|
|
{
|
|
SPlayerInfo player = m_PlayerInfoMgr.GetPlayerInfo();
|
|
SPlayerSlot * pPlayerSlot = this->m_GuildMgr.FindMember( player.GetName() );
|
|
|
|
if( pPlayerSlot )
|
|
{
|
|
if( pPlayerSlot->GetAuthority() == 7 )
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
// 권한처리.
|
|
void SUIGuildSubMasterTabManage::AuthorityProcess()
|
|
{
|
|
// 이전에 열린 패널이 있다면 오픈.
|
|
if( m_pCrrOpenPanel )
|
|
m_pCrrOpenPanel->OpenPanel();
|
|
// 없으면 첫번째 패널 오픈.
|
|
else
|
|
{
|
|
const vector< KUIControlPanel * > & arrPanels = m_pPanelManager->GetPanelControls();
|
|
KUIControlPanel * pPanel = NULL;
|
|
if( ( pPanel = arrPanels[ 0 ] ) )
|
|
pPanel->OpenPanel();
|
|
}
|
|
|
|
////
|
|
//int nMemberCount = m_GuildMgr.GetMemberCount();
|
|
//SPlayerInfo player = m_PlayerInfoMgr.GetPlayerInfo();
|
|
//SPlayerSlot * pPlayerSlot = this->m_GuildMgr.FindMember( player.GetName() );
|
|
|
|
//if( nMemberCount && pPlayerSlot )
|
|
//{
|
|
// const vector< KUIControlPanel * > & arrPanels = m_pPanelManager->GetPanelControls();
|
|
// KUIControlPanel * pPanel;
|
|
// int size = arrPanels.size();
|
|
|
|
// int nClass = pPlayerSlot->GetAuthority(); // 권한.
|
|
//
|
|
// // Master.
|
|
// if( nClass == _PERMISSION::PERMISSION_LEADER )
|
|
// {
|
|
// // 이전에 열린 패널이 있다면 오픈.
|
|
// if( m_pCrrOpenPanel )
|
|
// m_pCrrOpenPanel->OpenPanel();
|
|
// // 없으면 첫번째 패널 오픈.
|
|
// else
|
|
// {
|
|
// if( ( pPanel = arrPanels[ 0 ] ) )
|
|
// pPanel->OpenPanel();
|
|
// }
|
|
|
|
// for( int i=0; i<size; ++i )
|
|
// {
|
|
// pPanel = arrPanels[ i ];
|
|
// if( pPanel )
|
|
// PanelVisibily( pPanel, true );
|
|
// }
|
|
// }
|
|
// // Member. 자신보다 낮은 등급만 활성화.
|
|
// else
|
|
// {
|
|
// // 반전.
|
|
// nClass = _PERMISSION::PERMISSION_LEADER - nClass - 1; // Panel 은 0부터 시작이므로 -1 한다.( Class는 1부터 )
|
|
|
|
// // 이전 오픈패널 닫기.
|
|
// m_pCrrOpenPanel->ClosePanel();
|
|
// bool bOpenPanel = true;
|
|
|
|
// // 권한에 따른 활성/비활성 처리.
|
|
// for( int i=0; i<size; ++i )
|
|
// {
|
|
// pPanel = arrPanels[ i ];
|
|
// if( pPanel )
|
|
// {
|
|
// // 활성화.
|
|
// if( i > nClass )
|
|
// {
|
|
// PanelVisibily( pPanel, true );
|
|
|
|
// // 권한이 있는 패널 한개 오픈.
|
|
// if( bOpenPanel )
|
|
// {
|
|
// bOpenPanel = false;
|
|
// m_pCrrOpenPanel = pPanel;
|
|
// m_pCrrOpenPanel->OpenPanel();
|
|
// }
|
|
// }
|
|
// // 비활성화.
|
|
// else
|
|
// {
|
|
// PanelVisibily( pPanel, false );
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
void SUIGuildSubMasterTabManage::PanelVisibily( KUIControlPanel * pPanel, bool bFlag )
|
|
{
|
|
// 활성화.
|
|
if( bFlag )
|
|
{
|
|
KUIControlStatic * pStatic = dynamicCast< KUIControlStatic * >( pPanel->GetChild( "guild_master_menu_01" ) );
|
|
pStatic->SetEnableOption( true );
|
|
pStatic->Enable();
|
|
|
|
dynamicCast< KUIControlSimpleButton * >( pPanel->GetChild( "trim_titlebar_open" ) )->Enable();
|
|
dynamicCast< KUIControlSimpleButton * >( pPanel->GetChild( "sub_close" ) )->Enable();
|
|
}
|
|
// 비활성화.
|
|
else
|
|
{
|
|
KUIControlStatic * pStatic = dynamicCast< KUIControlStatic * >( pPanel->GetChild( "guild_master_menu_01" ) );
|
|
pStatic->SetEnableOption( false );
|
|
pStatic->Disable();
|
|
|
|
dynamicCast< KUIControlSimpleButton * >( pPanel->GetChild( "trim_titlebar_open" ) )->Disable();
|
|
dynamicCast< KUIControlSimpleButton * >( pPanel->GetChild( "sub_close" ) )->Disable();
|
|
}
|
|
} |