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

133 lines
4.3 KiB
C++

#include "stdafx.h"
#include "SUIPopupPartyMenuCreatureWnd.h"
#include "SUIPartyTypes.h"
#include "SGameManager.h"
#include "SGameInterface.h"
#include "KUIControlButton.h"
SUIPopupPartyMenuCreatureWnd::SUIPopupPartyMenuCreatureWnd( SGameManager* pGameManager ) : SUIWnd( pGameManager ), m_nIndex(-1)
{
}
bool SUIPopupPartyMenuCreatureWnd::InitControls( KPoint kPos )
{
m_pBtnBuffOn = dynamicCast<KUIControlButton*>(GetChild("buff_on_button"));
m_pBtnBuffOff = dynamicCast<KUIControlButton*>(GetChild("buff_off_button"));
m_pBtnCreatureOn = dynamicCast<KUIControlButton*>(GetChild("creature_on_button"));
m_pBtnCreatureOff = dynamicCast<KUIControlButton*>(GetChild("creature_off_button"));
KRect rt;
/// 버프
rt = m_pBtnBuffOn->GetRect();
m_pBtnBuffOff->MovePos(rt.left, rt.top);
/// 크리처
rt = m_pBtnCreatureOn->GetRect();
m_pBtnCreatureOff->MovePos(rt.left, rt.top);
//m_pBtnCreatureOn->Disable();
//m_pBtnCreatureOff->Disable();
// 2011.11.09 - prodongi
m_pGameManager->GetGameInterface()->addPopupList(TOGGLE_WINDOW::UIWINDOW_POPUP_PARTY_MENU_CREATURE);
return SUIWnd::InitControls( kPos );
}
void SUIPopupPartyMenuCreatureWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( ::_stricmp( lpszControlID, "buff_on_button" ) == 0 )
{
number_t type(TS_ENTER::GAME_SUMMON);
number_t index(m_nIndex);
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "one_state_on", m_strSelectPartyWnd.c_str(), type, index));
}
else if( ::_stricmp( lpszControlID, "buff_off_button" ) == 0 )
{
number_t type(TS_ENTER::GAME_SUMMON);
number_t index(m_nIndex);
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "one_state_off", m_strSelectPartyWnd.c_str(), type, index));
}
/// 2011.11.17 크리처 show/hide는 나중에 - prodongi
else if( ::_stricmp( lpszControlID, "creature_on_button" ) == 0 )
{
number_t index(m_nIndex);
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_one_creature", m_strSelectPartyWnd.c_str(), index, number_t(0)));
}
else if( ::_stricmp( lpszControlID, "creature_off_button" ) == 0 )
{
number_t index(m_nIndex);
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "hide_one_creature", m_strSelectPartyWnd.c_str(), index, number_t(0)));
}
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPUP_PARTY_MENU_CREATURE, false ) );
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIPopupPartyMenuCreatureWnd::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 == "select_party" ) // select party wnd
{
m_strSelectPartyWnd = pData->m_strText; // select party wnd name
m_nIndex = (int)pData->m_dwData; // select index
}
else if( pData->m_strString == "position" ) // ui position
{
MovePos( (int)pData->m_nNumber.getAmount(), (int)pData->m_nNumber2.getAmount() );
}
/// 2011.11.17 - prodongi
else if (pData->m_strString == "set_status")
{
setActivityButton(m_pBtnBuffOn, m_pBtnBuffOff, pData->m_nNumber.getAmount() == 0 ? false : true);
setActivityButton(m_pBtnCreatureOn, m_pBtnCreatureOff, pData->m_nNumber2.getAmount() == 0 ? false : true);
}
else if ( pData->m_strString == "popup_update")
{
updatePopup(pData->m_nNumber.getAmount(), pData->m_nNumber2.getAmount());
}
break;
}
}
}
/// 2011.11.17 - prodongi
void SUIPopupPartyMenuCreatureWnd::setActivityButton(KUIControlButton* buttonShow, KUIControlButton* buttonHide, bool show)
{
buttonShow->SetShow(false);
buttonHide->SetShow(false);
if (show)
{
buttonShow->SetShow(true);
}
else
{
buttonHide->SetShow(true);
}
}
void SUIPopupPartyMenuCreatureWnd::updatePopup(int x, int y)
{
if (!IsShow())
return ;
if (!IsInRect(x, y))
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPUP_PARTY_MENU_CREATURE, false) );
}
}