#include "stdafx.h" #include "SGameManager.h" #include "SGameMessage.h" #include "SMessengerMgr.h" #include "SPlayerInfoMgr.h" //#include "SGameMessageUI.h" #include #include "XAbuseFilter.h" #include #include "KUIControlButton.h" #include "KUIControlPanel.h" #include "KUIControlEdit.h" #include "KUIControlStatic.h" #include "SUIDonationPanelWnd.h" SUIDonationPanelWnd::SUIDonationPanelWnd( SGameManager * pGameManager, KUIControlPanelManager * pPanelManager ): KUIControlPanel( pGameManager, pPanelManager ), m_pExtensionButton( NULL ), // 확장버튼. m_GuildCurrent( NULL ), m_Point( NULL ), m_TotalPoint( NULL ) { } SUIDonationPanelWnd::~SUIDonationPanelWnd() { Release(); } // 메모리 해제. void SUIDonationPanelWnd::Release() { } //----------------------------- // Override // KUIControlPanel:: // 패널의 크기를 원본크기로 변경한다. 각 패널윈도우의 크기가 다르므로 재정의할것!!. void SUIDonationPanelWnd::ResizeOriginal() { KRect rtWnd = this->GetRect(); const KRect & rtTitlebar = GetChild( "trim_titlebar_open" )->GetRect(); rtWnd.bottom = rtWnd.top + rtTitlebar.GetHeight() - 1; // 윈도우 크기변경. KUIWnd::OnSizeChangeNofity( rtWnd ); // Panel 의 함수. KUIControlPanel::ResizeOriginal(); // 버튼 애니 변경. PanelExtend(); } bool SUIDonationPanelWnd::InitControls( KPoint kPos ) { m_Point = dynamicCast< KUIControl * >( GetChild( "text_class_6" ) ); m_TotalPoint = dynamicCast< KUIControl * >( GetChild( "text_class_7" ) ); m_GuildCurrent = dynamicCast< KUIControl * >( GetChild( "text_class_8" ) ); // **** // 확장 여부에따라 숨김, 보임 처리가 바뀌는 Wnd 를 배열에 추가한다. this->AddChangeVisibleWnd( GetChild( "select_list_cyan" ) ); // 확장버튼 컨트롤. m_pExtensionButton = dynamicCast< KUIControlSimpleButton * >( GetChild( "sub_open" ) ); //const KRect & rtOutLine = GetChild( "select_list_cyan_06" )->GetRect(); 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; // 활성화시 텍스트 컬러. dynamicCast< KUIControlStatic * >( GetChild( "guild_manage_menu" ) )->SetEnableColor( "<#ffffff>" ); return SUIWnd::InitControls( kPos ); } void SUIDonationPanelWnd::DataMapping() { SPlayerInfo player = m_PlayerInfoMgr.GetPlayerInfo(); SPlayerSlot * pPlayerSlot = this->m_GuildMgr.FindMember( player.GetName() ); m_Point->SetCaption( CStringUtil::StringFormat( "%d", pPlayerSlot->GetPoint() ).c_str() ); m_TotalPoint->SetCaption( CStringUtil::StringFormat( "%d", pPlayerSlot->GetTotalPoint() ).c_str() ); m_GuildCurrent->SetCaption( CStringUtil::StringFormat( "%d / %d", m_GuildMgr.GetGuildPoint(), m_GuildMgr.GetGuildObjectif() ).c_str() ); } void SUIDonationPanelWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd) { if( bOpen ) { DataMapping(); } } void SUIDonationPanelWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { switch( pMsg->nType ) { case IMSG_UI_SEND_DATA: { if( this->IsShow() ) { SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg; if( pData->m_strString == "guild_update" ) { DataMapping(); } } } break; case IMSG_UI_GUILD_DONATE_MODE : OpenPopupWnd( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_PANEL_DONATE, this->GetMultipurposePos().x, this->GetMultipurposePos().y ); pMsg->bUse = true; break; case IMSG_UI_GUILD_BUFF : m_pGameManager->ProcMsgAtStatic( &SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_BUFF, strParam ) ); pMsg->bUse = true; break; case IMSG_UI_GUILD_DONATE : m_pGameManager->ProcMsgAtStatic( &SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_DONATE, strParam ) ); pMsg->bUse = true; break; } } void SUIDonationPanelWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch( nMessage ) { case KUI_MESSAGE::KBUTTON_CLICK : { if( !::_stricmp( lpszControlID, "sub_open" )|| !::_stricmp( lpszControlID, "trim_titlebar_open" ) ) { this->ToggleExtend(); PanelExtend(); } else if (!::_stricmp(lpszControlID, "button_donate_10000")) { strParam = "10000"; m_pGameManager->ProcMsgAtStatic(&SIMSG_REQ_OPEN_MSGBOX(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_DONATE, S(2101000034), true)); } else if (!::_stricmp(lpszControlID, "button_donate_100000")) { strParam = "100000"; m_pGameManager->ProcMsgAtStatic(&SIMSG_REQ_OPEN_MSGBOX(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_DONATE, S(2101000035), true)); } else if (!::_stricmp(lpszControlID, "button_donate_1000000")) { strParam = "1000000"; m_pGameManager->ProcMsgAtStatic(&SIMSG_REQ_OPEN_MSGBOX(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_DONATE, S(2101000036), true)); } else if( !::_stricmp( lpszControlID, "button_donate_1000" ) ) { strParam = "1000"; m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_DONATE, S( 749 ), true ) ); } else if( !::_stricmp( lpszControlID, "button_donate_100" ) ) { strParam = "100"; m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_DONATE, S( 748 ), true ) ); } else if( !::_stricmp( lpszControlID, "button_donate_10" ) ) { strParam = "10"; m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_DONATE, S( 747 ), true ) ); } else if( !::_stricmp( lpszControlID, "button_buff_10" ) ) { strParam = "100"; m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_BUFF, SR( 745, "#@point@#", strParam.c_str() ).c_str(), true ) ); } /* else if( !::_stricmp( lpszControlID, "button_buff_1" ) ) { strParam = "1"; m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GUILD_BUFF, SR( 745, "#@point@#", strParam.c_str() ).c_str(), true ) ); } */ } break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } DWORD SUIDonationPanelWnd::OnMouseMessage(DWORD dwMessage, int x, int y) { return SUIWnd::OnMouseMessage( dwMessage, x, y ); } void SUIDonationPanelWnd::OpenPopupWnd( int wndID, int posX, int posY ) { SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE wndType = ( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE )wndID; m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( wndType, posX, posY ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_TOGGLE_UIWINDOW( wndType ) ); } void SUIDonationPanelWnd::PanelExtend() { m_pExtensionButton->SetAniName( this->GetIsExtend() ? "common_button_titanium_sub_open" : "common_button_titanium_sub_close" ); } void SUIDonationPanelWnd::CustomOpen() { PanelExtend(); }