265 lines
7.8 KiB
C++
265 lines
7.8 KiB
C++
|
|
#include "stdafx.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlGauge.h"
|
|
#include "KUIControlButton.h"
|
|
#include "KUIControl3DStatic.h"
|
|
#include "KSeqForm.h"
|
|
#include "GameDefine.h"
|
|
#include "SGameManager.h"
|
|
#include "SUIDisplayInfo.h"
|
|
#include "SJobDB.h"
|
|
#include "SMonsterDB.h"
|
|
#include "SCreatureDB.h"
|
|
#include "SNpcResourceDB.h"
|
|
#include "SPetDB.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
#include "SGameSystem.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SGameMessage.h"
|
|
#include "SSummonSlotMgr.h"
|
|
#include "SMessengerMgr.h"
|
|
#include "SGameOption.h"
|
|
//#include "Util.h"
|
|
#include "SGameSystem.h"
|
|
/// 2010.11.10 - proodngi
|
|
#include "SGameLobbyDefine.h"
|
|
/// 2011.01.11 - prodongi
|
|
#include "SCobManager.h"
|
|
/// 2010.11.24 - prodongi
|
|
//#include "SUIUtil.h"
|
|
#include "SGame.h"
|
|
#include "SGameAvatarEx.h"
|
|
#include "SGameInterface.h"
|
|
#include "SUIMissionEnteranceWnd.h"
|
|
|
|
namespace
|
|
{
|
|
const int BUTTON_Y = 39;
|
|
const int OUTFRAME_Y = 30;
|
|
|
|
const int OFFSET_BUTTON = 28;
|
|
const int OFFSET_BUTTON_CANCEL_Y = 35;
|
|
const int OFFSET_BOTTOM_Y = 41;
|
|
|
|
const int MAX_BUTTON = 5;
|
|
}
|
|
|
|
extern void MsgSplit( const char* szMsg, std::vector<std::string>& vecText, const wchar_t* lpDelimiter, bool bProcSpecialCharacter=false );
|
|
|
|
//////////////////////////////////////////
|
|
// SUIMissionEnteranceWnd
|
|
//
|
|
//////////////////////////////////////////
|
|
SUIMissionEnteranceWnd::SUIMissionEnteranceWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
|
|
: SUIWnd( pGameManager )
|
|
, m_pDisplayInfo( pDisplayInfo )
|
|
{
|
|
for (int i = 0; i < MAX_BUTTON; i++)
|
|
{
|
|
m_pBtn[i] = NULL;
|
|
}
|
|
|
|
m_pBtnCancel = NULL;
|
|
}
|
|
|
|
SUIMissionEnteranceWnd::~SUIMissionEnteranceWnd()
|
|
{
|
|
}
|
|
|
|
bool SUIMissionEnteranceWnd::InitControls( KPoint kPos )
|
|
{
|
|
m_pStaticOutFrame = dynamicCast< KUIControlStatic* > (GetChild("outframe")); // 전체 선택시 배경
|
|
if(m_pStaticOutFrame == NULL)
|
|
return false;
|
|
m_pStaticOutFrame->SetShow(true);
|
|
|
|
m_pStaticBGImage = dynamicCast< KUIControlStatic* >( GetChild( "bg_image" ) ); // 전체 선택시 배경
|
|
if (m_pStaticBGImage == NULL)
|
|
return false;
|
|
m_pStaticBGImage->SetShow( true );
|
|
|
|
m_pStaticInFrameBG = dynamicCast< KUIControlStatic* >( GetChild( "inframe_bg" ) ); // 전체 선택시 배경
|
|
if (m_pStaticInFrameBG == NULL)
|
|
return false;
|
|
m_pStaticInFrameBG->SetShow( true );
|
|
|
|
p_pStaticText = dynamicCast< KUIControlStatic* > (GetChild("info_view_text")); // 전체 선택시 배경
|
|
if(p_pStaticText == NULL)
|
|
return false;
|
|
p_pStaticText->SetShow(true);
|
|
p_pStaticText->SetEnableColor( "<#ffffff>" );
|
|
|
|
for (int i = 0; i < MAX_BUTTON; i++)
|
|
{
|
|
m_pBtn[i] = dynamicCast< KUIControlButton* > (GetChild( CStringUtil::StringFormat( "button_info_view_%02d", i + 1 ).c_str() ));
|
|
|
|
if(m_pBtn[i] == NULL)
|
|
return false;
|
|
|
|
m_pBtn[i]->SetShow(true);
|
|
m_pBtn[i]->SetEnableColor("<#ffffff>");
|
|
|
|
SetChildCaption( CStringUtil::StringFormat( "button_info_view_%02d", i + 1 ).c_str(),
|
|
CStringUtil::StringFormat( "<font:font_02><size:9><hcenter><vcenter>%s", S(9800) ).c_str() );
|
|
}
|
|
|
|
m_pBtnCancel = dynamicCast< KUIControlButton* > (GetChild("button_cancel"));
|
|
if(m_pBtnCancel == NULL)
|
|
return false;
|
|
m_pBtnCancel->SetShow(true);
|
|
m_pBtnCancel->SetEnableColor("<#ffffff>");
|
|
SetChildCaption( "button_cancel", CStringUtil::StringFormat( "<font:font_02><size:9><hcenter><vcenter>%s", S(3026) ).c_str() );
|
|
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
|
|
bool SUIMissionEnteranceWnd::InitData( bool bReload )
|
|
{
|
|
KRect rt = m_pStaticOutFrame->GetRect();
|
|
int nW = KUIWndManager::GetResolution().cx / 2;
|
|
int nH = KUIWndManager::GetResolution().cy / 2;
|
|
MovePos(nW - (rt.GetWidth() / 2), nH - (rt.GetHeight() / 2));
|
|
return SUIWnd::InitData(bReload);
|
|
}
|
|
|
|
void SUIMissionEnteranceWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch(pMsg->nType)
|
|
{
|
|
case MSG_NPC_DIALOG:
|
|
{
|
|
SMSG_NPC_DIALOG* pNPCDlgMsg = (SMSG_NPC_DIALOG*)pMsg;
|
|
pMsg->bUse = true;
|
|
|
|
int nCount = pNPCDlgMsg->vtMenus.size();
|
|
if( nCount < 1 )
|
|
{
|
|
return;
|
|
}
|
|
|
|
if( nCount > 5 )
|
|
nCount = MAX_BUTTON;
|
|
else
|
|
nCurrentCount = nCount;
|
|
|
|
std::string strTitle = "<font:font_01><size:9><hcenter><vcenter>";
|
|
strTitle += pNPCDlgMsg->strTitle.c_str();
|
|
p_pStaticText->SetEnableColor( "<#ffffff>" );
|
|
p_pStaticText->SetCaption( strTitle.c_str() );
|
|
|
|
for( int i = 0; i < MAX_BUTTON; i++ )
|
|
{
|
|
if (pNPCDlgMsg->vtMenus.size() > i)
|
|
{
|
|
std::string strMenuText = "<font:font_01><size:9><hcenter><vcenter>";
|
|
|
|
XStringUtil::Replace( pNPCDlgMsg->vtMenus[i].strMenuName, "|", "" );
|
|
strMenuText += pNPCDlgMsg->vtMenus[i].strMenuName;
|
|
|
|
m_pBtn[i]->SetEnableColor( "<#ffffff>" );
|
|
m_pBtn[i]->SetCaption( strMenuText.c_str() );
|
|
|
|
m_strTrigger[i] = pNPCDlgMsg->vtMenus[i].strTrigger;
|
|
|
|
if (m_strTrigger[i].size())
|
|
m_pBtn[i]->Enable();
|
|
else
|
|
m_pBtn[i]->Disable();
|
|
|
|
m_pBtn[i]->SetShow( true );
|
|
}
|
|
else
|
|
{
|
|
m_pBtn[i]->SetShow( false );
|
|
}
|
|
}
|
|
|
|
RefreshUI();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
void SUIMissionEnteranceWnd::RefreshUI()
|
|
{
|
|
KRect newRc = m_pStaticOutFrame->GetRect();
|
|
|
|
newRc.bottom = GetRect().top + BUTTON_Y + nCurrentCount * OFFSET_BUTTON + OFFSET_BOTTOM_Y;
|
|
m_pStaticOutFrame->Resize( newRc );
|
|
|
|
KRect rect = GetRect();
|
|
m_pStaticBGImage->Resize( KRect( newRc.left + 4, newRc.top + 4, newRc.right - 6, newRc.bottom - 4 ) );
|
|
m_pStaticInFrameBG->Resize( KRect( newRc.left + 4, newRc.top + OUTFRAME_Y, newRc.right - 6, newRc.bottom - 4 ) );
|
|
|
|
m_pBtnCancel->MovePos( m_pBtnCancel->GetRect().left, newRc.bottom - OFFSET_BUTTON_CANCEL_Y );
|
|
|
|
Resize( newRc );
|
|
}
|
|
|
|
void SUIMissionEnteranceWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
|
|
{
|
|
SUIWnd::OnNotifyUIWindowOpen(bOpen);
|
|
}
|
|
|
|
void SUIMissionEnteranceWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch(nMessage)
|
|
{
|
|
case KUI_MESSAGE::KBUTTON_CLICK:
|
|
{
|
|
if ( ::_stricmp( lpszControlID, "button_info_view_01" ) == 0 ) // 0번 버튼
|
|
{
|
|
if(m_strTrigger[0].size())
|
|
{
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_ACT_NPCDIALOG( m_strTrigger[0].c_str() ) );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MISSION_ENTERANCE_WND, false, true ) );
|
|
}
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_info_view_02" ) == 0 ) // 1번 버튼
|
|
{
|
|
if(m_strTrigger[1].size())
|
|
{
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_ACT_NPCDIALOG( m_strTrigger[1].c_str() ) );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MISSION_ENTERANCE_WND, false, true ) );
|
|
}
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_info_view_03" ) == 0 ) // 취소 버튼
|
|
{
|
|
if(m_strTrigger[2].size())
|
|
{
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_ACT_NPCDIALOG( m_strTrigger[2].c_str() ) );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MISSION_ENTERANCE_WND, false, true ) );
|
|
}
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_info_view_04" ) == 0 ) // 취소 버튼
|
|
{
|
|
if(m_strTrigger[3].size())
|
|
{
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_ACT_NPCDIALOG( m_strTrigger[3].c_str() ) );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MISSION_ENTERANCE_WND, false, true ) );
|
|
}
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_info_view_05" ) == 0 ) // 취소 버튼
|
|
{
|
|
if(m_strTrigger[4].size())
|
|
{
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_ACT_NPCDIALOG( m_strTrigger[4].c_str() ) );
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MISSION_ENTERANCE_WND, false, true ) );
|
|
}
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_cancel" ) == 0 ) // 취소 버튼
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MISSION_ENTERANCE_WND, false, true ) );
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|