813 lines
23 KiB
C++
813 lines
23 KiB
C++
|
|
#include "stdafx.h"
|
|
#include "KUIWndManager.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlClockBox.h"
|
|
#include "SGameManager.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SUIStateEffectWnd.h"
|
|
#include "SUIDisplayInfo.h"
|
|
#include "STenacityDB.h"
|
|
#include "SkillBaseFile.h"
|
|
#include "SGameOption.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
#include "SGameMessage.h"
|
|
#include "SGameAvatarEx.h"
|
|
#include "SGame.h"
|
|
|
|
|
|
namespace{
|
|
// const int c_nButtonClickArea = 10;
|
|
}
|
|
|
|
static const int REITERATION_OFFSET = 5; /// 2011.03.30 오버렙 아이콘의 상태 아이콘에 대한 옵셋값 - prodongi
|
|
static const int MAX_REITERATION_LEVEL = 99; /// 2011.04.01 - prodongi
|
|
|
|
SUIStateHEffectWnd::sUpdateTimeSlotInfo::sUpdateTimeSlotInfo(SStateSlot* stateSlot)
|
|
{
|
|
m_code = stateSlot->GetStateCode();
|
|
m_handle = stateSlot->GetStateHandle();
|
|
m_level = stateSlot->GetStateLevel();
|
|
}
|
|
|
|
bool SUIStateHEffectWnd::sUpdateTimeSlotInfo::isEqual(SStateSlot* stateSlot)
|
|
{
|
|
if (!stateSlot)
|
|
return false;
|
|
if (stateSlot->GetStateCode() == m_code &&
|
|
stateSlot->GetStateHandle() == m_handle &&
|
|
stateSlot->GetStateLevel() == m_level)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
bool SUIStateHEffectWnd::InitControls( KPoint kPos )
|
|
{
|
|
//SetCustomMovingRect( KRect( 0, 0, 15, c_nShortMoveRect ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area
|
|
//SetValidRect( "state_effect_h_change", KRect(0,c_nButtonClickArea,0,0) );
|
|
CreateItemIcon(); // 아이콘 생성
|
|
|
|
// state 재사용 시간 컨트롤
|
|
KUIWnd* pWnd( NULL );
|
|
// KUIWnd* pIcon = GetChild( "state_effect_syc_icon" );
|
|
// pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "clockbox", "state_effect_syc_clock", " ", pIcon->GetRect(), 0, KFLAG_NO_GET_MESSAGE, this, "", c_szDEF_SPR_NAME, m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) );
|
|
// if( pWnd ) ((KUIControlClockBox*)pWnd)->SetColor( c_ColorClockControl );
|
|
|
|
/// 2011.03.30 - prodongi
|
|
KRect rReiteration;
|
|
|
|
for( int i = 1; i <= c_nMaxStateIcon; i++ )
|
|
{
|
|
// 2011.11.30 - servantes : 형변환 버그 수정
|
|
// KUIWnd* pIcon = GetChild( CStringUtil::StringFormat("state_effect_h_icon%02d", i).c_str() );
|
|
KUIControlIconStatic* pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat("state_effect_h_icon%02d", i).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "clockbox", CStringUtil::StringFormat("state_effect_h_clock%02d", i).c_str(), " ", pIcon->GetRect(), 0, KFLAG_NO_GET_MESSAGE, this, "", c_szDEF_SPR_NAME, m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) );
|
|
if( pWnd )
|
|
{
|
|
((KUIControlClockBox*)pWnd)->SetColor( c_ColorClockControl );
|
|
pWnd->SetShow(false);
|
|
}
|
|
|
|
/// 2011.03.30 중첩 아이콘 생성 - prodongi
|
|
rReiteration.left = pIcon->GetRect().left + REITERATION_OFFSET;
|
|
rReiteration.top = pIcon->GetRect().top + REITERATION_OFFSET;
|
|
rReiteration.right = pIcon->GetRect().right;
|
|
rReiteration.bottom = pIcon->GetRect().bottom;
|
|
pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "static", CStringUtil::StringFormat("state_effect_h_reiteration%02d", i).c_str(), " ", rReiteration, 0, KFLAG_GET_PASS_MESSAGE, this, "", c_szDEF_SPR_NAME, m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) );
|
|
if (pWnd)
|
|
{
|
|
pWnd->SetShow(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
KRect Rt( GetRect() );
|
|
SetCorrectionRect( KRect(0,0,Rt.GetWidth()*-1,Rt.GetHeight()*-1), false );
|
|
|
|
return SUIWnd::InitControls(kPos);
|
|
}
|
|
bool SUIStateHEffectWnd::InitData( bool bReload )
|
|
{
|
|
InitChildShow( false );
|
|
return SUIWnd::InitData(bReload);
|
|
}
|
|
void SUIStateHEffectWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
switch(nMessage)
|
|
{
|
|
case KUI_MESSAGE::KBUTTON_CLICK:
|
|
{
|
|
}
|
|
break;
|
|
case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동
|
|
{
|
|
LimitMoveWnd(0, 0); // 게임 외부로 나가지 못하게 제한
|
|
}
|
|
break;
|
|
}
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
|
|
void SUIStateHEffectWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch(pMsg->nType)
|
|
{
|
|
case MSG_STATE:
|
|
{
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_UI_MOVE:
|
|
{
|
|
MovePos( ((SIMSG_UI_MOVE*)pMsg)->m_nX, ((SIMSG_UI_MOVE*)pMsg)->m_nY );
|
|
|
|
GetGameOption().SetStateHozX( GetRect().left );
|
|
GetGameOption().SetStateHozY( GetRect().top );
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_UI_STATE_UPDATE:
|
|
{
|
|
CheckState();
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_UI_STATE_LIST_UPDATE:
|
|
{
|
|
UpdateStateData(pMsg);
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
void SUIStateHEffectWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
|
|
{
|
|
SUIWnd::OnNotifyUIWindowOpen(bOpen);
|
|
|
|
if( bOpen )
|
|
RefreshAllStateSlot();
|
|
else
|
|
{
|
|
InitChildShow(false);
|
|
|
|
// 2011.05.17 - servantes
|
|
GetGameOption().SetStateHozX( GetRect().left );
|
|
GetGameOption().SetStateHozY( GetRect().top );
|
|
}
|
|
}
|
|
|
|
// =========================================
|
|
// 윈도우
|
|
// =========================================
|
|
void SUIStateHEffectWnd::CreateItemIcon()
|
|
{
|
|
KUIControlIconStatic* pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( "state_effect_h_icon01" ));
|
|
if( pIcon == NULL ) return;
|
|
|
|
int nLeft, nTop;
|
|
|
|
KRect rt = pIcon->GetRect();
|
|
KRect rcCashState = rt;
|
|
|
|
KUIWnd* pWnd = NULL;
|
|
for( int i(0); i<c_nMaxCashState; ++i )
|
|
{
|
|
if(i%2==0) rcCashState.top = rt.top;
|
|
else rcCashState.top = rt.top+35;
|
|
rcCashState.left = rt.left+ (i/2*32);
|
|
|
|
std::string strCtrName( CStringUtil::StringFormat( "state_effect_syc_icon%02d", i ) );
|
|
m_pManager->CreateControl( KUIWND_CREATE_ARG( "iconstatic", strCtrName.c_str(), " ", rcCashState, 0, KFLAG_GET_PASS_MESSAGE, this, "static_job_unknownicon", c_szDEF_SPR_NAME, m_pManager, 0, "tooltip", KANCHOR_LEFT | KANCHOR_TOP ) );
|
|
if( pWnd ) pWnd->SetShow(false);
|
|
}
|
|
|
|
nLeft = rt.left; nTop = rt.top;
|
|
rt.left += c_nIconHeight;
|
|
|
|
for( int i = 2; i <= c_nMaxNum; i++ )
|
|
{
|
|
rt.right = rt.left + c_nIconHeight;
|
|
rt.bottom = rt.top + c_nIconHeight;
|
|
|
|
//마우스 포커스 안 가도록 Flag : KFLAG_GET_PASS_MESSAGE 추가
|
|
pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "iconstatic", CStringUtil::StringFormat( "state_effect_h_icon%02d", i ).c_str(), " ", rt, 0, KFLAG_GET_PASS_MESSAGE, this, "static_job_unknownicon", c_szDEF_SPR_NAME, m_pManager, 0, "tooltip", KANCHOR_LEFT | KANCHOR_TOP ) );
|
|
pWnd->SetShow(false);
|
|
|
|
if( i%12 == 0 )
|
|
{
|
|
rt.left = nLeft;
|
|
rt.top = nTop + c_nIconHeight;
|
|
|
|
nTop = rt.top;
|
|
}
|
|
else
|
|
rt.left += c_nIconHeight;
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////
|
|
///////////////////////////////////////////////
|
|
|
|
// =========================================
|
|
// 스테이트 리스트
|
|
// =========================================
|
|
|
|
void SUIStateHEffectWnd::InitChildShow( bool bShow )
|
|
{
|
|
DisableSlot(0, c_nMaxNum, false);
|
|
DisableCashStateSlot(bShow);
|
|
CashStateMoveEffectWnd(bShow);
|
|
}
|
|
|
|
void SUIStateHEffectWnd::CashStateMoveEffectWnd( bool bInit/*=false*/ )
|
|
{
|
|
KUIControlIconStatic* pSycrutIcon = dynamicCast<KUIControlIconStatic*>(GetChild( "state_effect_syc_icon01" ));
|
|
if( pSycrutIcon == NULL )
|
|
return;
|
|
|
|
KRect rt( pSycrutIcon->GetRect() );
|
|
|
|
if( !IsSetPlayer() )
|
|
return;
|
|
|
|
vec_state_slot& CashStateList( m_pLocalplayer->GetCashStateList() );
|
|
|
|
if( CashStateList.empty() )
|
|
return ;
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//캐쉬용 버프가 있는지 살펴보고 그에 따른 위치값 산출 /////////////////////////////////////////////////////////////
|
|
int nStartLeft(rt.left), nStartTop(rt.top);
|
|
int nSize( CashStateList.size() );
|
|
if( !bInit && nSize>0 ) //(bInit == true) 이면 캐쉬 버프 유무와 무관하게 초기화 하는 것이기 때문에 좌측 상단 최초 위치로 설정
|
|
nStartLeft += (nSize+1)/2 * 33;
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
KUIControlIconStatic* pFirstIcon = dynamicCast<KUIControlIconStatic*>(GetChild( "state_effect_h_icon01" ));
|
|
if( pSycrutIcon == NULL ) return;
|
|
KRect FirstRT = pFirstIcon->GetRect();
|
|
|
|
if( FirstRT.left == nStartLeft )
|
|
return; //이미 이동하려는 위치와 동일하기 때문에 return;
|
|
else
|
|
{
|
|
FirstRT.left = nStartLeft;
|
|
FirstRT.right = FirstRT.left+c_nIconHeight;
|
|
}
|
|
|
|
//실질적인 버프 아이콘들의 위치이동
|
|
int nXpos(0);
|
|
KUIControlIconStatic* pIcon(NULL);
|
|
KUIControlClockBox* pClock(NULL);
|
|
KRect MoveRT(FirstRT.left,FirstRT.top,FirstRT.right,FirstRT.bottom);
|
|
for( int i = 0; i < c_nMaxNum; i++ )
|
|
{
|
|
nXpos = i%12;
|
|
// if(i>=10)
|
|
// {
|
|
nXpos = i%12;
|
|
// MoveRT.top = FirstRT.top + c_nIconHeight;
|
|
// }
|
|
MoveRT.left = FirstRT.left + (nXpos*c_nIconHeight);
|
|
MoveRT.top = FirstRT.top + ( (i/12) * c_nIconHeight );
|
|
MoveRT.right = MoveRT.left + c_nIconHeight;
|
|
MoveRT.bottom = MoveRT.top + c_nIconHeight;
|
|
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( "state_effect_h_icon%02d", i+1 ).c_str() ));
|
|
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat( "state_effect_h_clock%02d", i+1 ).c_str() ));
|
|
if( pIcon != NULL ) pIcon->MovePos( MoveRT.left, MoveRT.top );
|
|
if( pClock != NULL ) pClock->MovePos( MoveRT.left, MoveRT.top );
|
|
|
|
/// 2011.03.30 - prodongi
|
|
KUIControlStatic* reiteration = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat( "state_effect_h_reiteration%02d", i+1 ).c_str() ));
|
|
if (reiteration) reiteration->MovePos(MoveRT.left+REITERATION_OFFSET, MoveRT.top+REITERATION_OFFSET);
|
|
}
|
|
|
|
// KRect Rt = GetRect();
|
|
// Rt.right = MoveRT.right;
|
|
// SetCorrectionRect( KRect(0,0,Rt.GetWidth()*-1,Rt.GetHeight()*-1), false );
|
|
}
|
|
|
|
bool SUIStateHEffectWnd::IsSetPlayer()
|
|
{
|
|
if( !m_pLocalplayer )
|
|
{
|
|
SGame* pGame = m_pGameManager->GetActiveGame();
|
|
if( !pGame || pGame->GetGameType() != GAME_TYPE_WORLD )
|
|
return false;
|
|
|
|
AR_HANDLE handle = m_PlayerInfoMgr.GetPlayerHandle();
|
|
m_pLocalplayer = (SGameAvatarEx*)(pGame->GetGameObject(handle));
|
|
|
|
if( !m_pLocalplayer )
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// =========================================
|
|
// 스테이트 슬롯
|
|
// =========================================
|
|
|
|
void SUIStateHEffectWnd::DisableCashStateSlot( bool bShow )
|
|
{
|
|
for( int i(0); i<c_nMaxCashState; ++i )
|
|
{
|
|
KUIControlIconStatic* pIcon(NULL);
|
|
std::string strCtrName( CStringUtil::StringFormat( "state_effect_syc_icon%02d", i ) );
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( strCtrName.c_str() ));
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetShow(bShow);
|
|
pIcon->SetIcon(0);
|
|
pIcon->SetTooltip();
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIStateHEffectWnd::ResetStateSet()
|
|
{
|
|
::memset( m_StateIdSet, 0x00, sizeof(m_StateIdSet) );
|
|
}
|
|
|
|
void SUIStateHEffectWnd::RefreshAllStateSlot()
|
|
{
|
|
if( !IsSetPlayer() )
|
|
return;
|
|
|
|
ResetStateSet();
|
|
|
|
vec_state_slot& PositiveList = m_pLocalplayer->GetPositiveStateList();
|
|
vec_state_slot& NegativeList = m_pLocalplayer->GetNegativeStateList();
|
|
|
|
int nPositiveCount = static_cast<int>(PositiveList.size());
|
|
int nNegativeCount = static_cast<int>(NegativeList.size());
|
|
if( nPositiveCount>36 ) nPositiveCount = 36;
|
|
|
|
|
|
//이로운 지속효과를 세팅
|
|
for( int i(0); i<nPositiveCount; i++ )
|
|
{
|
|
SetStateData( i, PositiveList[i], false );
|
|
}
|
|
//이로운 지속효과 라인에서 나머지 부분을 NULL로 쎄팅
|
|
int nPositiveEndIndex(0);
|
|
if( nPositiveCount )
|
|
{
|
|
//((nPositiveCount-1)/10+1) * 10
|
|
//-> 1~10 = 10 / 11~20 = 20 으로 NULL로 쎄팅해야할 마지막 부분을 구하는 식
|
|
nPositiveEndIndex = ((nPositiveCount-1)/12+1) * 12;
|
|
for( int i(nPositiveCount); i<nPositiveEndIndex; i++ )
|
|
{
|
|
SetStateData( i, NULL, false );
|
|
}
|
|
}
|
|
//해로운 지속효과 쎄팅
|
|
for( int index(nPositiveEndIndex), nNegative(0); index<c_nMaxNum; ++index, ++nNegative )
|
|
{
|
|
if( nNegative<nNegativeCount )
|
|
SetStateData( index, NegativeList[nNegative], false );
|
|
else SetStateData( index, NULL, false );
|
|
}
|
|
|
|
RefreshCashStateSlot();
|
|
}
|
|
|
|
void SUIStateHEffectWnd::RefreshCashStateSlot()
|
|
{
|
|
if( !IsSetPlayer() ) return;
|
|
vec_state_slot& CashStateList = m_pLocalplayer->GetCashStateList();
|
|
|
|
int nSize( CashStateList.size() );
|
|
for( int i(0); i<c_nMaxCashState; ++i )
|
|
{
|
|
if( i<nSize )
|
|
SetStateData(i, CashStateList[i], true);
|
|
else SetStateData(i, NULL, true);
|
|
|
|
}
|
|
}
|
|
|
|
void SUIStateHEffectWnd::DisableSlot( int nIndex, int nEnd, bool bShow )
|
|
{
|
|
KUIControlIconStatic* pIcon = NULL;
|
|
KUIControlClockBox* pClock = NULL;
|
|
/// 2011.03.30 - prodongi
|
|
KUIControlStatic* ctrlReiteration;
|
|
|
|
for( int i = nIndex; i < nEnd; i++ )
|
|
{
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat("state_effect_h_icon%02d", i+1).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetShow(bShow);
|
|
pIcon->SetIcon(0);
|
|
pIcon->SetTooltip();
|
|
}
|
|
|
|
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat("state_effect_h_clock%02d", i+1).c_str() ));
|
|
if( pClock )
|
|
{
|
|
pClock->SetShow(bShow);
|
|
pClock->SetCurTime(0);
|
|
pClock->SetMaxTime(0);
|
|
pClock->Begin();
|
|
}
|
|
|
|
/// 2011.03.30 - prodongi
|
|
ctrlReiteration = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat("state_effect_h_reiteration%02d", i+1).c_str() ));
|
|
if( ctrlReiteration )
|
|
{
|
|
ctrlReiteration->SetShow(bShow);
|
|
}
|
|
}
|
|
}
|
|
// =========================================
|
|
// 삭제
|
|
// =========================================
|
|
/// 2011.03.30 - prodongi
|
|
void SUIStateHEffectWnd::CheckState( SStateSlot* pInfo, KUIControlIconStatic* pIcon, KUIControlClockBox* pClock, KUIControlStatic* ctrlReiteration )
|
|
{
|
|
if( !pInfo ) return;
|
|
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel(), pInfo->GetStateValue(), pInfo->IsToggleSkill()).c_str() );
|
|
}
|
|
|
|
/// 2011.03.30 - prodongi
|
|
if (ctrlReiteration)
|
|
{
|
|
setReiterationCount(pInfo, ctrlReiteration);
|
|
}
|
|
|
|
//여기서 IsValidProcTime()로 체크를 하고서 m_vUpdateTimeSlot 안에 있는 슬롯들에 해당하는 UI를 업데이트 하는 것은
|
|
//해당 slot의 proc()를 한번도 들어가지 않은 상태에서 pClock->SetCurTime()이 쎄팅되었었기 때문이다.
|
|
//해당 slot의 proc()를 체크 하지 않고 그냥 데이타를 사용하게 되면 잘 못된 값이 들어가게 되어 오작동 하게 된다.
|
|
if( pClock && pInfo->IsValidProcTime() )
|
|
{
|
|
if (!m_vUpdateTimeSlot.empty())
|
|
{
|
|
std::vector< sUpdateTimeSlotInfo >::iterator it = m_vUpdateTimeSlot.begin();
|
|
while( it != m_vUpdateTimeSlot.end() )
|
|
{
|
|
if (it->isEqual(pInfo))
|
|
{
|
|
pClock->SetMaxTime( pInfo->GetMaxTime() );
|
|
pClock->SetCurTime( pInfo->GetRemainTime() );
|
|
pClock->Begin( true );
|
|
m_vUpdateTimeSlot.erase(it);
|
|
break;
|
|
}
|
|
++it;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIStateHEffectWnd::CheckState()
|
|
{
|
|
if( !IsSetPlayer() )return;
|
|
|
|
vec_state_slot& CashList = m_pLocalplayer->GetCashStateList();
|
|
vec_state_slot& PositiveList = m_pLocalplayer->GetPositiveStateList();
|
|
vec_state_slot& NegativeList = m_pLocalplayer->GetNegativeStateList();
|
|
|
|
int nIndex (1);
|
|
int nRealIndex(-1);
|
|
SStateSlot* pInfo(NULL);
|
|
KUIControlIconStatic* pIcon(NULL);
|
|
KUIControlClockBox* pClock(NULL);
|
|
KUIControlStatic* ctrlReiteration;
|
|
|
|
if( CashList.size() > 0 )
|
|
{
|
|
int nCashIndex(0);
|
|
iterator_state_slot it = CashList.begin();
|
|
while( it != CashList.end() )
|
|
{
|
|
pInfo = (*it);
|
|
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat("state_effect_syc_icon%02d", nCashIndex).c_str() ));
|
|
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat("state_effect_syc_icon%02d", nCashIndex).c_str() ));
|
|
|
|
CheckState(pInfo, pIcon, pClock);
|
|
|
|
nCashIndex++;
|
|
it++;
|
|
}
|
|
}
|
|
|
|
if( PositiveList.size() > 0 )
|
|
{
|
|
iterator_state_slot it = PositiveList.begin();
|
|
while( it != PositiveList.end() )
|
|
{
|
|
pInfo = (*it);
|
|
|
|
nRealIndex = GetUpdateStateIndex(nIndex, pInfo->IsHarmful());
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat("state_effect_h_icon%02d", nRealIndex).c_str() ));
|
|
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat("state_effect_h_clock%02d", nRealIndex).c_str() ));
|
|
/// 2011.03.30 - prodongi
|
|
ctrlReiteration = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat("state_effect_h_reiteration%02d", nRealIndex).c_str() ));
|
|
CheckState(pInfo, pIcon, pClock, ctrlReiteration);
|
|
nIndex++;
|
|
it++;
|
|
}
|
|
}
|
|
|
|
if( NegativeList.size() > 0 )
|
|
{
|
|
nIndex = 1;
|
|
|
|
iterator_state_slot it = NegativeList.begin();
|
|
while( it != NegativeList.end() )
|
|
{
|
|
pInfo = (*it);
|
|
|
|
// 툴팁 갱신
|
|
nRealIndex = GetUpdateStateIndex(nIndex, pInfo->IsHarmful());
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat("state_effect_h_icon%02d", nRealIndex).c_str() ));
|
|
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat("state_effect_h_clock%02d", nRealIndex).c_str() ));
|
|
/// 2011.03.30 - prodongi
|
|
ctrlReiteration = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat("state_effect_h_reiteration%02d", nRealIndex).c_str() ));
|
|
CheckState(pInfo, pIcon, pClock, ctrlReiteration);
|
|
nIndex++;
|
|
it++;
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIStateHEffectWnd::AddState( SIMSG_UI_STATE_LIST_UPDATE* pStateMsg )
|
|
{
|
|
if( !pStateMsg ) return;
|
|
|
|
if( !pStateMsg->bharmful )
|
|
{
|
|
vec_state_slot& vNegativeStateList = m_pLocalplayer->GetNegativeStateList();
|
|
int nNegativeSize( vNegativeStateList.size() );
|
|
if( nNegativeSize )
|
|
{
|
|
vec_state_slot& vPositiveStateList = m_pLocalplayer->GetPositiveStateList();
|
|
int nPositiveSize( vPositiveStateList.size() );
|
|
|
|
int nLine = nPositiveSize / 12 + 1;
|
|
int nNegativeIndex( nLine*12 );
|
|
|
|
int nStateIndex(0);
|
|
if( 0<=nNegativeIndex && nNegativeIndex<c_nMaxStateIcon )
|
|
{
|
|
if( vNegativeStateList[0] && m_StateIdSet[nNegativeIndex] != vNegativeStateList[0]->GetStateCode() )
|
|
{
|
|
for( int i(0); i<nNegativeSize; ++i )
|
|
{
|
|
nStateIndex = GetUpdateStateIndex(i, true);
|
|
if( nStateIndex != -1 )
|
|
SetStateData(nStateIndex, vNegativeStateList[i], false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
int Index = GetUpdateStateIndex(pStateMsg->nIndex, pStateMsg->bharmful);
|
|
if( Index != -1 )
|
|
SetStateData(Index, pStateMsg->pState, false);
|
|
}
|
|
|
|
void SUIStateHEffectWnd::UpdateStateData( SGameMessage* pMsg )
|
|
{
|
|
SIMSG_UI_STATE_LIST_UPDATE* pStateMsg = (SIMSG_UI_STATE_LIST_UPDATE*)pMsg;
|
|
|
|
int Index(-1);
|
|
switch( pStateMsg->nUpdateType )
|
|
{
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_REFRESH:
|
|
CashStateMoveEffectWnd();
|
|
RefreshAllStateSlot();
|
|
break;
|
|
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_ADD:
|
|
{
|
|
// AddState( pStateMsg );
|
|
CashStateMoveEffectWnd();
|
|
RefreshAllStateSlot();
|
|
}
|
|
break;
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_CHANGE:
|
|
{
|
|
Index = GetUpdateStateIndex(pStateMsg->nIndex, pStateMsg->bharmful);
|
|
if( Index != -1 )
|
|
SetStateData(Index, pStateMsg->pState, false);
|
|
}
|
|
break;
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_ADD_CASH:
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_CHANGE_CASH:
|
|
{
|
|
if( pStateMsg->nIndex != -1 )
|
|
{
|
|
CashStateMoveEffectWnd();
|
|
SetStateData(pStateMsg->nIndex, pStateMsg->pState, true);
|
|
}
|
|
}
|
|
break;
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_DELETE:
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_DELETE_CASH:
|
|
{
|
|
CashStateMoveEffectWnd();
|
|
RefreshAllStateSlot();
|
|
}
|
|
break;
|
|
}
|
|
#ifdef _KUI_INVALIDATION
|
|
// { [sonador]
|
|
InvalidateWnd();
|
|
// }
|
|
#endif
|
|
}
|
|
|
|
int SUIStateHEffectWnd::GetUpdateStateIndex( int Index, bool bHarmhul )
|
|
{
|
|
if( !IsSetPlayer() ) return -1;
|
|
|
|
int nCrrIndex(0);
|
|
if(bHarmhul)
|
|
{
|
|
int nSize( m_pLocalplayer->GetPositiveStateList().size() );
|
|
if( nSize>0 )
|
|
{
|
|
if( nSize<=12 ) nCrrIndex = 12;
|
|
else nCrrIndex = 36;
|
|
|
|
nCrrIndex += Index;
|
|
if( nCrrIndex<48 )
|
|
return nCrrIndex;
|
|
}
|
|
else if( Index <= 36 )
|
|
{
|
|
return Index;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if( Index <= 36 )
|
|
return Index;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
void SUIStateHEffectWnd::SetStateData( int Index, SStateSlot* pInfo, bool bCash, bool bOnlyTime/*=false*/ )
|
|
{
|
|
if( Index < 0 || Index >= c_nMaxStateIcon ) return;
|
|
|
|
KUIControlIconStatic* pIcon(NULL);
|
|
KUIControlClockBox* pClock(NULL);
|
|
KUIControlStatic* ctrlReiteration = NULL; /// 2011.03.30 - prodongi
|
|
|
|
if( !bCash )
|
|
{
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat("state_effect_h_icon%02d", Index+1).c_str() ));
|
|
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat("state_effect_h_clock%02d", Index+1).c_str() ));
|
|
/// 2011.03.30 - prodongi
|
|
ctrlReiteration = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat("state_effect_h_reiteration%02d", Index+1).c_str() ));
|
|
if( pInfo ) m_StateIdSet[Index] = pInfo->GetStateCode();
|
|
}
|
|
else pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat("state_effect_syc_icon%02d", Index).c_str() ));
|
|
|
|
if( pIcon )
|
|
{
|
|
if( pInfo )
|
|
{
|
|
pIcon->SetShow(true);
|
|
if(!bOnlyTime) pIcon->SetIcon( c_szDEF_SPR_NAME, GetTenacityDB().GetIconName(pInfo->GetStateCode()) );
|
|
pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel(), pInfo->GetStateValue(), pInfo->IsToggleSkill()).c_str() );
|
|
}
|
|
else pIcon->SetShow(false);
|
|
}
|
|
|
|
if( pClock ) //토글형 스킬은 쿨타임 생략
|
|
{
|
|
if( pInfo && !pInfo->IsToggleSkill() )
|
|
{
|
|
pClock->SetShow(true);
|
|
pClock->SetMaxTime( pInfo->GetMaxTime() );
|
|
|
|
if( !pInfo->IsValidProcTime() )
|
|
m_vUpdateTimeSlot.push_back(sUpdateTimeSlotInfo(pInfo));
|
|
|
|
pClock->SetCurTime( pInfo->GetRemainTime() );
|
|
pClock->Begin( true );
|
|
}
|
|
else pClock->SetShow(false);
|
|
}
|
|
/// 2011.03.30 - prodongi
|
|
if (ctrlReiteration)
|
|
{
|
|
setReiterationCount(pInfo, ctrlReiteration);
|
|
}
|
|
}
|
|
|
|
void SUIStateHEffectWnd::RefreshStateSlot( SStateSlot* pInfo, KUIControlIconStatic* pIcon, KUIControlClockBox* pClock )
|
|
{
|
|
if( !pInfo )
|
|
return;
|
|
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetShow(true);
|
|
pIcon->SetIcon( c_szDEF_SPR_NAME, GetTenacityDB().GetIconName(pInfo->GetStateCode()) );
|
|
pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel(), pInfo->GetStateValue(), pInfo->IsToggleSkill()).c_str() );
|
|
}
|
|
|
|
if( pClock && !pInfo->IsToggleSkill() ) //토글형 스킬은 쿨타임 생략
|
|
{
|
|
pClock->SetShow(true);
|
|
pClock->SetMaxTime( pInfo->GetMaxTime() );
|
|
pClock->SetCurTime( pInfo->GetRemainTime() );
|
|
pClock->Begin( true );
|
|
}
|
|
}
|
|
|
|
bool SUIStateHEffectWnd::IsState()
|
|
{
|
|
vec_state_slot& PositiveList = m_pLocalplayer->GetPositiveStateList();
|
|
vec_state_slot& NegativeList = m_pLocalplayer->GetNegativeStateList();
|
|
|
|
return !PositiveList.empty() || !NegativeList.empty();
|
|
}
|
|
|
|
bool SUIStateHEffectWnd::IsAbleRemove( int nID )
|
|
{
|
|
if( nID )
|
|
{
|
|
StateInfoEx* s_data = GetTenacityDB().GetTenacityData(nID);
|
|
if( s_data && s_data->state_time_type & 1<<5 )
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
DWORD SUIStateHEffectWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
if( dwMessage == KLBUTTON_DBLCLK )
|
|
{
|
|
AR_HANDLE handle(NULL);
|
|
KUIWnd* pIcon(NULL);
|
|
for( int i(0); i<c_nMaxStateIcon; ++i )
|
|
{
|
|
pIcon = GetChild( CStringUtil::StringFormat("state_effect_h_icon%02d", i+1).c_str() );
|
|
if( pIcon->IsInRect(x, y) )
|
|
{
|
|
if( IsAbleRemove( m_StateIdSet[i]) )
|
|
{
|
|
handle = m_pLocalplayer->GetArID();
|
|
if( m_pLocalplayer && handle )
|
|
m_pGameManager->ProcMsgAtStatic( &SIMSG_REQUEST_REMOVE_STATE( handle, m_StateIdSet[i] ) );
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return SUIWnd::OnMouseMessage( dwMessage, x, y );
|
|
}
|
|
|
|
/// 2011.03.30 - prodongi
|
|
void SUIStateHEffectWnd::setReiterationCount(SStateSlot const* state, KUIControlStatic* control)
|
|
{
|
|
if (!state)
|
|
{
|
|
control->SetShow(false);
|
|
return ;
|
|
}
|
|
|
|
StateInfoEx const* info = GetTenacityDB().GetTenacityData(state->GetStateCode());
|
|
if (info && 0 < info->reiteration_count)
|
|
{
|
|
int level = min(state->GetStateLevel(), MAX_REITERATION_LEVEL);
|
|
control->SetShow(true);
|
|
control->SetCaption(CStringUtil::StringFormat("<font:font_01><out><#ffffff><size:8><vcenter><right>%d", level).c_str());
|
|
}
|
|
else
|
|
{
|
|
control->SetShow(false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|