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

219 lines
5.8 KiB
C++

#include "stdafx.h"
#include "SUIPartyRMenuWnd.h"
#include "SUIDisplayInfo.h"
#include "SGameManager.h"
#include "SGameInterface.h"
#include "SUIpartyTypes.h"
#include "KUIControlButton.h"
#include <toolkit/XStringUtil.h>
#include "SStringDB.h"
extern void MsgSplit( const char* szMsg, std::vector<std::string>& vecText, const wchar_t* lpDelimiter, bool bProcSpecialCharacter=false );
SUIPartyRMenuWnd::SUIPartyRMenuWnd(SGameManager *pGameManager, SUIDisplayInfo *pDisplayInfo) : SUIWnd(pGameManager), m_displayInfo(pDisplayInfo)
{
}
SUIPartyRMenuWnd::~SUIPartyRMenuWnd()
{
}
bool SUIPartyRMenuWnd::InitData( bool bReload )
{
m_pGameManager->GetGameInterface()->addPopupList(TOGGLE_WINDOW::UIWINDOW_PARTY_RMENU);
setControlEnableColor( "buff_all_on_button", "<#ffffff>" ); // 전체 버프 보이기
setControlEnableColor( "creature_all_on_button", "<#ffffff>" ); // 전체 크리처 보이기
setControlEnableColor( "ui_small_view_button", "<#ffffff>" ); // ui 작게 보기
setControlEnableColor( "ui_fold_button", "<#ffffff>" ); // ui 작게 보기
SetChildShow("ui_unfold_button", false);
SetChildShow("ui_default_view_button", false);
SetChildShow("buff_all_off_button", false);
SetChildShow("creature_all_off_button", false);
return SUIWnd::InitData(bReload);
}
void SUIPartyRMenuWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch (nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
/// 전체 버프 보이기/숨기기
if (::_stricmp(lpszControlID, "buff_all_on_button") == 0)
{
sendStatusData(sStatus::BUFF);
}
/// 전체 크리처 보이기/숨기기
else if (::_stricmp(lpszControlID, "creature_all_on_button") == 0)
{
sendStatusData(sStatus::CREATURE);
}
/// UI 작게/크게 보기
else if (::_stricmp(lpszControlID, "ui_small_view_button") == 0)
{
sendStatusData(sStatus::SIZE);
}
/// 펴기/접기
else if (::_stricmp(lpszControlID, "ui_fold_button") == 0)
{
sendStatusData(sStatus::FOLDING);
}
}
break;
}
}
void SUIPartyRMenuWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch(pMsg->nType)
{
case IMSG_UI_SEND_DATA:
{
SIMSG_UI_SEND_DATA* msg = dynamicCast<SIMSG_UI_SEND_DATA*>(pMsg);
if ("popup_update" == msg->m_strString)
{
updatePopup(msg->m_nNumber.getAmount(), msg->m_nNumber2.getAmount());
}
else if ("select_party" == msg->m_strString)
{
selectPartyName(msg->m_strText);
}
else if ("set_status" == msg->m_strString)
{
setStatus(msg->m_strText);
}
}
break;
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* msg = dynamicCast<SIMSG_UI_MOVE*>(pMsg);
MovePos(msg->m_nX, msg->m_nY);
LimitMoveWnd();
}
break;
}
}
void SUIPartyRMenuWnd::updatePopup(int x, int y)
{
if (!IsShow())
return ;
if (!IsInRect(x, y))
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY_RMENU, false) );
}
}
void SUIPartyRMenuWnd::selectPartyName(std::string const& partyName)
{
m_selectPartyName = partyName;
}
void SUIPartyRMenuWnd::setStatus(std::string const& status)
{
std::vector<std::string> textList;
MsgSplit(status.c_str(), textList, L"|");
setStatus(sStatus::BUFF, atoi(textList[0].c_str()));
setStatus(sStatus::CREATURE, atoi(textList[1].c_str()));
setStatus(sStatus::SIZE, atoi(textList[2].c_str()));
setStatus(sStatus::FOLDING, atoi(textList[3].c_str()));
textList.clear();
}
void SUIPartyRMenuWnd::setStatus(int type, int value)
{
char const* controlName;
int stringId;
if (sStatus::BUFF == type)
{
controlName = "buff_all_on_button";
if (1 == value) stringId = 6521; /// 보이기
else stringId = 12033; /// 숨기기
}
else if (sStatus::CREATURE == type)
{
controlName = "creature_all_on_button";
if (1 == value) stringId = 12034; /// 보이기
else stringId = 12035; /// 숨기기
}
else if (sStatus::SIZE == type)
{
controlName = "ui_small_view_button";
if (PARTY_UI_ID_SMALL == value) stringId = 9558; /// 작게 보기
else stringId = 9559; /// 크게 보기
}
else if (sStatus::FOLDING == type)
{
controlName = "ui_fold_button";
if (PARTY_UI_LIST_SIZE_EXTEND == value) stringId = 9841; /// 펴기
else stringId = 9840; /// 접기
}
KUIControlButton* button = dynamicCast<KUIControlButton*>(GetChild(controlName));
if (!button)
return ;
if (-1 == value)
{
button->Disable();
return ;
}
else
{
if (sStatus::CREATURE != type) ///크리처는 추가 작업 때 활성화 된다.
button->Enable();
}
m_status.m_value[type] = value;
std::string str;
XStringUtil::Format(str, "<font:font_01><size:8><hcenter><left>%s", S(stringId));
button->SetCaption(str.c_str());
}
void SUIPartyRMenuWnd::sendStatusData(int type)
{
char const* data = NULL;
int value = m_status.m_value[type];
if (sStatus::BUFF == type)
{
if (1 == value) data = "state_all_on"; /// 보이기
else data = "state_all_off"; /// 숨기기
}
else if (sStatus::CREATURE == type)
{
if (1 == value) data = "show_all_creature"; /// 보이기
else data = "hide_all_creature"; /// 숨기기
}
else if (sStatus::SIZE == type)
{
if (PARTY_UI_SIZE_BIG == value) data = "show_big_ui"; /// 크게 보기
else data = "show_small_ui"; /// 작게 보기
}
else if (sStatus::FOLDING == type)
{
if (PARTY_UI_LIST_SIZE_EXTEND == value) data = "extend_ui"; /// 펴기
else data = "reduce_ui"; /// 접기
}
if (!data)
return ;
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, data, m_selectPartyName.c_str()));
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY_RMENU, false ) );
}
void SUIPartyRMenuWnd::setControlEnableColor(const char * pControlName, const char * pColor)
{
KUIControl * pControl = dynamicCast<KUIControl *>(GetChild(pControlName));
if( pControl )
pControl->SetEnableColor( pColor );
}