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

367 lines
11 KiB
C++

#include "stdafx.h"
#include <toolkit/XStringUtil.h>
#include <toolkit/nsl.h>
#include <toolkit/nsluni.h>
#include "SDungeonResourceDB.h"
#include "SStringDB.h"
#include "SGameManager.h"
#include "SMessengerMgr.h"
//#include "SGameMessageUI.h"
#include "SPlayerInfoMgr.h"
#include "SGameMessage.h"
#include "KUIControlButton.h"
#include "KUIControlPanel.h"
#include "KUIControlStatic.h"
#include "SUIAttackingArmyPanelWnd.h"
#include "SGameInterface.h" // 2011.09.20 - servantes
#include "Arena\\ArenaJoinSituationChecker.h"
#include "SGameSystem.h"
extern SGameSystem* g_pCurrentGameSystem;
namespace
{
//int g_arrRaidStrIndex[] = { 1};
//char g_arrStrRaid[][64] = { "내 길드 정보", "시즈도전 길드정보", "레이드 1위 길드정보", "시즈방어 길드정보" };
std::vector< std::string > g_arrStrRaid;
}
// ** 공격대 결성 패널 **
SUIAttackingArmyPanelWnd::SUIAttackingArmyPanelWnd( SGameManager * pGameManager, KUIControlPanelManager * pPanelManager ):
KUIControlPanel( pGameManager, pPanelManager ),
m_pExtensionButton( NULL ), // 확장버튼.
m_pRaidType( NULL )
{
}
SUIAttackingArmyPanelWnd::~SUIAttackingArmyPanelWnd()
{
Release();
}
// 메모리 해제.
void SUIAttackingArmyPanelWnd::Release()
{
g_arrStrRaid.clear();
//this->m_RaidMgr
}
//-----------------------------
// Override
// KUIControlPanel::
// 패널의 크기를 원본크기로 변경한다. 각 패널윈도우의 크기가 다르므로 재정의할것!!.
void SUIAttackingArmyPanelWnd::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 SUIAttackingArmyPanelWnd::InitControls( KPoint kPos )
{
g_arrStrRaid.push_back( S( 1804 ) ); // 나의 길드정보.
g_arrStrRaid.push_back( S( 1893 ) ); // 시즈도전 길드정보.
g_arrStrRaid.push_back( S( 1892 ) ); // 레이드 1위 길드정보.
g_arrStrRaid.push_back( S( 1894 ) ); // 시즈방어 길드정보.
m_pRaidType = dynamicCast< KUIControl * >( GetChild( "text_dungeon_data_01" ) );
CStringUtil::GetTextDecoration( m_pRaidType->GetCaption(), m_TextDecorate );
// ****
// 확장 여부에따라 숨김, 보임 처리가 바뀌는 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>" );
// 텍스트 데코레이션.
CStringUtil::GetTextDecoration( GetChild( "dungeon_data_text_04" )->GetCaption(), m_TextDecoration );
//m_TextDecoration = "";
////GetChildList(
//std::list< KUIWnd * > rChildList = this->GetChildList();
//for( std::list< KUIWnd * >::iterator it = rChildList.begin(); it!=rChildList.end(); it++ )
//{
// static_cast< KUIControl * >( (*it) )->CutCaptionNTooltip();
//}
//CutCaptionNTooltip();
return SUIWnd::InitControls( kPos );
}
void SUIAttackingArmyPanelWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
{
// Open.
if( bOpen )
{
// 공격대정보 요청.
m_pGameManager->PostMsgAtDynamic( new SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_RAID ) );
}
else
{
// 공격대 도움말 팝업 닫기.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM_HELP, false ) );
}
}
void SUIAttackingArmyPanelWnd::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_RAID" )
{
pMsg->bUse = true;
// 던전 레이드/시즈 관련정보.
const SRaidSiege & raidSiegeInfo = m_GuildMgr.GetRaidSiege();
KUIControl * pControl = dynamicCast< KUIControl * >( GetChild( "dungeon_data_text_04" ) );
pControl->SetCaption( CStringUtil::StringFormat( "%s%s", m_TextDecoration.c_str(), raidSiegeInfo.strGuildName.c_str() ).c_str() );
pControl->CutCaptionNTooltip();
pControl = dynamicCast< KUIControl * >( GetChild( "dungeon_data_text_06" ) );
pControl->SetCaption( CStringUtil::StringFormat( "%s%s", m_TextDecoration.c_str(), raidSiegeInfo.strGuildMaster.c_str() ).c_str() );
pControl->CutCaptionNTooltip();
pControl = dynamicCast< KUIControl * >( GetChild( "dungeon_data_text_10" ) );
pControl->SetCaption( CStringUtil::StringFormat( "%s%d", m_TextDecoration.c_str(), raidSiegeInfo.nGuildCount ).c_str() );
pControl->CutCaptionNTooltip();
pControl = dynamicCast< KUIControl * >( GetChild( "dungeon_data_text_12" ) );
pControl->SetCaption( CStringUtil::StringFormat( "%s%02d:%02d:%02d", m_TextDecoration.c_str(),
raidSiegeInfo.nTime_hour, raidSiegeInfo.nTime_min, raidSiegeInfo.nTime_sec ).c_str() );
pControl->CutCaptionNTooltip();
// 소유던전.
int nDungeonID = GetDungeonResDB().GetDungeonNameID( raidSiegeInfo.nGuildDungeon );
pControl = dynamicCast< KUIControl * >( GetChild( "dungeon_data_text_02" ) );
std::string strDungeon = GetStringDB().GetString( nDungeonID );
std::string::size_type nSize = strDungeon.find( "empty" );
strDungeon = nSize == -1 ? strDungeon : m_TextDecoration;
pControl->SetCaption( CStringUtil::StringFormat( "%s%s", m_TextDecoration.c_str(), strDungeon.c_str() ).c_str() );
pControl->CutCaptionNTooltip();
// 공격대결성 버튼.
m_pBtnOrganizeTeam = dynamicCast< KUIControlButton * >( GetChild( "button_attackteam_01" ) );
m_pBtnOrganizeTeam->SetEnableColor( "<#ffffff>" );
m_pBtnOrganizeTeam->SetDisableColor( "<#a0a0a0>" );
// 공격대결성 버튼 활성/비활성 처리.
VisibilityTeamBtn();
}
//
// 던전스톤에서 레이드를 신청했음.
else if( pData->m_strString == "RAID_REQUEST" )
{
pMsg->bUse = true;
// 공격대정보 요청.
m_pGameManager->PostMsgAtDynamic( new SMSG_GUILD_COMMAND( SMSG_GUILD_COMMAND::GUILD_RAID ) );
}
}
break;
}
}
void SUIAttackingArmyPanelWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
//// 윈도우 이동
//case KUI_MESSAGE::KGENWND_MOVE:
//{
// // 공격대 도움말 팝업 이동.
// KRect rt = GetChild( "sub_open_01" )->GetRect();
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM_HELP, rt.right, rt.top ) );
//}
case KUI_MESSAGE::KBUTTON_CLICK :
{
// 확대축소 토글.
if( !::_stricmp( lpszControlID, "sub_open" ) || !::_stricmp( lpszControlID, "trim_titlebar_open" ) )
{
// 토글.
this->ToggleExtend();
// 버튼 애니 변경.
PanelExtend();
}
// 공격대결성 버튼.
else if( !::_stricmp( lpszControlID, "button_attackteam_01" ) )
{
if (0 < m_RaidMgr.GetPartyCount())
{
if (!isValidArenaJoinSituationAtPlaying())
{
std::string str = SStringDB::ParseString(2803, "#@guild_name@#", m_RaidMgr.getLeaderName(0));
m_pGameManager->GetGameInterface()->OpenMessageBox(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK, SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GENERAL, 0, -1, str.c_str());
}
}
else
{
// 이전에 열려있을 경우를 대비해서 닫는다.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM, // 위치이동.
m_pGameManager->GetScreenWidth() / 2, m_pGameManager->GetScreenHeight() / 2 ) );
// m_pGameManager->GetScreenWidth() / 2, m_pGameManager->GetScreenHeight() / 2 ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM, true ) ); // 팝업 Wnd 열기.
}
}
// 공격대 도움말.
else if( !::_stricmp( lpszControlID, "sub_open_01" ) )
{
KRect rt = GetChild( "sub_open_01" )->GetRect();
//-----------------------
// 공격대도움말 팝업 Wnd.
// 이전에 열려있을 경우를 대비해서 닫는다.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM_HELP, false ) ); // 닫기
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM_HELP,
m_pGameManager->GetScreenWidth() / 2, m_pGameManager->GetScreenHeight() / 2 ) ); // 위치이동.
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_SUB_MANAGE_TEAM_HELP, true ) ); // 팝업 Wnd 열기.
}
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
DWORD SUIAttackingArmyPanelWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
{
return SUIWnd::OnMouseMessage(dwMessage, x, y);
}
// Panel 확대,축소
void SUIAttackingArmyPanelWnd::PanelExtend()
{
m_pExtensionButton->SetAniName( this->GetIsExtend() ? "common_button_titanium_sub_open" : "common_button_titanium_sub_close" );
}
// Open 시 필요기능정의.
void SUIAttackingArmyPanelWnd::CustomOpen()
{
// Panel 확대,축소
PanelExtend();
}
// 공격대결성 버튼 활성/비활성 처리.
void SUIAttackingArmyPanelWnd::VisibilityTeamBtn()
{
// m_pBtnOrganizeTeam
int nRaidType = m_GuildMgr.GetRaidSiege().nType;
// 파티중.
if( m_PartyMgr.GetPartyName() != NULL && ::_stricmp( m_PartyMgr.GetPartyName(), "" ) )
{
m_pBtnOrganizeTeam->Disable();
}
else
{
m_pBtnOrganizeTeam->Enable();
}
/// 2011.10.20 레이드나 시즈도 결성이 안된다 (버그 같음) - prodongi
/*
// 레이드 신청전.
if( nRaidType == 0 || nRaidType != 1 )
{
m_pBtnOrganizeTeam->Disable();
}
else
{
m_pBtnOrganizeTeam->Enable();
}
*/
if(nRaidType == 0)
{
m_pBtnOrganizeTeam->Disable();
}
else
{
m_pBtnOrganizeTeam->Enable();
}
//m_pBtnOrganizeTeam->Enable();
//SPlayerInfo player = m_PlayerInfoMgr.GetPlayerInfo();
if( nRaidType < 4 )
{
m_pRaidType->SetCaption( CStringUtil::StringFormat( "%s%s", m_TextDecorate.c_str(), g_arrStrRaid[ nRaidType ].c_str() ).c_str() );
m_pRaidType->CutCaptionNTooltip();
}
else
{
m_pRaidType->SetCaption( " " );
}
}
bool SUIAttackingArmyPanelWnd::isValidArenaJoinSituationAtPlaying()
{
sArenaJoinSituationCondition situationCondition;
/// way
situationCondition.m_notificationWays = cArenaJoinSituationChecker::WAY_NOTIFICATION_WND;
/// situation
situationCondition.add(cArenaJoinSituationChecker::SITUATION_ARENA_PLAYING, S(2431));
return g_pCurrentGameSystem->isValidArenaJoinSituation(situationCondition);
}