1435 lines
40 KiB
C++
1435 lines
40 KiB
C++
|
|
#include "stdafx.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlQuest.h"
|
|
#include "KUIControlButton.h"
|
|
#include "KUIControlScroll.h"
|
|
#include "SGameManager.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SUIQuestListWnd.h"
|
|
#include "SQuestMgr.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
#include "SInventoryMgr.h"
|
|
#include "SQuestDB.h"
|
|
#include "SMonsterDB.h"
|
|
#include "SItemDB.h"
|
|
#include "SStringDB.h"
|
|
#include "SkillBaseFile.h"
|
|
#include "SGame.h"
|
|
#include "GameRule.h"
|
|
#include "ErrorCode/ErrorCode.h"
|
|
#include "SUIDisplayInfo.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include "SGameOption.h"
|
|
#include <toolkit/bits_scramble.h>
|
|
#include "SGameInterface.h"
|
|
#include "SUILazyTooltip.h"
|
|
|
|
static const size_t MAX_ICON_COUNT = 3; // 보상 아이템 갯수
|
|
static const size_t MAX_SLOT_COUNT = 12; // 한 다이얼로그에 보이는 퀘스트 갯수
|
|
static const size_t CONTROL_PER_SLOT = 4; // 한개의 슬롯이 사용하는 UI 컨트롤 갯수
|
|
static const int SLOT_Y_DELTA = 58; // 슬롯당 거리
|
|
static const int c_nSysMenu = 56; // 왼쪽 메뉴 바 width
|
|
static const int MAX_QUEST_COUNT = 20; /// 2011.09.28 최대 퀘스트 개수 - prodongi
|
|
|
|
// { 각 슬롯의 컨트롤에 편하게 접근하기 위해 만든 것들
|
|
namespace SLOT_CONTROL_INDEX
|
|
{
|
|
static const size_t BACK = 0;
|
|
static const size_t NAMEBACK = 1;
|
|
static const size_t SUBTITLE = 2;
|
|
static const size_t PROGRESS = 3;
|
|
};
|
|
|
|
namespace
|
|
{
|
|
static char *s_szSlotControlName[ CONTROL_PER_SLOT ]
|
|
= {
|
|
"quest_back_%02d",
|
|
"quest_nameback_%02d",
|
|
"quest_subtitle_%02d",
|
|
"quest_progress_%02d",
|
|
};
|
|
// }
|
|
char *szQuestMgrAniName = "static_common_inframe_linebox";
|
|
};
|
|
|
|
static int GetIconControlNum( const char* szSlotControlID )
|
|
{
|
|
for( int nSlotIndex( 0 ); nSlotIndex < MAX_ICON_COUNT; ++nSlotIndex )
|
|
{
|
|
if( 0 == ::_stricmp( CStringUtil::StringFormat( "quest_selectitem_itemback_%02d", nSlotIndex ).c_str(), szSlotControlID ) )
|
|
return nSlotIndex;
|
|
}
|
|
|
|
return (-1);
|
|
}
|
|
|
|
/// 2011.11.07 - prodongi
|
|
bool SUIQuestListWnd::m_isFirst = false;
|
|
|
|
|
|
void SUIQuestListWnd::sCheckChoice::init(KUIControl *wnd)
|
|
{
|
|
m_wnd = wnd;
|
|
setCheck(false);
|
|
}
|
|
|
|
void SUIQuestListWnd::sCheckChoice::toggle()
|
|
{
|
|
setCheck(!m_isCheck);
|
|
}
|
|
|
|
void SUIQuestListWnd::sCheckChoice::setCheck(bool check)
|
|
{
|
|
m_isCheck = check;
|
|
if (m_isCheck)
|
|
{
|
|
m_wnd->SetAniName("common_button_titanium_all_view");
|
|
m_wnd->SetTooltip(S(1450));
|
|
}
|
|
else
|
|
{
|
|
m_wnd->SetAniName("common_button_titanium_select_view");
|
|
m_wnd->SetTooltip(S(1451));
|
|
}
|
|
}
|
|
|
|
void SUIQuestListWnd::sOpacityButton::init(KUIControlSimpleButton *wnd)
|
|
{
|
|
m_wnd = wnd;
|
|
setOpacity(false);
|
|
}
|
|
|
|
void SUIQuestListWnd::sOpacityButton::setOpacity(bool opacity)
|
|
{
|
|
m_isOpacity = opacity;
|
|
if (m_isOpacity)
|
|
{
|
|
m_wnd->SetAniName("common_button_titanium_lock");
|
|
m_wnd->SetTooltip(S(6409));
|
|
}
|
|
else
|
|
{
|
|
m_wnd->SetAniName("common_button_titanium_unlock");
|
|
m_wnd->SetTooltip(S(6408));
|
|
}
|
|
}
|
|
|
|
void SUIQuestListWnd::sOpacityButton::toggle()
|
|
{
|
|
setOpacity(!m_isOpacity);
|
|
}
|
|
|
|
void SUIQuestListWnd::sDetailViewCheckButton::init(SUIWnd* parent)
|
|
{
|
|
m_wndWorldMap = dynamicCast<KUIControlCheck*>(parent->GetChild("quest_worldmap_button_01"));
|
|
m_wndInfo = dynamicCast<KUIControlCheck*>(parent->GetChild("quest_info_button"));
|
|
|
|
m_updateTime = 0.0f;
|
|
}
|
|
|
|
void SUIQuestListWnd::sDetailViewCheckButton::setCheck(SUIQuestListWnd::sDetailViewCheckButton::CHECK_TYPE type, bool bCheck)
|
|
{
|
|
|
|
if (type==WORLDMAP && m_wndWorldMap->GetCheck() != bCheck)
|
|
m_wndWorldMap->SetCheck(bCheck);
|
|
bool btemp = m_wndInfo->GetCheck();
|
|
if (type==INFO && m_wndInfo->GetCheck() != bCheck)
|
|
m_wndInfo->SetCheck(bCheck);
|
|
if (type==NONE)
|
|
{
|
|
m_wndWorldMap->SetCheck(false);
|
|
m_wndInfo->SetCheck(false);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
void SUIQuestListWnd::sDetailViewCheckButton::open(SGameInterface* gameInterface)
|
|
{
|
|
m_updateTime = 0.0f;
|
|
checkTopWnd(gameInterface);
|
|
}
|
|
|
|
void SUIQuestListWnd::sDetailViewCheckButton::update(DWORD elapsedtime, SGameInterface* gameInterface)
|
|
{
|
|
float e = (float)elapsedtime/1000.0f;
|
|
m_updateTime += e;
|
|
|
|
if (0.5f < m_updateTime)
|
|
{
|
|
m_updateTime -= 0.5f;
|
|
checkTopWnd(gameInterface);
|
|
}
|
|
}
|
|
|
|
void SUIQuestListWnd::sDetailViewCheckButton::checkTopWnd(SGameInterface* gameInterface)
|
|
{
|
|
bool isShowWorldMap = gameInterface->IsShow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP);
|
|
bool isShowInfo = gameInterface->IsShow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO);
|
|
|
|
/*if (isShowWorldMap && isShowInfo)
|
|
{
|
|
bool ret= gameInterface->GetWndManager()->isTop("window_world_map", "window_quest_info");
|
|
setCheck(ret ? CHECK_TYPE::WORLDMAP : CHECK_TYPE::INFO);
|
|
}
|
|
else if (isShowWorldMap)
|
|
{
|
|
setCheck(CHECK_TYPE::WORLDMAP);
|
|
}
|
|
else if (isShowInfo)
|
|
{
|
|
setCheck(CHECK_TYPE::INFO);
|
|
}
|
|
else
|
|
{
|
|
setCheck(CHECK_TYPE::NONE);
|
|
}*/
|
|
setCheck(CHECK_TYPE::WORLDMAP,isShowWorldMap);
|
|
setCheck(CHECK_TYPE::INFO,isShowInfo);
|
|
}
|
|
|
|
|
|
|
|
|
|
SUIQuestListWnd::~SUIQuestListWnd() // 2011.05.17 - servantes
|
|
{
|
|
GetGameOption().SetQuestX( GetRect().left );
|
|
GetGameOption().SetQuestY( GetRect().top );
|
|
}
|
|
|
|
void SUIQuestListWnd::IconFocus( int nIndex )
|
|
{
|
|
return;
|
|
}
|
|
|
|
void SUIQuestListWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch(nMessage)
|
|
{
|
|
case KUI_MESSAGE::KQUESTINFOMNG_CLICK:
|
|
{
|
|
if( (int)lparam >= 0 )
|
|
{
|
|
m_pGameManager->StartSound( "ui_button_click.wav" );
|
|
|
|
/// 2011.11.03 quest_info_check 체크 버튼을 눌렀을 때는 KUIControlQuestInfoManager의 KLBUTTON_UP이 체크 되어서 index가 다시 바껴버리게 된다.
|
|
/// 그래서 체크 버튼을 눌렀을 때는 바뀌지 않도록 해줌
|
|
if (!m_isChangeInfoCheck)
|
|
{
|
|
m_oldDataIndex = m_nDataIndex;
|
|
m_nDataIndex = (int)lparam+m_nScrollPos;
|
|
}
|
|
else
|
|
{
|
|
m_isChangeInfoCheck = false;
|
|
}
|
|
|
|
QuestBase::QuestCode qcode = SQuestMgr::GetInstance().GetQuestCodeByIndex( (int)lparam+m_nScrollPos );
|
|
m_nQuestCode = qcode;
|
|
SQuestMgr::GetInstance().SetCurrentQuest( qcode );
|
|
|
|
//if( m_pGameManager->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO ) )
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO, number_t( qcode ), "set_quest_code" ) );
|
|
if (m_nDataIndex != m_oldDataIndex)
|
|
{
|
|
if( m_pGameManager->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO ) )
|
|
{
|
|
if( (int)m_nQuestCode >= 0 )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_QUEST_INFO_REQUEST( SQuestMgr::GetInstance().GetQuestCodeByIndex( m_nDataIndex ) ) );
|
|
}
|
|
}
|
|
|
|
/// 2011.09.15 MSG_NPC_DIALOG는 npc를 클릭했을 때도 날라올 수 있기 때문에, MSG_NPC_DIALOG를 받을 때 처리하지 않고, 여기서 처리함- prodongi
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP, number_t(qcode), "set_quest_code"));
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case KUI_MESSAGE::KQUESTINFOMNG_REFRESH:
|
|
{
|
|
updateAllFoldStatus();
|
|
Refresh();
|
|
}
|
|
break;
|
|
|
|
case KUI_MESSAGE::KQUESTINFOMNG_DBLCLK:
|
|
{
|
|
m_pGameManager->StartSound( "ui_button_click.wav" );
|
|
|
|
|
|
if( m_nDataIndex == m_oldDataIndex && m_pGameManager->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO ) )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO, false ) );
|
|
}
|
|
else
|
|
{
|
|
if( (int)lparam >= 0 )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_QUEST_INFO_REQUEST( SQuestMgr::GetInstance().GetQuestCodeByIndex( m_nDataIndex ) ) );
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case KUI_MESSAGE::KBUTTON_CLICK:
|
|
{
|
|
//Refresh();
|
|
|
|
/// 2011.11.01 - prodongi
|
|
if (strstr(lpszControlID, "quest_info_new_button_"))
|
|
{
|
|
setChoiceCheck("quest_info_new_button_", lpszControlID);
|
|
Refresh(true);
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO, false) );
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_LIST, false) );
|
|
break;
|
|
}
|
|
/*
|
|
else if( ::_stricmp( lpszControlID, "quest_info_button" ) == 0 && SQuestMgr::GetInstance().GetQuestCount()>0 )
|
|
{
|
|
if( m_nDataIndex >= 0)
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_QUEST_INFO_REQUEST( SQuestMgr::GetInstance().GetQuestCodeByIndex( m_nDataIndex ) ) );
|
|
}
|
|
break;
|
|
}
|
|
*/
|
|
else if( ::_stricmp( lpszControlID, "button_giveup" ) == 0 && SQuestMgr::GetInstance().GetQuestCount()>0 )
|
|
{
|
|
if( m_nDataIndex >= 0 )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GIVEUPQUEST, (801), true) );
|
|
//m_nDataIndex = -1;
|
|
}
|
|
break;
|
|
}
|
|
/// 2011.09.27 - prodongi
|
|
else if (0 == ::_stricmp(lpszControlID, "button_quest_choice_view_01"))
|
|
{
|
|
if (0 < SQuestMgr::GetInstance().GetQuestCount())
|
|
{
|
|
toggleChoice();
|
|
}
|
|
}
|
|
/// 2011.09.28 - prodongi
|
|
else if (0 == ::_stricmp(lpszControlID, "button_quest_opacity_01"))
|
|
{
|
|
toggleOpacity();
|
|
Refresh();
|
|
}
|
|
/// 2011.12.01 - prodongi
|
|
else if (0 == ::_stricmp(lpszControlID, "button_quest_reduction_01"))
|
|
{
|
|
toggleExpansion();
|
|
}
|
|
/// 2011.12.07 - prodongi
|
|
else if (0 == ::_stricmp(lpszControlID, "button_unfold_01"))
|
|
{
|
|
toggleAllFold();
|
|
}
|
|
/// 2011.12.07 - prodongi
|
|
else if (0 == ::_stricmp(lpszControlID, "button_quest_default_view_01"))
|
|
{
|
|
setDefaultStatus();
|
|
}
|
|
}
|
|
break;
|
|
|
|
case KUI_MESSAGE::KCHECK_CHANGE:
|
|
{
|
|
/// 2011.09.26 - prodongi
|
|
if (strstr(lpszControlID, "quest_info_check"))
|
|
{
|
|
m_isChangeInfoCheck = true;
|
|
setChoiceCheck("quest_info_check", lpszControlID);
|
|
/// 아무것도 선택되어 있지 않으면
|
|
//if (-1 == m_nDataIndex)
|
|
//{
|
|
int offset = extractScrollOffset(lpszControlID, "quest_info_check");
|
|
selectQuest(offset + m_nScrollPos);
|
|
//}
|
|
|
|
if (m_checkChoice.m_isCheck)
|
|
{
|
|
Refresh(true);
|
|
}
|
|
}
|
|
/// 2011.09.30 - prodongi
|
|
else if (0 == ::_stricmp(lpszControlID, "quest_worldmap_button_01") && SQuestMgr::GetInstance().GetQuestCount()>0 )
|
|
{
|
|
selectFirstQuest();
|
|
bool isShowWorldMap = m_pGameManager->GetGameInterface()->IsShow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP);
|
|
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP, "set_quest_code", number_t(m_nQuestCode), number_t(1)));
|
|
|
|
if ( isShowWorldMap ) m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP, false ) );
|
|
else m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_LIST_MOVE_FORCE_BACK( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP ) );
|
|
m_detailViewCheckButton.setCheck(sDetailViewCheckButton::WORLDMAP,!isShowWorldMap);
|
|
}
|
|
else if( ::_stricmp( lpszControlID, "quest_info_button" ) == 0 && SQuestMgr::GetInstance().GetQuestCount()>0 )
|
|
{
|
|
selectFirstQuest();
|
|
|
|
if( m_nDataIndex >= 0)
|
|
{
|
|
bool isShowInfo = m_pGameManager->GetGameInterface()->IsShow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO);
|
|
|
|
if ( isShowInfo )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO, false ) );
|
|
m_detailViewCheckButton.setCheck(sDetailViewCheckButton::INFO,false);
|
|
}
|
|
else
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_QUEST_INFO_REQUEST( SQuestMgr::GetInstance().GetQuestCodeByIndex( m_nDataIndex ) ) );
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_LIST_MOVE_FORCE_BACK( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO ) );
|
|
m_detailViewCheckButton.setCheck(sDetailViewCheckButton::INFO,true);
|
|
}
|
|
|
|
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
|
|
|
|
case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동
|
|
{
|
|
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
|
|
|
|
// 로딩시나 재접속시 창위치 기억하게 변경 by 정동섭 2009.8.24
|
|
// 2011.05.17 - servantes 계속 저장 느리다
|
|
// GetGameOption().SetQuestX( GetRect().left );
|
|
// GetGameOption().SetQuestY( GetRect().top );
|
|
//KUIWnd *pInfoWnd = m_pManager->FindWnd( "window_quest_sub" );
|
|
//if( pInfoWnd ) pInfoWnd->MovePos( GetRect().right, GetRect().bottom-pInfoWnd->GetRect().GetHeight() );
|
|
|
|
break;
|
|
}
|
|
break;
|
|
case KUI_MESSAGE::KSCROLL_SELECT: // 스크롤 선택 //스크롤이 2개이어서 여기서 분류해서 처리해준다 -N4-
|
|
{
|
|
if( ::strcmp("vscroll_quest_list", lpszControlID) == 0 )
|
|
{
|
|
int nPos = int(lparam);
|
|
nPos = max( nPos, 0 );
|
|
|
|
if( m_nScrollPos != nPos )
|
|
{
|
|
m_nScrollPos = nPos;
|
|
|
|
Refresh(true);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
/// 2011.09.26 - prodongi
|
|
case KUI_MESSAGE::KQUESTINFOMNG_GIVEUP:
|
|
{
|
|
DWORD index = wparam;
|
|
if( SQuestMgr::GetInstance().GetQuestCount() > index )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GIVEUPQUEST, (801), true) );
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
return SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
void* SUIQuestListWnd::Perform( KID id, KArg& msg )
|
|
{
|
|
return SUIWnd::Perform( id, msg );
|
|
}
|
|
|
|
void SUIQuestListWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch( pMsg->nType )
|
|
{
|
|
case IMSG_SHOW_UIWINDOW:
|
|
{
|
|
//if( m_nSysMenuPosX > -99 && m_nSysMenuPosY > -99 )
|
|
//{
|
|
// MovePos(m_nSysMenuPosX, m_nSysMenuPosY);
|
|
//}
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_UI_MOVE:
|
|
{
|
|
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
|
|
m_nSysMenuPosX = pMoveMsg->m_nX;
|
|
m_nSysMenuPosY = pMoveMsg->m_nY;
|
|
MovePos(m_nSysMenuPosX, m_nSysMenuPosY);
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_MOUSEMOVE:
|
|
{
|
|
SIMSG_MOUSEMOVE* pMouseMove = (SIMSG_MOUSEMOVE* )pMsg;
|
|
|
|
m_mouseX = ((int)(short)LOWORD(pMouseMove->lParam));
|
|
m_mouseY = ((int)(short)HIWORD(pMouseMove->lParam));
|
|
}
|
|
break;
|
|
case IMSG_HOTKEY_EX: //servantes 2010.10.19
|
|
{
|
|
SIMSG_HOTKEY_EX* pHotKey = dynamicCast<SIMSG_HOTKEY_EX*>(pMsg);
|
|
|
|
if( pHotKey->wParam == VK_SHIFT )
|
|
m_bShiftKey = (pHotKey->bUp == 0); //servantes 2010.10.15
|
|
if( pHotKey->wParam == VK_CONTROL ) //servantes 2010.10.15
|
|
m_bControlKey = (pHotKey->bUp == 0);
|
|
if( pHotKey->wParam == VK_MENU )
|
|
{
|
|
bool bPreState = m_bAltKey;
|
|
m_bAltKey = (pHotKey->bUp == 0);
|
|
|
|
if( bPreState != m_bAltKey && IsShow() )
|
|
{
|
|
UpdateQuestInfo();
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
if( pMsg->nType == IMSG_UI_SEND_DATA )
|
|
{
|
|
SIMSG_UI_SEND_DATA *pData = dynamicCast< SIMSG_UI_SEND_DATA * >( pMsg );
|
|
|
|
if( pData->m_strString == "quest_list_updated" )
|
|
{
|
|
UpdateQuestInfo();
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO, false ) );
|
|
Refresh(true);
|
|
|
|
KUIControlVScrollSmallEx* pScrollBar = dynamicCast<KUIControlVScrollSmallEx*>(GetChild( "vscroll_quest_list" ));
|
|
if(pScrollBar)
|
|
{
|
|
DWORD scrollmax_cnt = pScrollBar->GetMaxRange() - 1;
|
|
if(scrollmax_cnt<0)
|
|
scrollmax_cnt = 0;
|
|
|
|
if(m_nScrollPos>=scrollmax_cnt)
|
|
{
|
|
_oprint("퀘스트리스트 목록 스크롤바 갱신 %d/%d",m_nScrollPos,scrollmax_cnt);
|
|
m_nScrollPos = scrollmax_cnt-1;
|
|
if(m_nScrollPos<0 || m_nScrollPos>=scrollmax_cnt)
|
|
m_nScrollPos = 0;
|
|
Refresh(true);
|
|
}
|
|
}
|
|
|
|
/// 2011.09.20 prodongi
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP, number_t(m_nQuestCode), "set_quest_code"));
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
|
|
if( pData->m_strString == "quest_status_updated" )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP, number_t(m_nQuestCode), "quest_status_updated"));
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MINIMAP, number_t(m_nQuestCode), "quest_status_updated"));
|
|
Refresh();
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
|
|
/// 2011.10.06 - prodongi
|
|
if (pData->m_strString == "quest_list_update_new")
|
|
{
|
|
Refresh(true);
|
|
pMsg->bUse = true;
|
|
}
|
|
|
|
//보상 관련
|
|
if( pData->m_strString == "select_reward" )
|
|
{
|
|
if( !IsRewardQuest( pData->m_nNumber.getAmount() ) )
|
|
m_vRewardList.push_back( pData->m_nNumber.getAmount() );
|
|
|
|
pMsg->bUse = true;
|
|
Refresh();
|
|
}
|
|
}
|
|
|
|
return SUIWnd::ProcMsgAtStatic( pMsg );
|
|
}
|
|
|
|
void SUIQuestListWnd::DelRewardQuest( QuestBase::QuestCode code )
|
|
{
|
|
for( unsigned int i(0); m_vRewardList.size()>i; i++ )
|
|
{
|
|
if( m_vRewardList[i] == code )
|
|
{
|
|
m_vRewardList.erase( m_vRewardList.begin() + i );
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
bool SUIQuestListWnd::IsRewardQuest( QuestBase::QuestCode code )
|
|
{
|
|
for( unsigned int i(0); m_vRewardList.size()>i; i++ )
|
|
{
|
|
if( m_vRewardList[i] == code )
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void SUIQuestListWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
|
|
{
|
|
if( bOpen )
|
|
{
|
|
m_pGameManager->StartSound( "ui_popup_window01.wav" );
|
|
|
|
Refresh(true);
|
|
/// 2011.09.15 - prodongi
|
|
//m_opacityList.open();
|
|
/// 2011.09.30 - prodongi
|
|
m_detailViewCheckButton.open(m_pGameManager->GetGameInterface());
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP, number_t(m_nQuestCode), "set_quest_code"));
|
|
}
|
|
else
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO, false));
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP, "hide_quest_region"));
|
|
}
|
|
|
|
// 2011.05.17 - servantes
|
|
GetGameOption().SetQuestX( GetRect().left );
|
|
GetGameOption().SetQuestY( GetRect().top );
|
|
|
|
return SUIWnd::OnNotifyUIWindowOpen( bOpen );
|
|
}
|
|
|
|
bool SUIQuestListWnd::InitControls( KPoint kPos )
|
|
{
|
|
m_nScrollPos = 0;
|
|
m_nDataIndex = -1;
|
|
m_oldDataIndex = -1; /// 2011.09.19 - prodongi
|
|
m_isChangeInfoCheck = false;
|
|
|
|
m_questInfoMgr = dynamicCast<KUIControlQuestInfoManager*>(GetChild( "list_control_01"));
|
|
if( m_questInfoMgr ) m_questInfoMgr->InitQuestInfoControl();
|
|
|
|
|
|
// 커스텀 윈도우 move 영역 설정
|
|
SetCustomMovingRect( KRect( 0, 0, 192, 25 ) );
|
|
SetChildShow( "quest_button_confirm", false );
|
|
//SetChildAsTop( "quest_count_01" );
|
|
|
|
#ifdef _KUI_INVALIDATION
|
|
// 퀘스트 창 배경을 off 시켰을 때 글씨가 흐리게 나오는 것을 해결하기 위해...
|
|
AddPopupControl( pControl );
|
|
#endif
|
|
|
|
/// 2011.09.23 - prodongi
|
|
addOpacityList();
|
|
m_checkChoice.init(dynamicCast<KUIControl*>(GetChild("button_quest_choice_view_01")));
|
|
m_opacityButton.init(dynamicCast<KUIControlSimpleButton*>(GetChild("button_quest_opacity_01")));
|
|
setOpacity(false);
|
|
m_closeButton = dynamicCast<KUIControlSimpleButton*>(GetChild("button_close"));
|
|
/// 2011.09.30 - prodongi
|
|
m_detailViewCheckButton.init(this);
|
|
/// 2011.12.01 - prodongi
|
|
m_titleBar = dynamicCast<KUIControlStatic*>(GetChild("titlebar"));
|
|
m_oriSize = KSize(GetRect().GetWidth(), GetRect().GetHeight());
|
|
SetResizeUnit(0, 1, KSize(m_titleBar->GetRect().GetWidth(), m_titleBar->GetRect().GetHeight()), m_oriSize);
|
|
setExpansion(true);
|
|
setAllFold(false);
|
|
|
|
KUIControlSimpleButton* buttonDefaultView = dynamicCast<KUIControlSimpleButton*>(GetChild("button_quest_default_view_01"));
|
|
if (buttonDefaultView)
|
|
buttonDefaultView->SetTooltip(S(1468));
|
|
|
|
return true;
|
|
}
|
|
|
|
void SUIQuestListWnd::addOpacityList()
|
|
{
|
|
m_opacityList.addChild(this, "titlebar");
|
|
m_opacityList.addChild(this, "title_deco_01");
|
|
m_opacityList.addChild(this, "title_text_01");
|
|
m_opacityList.addChild(this, "outframe");
|
|
m_opacityList.addChild(this, "inframe01");
|
|
m_opacityList.addChild(this, "select_list_cyan");
|
|
m_opacityList.addChild(this, "vscroll_quest_list");
|
|
m_opacityList.addChild(this, "button_quest_choice_view_01");
|
|
m_opacityList.addChild(this, "tab_all_01");
|
|
m_opacityList.addChild(this, "quest_count_01");
|
|
m_opacityList.addChild(this, "quest_count_text_01");
|
|
m_opacityList.addChild(this, "quest_info_button");
|
|
m_opacityList.addChild(this, "quest_worldmap_button_01");
|
|
m_opacityList.addChild(this, "button_unfold_01");
|
|
m_opacityList.addChild(this, "layout_partition_01");
|
|
m_opacityList.addChild(this, "button_quest_default_view_01");
|
|
m_opacityList.addChild(this, "panel_bg_01");
|
|
m_opacityList.addChild(this, "mark_quest_all_view_01");
|
|
m_opacityList.addChild(this, "tab_text_01");
|
|
m_opacityList.addChild(this, "button_quest_reduction_01");
|
|
}
|
|
|
|
std::string SUIQuestListWnd::CoordinateQuestName( int nDifficulty, int nLimitLevel, const std::string & strQuestName )
|
|
{
|
|
std::string strColor;
|
|
m_pDisplayInfo->getQuestDifficultyColor(nDifficulty, nLimitLevel, strColor);
|
|
return "<font:font_01><top><size:8><left><vcenter><b>" + strColor + strQuestName;
|
|
}
|
|
|
|
int SplitBR( std::string & strSrc, std::vector<std::string>& strDstlist, bool bDef )
|
|
{
|
|
{
|
|
if( strSrc.length() <= 1 ) return 0;
|
|
|
|
std::string strTmp = strSrc;
|
|
|
|
while( true )
|
|
{
|
|
size_t pos1 = strTmp.find( "<BR>" );
|
|
size_t pos2 = strTmp.find( "<br>" );
|
|
size_t result_pos;
|
|
|
|
if( pos1 != strTmp.npos && pos2 != strTmp.npos )
|
|
{
|
|
result_pos = std::min( pos1, pos2 );
|
|
}
|
|
else if( pos1 != strTmp.npos )
|
|
{
|
|
result_pos = pos1;
|
|
}
|
|
else if( pos2 != strTmp.npos )
|
|
{
|
|
result_pos = pos2;
|
|
}
|
|
else
|
|
{
|
|
if( !strTmp.empty() )
|
|
{
|
|
if( bDef )
|
|
strDstlist.push_back( CStringUtil::StringFormat( "<font:font_01><size:8><right><vcenter>%s", strTmp.c_str() ) );
|
|
else
|
|
strDstlist.push_back( CStringUtil::StringFormat( "%s", strTmp.c_str() ) );
|
|
}
|
|
break;
|
|
}
|
|
|
|
std::string strLine( strTmp.begin(), strTmp.begin() + result_pos );
|
|
if( bDef )
|
|
strDstlist.push_back( CStringUtil::StringFormat( "<font:font_01><size:8><right><vcenter>%s", strLine.c_str() ) );
|
|
else
|
|
strDstlist.push_back( CStringUtil::StringFormat( "%s", strLine.c_str() ) );
|
|
|
|
strTmp = strTmp.substr( result_pos + 4, strTmp.size() );
|
|
}
|
|
}
|
|
|
|
return (int)strDstlist.size();
|
|
}
|
|
|
|
void SUIQuestListWnd::Refresh(bool sortCheck)
|
|
{
|
|
m_updateRefreshTime = GetSafeTickCount();
|
|
|
|
extern std::string ParseQuestText( const char *szQuestString, int nQuestCode ); // GameVM.cpp
|
|
|
|
/// 2011.09.27 체크 상태에 따른 정렬 - prodongi
|
|
if (sortCheck)
|
|
{
|
|
SQuestMgr::GetInstance().sortByCheckStatus(m_checkChoice.m_isCheck);
|
|
reselectIndexBySort();
|
|
}
|
|
|
|
//윈도우 내에 하나만 존재
|
|
if (!m_questInfoMgr) return ;
|
|
m_questInfoMgr->ClearQuestInfo();
|
|
|
|
size_t quest_cnt = SQuestMgr::GetInstance().GetQuestCount();
|
|
size_t scrollmax_cnt = 0;
|
|
size_t add_quest_cnt = 0;
|
|
|
|
bool bSelect = false;
|
|
for( size_t idx = 0; idx < quest_cnt/*MAX_SLOT_COUNT*/; ++idx )
|
|
{
|
|
size_t orig_idx = idx;//m_nScrollPos + idx;
|
|
//if( orig_idx < quest_cnt )
|
|
{
|
|
if( !m_bTransparent )
|
|
{
|
|
if( m_nDataIndex >= 0 && orig_idx == m_nDataIndex )
|
|
{
|
|
// m_nFocus = idx;
|
|
bSelect = true;
|
|
}
|
|
else
|
|
bSelect = false;
|
|
}
|
|
|
|
QuestBase::QuestCode code = SQuestMgr::GetInstance().GetQuestCodeByIndex( orig_idx );
|
|
QuestBase *pBase = GetQuestDB().GetQuestData( code );
|
|
if( !pBase ) // 2011.07.12 - servantes
|
|
continue ;
|
|
|
|
/// 2011.10.06 체크 모드일때 체크 상태가 아니면 회색으로 처리
|
|
bool isGrey = false;
|
|
if (m_checkChoice.m_isCheck && !SQuestMgr::GetInstance().getQuestCheckByIndex(orig_idx) && !bSelect)
|
|
isGrey = true;
|
|
|
|
std::string strSubtitle( GetStringDB().GetQuestString( pBase->nQuestTextId ) );
|
|
|
|
std::string strProgress;
|
|
if( pBase->nStatusTextId ) strProgress = ParseQuestText( GetStringDB().GetQuestString( pBase->nStatusTextId ), code );
|
|
|
|
// 체크 모드浜?체크 상태가 아니면 회색으로 처리
|
|
if (isGrey)
|
|
{
|
|
strSubtitle = "<font:font_01><top><size:8><#707070><left><vcenter><b>" + strSubtitle;
|
|
}
|
|
else
|
|
{
|
|
strSubtitle = CoordinateQuestName( pBase->nQuestDifficulty, pBase->nLimitLevel, strSubtitle );
|
|
}
|
|
|
|
// 퀘스트 리스트에 목표 표시
|
|
std::vector<std::string> strlist;
|
|
std::vector<std::string> strtooltiplist; // 툴팁
|
|
|
|
//퀘스트 남은 시간 출력
|
|
//2009-07-14: hunee
|
|
//if(pBase->bP
|
|
|
|
/// 2011.09.27 - prodongi
|
|
int isCheck = -1;
|
|
if (sortCheck)
|
|
{
|
|
isCheck = SQuestMgr::GetInstance().getQuestCheckByIndex(orig_idx) == true ? 1 : 0;
|
|
}
|
|
|
|
bool bPendingquest = false;
|
|
/// 2011.09.23 - prodongi
|
|
bool isProgress = false;
|
|
|
|
if( SQuestMgr::GetInstance().IsPendingQuest(code) )
|
|
{
|
|
bPendingquest = true;
|
|
}
|
|
else
|
|
{
|
|
switch (SQuestMgr::GetInstance().GetQuestProgress( code ))
|
|
{
|
|
case SQuestMgr::QUEST_IN_PROGRESS:
|
|
{
|
|
isProgress = true;
|
|
SplitBR( strProgress, strlist, false);
|
|
|
|
/// 2011.10.06 success color 설정
|
|
std::vector<bool> successList;
|
|
SQuestMgr::GetInstance().getSuccessList(successList, code);
|
|
std::vector<std::string>::iterator it_s = strlist.begin();
|
|
for (size_t i = 0; i < strlist.size(); ++i)
|
|
{
|
|
if (isGrey)
|
|
{
|
|
strlist[i] = "<font:font_01><size:8><#707070><right><vcenter>" + strlist[i];
|
|
}
|
|
else
|
|
{
|
|
if (successList[i]) strlist[i] = "<font:font_01><size:8><#0076a3><right><vcenter>" + strlist[i];
|
|
else strlist[i] = "<font:font_01><size:8><#ffffff><right><vcenter>" + strlist[i];
|
|
}
|
|
}
|
|
successList.clear();
|
|
|
|
std::vector<int> monidlist;
|
|
SQuestMgr::GetInstance().getMonsterList(code, monidlist);
|
|
for(int i=monidlist.size();i<strlist.size();i++)
|
|
{
|
|
monidlist.push_back(0);
|
|
}
|
|
|
|
for(int i=0;i<monidlist.size();i++)
|
|
{
|
|
std::string sztooltip = "";
|
|
if(monidlist[i] > 0)
|
|
{
|
|
|
|
_MONSTER_INFO_FILE *pPtr = GetMonsterDB().GetMonsterData( bits_scramble< int, 3 >( monidlist[i] ) );
|
|
|
|
if( pPtr )
|
|
{
|
|
const char* lv = GetStringDB().GetString( 5035 ); // "Lv"
|
|
const char* pos = GetStringDB().GetString( 5036 ); // "pos"
|
|
char szdetail[256];
|
|
memset( szdetail, 0, sizeof(szdetail) );
|
|
sprintf(szdetail,"<br>%s<br><br>%s:%d<br>%s:%s<br>",
|
|
GetStringDB().GetString( pPtr->name_id ),
|
|
lv,
|
|
pPtr->level,
|
|
pos,
|
|
GetStringDB().GetString( pPtr->respawn_name_id ) );
|
|
sztooltip = szdetail;
|
|
}
|
|
}
|
|
strtooltiplist.push_back(sztooltip);
|
|
|
|
}
|
|
|
|
|
|
if (pBase->nTimeLimit > 0)
|
|
{
|
|
AR_TIME nCurArTime = GetArTime();
|
|
AR_TIME nTimeLimit = SQuestMgr::GetInstance().GetQuestTimeLimit( code );
|
|
if (nCurArTime < nTimeLimit)
|
|
{
|
|
nTimeLimit -= nCurArTime;
|
|
|
|
int sec = nTimeLimit /100 % 60;
|
|
int min = nTimeLimit / 6000 % 60;
|
|
int hour = nTimeLimit / 360000; //100*60*60 1/100초 기준
|
|
|
|
std::string strRemain;
|
|
strRemain = "<right>";
|
|
|
|
if (hour > 0)
|
|
{
|
|
strRemain += GetStringDB().GetString( 87 ); //"남은 시간 : #@time@#시간 #@min@#분"
|
|
|
|
XStringUtil::Replace( strRemain, "#@time@#", SStringDB::ToString( hour ).c_str() );
|
|
XStringUtil::Replace( strRemain, "#@min@#", SStringDB::ToString( min ).c_str() );
|
|
}
|
|
else if (min > 0)
|
|
{
|
|
strRemain += GetStringDB().GetString( 539 ); //"남은 시간 : #@min@#분"
|
|
|
|
XStringUtil::Replace( strRemain, "#@min@#", SStringDB::ToString( min ).c_str() );
|
|
}
|
|
else if (sec > 0)
|
|
{
|
|
strRemain += GetStringDB().GetString( 582 ); //"남은 시간 : #@second@#초"
|
|
|
|
XStringUtil::Replace( strRemain, "#@second@#", SStringDB::ToString( sec ).c_str() );
|
|
}
|
|
|
|
strlist.push_back(strRemain);
|
|
strtooltiplist.push_back( "" );
|
|
}
|
|
}
|
|
monidlist.clear();
|
|
}
|
|
break;
|
|
case SQuestMgr::QUEST_SUCCEED:
|
|
{
|
|
//<size:10><#e04444>퀘스트 완료
|
|
std::string strRemain;
|
|
//strRemain = "<right>";
|
|
//strRemain += GetStringDB().GetString( 536 );
|
|
strRemain = "<font:font_01><size:8><right><vcenter>";
|
|
if (isGrey) strRemain += "<#707070>";
|
|
else strRemain += "<#007cd2>";
|
|
strRemain += S(9553);
|
|
|
|
strlist.push_back(strRemain);
|
|
strtooltiplist.push_back( "" );
|
|
}
|
|
break;
|
|
case SQuestMgr::QUEST_FAILED:
|
|
{
|
|
//<size:10><#e04444>퀘스트 실패
|
|
std::string strRemain;
|
|
//strRemain = "<right>";
|
|
//strRemain += GetStringDB().GetString( 534 );
|
|
strRemain = "<font:font_01><size:8><right><vcenter>";;
|
|
if (isGrey) strRemain += "<#707070>";
|
|
else strRemain += "<#cc0500>";
|
|
strRemain += S(534);
|
|
|
|
strlist.push_back(strRemain);
|
|
strtooltiplist.push_back( "" );
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
bool isNew = SQuestMgr::GetInstance().getQuestIsNewByIndex(orig_idx);
|
|
int difficulty = m_pDisplayInfo->getQuestDifficulty(pBase->nQuestDifficulty, pBase->nLimitLevel);
|
|
if( orig_idx < quest_cnt && orig_idx >= m_nScrollPos)
|
|
{
|
|
add_quest_cnt++;
|
|
m_questInfoMgr->AddQuestInfo( code, strSubtitle.c_str(), strlist, strtooltiplist, bSelect, true, bPendingquest, isProgress, isCheck, difficulty, isNew );
|
|
//pControl->AddQuestInfo( code, strSubtitle.c_str(), strlist, strtooltiplist, bSelect, true, bPendingquest );
|
|
}
|
|
else
|
|
{
|
|
m_questInfoMgr->AddQuestInfo( code, strSubtitle.c_str(), strlist, strtooltiplist, bSelect, false, bPendingquest, isProgress, isCheck, difficulty, isNew );
|
|
//pControl->AddQuestInfo( code, strSubtitle.c_str(), strlist, strtooltiplist, bSelect, false, bPendingquest );
|
|
scrollmax_cnt++;
|
|
}
|
|
|
|
strlist.clear();
|
|
strtooltiplist.clear();
|
|
}
|
|
}
|
|
|
|
m_questInfoMgr->RefreshQuestInfo();
|
|
|
|
|
|
for( int i = 0; i <add_quest_cnt; i++ )
|
|
{
|
|
if(!m_questInfoMgr->GetQuestInfoCtrl(i)->IsShow())
|
|
{
|
|
scrollmax_cnt++;
|
|
}
|
|
else if( i>0 )
|
|
{
|
|
|
|
//if( ::_strcmpi( m_questInfoMgr->GetQuestInfoCtrl(i)->GetAniName(), m_questInfoMgr->GetQuestInfoCtrl(i-1)->GetAniName() ) != 0)
|
|
// scrollmax_cnt++;
|
|
if( ::_strcmpi( m_questInfoMgr->GetQuestInfoCtrl(i)->getBackAniName(), m_questInfoMgr->GetQuestInfoCtrl(i-1)->getBackAniName() ) != 0)
|
|
scrollmax_cnt++;
|
|
}
|
|
}
|
|
|
|
|
|
if( m_bTransparent ) return;
|
|
|
|
SetChildCaption( "quest_count_01", CStringUtil::StringFormat( "<font:font_01><hcenter><size:8><vcenter>%d/%d", quest_cnt, MAX_QUEST_COUNT ).c_str() );
|
|
|
|
UpdateQuestInfo();
|
|
//RefreshScrollbar();
|
|
KUIControlVScrollSmallEx* pScrollBar = dynamicCast<KUIControlVScrollSmallEx*>(GetChild( "vscroll_quest_list" ));
|
|
if(pScrollBar && m_questInfoMgr)
|
|
{
|
|
pScrollBar->SetMaxRange( scrollmax_cnt+1 );
|
|
}
|
|
|
|
|
|
}
|
|
|
|
void SUIQuestListWnd::UpdateQuestInfo()
|
|
{
|
|
size_t quest_cnt = SQuestMgr::GetInstance().GetQuestCount();
|
|
|
|
QuestBase::QuestCode qcode = SQuestMgr::GetInstance().GetQuestCodeByIndex( m_nDataIndex );
|
|
m_nQuestCode = qcode;
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_INFO, number_t( qcode ), "set_quest_code" ) );
|
|
|
|
SQuestMgr::GetInstance().SetCurrentQuest( qcode );
|
|
|
|
QuestBase::QuestCode code = qcode;
|
|
QuestBase *pBase = GetQuestDB().GetQuestData( code );
|
|
if( !pBase ) return;
|
|
|
|
// 보상
|
|
// EXP
|
|
if( pBase->nExp )
|
|
SetChildCaption( "quest_compens_expnumber", CStringUtil::StringFormat( "<size:10><right>%s", CStringUtil::GetCommaNumberString( pBase->nExp ).c_str() ).c_str() );
|
|
else
|
|
SetChildCaption( "quest_compens_expnumber", CStringUtil::StringFormat( "<size:10><right>%d", 0 ).c_str() );
|
|
// JP
|
|
if( pBase->nJP )
|
|
SetChildCaption( "quest_compens_jpnumber", CStringUtil::StringFormat( "<size:10><right>%s", CStringUtil::GetCommaNumberString( pBase->nJP ).c_str() ).c_str() );
|
|
else
|
|
SetChildCaption( "quest_compens_jpnumber", CStringUtil::StringFormat( "<size:10><right>%d", 0 ).c_str() );
|
|
|
|
// RP
|
|
if( pBase->nGold )
|
|
SetChildCaption( "quest_compens_rpnumber", CStringUtil::StringFormat( "<size:10><right>%s", CStringUtil::GetCommaNumberString( pBase->nGold ).c_str() ).c_str() );
|
|
else
|
|
SetChildCaption( "quest_compens_rpnumber", CStringUtil::StringFormat( "<size:10><right>%d", 0 ).c_str() );
|
|
|
|
// P
|
|
// 2009. 2. 13 hunee 은신감지 관련 추가, 기획쪽 담당자 김동민
|
|
if( pBase->nHolicPoint )
|
|
SetChildCaption( "quest_compens_pointnumber", CStringUtil::StringFormat( "<size:10><right>%s", CStringUtil::GetCommaNumberString( pBase->nHolicPoint ).c_str() ).c_str() );
|
|
else
|
|
SetChildCaption( "quest_compens_pointnumber", CStringUtil::StringFormat( "<size:10><right>%d", 0 ).c_str() );
|
|
|
|
// 기본아이템
|
|
if( pBase->DefaultReward.nItemCode )
|
|
{
|
|
SetChildCaption( "static_quest_base", CStringUtil::StringFormat( "<size:10><#FFFFFFFF><hcenter><vcenter>%s", S(6201) ).c_str() );
|
|
SetItemSlot( pBase->DefaultReward.nItemCode, pBase->DefaultReward.nQuantity, "quest_baseitem_itemback", "quest_baseitem_itemnumber" );
|
|
}
|
|
else
|
|
{
|
|
SetChildCaption( "static_quest_base", CStringUtil::StringFormat( "<size:10><#797979><hcenter><vcenter>%s", S(6201) ).c_str() );
|
|
SetItemSlot( 0, 0, "quest_baseitem_itemback", "quest_baseitem_itemnumber" );
|
|
}
|
|
|
|
// 옵셔널 아이템
|
|
if( pBase->OptionalReward[0].nItemCode )
|
|
{
|
|
SetChildCaption( "static_quest_select", CStringUtil::StringFormat( "<size:10><hcenter><vcenter><#FFFFFFFF>%s", S(6202) ).c_str() );
|
|
|
|
for( size_t slot_idx = 0; slot_idx < QuestBase::MAX_OPTIONAL_REWARD; ++slot_idx )
|
|
{
|
|
ItemBase::ItemCode code = pBase->OptionalReward[slot_idx].nItemCode;
|
|
int nCount = pBase->OptionalReward[slot_idx].nQuantity;
|
|
|
|
SetItemSlot( code, nCount, CStringUtil::StringFormat( "quest_selectitem_itemback_%02d", slot_idx ).c_str(), CStringUtil::StringFormat( "quest_selectitem_itemnumber%02d", slot_idx ).c_str() );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SetChildCaption( "static_quest_select", CStringUtil::StringFormat( "<size:10><hcenter><vcenter><#797979>%s", S(6202) ).c_str() );
|
|
|
|
for( size_t slot_idx = 0; slot_idx < QuestBase::MAX_OPTIONAL_REWARD; ++slot_idx )
|
|
SetItemSlot( 0, 0, CStringUtil::StringFormat( "quest_selectitem_itemback_%02d", slot_idx ).c_str(), CStringUtil::StringFormat( "quest_selectitem_itemnumber%02d", slot_idx ).c_str() );
|
|
}
|
|
|
|
}
|
|
|
|
void SUIQuestListWnd::Process(DWORD dwTime)
|
|
{
|
|
DWORD elapsedtime = dwTime - m_time;
|
|
m_time = dwTime;
|
|
|
|
KUIGenWnd::Process(dwTime);
|
|
|
|
AR_TIME time = GetSafeTickCount();
|
|
if (time > m_updateRefreshTime + 800)
|
|
{
|
|
Refresh();
|
|
}
|
|
|
|
/// 2011.09.15 - prodongi
|
|
updateOpacity(elapsedtime);
|
|
/// 2011.09.30 - prodongi
|
|
m_detailViewCheckButton.update(elapsedtime, m_pGameManager->GetGameInterface());
|
|
}
|
|
|
|
/// 2011.09.15 - prodongi
|
|
void SUIQuestListWnd::updateOpacity(DWORD elapsedtime)
|
|
{
|
|
if (m_bTransparent)
|
|
return ;
|
|
|
|
//m_opacityList.update(elapsedtime, m_mouseX, m_mouseY, this);
|
|
//m_questInfoMgr->updateOpacity(m_opacityList.m_alpha);
|
|
}
|
|
|
|
void SUIQuestListWnd::SetItemSlot( ItemBase::ItemCode code, int nCount, const char *szIconControl, const char *szNumberControl )
|
|
{
|
|
// 아이콘 설정
|
|
KUIControlIconStatic *pIcon = dynamicCast< KUIControlIconStatic* >( GetChild( szIconControl ) );
|
|
if( pIcon )
|
|
{
|
|
if( code )
|
|
{
|
|
const ItemBaseEx_info * base = GetItemDB().GetItemData( code );
|
|
|
|
pIcon->SetIcon( c_szDEF_SPR_NAME, base->pIcon_name );
|
|
pIcon->SetTooltip( m_pDisplayInfo->GetItemTooltipText( code, true, 0, 1, XFlag<int>(), 0, 0, 0, 0, 0, 0, 0, 0, 0, false, -1, -1, 0, base->nSummonId,0 ).c_str() );
|
|
pIcon->SetTooltipSprite( c_szDEF_SPR_NAME );
|
|
|
|
if( m_bAltKey )
|
|
{
|
|
m_pDisplayInfo->SetComparableEquipItemSubTooltip( pIcon, code );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
pIcon->SetIcon( c_szDEF_SPR_NAME, "static_common_itemslot" );
|
|
pIcon->SetTooltip( "" );
|
|
}
|
|
}
|
|
|
|
// 수량 설정
|
|
KUIWnd* pNum = GetChild( szNumberControl );
|
|
if( pNum )
|
|
{
|
|
if( code ) pNum->SetCaption( CStringUtil::StringFormat( "<shadow><right><size:8>%d", nCount ).c_str() );
|
|
else pNum->SetShow( false );
|
|
}
|
|
}
|
|
|
|
DWORD SUIQuestListWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
if( m_bTransparent )
|
|
{
|
|
/// 2011.09.28 closeButton 체크 추가
|
|
if (m_closeButton && m_opacityButton.m_wnd)
|
|
{
|
|
if (!m_closeButton->IsInRect(x, y) && !m_opacityButton.m_wnd->IsInRect(x, y))
|
|
{
|
|
OffToolTipWnd();
|
|
m_closeButton->SetButtonState(KUIControlSimpleButton::KBUTTON_NORMAL);
|
|
m_opacityButton.m_wnd->SetButtonState(KUIControlSimpleButton::KBUTTON_NORMAL);
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
switch (dwMessage)
|
|
{
|
|
case KLBUTTON_DBLCLK:
|
|
if (m_titleBar && m_titleBar->IsInRect(x, y))
|
|
{
|
|
toggleExpansion();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
return SUIWnd::OnMouseMessage(dwMessage, x, y);
|
|
}
|
|
|
|
void SUIQuestListWnd::setChoiceCheck(char const* sectionStr, char const* controlID)
|
|
{
|
|
int offset = extractScrollOffset(controlID, sectionStr);
|
|
SQuestMgr::GetInstance().setQuestCheckByIndex(offset+m_nScrollPos, m_questInfoMgr->isCheck(offset));
|
|
}
|
|
|
|
int SUIQuestListWnd::extractScrollOffset(char const* controlID, char const* str)
|
|
{
|
|
char const* strId = controlID + strlen(str);
|
|
return atoi(strId);
|
|
}
|
|
|
|
void SUIQuestListWnd::toggleOpacity()
|
|
{
|
|
setOpacity(!m_bTransparent);
|
|
}
|
|
|
|
void SUIQuestListWnd::setOpacity(bool opacity)
|
|
{
|
|
m_bTransparent = opacity;
|
|
m_opacityButton.setOpacity(opacity);
|
|
m_questInfoMgr->SetSimpleMode(m_bTransparent);
|
|
|
|
bool show;
|
|
|
|
if (m_bTransparent)
|
|
{
|
|
show = false;
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_LIST_MOVE_BACK( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_LIST ) );
|
|
}
|
|
else
|
|
{
|
|
show = true;
|
|
}
|
|
|
|
m_opacityList.setShow(show);
|
|
m_questInfoMgr->setOpacityShow(show);
|
|
/*
|
|
if (show)
|
|
{
|
|
m_opacityList.setAlpha(1.0f);
|
|
m_opacityList.changeAlpha();
|
|
m_questInfoMgr->updateOpacity(1.0f);
|
|
}
|
|
*/
|
|
}
|
|
|
|
void SUIQuestListWnd::selectFirstQuest()
|
|
{
|
|
size_t quest_cnt = SQuestMgr::GetInstance().GetQuestCount();
|
|
if (0 == quest_cnt)
|
|
return ;
|
|
if (0 != m_nQuestCode && -1 != m_nDataIndex)
|
|
return ;
|
|
|
|
m_nScrollPos = 0;
|
|
KUIControlVScrollSmallEx* scrollBar = dynamicCast<KUIControlVScrollSmallEx*>(GetChild("vscroll_quest_list"));
|
|
if (scrollBar)
|
|
scrollBar->SetPosition(m_nScrollPos);
|
|
|
|
selectQuest(0);
|
|
}
|
|
|
|
void SUIQuestListWnd::selectQuest(int index)
|
|
{
|
|
size_t quest_cnt = SQuestMgr::GetInstance().GetQuestCount();
|
|
if (0 == quest_cnt)
|
|
return ;
|
|
|
|
m_oldDataIndex = m_nDataIndex;
|
|
m_nDataIndex = index;
|
|
|
|
QuestBase::QuestCode qcode = SQuestMgr::GetInstance().GetQuestCodeByIndex( m_nDataIndex );
|
|
m_nQuestCode = qcode;
|
|
SQuestMgr::GetInstance().SetCurrentQuest( qcode );
|
|
}
|
|
|
|
void SUIQuestListWnd::setScrollStartPosition()
|
|
{
|
|
KUIControlVScrollSmallEx* scroll = dynamicCast<KUIControlVScrollSmallEx*>(GetChild("vscroll_quest_list"));
|
|
if (scroll)
|
|
{
|
|
scroll->SetPosition(0);
|
|
m_nScrollPos = scroll->GetPosition();
|
|
}
|
|
}
|
|
|
|
void SUIQuestListWnd::setChoice(bool check)
|
|
{
|
|
m_checkChoice.setCheck(check);
|
|
/// 스크롤을 시작 위치로 이동
|
|
if (m_checkChoice.m_isCheck)
|
|
{
|
|
setScrollStartPosition();
|
|
}
|
|
|
|
Refresh(true);
|
|
|
|
int stringId = m_checkChoice.m_isCheck ? 1451 : 1450;
|
|
std::string str;
|
|
XStringUtil::Format(str, "<#ffffff><font:font_02><vcenter><out><hcenter><size:9>%s", S(stringId));
|
|
SetChildCaption("tab_text_01", str.c_str());
|
|
|
|
KUIControlStatic* ctrl = dynamicCast<KUIControlStatic*>(GetChild("mark_quest_all_view_01"));
|
|
if (ctrl)
|
|
{
|
|
char const* aniName;
|
|
int tooltipIndex;
|
|
if (m_checkChoice.m_isCheck)
|
|
{
|
|
aniName = "common_mark_quest_select_view";
|
|
tooltipIndex = 1457;
|
|
}
|
|
else
|
|
{
|
|
aniName = "common_mark_quest_all_view";
|
|
tooltipIndex = 1456;
|
|
}
|
|
ctrl->SetTooltip(S(tooltipIndex));
|
|
ctrl->SetAniName(aniName);
|
|
}
|
|
}
|
|
|
|
void SUIQuestListWnd::toggleChoice()
|
|
{
|
|
setChoice(!m_checkChoice.m_isCheck);
|
|
}
|
|
|
|
void SUIQuestListWnd::reselectIndexBySort()
|
|
{
|
|
int reselectIndex = SQuestMgr::GetInstance().getQuestIndexByCode(m_nQuestCode);
|
|
if (0 <= reselectIndex)
|
|
selectQuest(reselectIndex);
|
|
}
|
|
|
|
void SUIQuestListWnd::toggleExpansion()
|
|
{
|
|
setExpansion(!m_isExpansion);
|
|
}
|
|
|
|
void SUIQuestListWnd::setExpansion(bool expansion)
|
|
{
|
|
m_isExpansion = expansion;
|
|
|
|
KRect r(GetRect());
|
|
if (m_isExpansion)
|
|
{
|
|
r.right = r.left + m_oriSize.width;
|
|
r.bottom = r.top + m_oriSize.height;
|
|
|
|
SetShowChildAll(true);
|
|
SetChildShow("titlebar_quest_fold_01", false);
|
|
m_opacityButton.m_wnd->Enable();
|
|
}
|
|
else
|
|
{
|
|
r.right = r.left + m_titleBar->GetRect().GetWidth();
|
|
r.bottom = r.top + m_titleBar->GetRect().GetHeight();
|
|
|
|
SetShowChildAll(false);
|
|
SetChildShow("button_quest_reduction_01", true);
|
|
SetChildShow("button_close", true);
|
|
SetChildShow("titlebar", true);
|
|
SetChildShow("title_text_01", true);
|
|
SetChildShow("title_deco_01", true);
|
|
SetChildShow("titlebar_quest_fold_01", true);
|
|
m_opacityButton.m_wnd->SetShow(true);
|
|
m_opacityButton.m_wnd->Disable();
|
|
}
|
|
SetRect(r);
|
|
LimitMoveWnd();
|
|
}
|
|
|
|
void SUIQuestListWnd::setAllFold(bool fold, bool refresh)
|
|
{
|
|
m_isAllFoldStatus = fold;
|
|
KUIControlSimpleButton* button = dynamicCast<KUIControlSimpleButton*>(GetChild("button_unfold_01"));
|
|
|
|
if (button)
|
|
{
|
|
if (fold)
|
|
{
|
|
if (button)
|
|
{
|
|
button->SetAniName("common_button_titanium_list_unfold");
|
|
button->SetTooltip(S(1467));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (button)
|
|
{
|
|
button->SetAniName("common_button_titanium_list_fold");
|
|
button->SetTooltip(S(1466));
|
|
}
|
|
}
|
|
}
|
|
|
|
if (refresh)
|
|
{
|
|
if (fold)
|
|
{
|
|
if (m_questInfoMgr)
|
|
m_questInfoMgr->setAllShort();
|
|
}
|
|
else
|
|
{
|
|
if (m_questInfoMgr)
|
|
m_questInfoMgr->setAllUnshort();
|
|
}
|
|
|
|
setScrollStartPosition();
|
|
Refresh(true);
|
|
}
|
|
}
|
|
|
|
void SUIQuestListWnd::toggleAllFold(bool refresh)
|
|
{
|
|
setAllFold(!m_isAllFoldStatus, refresh);
|
|
}
|
|
|
|
void SUIQuestListWnd::updateAllFoldStatus()
|
|
{
|
|
/// 전체 접기 상태
|
|
if (m_isAllFoldStatus)
|
|
{
|
|
/// 모두 안접힌 상태일 때
|
|
if (m_questInfoMgr->isAllUnshortList()) setAllFold(false, false);
|
|
}
|
|
/// 전체 안 접기 상태
|
|
else
|
|
{
|
|
/// 모두 접힌 상태일 때
|
|
if (m_questInfoMgr->isAllShortList()) setAllFold(true, false);
|
|
}
|
|
}
|
|
|
|
void SUIQuestListWnd::setDefaultStatus()
|
|
{
|
|
m_questInfoMgr->setAllShort();
|
|
updateAllFoldStatus();
|
|
setScrollStartPosition();
|
|
setChoice(false);
|
|
} |