636 lines
17 KiB
C++
636 lines
17 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "SUIPartyStateSetWnd.h"
|
|
#include "KUIWndManager.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SGameManager.h"
|
|
//#include "Util.h"
|
|
|
|
#include "SPlayerInfoMgr.h"
|
|
#include "SGameAvatarEx.h"
|
|
#include "SUIDisplayInfo.h"
|
|
#include "SGame.h"
|
|
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlClockBox.h"
|
|
|
|
#include "STenacityDB.h"
|
|
|
|
namespace
|
|
{
|
|
const int c_nMaxHStateIcon = 12;
|
|
const int c_nMaxVStateIcon = 3;
|
|
const int c_nMaxStateIcon = c_nMaxHStateIcon*c_nMaxVStateIcon;
|
|
const int c_nStateIconSize = 10;
|
|
const int c_nStateIconSizeSmall = 7;
|
|
|
|
const char* c_lpStaticIconID = "state_icon%02d";
|
|
const char* c_lpStaticClock = "state_clock%02d";
|
|
bool g_bShowBig = true; // 2011.11.14 - servantes : 보여주기 플래그
|
|
};
|
|
|
|
SUIPartyStateSetWnd::sUpdateTimeSlotInfo::sUpdateTimeSlotInfo(SStateSlot* stateSlot)
|
|
{
|
|
m_code = stateSlot->GetStateCode();
|
|
m_handle = stateSlot->GetStateHandle();
|
|
m_level = stateSlot->GetStateLevel();
|
|
}
|
|
|
|
bool SUIPartyStateSetWnd::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;
|
|
}
|
|
|
|
// Tip Control Implement
|
|
SUIPartyStateSetWnd::SUIPartyStateSetWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo, KUIWnd* pParent, KUIWndManager* pManager, const char* lpID, KRect rt )
|
|
: SUIWnd( pGameManager ), m_pDisplayInfo( pDisplayInfo ), m_pPlayer(NULL), m_hPlayer( 0 ), m_bLeft(true), m_nNegativeStateCnt(24)
|
|
{
|
|
KUIWND_CREATE_ARG genArg;
|
|
genArg.lpszClassName = "genwnd";
|
|
genArg.lpszID = lpID;
|
|
genArg.lpszSprName = "UI_frame.spr";
|
|
genArg.rcRect = rt;
|
|
genArg.pParent = pParent;
|
|
genArg.pWndManager = pManager;
|
|
genArg.dwFlag = KFLAG_GET_PASS_MESSAGE; //2011.11.12 - servantes : 클릭되는것 방지 KMR_GET_PASS
|
|
|
|
Create(genArg);
|
|
InitControls( KPoint(rt.left, rt.top) );
|
|
}
|
|
|
|
SUIPartyStateSetWnd::~SUIPartyStateSetWnd()
|
|
{
|
|
m_vUpdateTimeSlot.clear();
|
|
}
|
|
|
|
bool SUIPartyStateSetWnd::InitControls( KPoint kPos )
|
|
{
|
|
KUIWND_CREATE_ARG arg;
|
|
arg.lpszSprName = m_sSprName.c_str();
|
|
arg.pWndManager = m_pManager;
|
|
arg.pParent = this;
|
|
arg.dwStyle = 0;
|
|
arg.dwFlag = KFLAG_GET_PASS_MESSAGE;
|
|
|
|
KUIControlIconStatic* pIcon(NULL);
|
|
KUIControlClockBox* pClock(NULL);
|
|
for( int i(0); i < c_nMaxStateIcon; i++ )
|
|
{
|
|
arg.rcRect.left = kPos.x + ( (i%12) * c_nStateIconSize );
|
|
arg.rcRect.top = kPos.y + ( (i/12) * c_nStateIconSize );
|
|
arg.rcRect.right = arg.rcRect.left + c_nStateIconSize;
|
|
arg.rcRect.bottom = arg.rcRect.top + c_nStateIconSize;
|
|
{
|
|
arg.lpszID = CStringUtil::StringFormat(c_lpStaticIconID, i).c_str();
|
|
arg.lpszClassName = "iconstatic";
|
|
pIcon = (KUIControlIconStatic*)(m_pManager->CreateControl( arg ));
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetShow(true);
|
|
pIcon->SetAbleReSizeRes(false);
|
|
}
|
|
}
|
|
{
|
|
arg.lpszID = CStringUtil::StringFormat(c_lpStaticClock, i).c_str();
|
|
arg.lpszClassName = "clockbox";
|
|
pClock = (KUIControlClockBox*)(m_pManager->CreateControl( arg ));
|
|
if( pClock )
|
|
{
|
|
pClock->SetShow(true);
|
|
pClock->SetColor( KColor( 32, 32, 32, 200 ) );
|
|
}
|
|
}
|
|
}
|
|
|
|
return SUIWnd::InitControls( kPos );
|
|
}
|
|
|
|
// 2011.11.10 - servantes : 리턴형 수정
|
|
bool SUIPartyStateSetWnd::StateUpdate( SGameMessage* pMsg )
|
|
{
|
|
if( pMsg->nType == IMSG_UI_STATE_UPDATE )
|
|
{
|
|
SIMSG_UI_STATE_UPDATE* pUpdateMsg = (SIMSG_UI_STATE_UPDATE*)pMsg;
|
|
|
|
if( IsEqualPlayer(pUpdateMsg->m_hPlayer) )
|
|
{
|
|
CheckState();
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool SUIPartyStateSetWnd::StateListUpdate( SGameMessage* pMsg )
|
|
{
|
|
if( pMsg->nType == IMSG_UI_STATE_LIST_UPDATE )
|
|
{
|
|
SIMSG_UI_STATE_LIST_UPDATE* pStatListMsg = (SIMSG_UI_STATE_LIST_UPDATE*)pMsg;
|
|
|
|
if( IsEqualPlayer(pStatListMsg->hPlayer) )
|
|
{
|
|
UpdateStateData( pMsg );
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void SUIPartyStateSetWnd::ChangeSizeStateWnd(bool bBig)
|
|
{
|
|
if( !IsSetPlayer() )
|
|
return;
|
|
|
|
g_bShowBig = bBig;
|
|
|
|
if(g_bShowBig)
|
|
{
|
|
KRect rt2;
|
|
KRect rt = GetRect();
|
|
|
|
KUIControlIconStatic* pIcon(NULL);
|
|
KUIControlClockBox* pClock(NULL);
|
|
for( int i(0); i < c_nMaxStateIcon; i++ )
|
|
{
|
|
rt2.left = rt.left + ( (i%12) * c_nStateIconSize );
|
|
rt2.top = rt.top + ( (i/12) * c_nStateIconSize );
|
|
rt2.right = rt2.left + c_nStateIconSize;
|
|
rt2.bottom = rt2.top + c_nStateIconSize;
|
|
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( c_lpStaticIconID, i ).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
pIcon->Resize(rt2);
|
|
pIcon->MovePos(rt2.left, rt2.top);
|
|
}
|
|
|
|
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat( c_lpStaticClock, i ).c_str() ));
|
|
if( pClock )
|
|
{
|
|
pClock->Resize(rt2);
|
|
pClock->MovePos(rt2.left, rt2.top);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
KRect rt2;
|
|
KRect rt = GetRect();
|
|
|
|
KUIControlIconStatic* pIcon(NULL);
|
|
KUIControlClockBox* pClock(NULL);
|
|
for( int i(0); i < c_nMaxStateIcon; i++ )
|
|
{
|
|
rt2.left = rt.left + ( (i%12) * c_nStateIconSizeSmall );
|
|
rt2.top = rt.top + ( (i/12) * c_nStateIconSizeSmall );
|
|
rt2.right = rt2.left + c_nStateIconSizeSmall;
|
|
rt2.bottom = rt2.top + c_nStateIconSizeSmall;
|
|
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat( c_lpStaticIconID, i ).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
pIcon->Resize(rt2);
|
|
pIcon->MovePos(rt2.left, rt2.top);
|
|
}
|
|
|
|
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat( c_lpStaticClock, i ).c_str() ));
|
|
if( pClock )
|
|
{
|
|
pClock->Resize(rt2);
|
|
pClock->MovePos(rt2.left, rt2.top);
|
|
}
|
|
}
|
|
}
|
|
/*
|
|
std::vector<SStateSlot*> PositiveList = m_pPlayer->GetPositiveStateList();
|
|
std::vector<SStateSlot*> NegativeList = m_pPlayer->GetNegativeStateList();
|
|
|
|
int nPositiveCount = static_cast<int>(PositiveList.size());
|
|
int nNegativeCount = static_cast<int>(NegativeList.size());
|
|
if( nPositiveCount>20 ) nPositiveCount = 20;
|
|
|
|
//이로운 지속효과를 세팅
|
|
int nIndex(0);
|
|
for( int i(0); i<nPositiveCount; i++ )
|
|
{
|
|
nIndex = i;
|
|
|
|
SStateSlot* pInfo = PositiveList[i];
|
|
|
|
int Index = ConvertIndexAligned( Index );
|
|
|
|
KUIControlIconStatic* pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat(c_lpStaticIconID, Index).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
if( pInfo )
|
|
{
|
|
pIcon->SetShow(true);
|
|
pIcon->SetAbleReSizeRes(true);
|
|
pIcon->SetBack(c_szDEF_SPR_NAME, GetTenacityDB().GetIconName(pInfo->GetStateCode()));
|
|
pIcon->InvalidateWnd();
|
|
pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel(), pInfo->IsToggleSkill(), false).c_str() );
|
|
pIcon->SetToolTipLeftRender(!IsAlignLeft());
|
|
}
|
|
else
|
|
{
|
|
pIcon->SetShow(false); // 2011.11.08 - servantes : test
|
|
}
|
|
}
|
|
}
|
|
|
|
//해로운 지속효과 쎄팅
|
|
int nPositiveEndIndex(0);
|
|
for( int i(nPositiveEndIndex), nNegative(0); i<c_nMaxStateIcon; i++, ++nNegative )
|
|
{
|
|
nIndex = i;
|
|
//if( !m_bLeft ) nIndex = c_nMaxHStateIcon - i -1;
|
|
|
|
if( nNegative<nNegativeCount )
|
|
{
|
|
SStateSlot* pInfo = NegativeList[nNegative];
|
|
|
|
int Index = ConvertIndexAligned( nIndex );
|
|
|
|
KUIControlIconStatic* pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat(c_lpStaticIconID, Index).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
if( pInfo )
|
|
{
|
|
pIcon->SetShow(true);
|
|
pIcon->SetAbleReSizeRes(true);
|
|
pIcon->SetBack(c_szDEF_SPR_NAME, GetTenacityDB().GetIconName(pInfo->GetStateCode()));
|
|
pIcon->InvalidateWnd();
|
|
pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel(), pInfo->IsToggleSkill(), false).c_str() );
|
|
pIcon->SetToolTipLeftRender(!IsAlignLeft());
|
|
}
|
|
else
|
|
{
|
|
pIcon->SetShow(false); // 2011.11.08 - servantes : test
|
|
}
|
|
}
|
|
}
|
|
}*/
|
|
}
|
|
|
|
void SUIPartyStateSetWnd::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:
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_ADD:
|
|
{
|
|
RefreshAllStateSlot();
|
|
}
|
|
break;
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_CHANGE:
|
|
{
|
|
Index = GetUpdateStateIndex(pStateMsg->nIndex, pStateMsg->bharmful);
|
|
if( Index != -1 )
|
|
SetStateData(Index, pStateMsg->pState);
|
|
}
|
|
break;
|
|
case SIMSG_UI_STATE_LIST_UPDATE::STATE_DELETE:
|
|
{
|
|
RefreshAllStateSlot();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
int SUIPartyStateSetWnd::GetUpdateStateIndex( int Index, bool bHarmhul )
|
|
{
|
|
if( !IsSetPlayer() ) return -1;
|
|
|
|
int nCrrIndex(0);
|
|
if(bHarmhul)
|
|
{
|
|
int nSize( m_pPlayer->GetPositiveStateList().size() );
|
|
if( nSize>0 )
|
|
{
|
|
if( nSize<=12 ) nCrrIndex = 12;
|
|
else nCrrIndex = 24;
|
|
|
|
nCrrIndex += Index;
|
|
if( nCrrIndex<36 )
|
|
return nCrrIndex;
|
|
}
|
|
else if( Index<m_nNegativeStateCnt )
|
|
{
|
|
return Index;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if( Index<m_nNegativeStateCnt )
|
|
return Index;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
int SUIPartyStateSetWnd::ConvertIndexAligned( int index ) const
|
|
{
|
|
if( IsAlignLeft() ) return index;
|
|
|
|
return ( index - index % c_nMaxHStateIcon )
|
|
+ ( ( c_nMaxHStateIcon - 1 ) - index % c_nMaxHStateIcon );
|
|
}
|
|
|
|
void SUIPartyStateSetWnd::SetStateData( int Index, SStateSlot* pInfo )
|
|
{
|
|
if( Index < 0 ) return;
|
|
|
|
Index = ConvertIndexAligned( Index );
|
|
|
|
KUIControlIconStatic* pIcon(NULL);
|
|
KUIControlClockBox* pClock(NULL);
|
|
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat(c_lpStaticIconID, Index).c_str() ));
|
|
pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat(c_lpStaticClock, Index).c_str() ));
|
|
|
|
if( pIcon )
|
|
{
|
|
if( pInfo )
|
|
{
|
|
pIcon->SetShow(true);
|
|
// pIcon->SetIcon( c_szDEF_SPR_NAME, GetTenacityDB().GetIconName(pInfo->GetStateCode()) );
|
|
pIcon->SetBack(c_szDEF_SPR_NAME, GetTenacityDB().GetIconName(pInfo->GetStateCode()));
|
|
pIcon->InvalidateWnd();
|
|
pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel(), pInfo->IsToggleSkill(), false).c_str() );
|
|
pIcon->SetToolTipLeftRender(!IsAlignLeft());
|
|
}
|
|
else
|
|
{
|
|
pIcon->SetShow(false); // 2011.11.08 - servantes : test
|
|
}
|
|
}
|
|
|
|
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.11.08 - servantes : test
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIPartyStateSetWnd::CheckState( SStateSlot* pInfo, KUIControlIconStatic* pIcon, KUIControlClockBox* pClock )
|
|
{
|
|
if (!pInfo)
|
|
return ;
|
|
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel(), pInfo->GetStateValue(), pInfo->IsToggleSkill()).c_str() );
|
|
}
|
|
|
|
//여기서 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() );
|
|
m_vUpdateTimeSlot.erase(it);
|
|
break;
|
|
}
|
|
++it;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIPartyStateSetWnd::CheckState()
|
|
{
|
|
if( !IsSetPlayer() )return;
|
|
|
|
std::vector<SStateSlot*> PositiveList = m_pPlayer->GetPositiveStateList();
|
|
std::vector<SStateSlot*> NegativeList = m_pPlayer->GetNegativeStateList();
|
|
|
|
int nIndex(0);
|
|
int nRealIndex(-1);
|
|
SStateSlot* pInfo(NULL);
|
|
KUIControlIconStatic* pIcon(NULL);
|
|
KUIControlClockBox* pClock(NULL);
|
|
|
|
if( PositiveList.size() > 0 )
|
|
{
|
|
std::vector<SStateSlot*>::iterator it = PositiveList.begin();
|
|
while( it != PositiveList.end() )
|
|
{
|
|
pInfo = (*it);
|
|
|
|
// 2011.11.30 - servantes : 컨트롤 이름 달랐던것 바르게 수정
|
|
nRealIndex = GetUpdateStateIndex(nIndex, pInfo->IsHarmful());
|
|
KUIWnd* pW = GetChild( CStringUtil::StringFormat(c_lpStaticIconID, nRealIndex).c_str() );
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(pW);
|
|
|
|
KUIWnd* pW2 = GetChild( CStringUtil::StringFormat(c_lpStaticClock, nRealIndex).c_str() );
|
|
pClock = dynamicCast<KUIControlClockBox*>(pW2);
|
|
// 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() ));
|
|
|
|
CheckState(pInfo, pIcon, pClock);
|
|
|
|
nIndex++;
|
|
it++;
|
|
}
|
|
}
|
|
|
|
if( NegativeList.size() > 0 )
|
|
{
|
|
std::vector<SStateSlot*>::iterator it = NegativeList.begin();
|
|
while( it != NegativeList.end() )
|
|
{
|
|
pInfo = (*it);
|
|
|
|
nRealIndex = GetUpdateStateIndex(nIndex, pInfo->IsHarmful());
|
|
|
|
// 2011.11.30 - servantes : 컨트롤 이름 달랐던것 바르게 수정
|
|
nRealIndex = GetUpdateStateIndex(nIndex, pInfo->IsHarmful());
|
|
KUIWnd* pW = GetChild( CStringUtil::StringFormat(c_lpStaticIconID, nRealIndex).c_str() );
|
|
pIcon = dynamicCast<KUIControlIconStatic*>(pW);
|
|
|
|
KUIWnd* pW2 = GetChild( CStringUtil::StringFormat(c_lpStaticClock, nRealIndex).c_str() );
|
|
pClock = dynamicCast<KUIControlClockBox*>(pW2);
|
|
// 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() ));
|
|
|
|
CheckState(pInfo, pIcon, pClock);
|
|
|
|
nIndex++;
|
|
it++;
|
|
}
|
|
}
|
|
}
|
|
|
|
bool SUIPartyStateSetWnd::IsEqualPlayer( AR_HANDLE handle )
|
|
{
|
|
if( IsSetPlayer() == false ) return false;
|
|
|
|
if( m_pPlayer && m_pPlayer->GetArID() == handle )
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
void SUIPartyStateSetWnd::SetPlayer( AR_HANDLE handle )
|
|
{
|
|
m_pPlayer = NULL;
|
|
m_hPlayer = 0;
|
|
|
|
if( !handle ) return;
|
|
|
|
SGame* pGame = m_pGameManager->GetActiveGame();
|
|
if( !pGame || pGame->GetGameType() != GAME_TYPE_WORLD )
|
|
return;
|
|
|
|
m_pPlayer = (SGameAvatarEx*)(pGame->GetGameObject(handle));
|
|
m_hPlayer = handle;
|
|
}
|
|
|
|
bool SUIPartyStateSetWnd::IsSetPlayer( AR_HANDLE handle/*=0*/ )
|
|
{
|
|
if( m_pPlayer == NULL )
|
|
{
|
|
m_hPlayer = handle;
|
|
}
|
|
|
|
SGame* pGame = m_pGameManager->GetActiveGame();
|
|
if( !pGame || pGame->GetGameType() != GAME_TYPE_WORLD )
|
|
{
|
|
m_pPlayer = NULL;
|
|
m_hPlayer = 0;
|
|
}
|
|
else
|
|
{
|
|
m_pPlayer = (SGameAvatarEx*)(pGame->GetGameObject( m_hPlayer ));
|
|
}
|
|
|
|
if( m_pPlayer == NULL )
|
|
{
|
|
m_hPlayer = 0;
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
void SUIPartyStateSetWnd::RefreshAllStateSlot()
|
|
{
|
|
if( !IsSetPlayer() )
|
|
return;
|
|
|
|
std::vector<SStateSlot*> PositiveList = m_pPlayer->GetPositiveStateList();
|
|
std::vector<SStateSlot*> NegativeList = m_pPlayer->GetNegativeStateList();
|
|
|
|
int nPositiveCount = static_cast<int>(PositiveList.size());
|
|
int nNegativeCount = static_cast<int>(NegativeList.size());
|
|
if( nPositiveCount>24 ) nPositiveCount = 24;
|
|
|
|
|
|
//이로운 지속효과를 세팅
|
|
int nIndex(0);
|
|
for( int i(0); i<nPositiveCount; i++ )
|
|
{
|
|
nIndex = i;
|
|
//if( !m_bLeft ) nIndex = c_nMaxHStateIcon - i -1;
|
|
SetStateData( nIndex, PositiveList[i] );
|
|
}
|
|
//이로운 지속효과 라인에서 나머지 부분을 NULL로 쎄팅
|
|
int nPositiveEndIndex(0);
|
|
if( nPositiveCount )
|
|
{
|
|
//((nPositiveCount-1)/c_nMaxHStateIcon+1) * c_nMaxHStateIcon
|
|
//-> 1~10 = 10 / 11~20 = 20 으로 NULL로 쎄팅해야할 마지막 부분을 구하는 식
|
|
nPositiveEndIndex = ((nPositiveCount-1)/c_nMaxHStateIcon+1) * c_nMaxHStateIcon;
|
|
for( int i(nPositiveCount); i<nPositiveEndIndex; i++ )
|
|
{
|
|
nIndex = i;
|
|
//if( !m_bLeft ) nIndex = c_nMaxHStateIcon - i -1;
|
|
SetStateData( nIndex, NULL );
|
|
}
|
|
}
|
|
//해로운 지속효과 쎄팅
|
|
for( int i(nPositiveEndIndex), nNegative(0); i<c_nMaxStateIcon; i++, ++nNegative )
|
|
{
|
|
nIndex = i;
|
|
//if( !m_bLeft ) nIndex = c_nMaxHStateIcon - i -1;
|
|
|
|
if( nNegative<nNegativeCount )
|
|
SetStateData( nIndex, NegativeList[nNegative] );
|
|
else SetStateData( nIndex, NULL );
|
|
}
|
|
}
|
|
|
|
void SUIPartyStateSetWnd::SwapPos( bool bLeft )
|
|
{
|
|
if( m_bLeft == bLeft ) return;
|
|
m_bLeft = bLeft;
|
|
RefreshAllStateSlot();
|
|
}
|
|
|
|
void SUIPartyStateSetWnd::DisAbleAllSlot()
|
|
{
|
|
for( int i(0); i<c_nMaxStateIcon; ++i )
|
|
{
|
|
KUIControlIconStatic* pIcon = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat(c_lpStaticIconID, i).c_str() ));
|
|
if( pIcon )
|
|
{
|
|
pIcon->SetTooltip("");
|
|
pIcon->SetShow(false); // 2011.11.08 - servantes : test
|
|
}
|
|
|
|
KUIControlClockBox* pClock = dynamicCast<KUIControlClockBox*>(GetChild( CStringUtil::StringFormat(c_lpStaticClock, i).c_str() ));
|
|
if( pClock )
|
|
{
|
|
pClock->SetShow(false); // 2011.11.08 - servantes : test
|
|
}
|
|
}
|
|
}
|
|
|
|
DWORD SUIPartyStateSetWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
if( dwMessage == KLBUTTON_DOWN )
|
|
return 0;
|
|
|
|
return SUIWnd::OnMouseMessage( dwMessage, x, y );
|
|
}
|
|
|
|
//
|
|
//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);
|
|
//}
|
|
//
|