#include "stdafx.h" #include "SGameManager.h" #include "SGameMessage.h" //#include "SGameMessageUI.h" #include "SPlayerInfoMgr.h" #include "SMessengerMgr.h" #include "KUITabControl.h" #include "KUIControlStatic.h" #include "KUIControlButton.h" #include "SUIGuildSubMasterTabManage.h" #include "SUIGuildSubMasterTabAuthority.h" #include "SUIGuildSubMasterWnd.h" namespace { // 탭 Wnd 타입. enum GUILDMasterTab_TYPE { GUILDMasterTab_NONE = -1, GUILDMasterTab_MANAGE = 0, GUILDMasterTab_AUTHORITY = 1, GUILDMasterTab_MAX }; const char g_arrLine[][128] = { "common_guage_titanium_line_orange", "common_guage_titanium_member_low" }; const char g_arrTabButton[][128] = { "common_button_tab_beamblue_orange", "common_button_tab_beamblue_red", "common_button_tab_beamblue_cyan" }; } SUIGuildSubMasterWnd::SUIGuildSubMasterWnd( SGameManager * pGameManager ) : SUIWnd( pGameManager ), m_pGauge( NULL ), m_nIndexShowTab( GUILDMasterTab_TYPE::GUILDMasterTab_MANAGE ), m_bRefresh( GUILD_UPDATE::GUILD_UPDATE_NONE ), m_bUIRefresh( true ) { } SUIGuildSubMasterWnd::~SUIGuildSubMasterWnd() { Release(); } // 메모리 해제. void SUIGuildSubMasterWnd::Release() { m_arrTabWnd.clear(); // Tab Wnd 배열. } SUIWnd* SUIGuildSubMasterWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID ) { SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID ); // 탭 컨트롤이 위치할 영역지정 컨트롤. m_pTabOutline = dynamicCast< KUIControl * >( GetChild( "select_list_orange_01" ) ); //-------------------------------- // 탭 컨트롤 생성. // 길드등급관리설정. SUIWnd * pTabManage = new SUIGuildSubMasterTabManage( m_pGameManager ); pTabManage->SetUseCutCaption(); // 컨트롤의 Caption 텍스트 자르기. pTabManage->CreateWnd( "window_guild_sub_master_tab_class_manage.nui", pWndManager, KPoint( kPos.x, kPos.y ) ); pTabManage->SetParent( this ); // 길드마스터권한. SUIWnd * pTabAuthority = new SUIGuildSubMasterTabAuthority( m_pGameManager ); pTabAuthority->SetUseCutCaption(); // 컨트롤의 Caption 텍스트 자르기. pTabAuthority->CreateWnd( "window_guild_sub_master_tab_authority.nui", pWndManager, KPoint( kPos.x, kPos.y ) ); pTabAuthority->SetParent( this ); // 부모에 자식으로 등록. this->AddChild( pTabManage ); m_arrTabWnd.push_back( pTabManage ); this->AddChild( pTabAuthority ); m_arrTabWnd.push_back( pTabAuthority ); // 위치지정. KRect rt = m_pTabOutline->GetRect(); pTabManage->MovePos( rt.left, rt.top ); pTabAuthority->MovePos( rt.left, rt.top ); //// 최초엔 길드등급관리설정 탭을 보여줌. // 주석. bintitle.2010.11.30. //pTabManage->SetShow( true ); // // 탭 버튼. 탭컨트롤 기능을 대신한다. m_arrTabButton.push_back( dynamicCast< KUIControlButton * >( GetChild( "tab00" ) ) ); m_arrTabButton.push_back( dynamicCast< KUIControlButton * >( GetChild( "tab_01" ) ) ); int size = m_arrTabButton.size(); for( int i=0; iSetEnableColor( "<#ffffff>" ); m_arrTabButton[ i ]->SetDisableColor( "<#a0a0a0>" ); } // 이부분 때문에 탭컨트롤 대신 버튼을 사용했다. // 활성화된 탭의 레이아웃을 탭에 속한 Wnd 보다 높게하여 ------ // _____| |_______ // 이런 모양이 되도록 해야하지만, // 탭컨트롤은 탭컨트롤안에 버튼기능의 TabItem 이 포함된다. // 탭컨트롤의 레이아웃이 탭에속한 Wnd 보다 낮은 상태에서 TabItem의 레이아웃은 탭에속한 Wnd 보다 높게 할 수 없다. std::list & rChildList = const_cast< std::list & >( this->GetChildList() ); std::list< KUIWnd* >::iterator it = std::find( rChildList.begin(), rChildList.end(), m_arrTabButton[ 0 ] ); if( it != rChildList.end() ) { rChildList.erase( it ); rChildList.push_back( m_arrTabButton[ 0 ] ); } m_arrTabButton[ GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY ]->SetAniName( g_arrTabButton[ GUILDMasterTab_TYPE::GUILDMasterTab_MAX ] ); m_arrTabButton[ 1 ]->SetAniName( "common_button_tab_beamblue_off" ); // 길드마스터권한탭 - 최초엔 비활성 이미지. //// //// 탭 컨트롤 설정. //KUISimpleTabControl * pTab = static_cast< KUISimpleTabControl * >( GetChild( "tab00" ) ); //if( pTab ) //{ // pTab->SetTabProperty( 0, false, 2 ); // pTab->AddTabItem( "길드등급관리설정", "길드등급관리설정", 0, 1.0f, "<#a0a0a0>" ); // pTab->AddTabItem( "길드마스터권한", "길드마스터권한", 0, 1.0f, "<#a0a0a0>" ); // pTab->SetSelectedItem( 0 ); //} //m_pTabControl = pTab; //// 탭 컨트롤과 탭에 속한 wnd 의 레이어 순서변경(탭컨트롤을 더앞쪽으로). //std::list rChildList = this->GetChildList(); //std::list< KUIWnd* >::iterator it = std::find( rChildList.begin(), rChildList.end(), m_pTabControl ); //if( it != rChildList.end() ) //{ // rChildList.erase( it ); // this->AddChild( m_pTabControl ); //} // 라인컨트롤. m_pGauge = dynamicCast< KUIControlStatic * >( GetChild( "gauge_guild_master_01" ) ); return this; } bool SUIGuildSubMasterWnd::InitControls( KPoint kPos ) { m_selectedTempTabIdx = -1; return SUIWnd::InitControls( kPos ); } // Tab 에 속한 Wnd 보임/숨김 처리. void SUIGuildSubMasterWnd::TabShow( bool bFlag ) { // 열기. // 이전에 열어놨던 탭이 열려야한다. if( bFlag ) { for( int i=0; iSetShow( true ); m_arrTabWnd[ i ]->OnNotifyUIWindowOpen( true ); } else { m_arrTabWnd[ i ]->SetShow( false ); m_arrTabWnd[ i ]->OnNotifyUIWindowOpen( false ); } } } // 닫기. else { for( int i=0; iSetShow( bFlag ); m_arrTabWnd[ i ]->OnNotifyUIWindowOpen( bFlag ); } } } void SUIGuildSubMasterWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd) { // Guild Main Wnd 옆의 위치 잡기. KUIWnd *pInfoWnd = m_pManager->FindWnd( "window_guild_main" ); if( pInfoWnd ) MovePos( pInfoWnd->GetRect().right - 4, pInfoWnd->GetRect().top ); if( bOpen ) { // 권한처리. if( m_bUIRefresh && ( m_bRefresh & GUILD_UPDATE::GUILD_UPDATE_GMEMBER ) || /// 2010.12.14 or 연산 수정 - prodongi ( m_bRefresh & GUILD_UPDATE_PROMOTE ) || ( m_bRefresh & GUILD_UPDATE_CHANGE_PERMISSION ) ) { AuthorityProcess(); } TabShow( true ); UpdateTabWnd(); // Tab Wnd Update. m_bUIRefresh = false; m_bRefresh = GUILD_UPDATE::GUILD_UPDATE_NONE; } else { TabShow( false ); // 길드장 인계 팝업 윈도우 닫기. m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_SUB_MASTER_PROMOTE, false ) ); m_bUIRefresh = false; m_bRefresh = GUILD_UPDATE::GUILD_UPDATE_NONE; } } void SUIGuildSubMasterWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { switch( pMsg->nType ) { case IMSG_UI_MOVE: { SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg; MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY ); pMsg->bUse = true; } break; case IMSG_UI_GUILD_DESTROY : // 길드해체. case IMSG_UI_GUILD_UPGRADE: // 길드마스터 탭 으로 메세지 전송. m_arrTabWnd[ GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY ]->ProcMsgAtStatic( pMsg ); break; case IMSG_UI_SEND_DATA: { SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg; // // 길드 업데이트. if( pData->m_strString == "guild_update" ) { pData->bUse = true; // 권한처리. if( this->IsShow() ) { if( ( ( pData->m_dwData & GUILD_UPDATE::GUILD_UPDATE_GMEMBER ) && ( pData->m_strText == "Self" ) ) || /// 2010.12.14 or 연산 수정 - prodongi ( pData->m_dwData & GUILD_UPDATE_PROMOTE ) || ( pData->m_dwData & GUILD_UPDATE_CHANGE_PERMISSION ) ) { AuthorityProcess(); } m_bRefresh = GUILD_UPDATE::GUILD_UPDATE_NONE; m_bUIRefresh = false; } else { m_bRefresh |= pData->m_dwData; m_bUIRefresh = true; } 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_DONATION ) || ( pData->m_dwData & GUILD_UPDATE_CHANGE_PERMISSION_SET ) ) { // 길드마스터 탭 으로 메세지 전송. m_arrTabWnd[ GUILDMasterTab_TYPE::GUILDMasterTab_MANAGE ]->ProcMsgAtStatic( pMsg ); } } // // 길드장 변경. else if( pData->m_strString == "change_guild_master" ) { pData->bUse = true; // 권한처리. AuthorityProcess(); // 길드마스터 탭 으로 메세지 전송. m_arrTabWnd[ GUILDMasterTab_TYPE::GUILDMasterTab_MANAGE ]->ProcMsgAtStatic( pMsg ); } } break; } } void SUIGuildSubMasterWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch( nMessage ) { // 윈도우 이동 case KUI_MESSAGE::KGENWND_MOVE: { LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한 } break; case KUI_MESSAGE::KBUTTON_CLICK : if( !::_stricmp( lpszControlID, "button_close" ) ) { CloseWnd(); // m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MASTER, false) ); } else if( !::_stricmp( lpszControlID, "tab00" ) ) { m_selectedTempTabIdx = GUILDMasterTab_TYPE::GUILDMasterTab_MANAGE; //ShowTabWnd( GUILDMasterTab_TYPE::GUILDMasterTab_MANAGE ); } else if( !::_stricmp( lpszControlID, "tab_01" ) ) { m_selectedTempTabIdx = GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY; //ShowTabWnd( GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY ); } break; //// 탭 변경 //case KUI_MESSAGE::KTAB_SELECT : // // ShowTabWnd( (int)lparam ); // break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } DWORD SUIGuildSubMasterWnd::OnMouseMessage(DWORD dwMessage, int x, int y) { return SUIWnd::OnMouseMessage( dwMessage, x, y ); } void SUIGuildSubMasterWnd::Process(DWORD dwTime) { updateShowTabWnd(); SUIWnd::Process(dwTime); } void SUIGuildSubMasterWnd::updateShowTabWnd() { if (-1 == m_selectedTempTabIdx) return ; ShowTabWnd(m_selectedTempTabIdx); m_selectedTempTabIdx = -1; } // 창 닫기. void SUIGuildSubMasterWnd::CloseWnd() { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MASTER, false) ); } // Tab Wnd Update. void SUIGuildSubMasterWnd::UpdateTabWnd() { m_arrTabWnd[ 0 ]->SetShow( true ); int size = m_arrTabWnd.size(); for( int i=0; iForcedProcess( 0 ); } // 탭 Wnd 보임, 숨김 처리. void SUIGuildSubMasterWnd::ShowTabWnd( int tabIndex ) { if( tabIndex > GUILDMasterTab_TYPE::GUILDMasterTab_NONE && tabIndex < GUILDMasterTab_TYPE::GUILDMasterTab_MAX ) { // 탭에 속하는 윈도우들의 레이아웃을 최하단으로 이동. std::list & rChildList = const_cast< std::list & >( this->GetChildList() ); int size = m_arrTabWnd.size(); for( int i=0; i::iterator it = std::find( rChildList.begin(), rChildList.end(), m_arrTabWnd[ i ] ); if( it != rChildList.end() ) { rChildList.erase( it ); rChildList.push_back( m_arrTabWnd[ i ] ); } } for( int i=0; iSetShow( true ); m_arrTabWnd[ i ]->OnNotifyUIWindowOpen( true ); // 선택된 탭버튼의 레이아웃을 최하단으로 이동. std::list< KUIWnd* >::iterator it = std::find( rChildList.begin(), rChildList.end(), m_arrTabButton[ tabIndex ] ); if( it != rChildList.end() ) { rChildList.erase( it ); rChildList.push_back( m_arrTabButton[ tabIndex ] ); m_arrTabButton[ tabIndex ]->SetAniName( g_arrTabButton[ tabIndex ] ); } } else { m_arrTabWnd[ i ]->SetShow( false ); m_arrTabWnd[ i ]->OnNotifyUIWindowOpen( false ); // 비선택 탭버튼 이미지 변경. if( m_arrTabButton[ i ] ) { //m_arrTabButton[ i ]->SetAniName( g_arrTabButton[ GUILDMasterTab_TYPE::GUILDMasterTab_MAX ] ); m_arrTabButton[ i ]->SetAniName( "common_button_tab_beamblue_off" ); } } //m_arrTabWnd[ i ]->SetShow( ( i == tabIndex ? true : false ) ); } // 라인컨트롤. m_pGauge->SetAniName( g_arrLine[ tabIndex ] ); } // 탭컨트롤 Ani 변경. //m_pTabControl->SetTabItemAniName( 1, tabIndex > 0 ? "common_button_tab_beamblue_red" : "common_button_tab_beamblue_orange" ); } // 권한처리. void SUIGuildSubMasterWnd::AuthorityProcess() { SPlayerInfo player = m_PlayerInfoMgr.GetPlayerInfo(); SPlayerSlot * pPlayerSlot = this->m_GuildMgr.FindMember( player.GetName() ); if( pPlayerSlot ) { int nAuthority = pPlayerSlot->GetAuthority(); //// 길드마스터 탭. //if( nClass == _PERMISSION::PERMISSION_LEADER ) // m_pTabControl->SetEnableTab( GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY ); //else // m_pTabControl->SetDisableTab( GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY ); // 길드마스터 탭. if( nAuthority == _PERMISSION::PERMISSION_LEADER ) m_arrTabButton[ GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY ]->Enable(); else m_arrTabButton[ GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY ]->Disable(); //// 길드마스터 탭. //if( nAuthority == _PERMISSION::PERMISSION_LEADER ) // m_arrTabButton[ GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY ]->Enable(); //else //{ // // 길드마스터 탭. // m_arrTabButton[ GUILDMasterTab_TYPE::GUILDMasterTab_AUTHORITY ]->Disable(); // // 등급별권한설정 권한 추가. // int nBitSet = m_GuildMgr.GetAuthorityClassBitSet( nAuthority - 1 ); // 권한 비트셋. // // if( _PERMIT_REQUIRED_ACTION::PRA_CLASS_AUTHORITY_SET & nBitSet ) // m_arrTabButton[ GUILDMasterTab_TYPE::GUILDMasterTab_MANAGE ]->Enable(); // else // m_arrTabButton[ GUILDMasterTab_TYPE::GUILDMasterTab_MANAGE ]->Disable(); //} } }