583 lines
15 KiB
C++
583 lines
15 KiB
C++
|
|
#include "stdafx.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include "SGameManager.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SMessengerMgr.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
#include "KUIControlScroll.h"
|
|
#include "KUIListControl.h"
|
|
#include "KUIControlButton.h"
|
|
#include "KUIControlPanel.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "SUIClass1PanelWnd.h"
|
|
|
|
namespace
|
|
{
|
|
const int g_ListSizeMAX = 11; // 권한목록 최대개수.
|
|
|
|
std::string textDecorate( "<font:font_02><size:7><#246771><hcenter><vcenter><left>" );
|
|
std::string g_arrText[] = { "<$1858:Write a note>",
|
|
"<$1859:Write a Guild announcement>",
|
|
"<$1860:Add a Guild icon>",
|
|
"<$1861:Manage a Guild announcement>",
|
|
"<$1862:Invite new members>",
|
|
"<$1863:Manage rights by rank>",
|
|
"<$1864:Expel a member>",
|
|
"<$1865:Set up a Timed Challenge>",
|
|
"<$1866:Manage an occupied dungeon>",
|
|
"<$1927:Modify Guild ranks>",
|
|
"<$744:Receive the guild's blessing>"
|
|
//"<font:font_02><size:9><#246771><hcenter><vcenter><left><$1928:Permission_by_Rank_Modification>"
|
|
};
|
|
|
|
/*const char g_arrText[][64] = {
|
|
"Permission to write memos",
|
|
"Permission to post guild notices",
|
|
"Permission to set guild emblem",
|
|
"Permission to manage guild advertisements",
|
|
"Permission to approve guild member applications",
|
|
"Permission to manage guild member promotions",
|
|
"Permission to expel guild members",
|
|
"Permission to form raid groups",
|
|
"Permission to manage dungeons"
|
|
};*/
|
|
|
|
|
|
|
|
/*
|
|
PRA_MEMBER_MEMO = 1 << 9, // 길드원 메모 작성/수정
|
|
PRA_NOTICE = 1 << 8, // 길드 공지
|
|
PRA_UPDATE_GUILD_ICON = 1 << 13, // 길드 아이콘 변경
|
|
PRA_ADVERTISE_MANAGEMENT = 1 << 14, // 길드 광고 관리
|
|
PRA_MEMBER_INVITE = 1 << 1, // 길드원 가입
|
|
PRA_GRANT_REVOKE_PERMISSION = 1 << 3, // 길드원 승급/강등
|
|
PRA_MEMBER_KICK = 1 << 2, // 길드원 추방
|
|
PRA_ATTACK_TEAM_CREATE = 1 << 6, // 공격대 결성
|
|
PRA_DUNGEON_MANAGEMENT = 1 << 4, // 던전 관리
|
|
PRA_UPDATE_GUILD_ICON = 1 << 13, // 길드 아이콘 변경
|
|
PRA_ADVERTISE_MANAGEMENT = 1 << 14, // 길드 광고 관리
|
|
PRA_SET_PERMISSION_NAME = 1 << 0, // 등급명칭쓰기
|
|
PRA_BUFF = 1 << 15,
|
|
*/
|
|
const int g_arrAuthority_Bit[] = { 9, 8, 13, 14, 1, 3, 2, 6, 4, 0 , 15 }; //, 15, 16 }; 15 = AziaMafia buff guild
|
|
}
|
|
|
|
|
|
SUIClass1PanelWnd::SUIClass1PanelWnd( SGameManager * pGameManager, KUIControlPanelManager * pPanelManager, int panelIndex ):
|
|
KUIControlPanel( pGameManager, pPanelManager ),
|
|
m_pExtensionButton( NULL ), // 확장버튼.
|
|
m_pScrollBar( NULL ),
|
|
m_pCheckControl( NULL ),
|
|
m_pListAuthority( NULL ),
|
|
m_PanelIndex( panelIndex ),
|
|
m_nScrollPos( 0 ),
|
|
m_checkIndex( 0 )
|
|
{
|
|
}
|
|
|
|
|
|
SUIClass1PanelWnd::~SUIClass1PanelWnd()
|
|
{
|
|
Release();
|
|
}
|
|
|
|
// 메모리 해제.
|
|
void SUIClass1PanelWnd::Release()
|
|
{
|
|
SAFE_DELETE( m_pListAuthority );
|
|
}
|
|
|
|
|
|
//-----------------------------
|
|
// Override
|
|
|
|
// KUIControlPanel::
|
|
// 패널의 크기를 원본크기로 변경한다. 각 패널윈도우의 크기가 다르므로 재정의할것!!.
|
|
void SUIClass1PanelWnd::ResizeOriginal()
|
|
{
|
|
KRect rtWnd = this->GetRect();
|
|
const KRect & rtTitlebar = GetChild( "trim_titlebar_open" )->GetRect();
|
|
|
|
rtWnd.bottom = rtWnd.top + rtTitlebar.GetHeight();
|
|
|
|
// 윈도우 크기변경.
|
|
KUIWnd::OnSizeChangeNofity( rtWnd );
|
|
|
|
// Panel 의 함수.
|
|
KUIControlPanel::ResizeOriginal();
|
|
|
|
// 버튼 애니 변경.
|
|
PanelExtend();
|
|
}
|
|
|
|
|
|
bool SUIClass1PanelWnd::InitControls( KPoint kPos )
|
|
{
|
|
// Check 박스 컨트롤 배열 설정.
|
|
InitializeCheckBox();
|
|
|
|
// 텍스트 컨트롤.
|
|
m_TextTag = GetChild( "text_guild_permission_01" )->GetCaption();
|
|
//m_TextTag
|
|
|
|
// 확장버튼 컨트롤.
|
|
m_pExtensionButton = dynamicCast< KUIControlSimpleButton * >( GetChild( "sub_close" ) );
|
|
|
|
|
|
const KRect & rtTitlebar = GetChild( "trim_titlebar_open" )->GetRect();
|
|
|
|
KRect rtOriginal = this->GetRect(); // window의 크기.
|
|
rtOriginal.bottom = rtOriginal.top + rtTitlebar.GetHeight();
|
|
|
|
// 초기설정.( 확대, 축소 크기지정 )
|
|
this->Initialize( rtOriginal, this->GetRect() );
|
|
|
|
kPos.x = rtOriginal.left;
|
|
kPos.y = rtOriginal.top;
|
|
|
|
// Enable/Disable Color 설정.
|
|
KUIControlStatic * pStatic = dynamicCast< KUIControlStatic * >( GetChild( "text_guild_permission_01" ) );
|
|
pStatic->SetEnableColor( "<#ffffff>" );
|
|
pStatic->SetDisableColor( "<#a0a0a0>" );
|
|
|
|
//------------------------------------
|
|
// ListControl 생성.
|
|
SAFE_DELETE( m_pListAuthority );
|
|
m_pListAuthority = new KUIListControl( this, "listcontol_01", "", "item_base", 8 );
|
|
|
|
// Item column
|
|
m_pListAuthority->AddStringItemColumn( "text_guild_permission_01" );
|
|
m_pListAuthority->AddStringItemColumn( "button_checkbutton_01" );
|
|
m_pListAuthority->AddStringItemColumn( "layout_dotline_01" );
|
|
|
|
// Create
|
|
m_pListAuthority->Create();
|
|
//-------------------------------------
|
|
|
|
|
|
// 스크롤바.
|
|
// 2010.09.20 - prodongi
|
|
m_pScrollBar = dynamicCast< KUIControlVScrollSmallEx* >(GetChild( "scrollbar_list" ));
|
|
//m_pScrollBar = static_cast< KUIControlVScroll* >(GetChild( "scrollbar_list" ));
|
|
|
|
// ****
|
|
// 확장 여부에따라 숨김, 보임 처리가 바뀌는 Wnd 를 배열에 추가한다.
|
|
this->AddChangeVisibleWnd( GetChild( "sub_window" ) );
|
|
|
|
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
|
|
|
|
|
|
void SUIClass1PanelWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
|
|
{
|
|
if( bOpen )
|
|
{
|
|
// 권한비트셋 설정.
|
|
SetAuthorityClassBitSet();
|
|
|
|
m_nScrollPos = 0; // scroll bar의 변경 정보.
|
|
|
|
// 리스트의 각 아이템의 상태정보.
|
|
if( m_pListAuthority )
|
|
{
|
|
m_pListAuthority->RefreshItemState( g_ListSizeMAX );
|
|
|
|
// Scroll bar
|
|
RefreshScrollbar();
|
|
|
|
// List 설정.
|
|
RefreshList( m_nScrollPos );
|
|
|
|
// 처음엔 리스트 숨김.
|
|
m_pListAuthority->SetShowList( false );
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Refresh.
|
|
void SUIClass1PanelWnd::RefreshData()
|
|
{
|
|
// 권한비트셋 설정.
|
|
SetAuthorityClassBitSet();
|
|
|
|
// 리스트의 각 아이템의 상태정보.
|
|
if( m_pListAuthority )
|
|
{
|
|
m_pListAuthority->RefreshItemState( g_ListSizeMAX );
|
|
|
|
// Scroll bar
|
|
RefreshScrollbar();
|
|
|
|
// List 설정.
|
|
RefreshList( m_nScrollPos );
|
|
|
|
// 처음엔 리스트 숨김.
|
|
m_pListAuthority->SetShowList( false );
|
|
}
|
|
}
|
|
|
|
void SUIClass1PanelWnd::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->m_dwData & GUILD_UPDATE::GUILD_UPDATE_CHANGE_PERMISSION_SET ) &&
|
|
( pData->m_dwData & GUILD_UPDATE::GUILD_UPDATE_GPERMISSION )
|
|
)
|
|
{
|
|
pMsg->bUse = true;
|
|
|
|
// Refresh.
|
|
RefreshData();
|
|
}
|
|
|
|
// 길드장 변경.
|
|
else if( pData->m_strString == "change_guild_master" )
|
|
{
|
|
pData->bUse = true;
|
|
|
|
// Refresh.
|
|
RefreshData();
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void SUIClass1PanelWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch( nMessage )
|
|
{
|
|
|
|
case KUI_MESSAGE::KBUTTON_CLICK :
|
|
|
|
// 확대축소 토글.
|
|
if( !::_stricmp( lpszControlID, "sub_close" ) || !::_stricmp( lpszControlID, "trim_titlebar_open" ) )
|
|
{
|
|
// 토글.
|
|
this->ToggleExtend();
|
|
|
|
// 버튼 애니 변경.
|
|
PanelExtend();
|
|
}
|
|
|
|
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;
|
|
|
|
// 길드원정보 재설정.
|
|
RefreshList( m_nScrollPos );
|
|
|
|
// 스크롤바 조절.
|
|
RefreshScrollbar();
|
|
}
|
|
break;
|
|
|
|
|
|
// Check
|
|
case KUI_MESSAGE::KCHECK_CHANGE :
|
|
if( m_pListAuthority && m_pCheckControl )
|
|
{
|
|
// Check 박스 체크 검사.
|
|
SetCheckBoxState( m_checkIndex + m_nScrollPos, m_pCheckControl->GetCheck() );
|
|
m_pCheckControl = NULL;
|
|
m_checkIndex = 0;
|
|
}
|
|
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_pListAuthority && m_pListAuthority->GetControl( pControl, ( ITEMTYPE )msg.type, msg.itemIndex, msg.columnIndex ) )
|
|
{
|
|
//
|
|
// 아이템
|
|
//
|
|
if( ITEMTYPE::TYPE_ITEM_Base == msg.type || ITEMTYPE::TYPE_ITEM_Column == msg.type )
|
|
{
|
|
// 체크박스선택.
|
|
if( !::_stricmp( pControl->GetID(), "button_checkbutton_01" ) )
|
|
{
|
|
m_pCheckControl = dynamicCast< KUIControlCheck * >( pControl );
|
|
m_checkIndex = msg.itemIndex;
|
|
}
|
|
}
|
|
|
|
}// if
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
|
|
DWORD SUIClass1PanelWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
if( dwMessage == KLBUTTON_DOWN )
|
|
{
|
|
// ListControl 의 Mouse Event 처리.
|
|
if( m_pListAuthority )
|
|
m_pListAuthority->OnMouseMessage( dwMessage, x, y );
|
|
}
|
|
|
|
return SUIWnd::OnMouseMessage(dwMessage, x, y);
|
|
}
|
|
|
|
|
|
//강제 프로세스
|
|
void SUIClass1PanelWnd::ForcedProcess(DWORD dwTime)
|
|
{
|
|
//m_nScrollPos = 0; // scroll bar의 변경 정보.
|
|
|
|
//// 리스트의 각 아이템의 상태정보.
|
|
//if( m_pListAuthority )
|
|
//{
|
|
// m_pListAuthority->RefreshItemState( g_ListSizeMAX );
|
|
//
|
|
// // Scroll bar
|
|
// RefreshScrollbar();
|
|
|
|
// // List 설정.
|
|
// RefreshList( m_nScrollPos );
|
|
|
|
// // 처음엔 리스트 숨김.
|
|
// m_pListAuthority->SetShowList( false );
|
|
//}
|
|
}
|
|
|
|
|
|
// Check 박스 컨트롤 배열 설정.
|
|
void SUIClass1PanelWnd::InitializeCheckBox()
|
|
{
|
|
// 최초설정.
|
|
//if( m_arrCheckBox.size() < 1 )
|
|
//{
|
|
m_arrCheckBox.resize( g_ListSizeMAX, false );
|
|
//}
|
|
//// 초기화.
|
|
//else
|
|
//{
|
|
// int size = m_arrCheckBox.size();
|
|
// for( int i=0; i<size; i++ )
|
|
// m_arrCheckBox[ i ] = false;
|
|
//}
|
|
}
|
|
|
|
|
|
// Check 박스 상태 설정.
|
|
void SUIClass1PanelWnd::SetCheckBoxState( int index, bool bCheck )
|
|
{
|
|
if( index < m_arrCheckBox.size() )
|
|
{
|
|
m_arrCheckBox[ index ] = bCheck;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
// Panel 확대,축소
|
|
void SUIClass1PanelWnd::PanelExtend()
|
|
{
|
|
m_pExtensionButton->SetAniName( this->GetIsExtend() ? "common_button_titanium_sub_open" : "common_button_titanium_sub_close" );
|
|
|
|
m_pListAuthority->SetShowList( this->GetIsExtend() ); // 확장여부에따라 리스트 보임, 숨김.
|
|
}
|
|
|
|
|
|
// 스크롤바 설정.
|
|
void SUIClass1PanelWnd::RefreshScrollbar()
|
|
{
|
|
if( m_pScrollBar && m_pListAuthority )
|
|
{
|
|
m_pScrollBar->SetScrollRange( m_pListAuthority->GetListConutMAX(), g_ListSizeMAX );
|
|
}
|
|
}
|
|
|
|
// 스크롤바 설정.
|
|
void SUIClass1PanelWnd::RefreshList( int nScroll )
|
|
{
|
|
if( m_pListAuthority == NULL )
|
|
return;
|
|
|
|
// 길드마스터인가?
|
|
SPlayerInfo player = m_PlayerInfoMgr.GetPlayerInfo();
|
|
SPlayerSlot * pPlayerSlot = this->m_GuildMgr.FindMember( player.GetName() );
|
|
bool bMaster = false;
|
|
if( pPlayerSlot )
|
|
{
|
|
if( pPlayerSlot->GetAuthority() == _PERMISSION::PERMISSION_LEADER )
|
|
bMaster = true;
|
|
}
|
|
|
|
KUIControl * pControl = NULL;
|
|
|
|
int maxSize = m_pListAuthority->GetListConutMAX(); // 리스트 최대개수.
|
|
int textIndex = 0;
|
|
bool bVisible = false;
|
|
|
|
for( int i=0; i<maxSize; i++ )
|
|
{
|
|
// ListControl 의 Item.
|
|
KUIListItem * pItem = m_pListAuthority->GetItem( i );
|
|
|
|
if( pItem )
|
|
{
|
|
// index가 권한목록 최대개수 이하인동안 Refresh.
|
|
if( i + nScroll < g_ListSizeMAX )
|
|
{
|
|
// 권한 텍스트 인덱스.
|
|
textIndex = i + nScroll;
|
|
|
|
// 컨트롤에 텍스트 맵핑.
|
|
pItem->GetControl( pControl, "text_guild_permission_01" );
|
|
|
|
std::string strDeco = textDecorate;
|
|
XStringUtil::Replace( strDeco, "<size:7>", CStringUtil::StringFormat("<size:%d>", pControl->GetFontSize() ) );
|
|
pControl->SetCaption( ( strDeco + g_arrText[ textIndex ] ).c_str() );
|
|
|
|
//// 체크박스.
|
|
KUIControl * pCheck;
|
|
pItem->GetControl( pCheck, "button_checkbutton_01" );
|
|
KUIControlCheck * pCheckBox = dynamicCast< KUIControlCheck * >( pCheck );
|
|
pCheckBox->SetCheck( GetCheckBoxState( textIndex ) );
|
|
|
|
// 권한등급별 권한설정.
|
|
//bVisible = AuthorityProcess( textIndex );
|
|
//if( bMaster || bVisible ) // 길드마스터는 전부 활성화.
|
|
//{
|
|
// // 활성화.
|
|
// KUIControlStatic * pStatic = static_cast< KUIControlStatic * >( pControl );
|
|
// pStatic->SetEnableOption( true );
|
|
// pStatic->Enable();
|
|
|
|
// pCheckBox->SetCheck( GetCheckBoxState( textIndex ) );
|
|
// pCheckBox->Enable();
|
|
//}
|
|
//else
|
|
//{
|
|
// // 비활성화.
|
|
// KUIControlStatic * pStatic = static_cast< KUIControlStatic * >( pControl );
|
|
// pStatic->SetEnableOption( false );
|
|
// pStatic->Disable();
|
|
//
|
|
// pCheckBox->SetCheck( false );
|
|
// pCheckBox->Disable();
|
|
//}
|
|
|
|
|
|
////-------------------------------
|
|
//// ** 해당 아이템을 확장 or 축소(원본크기) 한다.
|
|
m_pListAuthority->SetResize( i, textIndex, 1 );
|
|
}
|
|
}
|
|
|
|
}// for
|
|
|
|
////-------------------------------
|
|
//// ** 리스트정보 최종 업데이트.
|
|
m_pListAuthority->RefreshList( m_nScrollPos );
|
|
|
|
}
|
|
|
|
// 체크된 권한을 검사하여, 권한등급비트셋을 구성하여 반환한다.
|
|
int SUIClass1PanelWnd::GetNumberData()
|
|
{
|
|
// 권한등급비트셋.
|
|
int nResultBitSet = 0;
|
|
|
|
int size = m_arrCheckBox.size();
|
|
for( int i=0; i<size; i++ )
|
|
{
|
|
if( m_arrCheckBox[ i ] )
|
|
nResultBitSet |= ( 1 << g_arrAuthority_Bit[ i ] ); // 비트셋 구성.
|
|
}
|
|
|
|
return nResultBitSet;
|
|
}
|
|
|
|
|
|
// 권한비트셋 설정.
|
|
void SUIClass1PanelWnd::SetAuthorityClassBitSet()
|
|
{
|
|
// int nClass = this->GetPanelIndex(); // 권한.
|
|
//int nClassBitSet = m_GuildMgr.GetAuthorityClassBitSet( nClass ); // 권한비트셋.
|
|
|
|
//int size = m_arrCheckBox.size();
|
|
//for( int i=0; i<size; i++ )
|
|
//{
|
|
// m_arrCheckBox[ i ] = ( nClassBitSet & ( 1 << g_arrAuthority_Bit[ i ] ) );
|
|
//}
|
|
|
|
int nClass = this->GetPanelIndex(); // 권한.
|
|
nClass = _PERMISSION::PERMISSION_MEMBER_MAX - nClass;
|
|
int nClassBitSet = m_GuildMgr.GetAuthorityClassBitSet( nClass - 1 ); // 권한비트셋.
|
|
|
|
int size = m_arrCheckBox.size();
|
|
for( int i=0; i<size; i++ )
|
|
{
|
|
/// 2011.01.19 warning 수정 - prodongi
|
|
//m_arrCheckBox[ i ] = ( nClassBitSet & ( 1 << g_arrAuthority_Bit[ i ] ) );
|
|
m_arrCheckBox[ i ] = ( nClassBitSet & ( 1 << g_arrAuthority_Bit[ i ] ) ) == 0 ? false : true;
|
|
}
|
|
}
|
|
|
|
|
|
// 권한처리.
|
|
// 상위등급의 권한 이거나, 현재등급의 권한 이면 해당 리스트아이템을 활성화, 아니면 비활성화 한다.
|
|
// Return : true 활성, false 비활성
|
|
bool SUIClass1PanelWnd::AuthorityProcess( int index )
|
|
{
|
|
// 1등급 권한셋은 길드마스터만이 설정할 수 있으므로 비활성처리 하지않는다.
|
|
if( m_PanelIndex > 0 )
|
|
{
|
|
int mask = 1 << g_arrAuthority_Bit[ index ];
|
|
|
|
int nClass = _PERMISSION::PERMISSION_LEADER - ( m_PanelIndex + 1 );
|
|
--nClass;
|
|
|
|
int nUpperSet = m_GuildMgr.GetAuthorityClassBitSet( nClass + 1 ); // 상위등급 권한비트셋.
|
|
int nCrrSet = m_GuildMgr.GetAuthorityClassBitSet( nClass ); // 현재등급 권한비트셋.
|
|
|
|
if( ( nCrrSet & mask ) || ( nUpperSet & mask ) )
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
} |