1397 lines
36 KiB
C++
1397 lines
36 KiB
C++
|
|
#include "stdafx.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlQuest.h"
|
|
#include "KUIControlButton.h"
|
|
|
|
#include "KResourceManager.h"
|
|
#include "KUIWndManager.h"
|
|
#include "SLog.h"
|
|
#include "SStringDB.h"
|
|
|
|
using namespace KUI_MESSAGE;
|
|
|
|
|
|
#ifdef _COUNTRY_ME_
|
|
#define TEXT_PHRASE KTextLayout2
|
|
#else
|
|
#define TEXT_PHRASE KTextPhrase
|
|
#endif
|
|
|
|
std::string StrFormat_( const char* szString, ... )
|
|
{
|
|
char szBuf[1024];
|
|
|
|
va_list va;
|
|
va_start( va, szString );
|
|
_vsnprintf( szBuf, _countof(szBuf), szString, va );
|
|
va_end( va );
|
|
|
|
return std::string( szBuf );
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::sSlot::setShow(bool show)
|
|
{
|
|
m_auto->SetShow(show);
|
|
m_info->SetShow(show);
|
|
m_check->SetShow(show);
|
|
m_view->SetShow(show);
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::sSlot::setNewShow(bool show, bool simple)
|
|
{
|
|
m_new.SetShow(show, simple);
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::sSlot::backupNewShow()
|
|
{
|
|
m_backupNewShow = m_new.IsShow();
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::sSlot::restoreNewShow(bool simple)
|
|
{
|
|
m_new.SetShow(m_backupNewShow, simple);
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::sSlot::sNew::SetShow(bool show, bool simple)
|
|
{
|
|
if (show)
|
|
{
|
|
if (simple)
|
|
{
|
|
m_static->SetShow(true);
|
|
m_button->SetShow(false);
|
|
}
|
|
else
|
|
{
|
|
m_static->SetShow(false);
|
|
m_button->SetShow(true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m_static->SetShow(show);
|
|
m_button->SetShow(show);
|
|
}
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::sSlot::sNew::MovePos(int x, int y)
|
|
{
|
|
m_static->MovePos(x, y);
|
|
m_button->MovePos(x, y);
|
|
}
|
|
|
|
bool KUIControlQuestInfoManager::sSlot::sNew::IsShow() const
|
|
{
|
|
if (m_static->IsShow() || m_button->IsShow())
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::sSlot::sNew::SetSimpleMode(bool simple)
|
|
{
|
|
if (!IsShow())
|
|
return ;
|
|
SetShow(true, simple);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// KUIControlQuestInfo Implement
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
namespace
|
|
{
|
|
KUIWnd* QuestInfoCreator()
|
|
{
|
|
return new KUIControlQuestInfo;
|
|
}
|
|
bool bQuestInfoRegister = KUIFactory::GetInstance()->RegisterCreator( QuestInfoCreator, "quest_info");
|
|
|
|
LPCSTR QUEST_ANI_AUTOQUEST = "static_quest_exmark";
|
|
|
|
/// 2011.09.21 - prodongi
|
|
LPCSTR QUEST_INFO_FOLD = "common_button_titanium_fold_a";
|
|
LPCSTR QUEST_INFO_PROGRESS_UNFOLD = "common_button_titanium_quest02_unfold";
|
|
LPCSTR QUEST_INFO_FINISH_UNFOLD = "common_button_titanium_quest03_unfold";
|
|
LPCSTR QUEST_FRAME_SELECTCLICK = "common_select_titanium_bg_orange";
|
|
LPCSTR QUEST_FRAME_SELECTCLICK_OVERAREA_ANI_NAME = "common_select_titanium_bg_orange_bottom_hide";
|
|
LPCSTR QUEST_FRAME_ANI_NAME = "common_panel_inframe_titanium_blue";
|
|
LPCSTR QUEST_FRAME_OVERAREA_ANI_NAME = "common_panel_inframe_titanium_blue_bottom_hide";
|
|
LPCSTR QUEST_INFO_ANI_ROLLOVER = "common_panel_titanium_slot_disable";
|
|
|
|
const int c_nQuestInfoHeight = 24;
|
|
const int c_nMaxQuestObjectInfo = 12;
|
|
}
|
|
|
|
|
|
|
|
KUIControlQuestInfo::KUIControlQuestInfo()
|
|
{
|
|
m_IsSimpleMode = false;
|
|
/// 2011.09.21 - prodongi
|
|
m_wndGiveUp = NULL;
|
|
m_wndDifficulty = NULL;
|
|
m_wndDotLine = NULL;
|
|
m_wndBack = NULL;
|
|
m_wndSelect = NULL;
|
|
m_index = 0;
|
|
m_difficulty = 0;
|
|
}
|
|
KUIControlQuestInfo::~KUIControlQuestInfo()
|
|
{
|
|
m_pQuestObjectList.clear();
|
|
m_pQuestObjectSelectList.clear();
|
|
SAFE_DELETE_VECTOR( m_vProgressPhrase );
|
|
}
|
|
|
|
//void KUIControlQuestInfo::_initControl()
|
|
//{
|
|
// if(m_sAniName.empty() )
|
|
// m_sAniName = QUEST_FRAME_ANI_NAME;
|
|
//
|
|
// UpdateBack();
|
|
//}
|
|
|
|
void KUIControlQuestInfo::InitQuestInfoControl()
|
|
{
|
|
KUIWND_CREATE_ARG arg;
|
|
|
|
/// back
|
|
arg.pParent = this;
|
|
arg.lpszClassName = "static";
|
|
arg.lpszID = "quest_back";
|
|
arg.lpszSprName = m_sSprName.c_str();
|
|
arg.lpszAniName = QUEST_FRAME_ANI_NAME;
|
|
arg.rcRect = GetRect();
|
|
arg.dwFlag = 0;
|
|
m_wndBack = m_pManager->CreateControl(arg);
|
|
/// select
|
|
arg.pParent = this;
|
|
arg.lpszClassName = "static";
|
|
arg.lpszID = "quest_select";
|
|
arg.lpszSprName = m_sSprName.c_str();
|
|
arg.lpszAniName = QUEST_FRAME_SELECTCLICK;
|
|
arg.rcRect = GetRect();
|
|
arg.dwFlag = 0;
|
|
m_wndSelect = m_pManager->CreateControl(arg);
|
|
if (m_wndSelect)
|
|
m_wndSelect->SetShow(false);
|
|
///
|
|
for( int i(0); c_nMaxQuestObjectInfo>i; i++ )
|
|
{
|
|
KUIWND_CREATE_ARG CHILD_ARG;
|
|
CHILD_ARG.pParent = this;
|
|
CHILD_ARG.pWndManager = m_pManager;
|
|
CHILD_ARG.lpszSprName = m_sSprName.c_str();
|
|
CHILD_ARG.lpszClassName = "static";
|
|
CHILD_ARG.lpszID = StrFormat_( "quest_object%02d", i ).c_str();
|
|
CHILD_ARG.lpszAniName = "";//"static_common_selectover";
|
|
CHILD_ARG.lpszCaption = "<font:font_01><size:8><#0076a3><right><vcenter>";
|
|
|
|
CHILD_ARG.dwFlag = 0;
|
|
|
|
// select
|
|
CHILD_ARG.rcRect.left = GetRect().left + 29;
|
|
CHILD_ARG.rcRect.top = 20 + i*12;
|
|
CHILD_ARG.rcRect.right = CHILD_ARG.rcRect.left + 130;
|
|
CHILD_ARG.rcRect.bottom = CHILD_ARG.rcRect.top + 22;
|
|
CHILD_ARG.lpszID = StrFormat_( "quest_object_select%02d", i ).c_str();
|
|
KUIControlStatic* pQuestObjectSelect = dynamic_cast<KUIControlStatic*>( m_pManager->CreateControl(CHILD_ARG) );
|
|
if( pQuestObjectSelect )
|
|
pQuestObjectSelect->SetShow( false );
|
|
|
|
m_pQuestObjectSelectList.push_back( pQuestObjectSelect );
|
|
|
|
//
|
|
CHILD_ARG.rcRect = GetRect();
|
|
CHILD_ARG.rcRect.top = 22 + i*12;
|
|
CHILD_ARG.rcRect.bottom = 22 + i*12 + 12;
|
|
CHILD_ARG.rcRect.left = CHILD_ARG.rcRect.left + 3;
|
|
CHILD_ARG.rcRect.right = CHILD_ARG.rcRect.right - 3;
|
|
CHILD_ARG.lpszID = StrFormat_( "quest_object%02d", i ).c_str();
|
|
KUIControlStatic* pQuestObject = dynamic_cast<KUIControlStatic*>( m_pManager->CreateControl(CHILD_ARG) );
|
|
if( pQuestObject )
|
|
pQuestObject->SetShow( false );
|
|
|
|
m_pQuestObjectList.push_back( pQuestObject );
|
|
}
|
|
|
|
/// 2011.09.22 - prodongi
|
|
/// 포기 버튼
|
|
arg.pParent = this;
|
|
arg.pWndManager = m_pManager;
|
|
arg.lpszSprName = m_sSprName.c_str();
|
|
arg.lpszClassName = "simplebutton";
|
|
arg.lpszID = "quest_giveup";
|
|
arg.lpszAniName = "common_button_titanium_giveup";
|
|
arg.rcRect.left = GetRect().left + 17;
|
|
arg.rcRect.top = GetRect().top + 18;
|
|
arg.rcRect.right = arg.rcRect.left + 15;
|
|
arg.rcRect.bottom = arg.rcRect.top + 15;
|
|
arg.dwFlag = 0;
|
|
m_wndGiveUp = m_pManager->CreateControl(arg);
|
|
KUIControlSimpleButton* buttonGiveUp = dynamicCast<KUIControlSimpleButton*>(m_wndGiveUp);
|
|
if (buttonGiveUp)
|
|
buttonGiveUp->SetTooltip(S(1452));
|
|
/// 난이도
|
|
arg.lpszClassName = "static";
|
|
arg.lpszID = "quest_difficult";
|
|
arg.lpszAniName = "common_mark_quest_difficulty_easy";
|
|
arg.rcRect.left = GetRect().left + 21;
|
|
arg.rcRect.top = GetRect().top;
|
|
arg.rcRect.right = arg.rcRect.left + 7;
|
|
arg.rcRect.bottom = arg.rcRect.top + 20;
|
|
m_wndDifficulty = m_pManager->CreateControl(arg);
|
|
setDifficultyToolTip();
|
|
/// dot line
|
|
arg.lpszClassName = "static";
|
|
arg.lpszID = "quest_dotline";
|
|
arg.lpszAniName = "common_layout_titanium_dotline_quest_list";
|
|
arg.rcRect.left = GetRect().left;
|
|
arg.rcRect.top = GetRect().top + 22;
|
|
arg.rcRect.right = arg.rcRect.left + 155;
|
|
arg.rcRect.bottom = arg.rcRect.top + 1;
|
|
m_wndDotLine = m_pManager->CreateControl(arg);
|
|
// title
|
|
arg.lpszClassName = "static";
|
|
arg.lpszID = "quest_title";
|
|
arg.lpszAniName = "";
|
|
arg.rcRect.left = GetRect().left + 29;
|
|
arg.rcRect.top = GetRect().top + 4;
|
|
arg.rcRect.right = arg.rcRect.left + 113;
|
|
arg.rcRect.bottom = arg.rcRect.top + 18;
|
|
arg.dwFlag = KFLAG_NO_GET_MESSAGE | KFLAG_SINGLE_LINE;
|
|
arg.lpszCaption = "<font:font_01><left><top><#b92c36><vcenter><size:8><b>";
|
|
m_ctrlTitle = m_pManager->CreateControl(arg);
|
|
}
|
|
|
|
void KUIControlQuestInfo::Render(KViewportObject * pViewport, bool isFront )
|
|
{
|
|
if ( m_bShowFlag )
|
|
{
|
|
if( !m_IsSimpleMode )
|
|
{
|
|
KUIControl::Render(pViewport, isFront);
|
|
}
|
|
else
|
|
{
|
|
for(int i=0;i<m_pQuestObjectList.size();i++)
|
|
{
|
|
m_pQuestObjectList[i]->Render(pViewport, isFront);
|
|
}
|
|
|
|
m_ctrlTitle->Render(pViewport, isFront);
|
|
}
|
|
}
|
|
}
|
|
|
|
void KUIControlQuestInfo::OnPosChangeNofity(int XOffset, int YOffset)
|
|
{
|
|
KUIControl::OnPosChangeNofity( XOffset, YOffset );
|
|
}
|
|
|
|
void KUIControlQuestInfo::OnClipChangeNotify(const KRect& rcClipRect)
|
|
{
|
|
KUIControl::OnClipChangeNotify(rcClipRect);
|
|
}
|
|
|
|
void KUIControlQuestInfo::OnAlphaChangeNotify(float fAlpha)
|
|
{
|
|
KUIControl::OnAlphaChangeNotify(fAlpha);
|
|
}
|
|
|
|
DWORD KUIControlQuestInfo::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
DWORD dwRet = KUIControl::OnMouseMessage(dwMessage,x,y);
|
|
|
|
if(KMR_NO_GET & dwRet)
|
|
return dwRet;
|
|
|
|
if( IsDisable() ) return dwRet;
|
|
|
|
if( m_IsSimpleMode ) return KMR_NO_GET;
|
|
|
|
if(IsInRect(x,y) )
|
|
{
|
|
for(int i=0;i<m_pQuestObjectSelectList.size();i++)
|
|
{
|
|
if(m_pQuestObjectSelectList[i]->IsShow())
|
|
{
|
|
if(m_pQuestObjectSelectList[i]->IsInRect(x,y))
|
|
{
|
|
if( ::_stricmp( m_pQuestObjectSelectList[i]->GetAniName(), QUEST_INFO_ANI_ROLLOVER ) != 0 )
|
|
m_pQuestObjectSelectList[i]->SetAniName( QUEST_INFO_ANI_ROLLOVER );
|
|
}
|
|
else
|
|
{
|
|
if( ::_stricmp( m_pQuestObjectSelectList[i]->GetAniName(), QUEST_INFO_ANI_ROLLOVER ) == 0 )
|
|
m_pQuestObjectSelectList[i]->SetAniName( "" );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for(int i=0;i<m_pQuestObjectSelectList.size();i++)
|
|
if( ::_stricmp( m_pQuestObjectSelectList[i]->GetAniName(), QUEST_INFO_ANI_ROLLOVER ) == 0 )
|
|
m_pQuestObjectSelectList[i]->SetAniName( "" );
|
|
}
|
|
|
|
return dwRet;
|
|
}
|
|
|
|
void KUIControlQuestInfo::PumpUpMessage(LPCSTR lpszControlID, DWORD dwMessage, DWORD lParam, DWORD wParam)
|
|
{
|
|
switch (dwMessage)
|
|
{
|
|
case KBUTTON_CLICK:
|
|
{
|
|
if (0 == ::stricmp(lpszControlID, "quest_giveup"))
|
|
return KUIControl::PumpUpMessage(lpszControlID, KQUESTINFOMNG_GIVEUP, lParam, m_index);
|
|
}
|
|
break;
|
|
}
|
|
|
|
KUIControl::PumpUpMessage( lpszControlID, dwMessage, lParam, wParam);
|
|
}
|
|
|
|
void KUIControlQuestInfo::SetSimpleMode( bool bFlag )
|
|
{
|
|
if( m_IsSimpleMode != bFlag )
|
|
{
|
|
m_IsSimpleMode = bFlag;
|
|
#ifdef _KUI_INVALIDATION
|
|
InvalidateWnd();
|
|
#endif
|
|
}
|
|
|
|
/// 2011.09.26 - prodongi
|
|
if (bFlag)
|
|
{
|
|
if (m_wndSelect)
|
|
m_wndSelect->SetShow(false);
|
|
}
|
|
}
|
|
|
|
void KUIControlQuestInfo::RefreshQuestInfo(bool bShortmode)
|
|
{
|
|
std::vector<std::string> tempveclist;
|
|
KRect rect = GetRect();
|
|
if(!bShortmode)
|
|
{
|
|
for(std::vector<std::string>::iterator itt = m_strProgress.begin(); itt != m_strProgress.end(); itt++)
|
|
{
|
|
if(tempveclist.size() >= rect.GetHeight()/c_nQuestInfoHeight)
|
|
break;
|
|
tempveclist.push_back(*itt);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
SetQuestInfo(m_strTitle.c_str(), tempveclist, m_strTooltip, m_difficulty );
|
|
|
|
tempveclist.clear();
|
|
}
|
|
|
|
void KUIControlQuestInfo::SetQuestInfo( const char * strTitle,
|
|
std::vector<std::string>& strProgressList,
|
|
std::vector<std::string>& strTooltipList,
|
|
int difficulty )
|
|
{
|
|
KRect rect = GetRect();
|
|
|
|
if (m_wndBack)
|
|
{
|
|
if (m_wndBack->GetRect() != rect)
|
|
{
|
|
m_wndBack->Resize(rect);
|
|
m_wndBack->MovePos(rect.left, rect.top);
|
|
}
|
|
}
|
|
|
|
int titleOffset = 24;
|
|
int objectInterval = 23;
|
|
|
|
if( ::_stricmp( strTitle, m_strTitle.c_str()) != 0 )
|
|
{
|
|
m_strTitle = strTitle;
|
|
m_ctrlTitle->SetCaption(m_strTitle.c_str());
|
|
|
|
}
|
|
|
|
m_ctrlTitle->MovePos(rect.left + 29, rect.top + 4);
|
|
|
|
/// 2011.09.22 - prodongi
|
|
if (m_wndDifficulty)
|
|
{
|
|
m_wndDifficulty->MovePos(rect.left + 21, rect.top+2);
|
|
}
|
|
setDifficulty(difficulty);
|
|
|
|
bool bRefreshstrProgressList = true;
|
|
if( m_strProgress.size() == strProgressList.size() )
|
|
{
|
|
bRefreshstrProgressList = false;
|
|
|
|
for(int i=0; i< m_strProgress.size() ;i++)
|
|
{
|
|
if( ::_stricmp( m_strProgress[i].c_str(), strProgressList[i].c_str() ) != 0)
|
|
{
|
|
bRefreshstrProgressList = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if( bRefreshstrProgressList )
|
|
{
|
|
SAFE_DELETE_VECTOR( m_vProgressPhrase );
|
|
|
|
for(int i=0; i < c_nMaxQuestObjectInfo ; i++)
|
|
{
|
|
m_pQuestObjectList[i]->SetShow(false);
|
|
m_pQuestObjectSelectList[i]->SetShow(false);
|
|
}
|
|
|
|
m_strProgress.clear();
|
|
|
|
DWORD nMaxW, nMaxH, nW,nH;
|
|
nMaxW = nMaxH = 0;
|
|
for( unsigned int i(0); strProgressList.size()>i; i++ )
|
|
{
|
|
nW = nH = 0;
|
|
KTextPhrase::GetOneLineStringSize( strProgressList[i].c_str(), &nW, &nH );
|
|
nH += 5;
|
|
nMaxW += nW;
|
|
nMaxH += nH;
|
|
|
|
TEXT_PHRASE* pProgress = new TEXT_PHRASE( rect.right - rect.left-4, nH );
|
|
pProgress->SetPosition(rect.left, rect.top+titleOffset+(nH*i), m_fZPos);
|
|
pProgress->AddString( strProgressList[i].c_str(), m_fZPos );
|
|
|
|
m_vProgressPhrase.push_back( pProgress );
|
|
|
|
m_strProgress.push_back( strProgressList[i] );
|
|
|
|
if(i < c_nMaxQuestObjectInfo)
|
|
{
|
|
KRect newrect = rect;
|
|
newrect.top = rect.top+titleOffset+(nH*i)+2;
|
|
newrect.bottom = newrect.top + nH;
|
|
newrect.right = rect.right - 3;
|
|
newrect.left = rect.left + 3;
|
|
m_pQuestObjectList[i]->Resize( newrect );
|
|
m_pQuestObjectList[i]->SetCaption( strProgressList[i].c_str() );
|
|
m_pQuestObjectList[i]->SetTooltip( strTooltipList[i].c_str() );
|
|
m_pQuestObjectList[i]->SetShow(true);
|
|
|
|
newrect.left = rect.left + 29;
|
|
newrect.top = rect.top+titleOffset+(nH*i);
|
|
newrect.right = newrect.left + 130;
|
|
newrect.bottom = newrect.top + 22;
|
|
m_pQuestObjectSelectList[i]->Resize(newrect);
|
|
m_pQuestObjectSelectList[i]->SetShow(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
DWORD nMaxW, nMaxH, nW,nH;
|
|
nMaxW = nMaxH = 0;
|
|
for( unsigned int i(0); m_strProgress.size()>i; i++ )
|
|
{
|
|
nW = nH = 0;
|
|
KTextPhrase::GetOneLineStringSize( m_strProgress[i].c_str(), &nW, &nH );
|
|
nH = objectInterval;
|
|
|
|
nMaxW += nW;
|
|
nMaxH += nH;
|
|
|
|
m_vProgressPhrase[i]->SetPosition(rect.left, rect.top+titleOffset+(nH*i), m_fZPos);
|
|
|
|
if(i < c_nMaxQuestObjectInfo)
|
|
{
|
|
KRect newrect = rect;
|
|
newrect.top = rect.top+titleOffset+(nH*i)+2;
|
|
newrect.bottom = newrect.top + nH;
|
|
m_pQuestObjectList[i]->MovePos(newrect.left, newrect.top);
|
|
|
|
newrect.top = rect.top+titleOffset+(nH*i);
|
|
newrect.left = rect.left + 29;
|
|
m_pQuestObjectSelectList[i]->MovePos(newrect.left, newrect.top);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// 2011.09.22 - prodongi
|
|
if (m_wndGiveUp && m_wndDotLine)
|
|
{
|
|
if (m_strProgress.empty())
|
|
{
|
|
m_wndGiveUp->SetShow(false);
|
|
m_wndDotLine->SetShow(false);
|
|
}
|
|
else
|
|
{
|
|
KSize s;
|
|
s.cx = rect.left + 9; s.cy = rect.top + titleOffset+2;
|
|
if (s.cx != m_wndGiveUp->GetRect().left || s.cy != m_wndGiveUp->GetRect().top)
|
|
m_wndGiveUp->MovePos(s.cx, s.cy);
|
|
m_wndGiveUp->SetShow(true);
|
|
|
|
s.cx = rect.left; s.cy = rect.top + 22;
|
|
if (s.cx != m_wndDotLine->GetRect().left || s.cy != m_wndDotLine->GetRect().top)
|
|
m_wndDotLine->MovePos(rect.left, rect.top + 22);
|
|
m_wndDotLine->SetShow(true);
|
|
}
|
|
}
|
|
|
|
m_strTooltip.clear();
|
|
|
|
for(int i=0;i<strTooltipList.size();i++)
|
|
m_strTooltip.push_back(strTooltipList[i]);
|
|
|
|
InvalidateWnd();
|
|
}
|
|
|
|
void KUIControlQuestInfo::updateOpacity(float alpha)
|
|
{
|
|
OnAlphaChangeNotNotify(alpha);
|
|
|
|
m_wndGiveUp->ChangeAlpha(alpha);
|
|
m_wndDifficulty->ChangeAlpha(alpha);
|
|
m_wndDotLine->ChangeAlpha(alpha);
|
|
m_wndBack->ChangeAlpha(alpha);
|
|
m_wndSelect->ChangeAlpha(alpha);
|
|
}
|
|
|
|
void KUIControlQuestInfo::setOpacityShow(bool show)
|
|
{
|
|
m_wndGiveUp->SetShow(show);
|
|
m_wndDifficulty->SetShow(show);
|
|
m_wndDotLine->SetShow(show);
|
|
m_wndBack->SetShow(show);
|
|
m_wndSelect->SetShow(show);
|
|
}
|
|
|
|
void KUIControlQuestInfo::setSelect()
|
|
{
|
|
if(GetRect() != m_wndSelect->GetRect())
|
|
{
|
|
m_wndSelect->Resize(GetRect());
|
|
m_wndSelect->MovePos(GetRect().left, GetRect().top);
|
|
}
|
|
|
|
LPCSTR anifilename = NULL;
|
|
|
|
if( ::_stricmp( getBackAniName(), QUEST_FRAME_ANI_NAME) == 0)
|
|
anifilename = QUEST_FRAME_SELECTCLICK;
|
|
else
|
|
anifilename = QUEST_FRAME_SELECTCLICK_OVERAREA_ANI_NAME;
|
|
|
|
if(anifilename)
|
|
{
|
|
if( ::_stricmp(anifilename, getSelectAniName() ) != 0)
|
|
setSelectAniName( anifilename );
|
|
|
|
}
|
|
m_wndSelect->SetShow(true);
|
|
}
|
|
|
|
void KUIControlQuestInfo::setDifficulty(int difficulty)
|
|
{
|
|
if (!m_wndDifficulty)
|
|
return ;
|
|
|
|
m_difficulty = difficulty;
|
|
char const* aniName = "common_mark_quest_difficulty_easy";
|
|
switch (difficulty)
|
|
{
|
|
case 0: aniName = "common_mark_quest_difficulty_easy"; break;
|
|
case 1: aniName = "common_mark_quest_difficulty_nomal"; break;
|
|
case 2: aniName = "common_mark_quest_difficulty_hard"; break;
|
|
}
|
|
|
|
m_wndDifficulty->SetAniName(aniName);
|
|
}
|
|
|
|
void KUIControlQuestInfo::setDifficultyToolTip()
|
|
{
|
|
if (!m_wndDifficulty)
|
|
return ;
|
|
|
|
KUIControlStatic* diff = dynamic_cast<KUIControlStatic*>(m_wndDifficulty);
|
|
if (!diff)
|
|
return ;
|
|
|
|
std::string tooltip;
|
|
tooltip += "#@quest_easy@#"; tooltip += " "; tooltip += S(1460); tooltip += "<br>";
|
|
tooltip += "#@quest_normal@#"; tooltip += " "; tooltip += S(1462); tooltip += "<br>";
|
|
tooltip += "#@quest_hard@#"; tooltip += " "; tooltip += S(1461);
|
|
|
|
diff->SetTooltip(tooltip.c_str());
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// KUIControlQuestInfoManager Implement
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
namespace
|
|
{
|
|
KUIWnd* QuestInfoManagerCreator()
|
|
{
|
|
return new KUIControlQuestInfoManager;
|
|
}
|
|
bool bQuestInfoManagerRegister = KUIFactory::GetInstance()->RegisterCreator( QuestInfoManagerCreator, "quest_info_mgr");
|
|
const int c_nMaxQuestInfo = 20;
|
|
}
|
|
|
|
|
|
KUIControlQuestInfoManager::KUIControlQuestInfoManager()
|
|
{
|
|
|
|
}
|
|
|
|
KUIControlQuestInfoManager::~KUIControlQuestInfoManager()
|
|
{
|
|
/// 2011.09.23 - prodongi
|
|
m_strQuestItemList.clear();
|
|
//m_pQuestInfoCtrlList.clear();
|
|
//m_pQuestInfoViewTypeCtrlList.clear();
|
|
//m_pQuestInfoAutoQuestList.clear();
|
|
//m_questInfoCheckCtrlList.clear();
|
|
m_opacityList.clear();
|
|
m_QuestShortInfoCodeList.clear();
|
|
m_slot.clear();
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::SetButtonState( DWORD State )
|
|
{
|
|
m_dwButtonState = State;
|
|
InvalidateWnd();
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::InitQuestInfoControl()
|
|
{
|
|
m_IsSimpleMode = false;
|
|
m_nCanUseIndex = 0;
|
|
m_nUseCnt = 0;
|
|
m_nSelectIndex = -1;
|
|
|
|
int nW = GetRect().right -GetRect().left;
|
|
int nH = GetRect().bottom-GetRect().top;
|
|
|
|
int prevTop = 0;
|
|
/*
|
|
//셀렉트 앞 배경 생성
|
|
{
|
|
KUIWND_CREATE_ARG CHILD_ARG;
|
|
CHILD_ARG.pParent = this;
|
|
CHILD_ARG.pWndManager = m_pManager;
|
|
CHILD_ARG.lpszSprName = m_sSprName.c_str();
|
|
CHILD_ARG.lpszClassName = "static";
|
|
CHILD_ARG.lpszID = "static_quest_selectbar";
|
|
CHILD_ARG.lpszAniName = QUEST_FRAME_SELECTCLICK;
|
|
CHILD_ARG.rcRect = GetRect();
|
|
/// 2011.09.22 - prodongi
|
|
CHILD_ARG.rcRect.left += 1;
|
|
CHILD_ARG.rcRect.right -= 1;
|
|
CHILD_ARG.rcRect.top += 1;
|
|
CHILD_ARG.rcRect.bottom -=1;
|
|
CHILD_ARG.dwFlag = 0;
|
|
KUIWnd * pCtrl = m_pManager->CreateControl(CHILD_ARG);
|
|
if( pCtrl ) pCtrl->SetShow( false );
|
|
}
|
|
*/
|
|
for( int i(0); c_nMaxQuestInfo>i; i++ )
|
|
{
|
|
sSlot slot;
|
|
|
|
{
|
|
KUIWND_CREATE_ARG CHILD_ARG;
|
|
CHILD_ARG.pParent = this;
|
|
CHILD_ARG.pWndManager = m_pManager;
|
|
CHILD_ARG.lpszSprName = m_sSprName.c_str();
|
|
CHILD_ARG.lpszClassName = "quest_info";
|
|
CHILD_ARG.lpszID = StrFormat_( "quest_info%02d", i ).c_str();
|
|
CHILD_ARG.lpszAniName = "";//QUEST_FRAME_ANI_NAME;
|
|
CHILD_ARG.rcRect = GetRect();
|
|
/// 2011.09.23 - prodongi
|
|
CHILD_ARG.rcRect.left = GetRect().left;
|
|
CHILD_ARG.rcRect.right = GetRect().right;
|
|
CHILD_ARG.rcRect.top += prevTop;
|
|
CHILD_ARG.rcRect.bottom = CHILD_ARG.rcRect.top + nH;
|
|
CHILD_ARG.dwFlag = 0;
|
|
|
|
KUIControlQuestInfo* pQuestInfo = reinterpret_cast<KUIControlQuestInfo*>( m_pManager->CreateControl(CHILD_ARG) );
|
|
|
|
prevTop = CHILD_ARG.rcRect.top + 3;
|
|
|
|
pQuestInfo->InitQuestInfoControl();
|
|
pQuestInfo->SetShow( false );
|
|
pQuestInfo->SetSimpleMode( m_IsSimpleMode );
|
|
pQuestInfo->setIndex(i);
|
|
|
|
//m_pQuestInfoCtrlList.push_back( pQuestInfo );
|
|
slot.m_info = pQuestInfo;
|
|
}
|
|
|
|
{
|
|
KUIWND_CREATE_ARG CHILD_ARG;
|
|
CHILD_ARG.pParent = this;
|
|
CHILD_ARG.pWndManager = m_pManager;
|
|
CHILD_ARG.lpszSprName = m_sSprName.c_str();
|
|
CHILD_ARG.lpszClassName = "simplebutton";
|
|
CHILD_ARG.lpszID = StrFormat_( "quest_info_viewtype%02d", i ).c_str();
|
|
CHILD_ARG.rcRect = GetRect();
|
|
CHILD_ARG.dwFlag = 0;
|
|
CHILD_ARG.lpszAniName = QUEST_INFO_PROGRESS_UNFOLD;
|
|
CHILD_ARG.rcRect.left = GetRect().left + 142;
|
|
CHILD_ARG.rcRect.right = CHILD_ARG.rcRect.left + 18;
|
|
CHILD_ARG.rcRect.top = GetRect().top + 3;
|
|
CHILD_ARG.rcRect.bottom = CHILD_ARG.rcRect.top + 18;
|
|
KUIControlSimpleButton* pCtrl = dynamic_cast<KUIControlSimpleButton*>(m_pManager->CreateControl(CHILD_ARG));
|
|
if( pCtrl ) pCtrl->SetShow( true );
|
|
|
|
//m_pQuestInfoViewTypeCtrlList.push_back( pCtrl );
|
|
slot.m_view = pCtrl;
|
|
}
|
|
|
|
{
|
|
KUIWND_CREATE_ARG CHILD_ARG;
|
|
CHILD_ARG.pParent = this;
|
|
CHILD_ARG.pWndManager = m_pManager;
|
|
CHILD_ARG.lpszSprName = m_sSprName.c_str();
|
|
CHILD_ARG.lpszClassName = "static";
|
|
CHILD_ARG.lpszID = StrFormat_( "quest_info_autoquest%02d", i ).c_str();
|
|
CHILD_ARG.lpszAniName = QUEST_ANI_AUTOQUEST;
|
|
CHILD_ARG.rcRect = GetRect();
|
|
CHILD_ARG.dwFlag = 0;
|
|
|
|
CHILD_ARG.rcRect.left = GetRect().left + 169;
|
|
CHILD_ARG.rcRect.right = CHILD_ARG.rcRect.left + 12;
|
|
CHILD_ARG.rcRect.top = GetRect().top + 2;
|
|
CHILD_ARG.rcRect.bottom = CHILD_ARG.rcRect.top + 17;
|
|
|
|
KUIControlStatic* pCtrl = dynamic_cast<KUIControlStatic*>(m_pManager->CreateControl(CHILD_ARG));
|
|
if( pCtrl ) pCtrl->SetShow( true );
|
|
|
|
//m_pQuestInfoAutoQuestList.push_back( pCtrl );
|
|
slot.m_auto = pCtrl;
|
|
}
|
|
|
|
{
|
|
KUIWND_CREATE_ARG CHILD_ARG;
|
|
CHILD_ARG.pParent = this;
|
|
CHILD_ARG.pWndManager = m_pManager;
|
|
CHILD_ARG.lpszSprName = m_sSprName.c_str();
|
|
CHILD_ARG.lpszClassName = "check";
|
|
CHILD_ARG.lpszID = StrFormat_( "quest_info_check%02d", i ).c_str();
|
|
CHILD_ARG.lpszAniName = "common_button_check_titanium";
|
|
CHILD_ARG.rcRect = GetRect();
|
|
CHILD_ARG.dwFlag = 0;
|
|
|
|
CHILD_ARG.rcRect.left = GetRect().left + 3;
|
|
CHILD_ARG.rcRect.right = CHILD_ARG.rcRect.left + 17;
|
|
CHILD_ARG.rcRect.top = GetRect().top + 3;
|
|
CHILD_ARG.rcRect.bottom = CHILD_ARG.rcRect.top + 17;
|
|
|
|
KUIControlCheck* pCtrl = dynamic_cast<KUIControlCheck*>(m_pManager->CreateControl(CHILD_ARG));
|
|
if( pCtrl )
|
|
{
|
|
pCtrl->SetShow( true );
|
|
pCtrl->SetCheck(false);
|
|
}
|
|
|
|
//m_questInfoCheckCtrlList.push_back( pCtrl );
|
|
slot.m_check = pCtrl;
|
|
}
|
|
|
|
{
|
|
/// button
|
|
KUIWND_CREATE_ARG CHILD_ARG;
|
|
CHILD_ARG.pParent = this;
|
|
CHILD_ARG.pWndManager = m_pManager;
|
|
CHILD_ARG.lpszSprName = m_sSprName.c_str();
|
|
CHILD_ARG.lpszClassName = "simplebutton";
|
|
CHILD_ARG.lpszID = StrFormat_( "quest_info_new_button_%02d", i ).c_str();
|
|
CHILD_ARG.lpszAniName = "common_button_titanium_new_list_check";
|
|
CHILD_ARG.rcRect = GetRect();
|
|
CHILD_ARG.dwFlag = 0;
|
|
|
|
CHILD_ARG.rcRect.left = GetRect().left + 3;
|
|
CHILD_ARG.rcRect.right = CHILD_ARG.rcRect.left + 17;
|
|
CHILD_ARG.rcRect.top = GetRect().top + 3;
|
|
CHILD_ARG.rcRect.bottom = CHILD_ARG.rcRect.top + 17;
|
|
|
|
slot.m_new.m_button = dynamic_cast<KUIControlSimpleButton*>(m_pManager->CreateControl(CHILD_ARG));
|
|
|
|
/// static
|
|
CHILD_ARG.lpszClassName = "static";
|
|
CHILD_ARG.lpszID = StrFormat_( "quest_info_new_static_%02d", i ).c_str();
|
|
CHILD_ARG.lpszAniName = "common_mark_new_list_check";
|
|
|
|
slot.m_new.m_static = dynamic_cast<KUIControlStatic*>(m_pManager->CreateControl(CHILD_ARG));
|
|
}
|
|
|
|
m_slot.push_back(slot);
|
|
}
|
|
|
|
this->ClipRect(KRect(0,0,50,200));
|
|
|
|
m_QuestShortInfoCodeList.clear();
|
|
|
|
addOpacityList(); /// 2011.09.23 - prodongi
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::ClearQuestInfo()
|
|
{
|
|
m_strQuestItemList.clear();
|
|
m_nCanUseIndex = 0;
|
|
m_nUseCnt = 0;
|
|
m_nSelectIndex = -1;
|
|
|
|
/*
|
|
// KUIWnd * pCtrl1 = GetChild( "static_quest_selectback" );
|
|
KUIWnd * pCtrl2 = GetChild( "static_quest_selectbar" );
|
|
// if( pCtrl1 ) pCtrl1->SetShow( false );
|
|
if( pCtrl2 ) pCtrl2->SetShow( false );
|
|
*/
|
|
|
|
/// 2011.09.26 - prodongi
|
|
size_t count = m_slot.size();
|
|
for (size_t i = 0; i < count; ++i)
|
|
{
|
|
m_slot[i].setShow(false);
|
|
m_slot[i].setNewShow(false, m_IsSimpleMode);
|
|
}
|
|
/*
|
|
for( unsigned int i(0); m_pQuestInfoCtrlList.size()>i; i++ )
|
|
m_pQuestInfoCtrlList[i]->SetShow( false );
|
|
for( unsigned int i(0); m_pQuestInfoViewTypeCtrlList.size()>i; i++ )
|
|
m_pQuestInfoViewTypeCtrlList[i]->SetShow( false );
|
|
|
|
for( unsigned int i(0); m_pQuestInfoAutoQuestList.size()>i; i++ )
|
|
m_pQuestInfoAutoQuestList[i]->SetShow( false );
|
|
|
|
/// 2011.09.23 - prodongi
|
|
for (size_t i = 0; i < m_questInfoCheckCtrlList.size(); ++i)
|
|
m_questInfoCheckCtrlList[i]->SetShow(false);
|
|
*/
|
|
#ifdef _KUI_INVALIDATION
|
|
InvalidateWnd();
|
|
#endif
|
|
}
|
|
|
|
bool KUIControlQuestInfoManager::IsQuestInfoShortMode( int questCode )
|
|
{
|
|
for(std::vector< _QUEST_ITEM >::iterator itt=m_strQuestItemList.begin();
|
|
itt!=m_strQuestItemList.end();
|
|
itt++)
|
|
{
|
|
std::vector< int >::iterator finditt = std::find( m_QuestShortInfoCodeList.begin(), m_QuestShortInfoCodeList.end(), questCode);
|
|
if(finditt != m_QuestShortInfoCodeList.end())
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
int KUIControlQuestInfoManager::GetQuestInfoHeight( int questCode )
|
|
{
|
|
std::vector< _QUEST_ITEM >::iterator itt = m_strQuestItemList.begin();
|
|
for(; itt!=m_strQuestItemList.end(); itt++)
|
|
{
|
|
std::vector< int >::iterator finditt = std::find( m_QuestShortInfoCodeList.begin(), m_QuestShortInfoCodeList.end(), questCode);
|
|
if(finditt != m_QuestShortInfoCodeList.end())
|
|
return c_nQuestInfoHeight;
|
|
|
|
if(itt->questCode == questCode )
|
|
return c_nQuestInfoHeight+(itt->strProgress.size() * c_nQuestInfoHeight);
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
//quest_item.strProgress
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::AddQuestInfo( int questCode,
|
|
const char * strTitle,
|
|
std::vector<std::string>& strProgressList,
|
|
std::vector<std::string>& strTooltipList,
|
|
bool bSelect,
|
|
bool bVisible,
|
|
bool bPending,
|
|
bool isProgress,
|
|
int isCheck,
|
|
int difficulty, bool isNew)
|
|
{
|
|
_QUEST_ITEM quest_item;
|
|
quest_item.strTitle = strTitle;
|
|
quest_item.questCode = questCode;
|
|
quest_item.questInfoCtrlID = -1;
|
|
quest_item.pendingQuest = bPending;
|
|
|
|
|
|
//if(
|
|
std::vector< int >::iterator finditt = std::find( m_QuestShortInfoCodeList.begin(), m_QuestShortInfoCodeList.end(), questCode);
|
|
|
|
if(finditt == m_QuestShortInfoCodeList.end())
|
|
{
|
|
for( unsigned int i(0); strProgressList.size()>i; i++ )
|
|
{
|
|
quest_item.strProgress.push_back( strProgressList[i] );
|
|
}
|
|
}
|
|
|
|
|
|
if(bVisible)
|
|
{
|
|
//if( m_nUseCnt < m_pQuestInfoCtrlList.size() )
|
|
if( m_nUseCnt < m_slot.size())
|
|
{
|
|
sSlot& slot = m_slot[m_nCanUseIndex];
|
|
|
|
quest_item.questInfoCtrlID = m_nCanUseIndex;
|
|
//m_pQuestInfoCtrlList[m_nCanUseIndex]->SetQuestInfo( strTitle, strProgressList, strTooltipList );
|
|
//m_pQuestInfoCtrlList[m_nCanUseIndex]->SetShow( true );
|
|
slot.m_info->SetQuestInfo( strTitle, strProgressList, strTooltipList, difficulty );
|
|
slot.m_info->SetShow( true );
|
|
|
|
if (-1 != isCheck)
|
|
{
|
|
slot.m_check->SetCheck(isCheck == 1 ? true : false);
|
|
}
|
|
|
|
std::vector< int >::iterator finditt = std::find( m_QuestShortInfoCodeList.begin(), m_QuestShortInfoCodeList.end(), questCode);
|
|
|
|
LPCSTR anifilename = NULL;
|
|
|
|
if(finditt != m_QuestShortInfoCodeList.end())
|
|
{
|
|
if (isProgress) anifilename = QUEST_INFO_PROGRESS_UNFOLD;
|
|
else anifilename = QUEST_INFO_FINISH_UNFOLD;
|
|
}
|
|
else
|
|
{
|
|
anifilename = QUEST_INFO_FOLD;
|
|
}
|
|
|
|
if(anifilename)
|
|
{
|
|
if( ::_stricmp(anifilename, slot.m_view->GetAniName() ) != 0)
|
|
slot.m_view->SetAniName( anifilename );
|
|
}
|
|
|
|
slot.m_view->SetShow(true);
|
|
slot.m_auto->SetShow(true);
|
|
slot.m_check->SetShow(true); /// 2011.09.23 - prodongi
|
|
slot.m_new.SetShow(isNew, m_IsSimpleMode);
|
|
|
|
if(bSelect)
|
|
{
|
|
m_nSelectIndex = m_nCanUseIndex;
|
|
}
|
|
|
|
m_nUseCnt++;
|
|
|
|
m_nCanUseIndex++;
|
|
}
|
|
#ifdef _KUI_INVALIDATION
|
|
InvalidateWnd();
|
|
#endif
|
|
}
|
|
|
|
|
|
|
|
m_strQuestItemList.push_back( quest_item );
|
|
}
|
|
|
|
|
|
void KUIControlQuestInfoManager::RefreshQuestInfo()
|
|
{
|
|
if( m_nUseCnt <= 0 ) return;
|
|
|
|
KRect rect = GetRect();
|
|
|
|
|
|
//정보 타입에 따라 resize..
|
|
/*
|
|
for(int d=0; d<m_pQuestInfoCtrlList.size();d++)
|
|
{
|
|
m_pQuestInfoCtrlList[d]->SetShow(false);
|
|
m_pQuestInfoViewTypeCtrlList[d]->SetShow(false);
|
|
m_pQuestInfoAutoQuestList[d]->SetShow(false);
|
|
m_questInfoCheckCtrlList[d]->SetShow(false); /// 2011.09.23 - prodongi
|
|
}
|
|
*/
|
|
for (size_t i = 0; i < m_slot.size(); ++i)
|
|
{
|
|
m_slot[i].setShow(false);
|
|
m_slot[i].backupNewShow();
|
|
m_slot[i].setNewShow(false, m_IsSimpleMode);
|
|
}
|
|
|
|
for( int n(0); m_nUseCnt>n; n++ )
|
|
{
|
|
sSlot& slot = m_slot[n];
|
|
|
|
int questCode = -1;
|
|
int questID = 0;
|
|
|
|
for (int j=0;j<m_strQuestItemList.size();j++)
|
|
{
|
|
if(m_strQuestItemList[j].questInfoCtrlID == n)
|
|
{
|
|
questCode = m_strQuestItemList[j].questCode;
|
|
questID = j;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(questCode>=0)
|
|
{
|
|
KRect newrect= slot.m_info->GetRect();
|
|
if(n>0)
|
|
newrect.top = m_slot[n-1].m_info->GetRect().bottom;// + 1;
|
|
newrect.bottom = newrect.top + GetQuestInfoHeight(questCode);
|
|
|
|
if(newrect.top - rect.bottom > - c_nQuestInfoHeight)
|
|
{
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
slot.m_info->SetShow(true);
|
|
slot.m_view->SetShow(true);
|
|
slot.m_auto->SetShow(m_strQuestItemList[questID].pendingQuest);
|
|
slot.m_check->SetShow(true); /// 2011.09.23 - prodongi
|
|
slot.restoreNewShow(m_IsSimpleMode);
|
|
|
|
LPCSTR anifilename = NULL;
|
|
|
|
if(newrect.bottom > rect.bottom)
|
|
{
|
|
anifilename = QUEST_FRAME_OVERAREA_ANI_NAME;
|
|
newrect.bottom = rect.bottom-4;
|
|
}
|
|
else
|
|
{
|
|
anifilename = QUEST_FRAME_ANI_NAME;
|
|
}
|
|
|
|
if(anifilename)
|
|
{
|
|
/// 2011.09.26 - prodongi
|
|
//if( ::_stricmp(m_pQuestInfoCtrlList[n]->GetAniName(), anifilename) != 0)
|
|
// m_pQuestInfoCtrlList[n]->SetAniName( anifilename );
|
|
if( ::_stricmp(slot.m_info->getBackAniName(), anifilename) != 0)
|
|
slot.m_info->setBackAniName( anifilename );
|
|
}
|
|
|
|
//if(m_pQuestInfoCtrlList[n]->GetRect() != newrect)
|
|
{
|
|
slot.m_info->Resize(newrect);
|
|
slot.m_info->MovePos(newrect.left, newrect.top);
|
|
slot.m_auto->MovePos( newrect.left + 169, newrect.top + 2 );
|
|
slot.m_check->MovePos( newrect.left + 3, newrect.top + 3 ); /// 2011.09.23 - prodongi
|
|
slot.m_view->MovePos( newrect.left + 142, newrect.top + 3 );
|
|
slot.m_new.MovePos( newrect.left + 3, newrect.top + 3 );
|
|
}
|
|
|
|
slot.m_info->RefreshQuestInfo( IsQuestInfoShortMode(questCode) );
|
|
}
|
|
}
|
|
|
|
if(m_IsSimpleMode)
|
|
{
|
|
slot.m_view->SetShow(false);
|
|
slot.m_check->SetShow(false); /// 2011.09.23 - prodongi
|
|
slot.m_new.SetSimpleMode(m_IsSimpleMode);
|
|
}
|
|
}
|
|
|
|
hideSelect();
|
|
|
|
if (!m_IsSimpleMode)
|
|
{
|
|
//if( m_nSelectIndex >= 0 && m_nSelectIndex<m_pQuestInfoCtrlList.size() )
|
|
if( m_nSelectIndex >= 0 && m_nSelectIndex<m_slot.size() )
|
|
{
|
|
if(m_slot[m_nSelectIndex].m_info->IsShow())
|
|
{
|
|
m_slot[m_nSelectIndex].m_info->setSelect();
|
|
}
|
|
}
|
|
}
|
|
|
|
#ifdef _KUI_INVALIDATION
|
|
InvalidateWnd();
|
|
#endif
|
|
}
|
|
|
|
|
|
void KUIControlQuestInfoManager::SetSimpleMode( bool bFlag )
|
|
{
|
|
m_IsSimpleMode = bFlag;
|
|
|
|
//for( unsigned int n(0); m_pQuestInfoCtrlList.size()>n; n++ )
|
|
for( unsigned int n(0); m_slot.size()>n; n++ )
|
|
{
|
|
m_slot[n].m_info->SetSimpleMode( m_IsSimpleMode );
|
|
}
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::hideSelect()
|
|
{
|
|
//for( unsigned int n(0); m_pQuestInfoCtrlList.size()>n; n++ )
|
|
for( unsigned int n(0); m_slot.size()>n; n++ )
|
|
{
|
|
m_slot[n].m_info->setUnSelect();
|
|
}
|
|
}
|
|
|
|
DWORD KUIControlQuestInfoManager::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
DWORD dwRet = KUIControl::OnMouseMessage(dwMessage,x,y);
|
|
|
|
if(KMR_NO_GET & dwRet)
|
|
return dwRet;
|
|
|
|
if( IsDisable() ) return dwRet;
|
|
|
|
if( m_IsSimpleMode ) return KMR_NO_GET;
|
|
|
|
if(IsInRect(x,y) )
|
|
{
|
|
switch(dwMessage)
|
|
{
|
|
case KLBUTTON_DOWN:
|
|
m_bLeftButton = true;
|
|
PumpUpMessage(GetID(), KQUESTINFOMNG_PRESSING, 0,0);
|
|
SetButtonState( KQUESTINFOMNG_DOWN );
|
|
break;
|
|
case KLBUTTON_UP:
|
|
m_bLeftButton = false;
|
|
if(m_dwButtonState == KQUESTINFOMNG_DOWN )
|
|
{
|
|
bool bEnableFormClick = true;
|
|
bool bRefresh = false;
|
|
|
|
int nIndex = checkQuestInfo( x, y );
|
|
if(m_nSelectIndex != nIndex)
|
|
bRefresh = true;
|
|
|
|
m_nSelectIndex = nIndex;
|
|
|
|
|
|
for( int i(0); m_nUseCnt>i; i++ )
|
|
{
|
|
if( m_slot[i].m_view->IsInRect( x, y ) )
|
|
{
|
|
for( int j=0;j <m_strQuestItemList.size();j++)
|
|
{
|
|
if( m_strQuestItemList[j].questInfoCtrlID == i)
|
|
{
|
|
std::vector<int>::iterator finditt = std::find( m_QuestShortInfoCodeList.begin(), m_QuestShortInfoCodeList.end(), m_strQuestItemList[j].questCode );
|
|
if(finditt != m_QuestShortInfoCodeList.end())
|
|
m_QuestShortInfoCodeList.erase( finditt );
|
|
else
|
|
m_QuestShortInfoCodeList.push_back( m_strQuestItemList[j].questCode );
|
|
break;
|
|
}
|
|
}
|
|
|
|
bRefresh = true;
|
|
bEnableFormClick = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(bEnableFormClick)
|
|
PumpUpMessage(GetID(), KQUESTINFOMNG_CLICK, nIndex, 0);
|
|
|
|
if(bRefresh)
|
|
PumpUpMessage(GetID(), KQUESTINFOMNG_REFRESH, nIndex, 0);
|
|
|
|
}
|
|
|
|
SetButtonState( KQUESTINFOMNG_ACTIVATE );
|
|
break;
|
|
case KRBUTTON_DOWN:
|
|
{
|
|
m_bLeftButton = true;
|
|
/// 실제 영역 체크
|
|
if (!isInQuestInfo(x, y))
|
|
{
|
|
break;
|
|
}
|
|
|
|
PumpUpMessage(GetID(), KQUESTINFOMNG_PRESSING, 0,0);
|
|
SetButtonState( KQUESTINFOMNG_DOWN );
|
|
|
|
int nIndex = checkQuestInfo( x, y );
|
|
|
|
m_nSelectIndex = nIndex;
|
|
|
|
PumpUpMessage(GetID(), KQUESTINFOMNG_CLICK, nIndex, 0);
|
|
|
|
PumpUpMessage(GetID(), KQUESTINFOMNG_DBLCLK, 0, 0);
|
|
}
|
|
break;
|
|
case KLBUTTON_DBLCLK:
|
|
{
|
|
bool bEnableFormDBLClick = true;
|
|
|
|
for( int i(0); m_nUseCnt>i; i++ )
|
|
{
|
|
if( m_slot[i].m_view->IsInRect( x, y ) || m_slot[i].m_check->IsInRect( x, y ))
|
|
bEnableFormDBLClick = false;
|
|
}
|
|
|
|
/// 실제 영역 체크
|
|
if (!isInQuestInfo(x, y))
|
|
{
|
|
bEnableFormDBLClick = false;
|
|
}
|
|
|
|
if(bEnableFormDBLClick)
|
|
PumpUpMessage(GetID(), KQUESTINFOMNG_DBLCLK, 0, 0);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
return dwRet;
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::PumpUpMessage(LPCSTR lpszControlID, DWORD dwMessage, DWORD lParam, DWORD wParam)
|
|
{
|
|
KUIControl::PumpUpMessage(lpszControlID, dwMessage, lParam, wParam);
|
|
}
|
|
|
|
/// 2011.09.15 - prodongi
|
|
void KUIControlQuestInfoManager::OnAlphaChangeNotify(float fAlphaDiff)
|
|
{
|
|
if (m_IsSimpleMode)
|
|
{
|
|
KUIControl::OnAlphaChangeNotify(fAlphaDiff);
|
|
}
|
|
}
|
|
|
|
int KUIControlQuestInfoManager::checkQuestInfo( int x, int y )
|
|
{
|
|
hideSelect();
|
|
|
|
for( int i(0); m_nUseCnt>i; i++ )
|
|
{
|
|
if( m_slot[i].m_info->IsInRect( x, y ) )
|
|
{
|
|
m_slot[i].m_info->setSelect();
|
|
#ifdef _KUI_INVALIDATION
|
|
InvalidateWnd();
|
|
#endif
|
|
return i;
|
|
}
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::updateOpacity(float alpha)
|
|
{
|
|
std::vector<KUIWnd*>::iterator it_a = m_opacityList.begin();
|
|
for (; it_a != m_opacityList.end(); ++it_a)
|
|
{
|
|
(*it_a)->ChangeAlpha(alpha);
|
|
}
|
|
|
|
for (size_t i = 0; i < m_slot.size(); ++i)
|
|
{
|
|
m_slot[i].m_info->updateOpacity(alpha);
|
|
}
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::addOpacityList()
|
|
{
|
|
for( int i(0); c_nMaxQuestInfo>i; i++ )
|
|
{
|
|
addOpacityChild(m_slot[i].m_view->GetID());
|
|
addOpacityChild(m_slot[i].m_check->GetID());
|
|
addOpacityChild(m_slot[i].m_auto->GetID());
|
|
addOpacityChild(m_slot[i].m_new.m_button->GetID());
|
|
}
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::addOpacityChild(char const* id)
|
|
{
|
|
KUIWnd* wnd = GetChild(id);
|
|
if (wnd)
|
|
m_opacityList.push_back(wnd);
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::setOpacityShow(bool show)
|
|
{
|
|
std::vector<KUIWnd*>::iterator it_a = m_opacityList.begin();
|
|
for (; it_a != m_opacityList.end(); ++it_a)
|
|
{
|
|
(*it_a)->SetShow(show);
|
|
}
|
|
|
|
for (size_t i = 0; i < m_slot.size(); ++i)
|
|
{
|
|
m_slot[i].m_info->setOpacityShow(show);
|
|
}
|
|
}
|
|
|
|
bool KUIControlQuestInfoManager::isCheck(int idx) const
|
|
{
|
|
return m_slot[idx].m_check->GetCheck();
|
|
}
|
|
|
|
bool KUIControlQuestInfoManager::isInQuestInfo(int x, int y)
|
|
{
|
|
for(int i = 0 ; m_nUseCnt>i; i++ )
|
|
{
|
|
if( m_slot[i].m_info->IsInRect( x, y ) )
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::setAllShort()
|
|
{
|
|
m_QuestShortInfoCodeList.clear();
|
|
|
|
size_t len = m_strQuestItemList.size();
|
|
for (size_t i = 0; i < len; ++i)
|
|
{
|
|
m_QuestShortInfoCodeList.push_back(m_strQuestItemList[i].questCode);
|
|
}
|
|
}
|
|
|
|
void KUIControlQuestInfoManager::setAllUnshort()
|
|
{
|
|
m_QuestShortInfoCodeList.clear();
|
|
}
|
|
|
|
bool KUIControlQuestInfoManager::isAllShortList()
|
|
{
|
|
return m_QuestShortInfoCodeList.size() == m_strQuestItemList.size();
|
|
}
|
|
|
|
bool KUIControlQuestInfoManager::isAllUnshortList()
|
|
{
|
|
return m_QuestShortInfoCodeList.empty();
|
|
} |