396 lines
10 KiB
C++
396 lines
10 KiB
C++
//////////////////////////////////////////////////////////////////////////
|
|
// Name : SUIAwakeningWnd.cpp
|
|
// Desc :
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "SUIAwakeningWnd.h"
|
|
#include "SGameMessage.h"
|
|
#include "SGameManager.h"
|
|
//#include "SGameMessageUI.h"
|
|
//#include "KUIControl.h"
|
|
#include "SAutoToolTip.h"
|
|
|
|
#include <toolkit/XStringUtil.h>
|
|
|
|
class rp::CAutoToolTip;
|
|
|
|
SUIAwakeningWnd::SUIAwakeningWnd( SGameManager * pGameManager, SUIDisplayInfo* pDisplayInfo ) :
|
|
SUIWnd( pGameManager ), m_dwPastTime(0), m_dwStartTime(0), m_pDisplayInfo(pDisplayInfo), bAwaken(TRUE)
|
|
{
|
|
memset( &m_stOption, 0, sizeof(m_stOption));
|
|
|
|
nSlotSpeed = 300;
|
|
|
|
dwDownTime = 300;
|
|
dwUpTime = 600;
|
|
}
|
|
|
|
|
|
SUIAwakeningWnd::~SUIAwakeningWnd()
|
|
{
|
|
}
|
|
|
|
|
|
SUIWnd* SUIAwakeningWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
|
|
{
|
|
|
|
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
|
|
|
|
InitShowOptionWnd();
|
|
|
|
for ( int i = 0; i < 3; i++ )
|
|
{
|
|
KUIWnd* pSlotWnd = GetChild(arOptionNameWnd[0][i]);
|
|
if ( pSlotWnd )
|
|
m_nOriginPosition[i] = pSlotWnd->GetRect().top;
|
|
}
|
|
|
|
|
|
return this;
|
|
}
|
|
|
|
void SUIAwakeningWnd::Render( KViewportObject *viewport,bool isFront )
|
|
{
|
|
KUIWnd::Render(viewport, isFront);
|
|
}
|
|
|
|
|
|
|
|
bool SUIAwakeningWnd::InitControls( KPoint kPos )
|
|
{
|
|
InitShowOptionWnd();
|
|
|
|
KPoint point;
|
|
point.x = (m_pGameManager->GetScreenWidth() - this->GetRect().GetWidth()) / 2;
|
|
point.y = (m_pGameManager->GetScreenHeight() - this->GetRect().GetHeight()) / 2;
|
|
|
|
return SUIWnd::InitControls( point );
|
|
}
|
|
|
|
|
|
bool SUIAwakeningWnd::InitData( bool bReload )
|
|
{
|
|
return SUIWnd::InitData(bReload);
|
|
}
|
|
|
|
|
|
void SUIAwakeningWnd::InitShowOptionWnd()
|
|
{
|
|
for ( int i = 0; i < COUNT_OPTION; i++ )
|
|
{
|
|
SetChildShow(arOptionNameWnd[i][0], false);
|
|
SetChildShow(arOptionNameWnd[i][1], false);
|
|
SetChildShow(arOptionNameWnd[i][2], false);
|
|
}
|
|
}
|
|
|
|
|
|
void SUIAwakeningWnd::InitSlotBounceStartPosition()
|
|
{
|
|
for ( int i = 0; i < COUNT_OPTION; i++ )
|
|
{
|
|
for ( int j = 0; j < 3; j++ )
|
|
{
|
|
KUIWnd* pWnd = GetChild(arOptionNameWnd[i][j]);
|
|
if ( pWnd )
|
|
{
|
|
if ( pWnd->GetRect().top != m_nOriginPosition[j] )
|
|
pWnd->MovePosOffset(0, m_nOriginPosition[j] - pWnd->GetRect().top);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void SUIAwakeningWnd::InitSlotOptionAndTime()
|
|
{
|
|
memset(&m_stOption, 0, sizeof(m_stOption));
|
|
}
|
|
|
|
|
|
void SUIAwakeningWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
|
|
{
|
|
SUIWnd::OnNotifyUIWindowOpen(bOpen);
|
|
}
|
|
|
|
|
|
// Message 처리
|
|
void SUIAwakeningWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch( pMsg->nType )
|
|
{
|
|
case MSG_MIX_RESULT:
|
|
{
|
|
SMSG_MIX_RESULT* pMixResultMsg = (SMSG_MIX_RESULT*)pMsg;
|
|
if ( pMixResultMsg->type != MIX_TYPE_AWAKEN )
|
|
break;
|
|
|
|
/* AziaMafia Off Awaken windows
|
|
for( int i = 0; i < pMixResultMsg->count; i++ )
|
|
{
|
|
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pMixResultMsg->pArHandle[i] );
|
|
if( pSlot )
|
|
{
|
|
if ( m_InventoryMgr.IsAwakeningItem(pSlot) )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_AWAKENING, true, true ) );
|
|
|
|
SetSlotOptionAndTime(pSlot, GetSafeTickCount()+TIME_BOUNCE_GAP); // TIME_BOUNCE_GAP
|
|
|
|
SetCaptionByResult();
|
|
|
|
SetSlotBounceStartPosition(-50);
|
|
|
|
SetBounce(GetSafeTickCount());
|
|
}
|
|
bAwaken = TRUE;
|
|
if ( pSlot->GetAwakening()->nValue[0] == StateInfo::INC_ALL_SKILL1 ||
|
|
pSlot->GetAwakening()->nValue[0] == StateInfo::INC_ALL_SKILL2 ||
|
|
pSlot->GetAwakening()->nValue[0] == StateInfo::INC_ALL_SKILL3 ||
|
|
pSlot->GetAwakening()->nValue[0] == StateInfo::INC_CASTING_SPEED ||
|
|
pSlot->GetAwakening()->nValue[0] == StateInfo::RESIST_NEGATIVE )
|
|
bAwaken = FALSE;
|
|
}
|
|
}
|
|
*/
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// Name :
|
|
// Desc :
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIAwakeningWnd::SetSlotOptionAndTime(SInventorySlot* pSlot, DWORD dwTime)
|
|
{
|
|
const DWORD* pType = pSlot->GetAwakeningType();
|
|
const int* pValue = pSlot->GetAwakeningValue();
|
|
for ( int i = 0; i < COUNT_OPTION; i++ )
|
|
{
|
|
m_stOption[i].dwOption = pType[i];
|
|
m_stOption[i].nValue = pValue[i];
|
|
m_stOption[i].dwTime = dwTime + i*TIME_INTERVAL_SLOT;
|
|
m_stOption[i].dwPreTime = dwTime;
|
|
m_stOption[i].nStatus = SLOT_STATUS_NORMAL;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// Name :
|
|
// Desc :
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIAwakeningWnd::SetSlotBounceStartPosition(int nOffSet)
|
|
{
|
|
for ( int i = 0; i < COUNT_OPTION; i++ )
|
|
{
|
|
for ( int j = 0; j < 3; j++ )
|
|
{
|
|
KUIWnd* pWnd = GetChild(arOptionNameWnd[i][j]);
|
|
if ( pWnd )
|
|
pWnd->MovePosOffset(0, nOffSet);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// Name :
|
|
// Desc :
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIAwakeningWnd::SetCaptionByResult()
|
|
{
|
|
for ( int i = 0; i < COUNT_OPTION; i++ )
|
|
{
|
|
//m_stOption[i];
|
|
SetCaptionOptionName(i, m_stOption[i].dwOption);
|
|
SetCaptionOptionValue(i, m_stOption[i].dwOption, m_stOption[i].nValue);
|
|
}
|
|
}
|
|
|
|
|
|
void SUIAwakeningWnd::SetCaptionOptionName(int nIndex, DWORD dwOption)
|
|
{
|
|
rp::CAutoToolTip* pAutoToolTip = m_pDisplayInfo->GetAutoToolTip();
|
|
if ( !pAutoToolTip )
|
|
return;
|
|
|
|
std::string strOption;
|
|
XStringUtil::Format(strOption, "<font:font_02><size:9><#59a7a6><hcenter><vcenter>%s", pAutoToolTip->GetItemAwakeningOptionString(dwOption).c_str());
|
|
KUIWnd* pWndCaption = GetChild(arOptionNameWnd[nIndex][1]);
|
|
if ( pWndCaption )
|
|
pWndCaption->SetCaption(strOption.c_str());
|
|
}
|
|
|
|
|
|
void SUIAwakeningWnd::SetCaptionOptionValue(int nIndex, DWORD dwOption, int nValue)
|
|
{
|
|
std::string strValue;
|
|
if ( nValue >= 0 )
|
|
XStringUtil::Format(strValue, "<font:font_02><size:13><#8dc63f><hcenter><vcenter>+%d", nValue);
|
|
else
|
|
XStringUtil::Format(strValue, "<font:font_02><size:13><#b92c36><hcenter><vcenter>%d", nValue);
|
|
if ( dwOption >= ITEM_EFFECT_PASSIVE::INC_COOLTIME_SPEED && dwOption <= ITEM_EFFECT_PASSIVE::INC_BELT_ENHANCE ||
|
|
dwOption >= ITEM_EFFECT_PASSIVE::INC_FIRE_DAMAGE && dwOption <= ITEM_EFFECT_PASSIVE::INC_DARK_DAMAGE
|
|
)
|
|
strValue += "%";
|
|
KUIWnd* pWndCaption = GetChild(arOptionNameWnd[nIndex][2]);
|
|
if ( pWndCaption )
|
|
pWndCaption->SetCaption(strValue.c_str());
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// Name :
|
|
// Desc :
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIAwakeningWnd::SetBounce(DWORD dwTime)
|
|
{
|
|
m_dwStartTime = dwTime;
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// Name :
|
|
// Desc :
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIAwakeningWnd::SetStatus(eAWAKENINGSTATUS Status)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
void SUIAwakeningWnd::SetShowSlot(int nSlot, bool bShow)
|
|
{
|
|
SetChildShow(arOptionNameWnd[nSlot][0], bShow);
|
|
SetChildShow(arOptionNameWnd[nSlot][1], bShow);
|
|
SetChildShow(arOptionNameWnd[nSlot][2], bShow);
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// Name :
|
|
// Desc :
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIAwakeningWnd::Process(DWORD dwTime)
|
|
{
|
|
ProcBounceEffectWnd( dwTime );
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// Name :
|
|
// Desc : 각성 결과 보여주는 각 Control을 꿀렁거리게 해달란다.
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIAwakeningWnd::ProcBounceEffectWnd(DWORD dwTime)
|
|
{
|
|
// m_dwStartTime가 0인데 여기 계속해서 들어온다는것은 창이 완전히 닫히지 않았다는 얘기
|
|
// 창을 닫아준다.
|
|
if( m_dwStartTime == 0 )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_AWAKENING, false, true ) );
|
|
return;
|
|
}
|
|
|
|
if ( m_dwStartTime > 0 )
|
|
{
|
|
m_dwPastTime = dwTime - m_dwStartTime;
|
|
|
|
// 효과
|
|
ProcSetBounceSlots(dwTime);
|
|
|
|
if ( m_dwPastTime > TIME_BOUNCE + TIME_WNDCLOSE )
|
|
{
|
|
SetBounce(0); // 초기화
|
|
|
|
InitSlotOptionAndTime();
|
|
|
|
InitShowOptionWnd();
|
|
|
|
InitSlotBounceStartPosition();
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_AWAKENING, false, true ) ); // 창닫기.
|
|
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void SUIAwakeningWnd::ProcSetBounceSlots(DWORD dwTime)
|
|
{
|
|
KUIWnd* pWndCaption = GetChild("text_progress");
|
|
|
|
if ( bAwaken )
|
|
{
|
|
if ( pWndCaption ) pWndCaption->SetCaption("<font:font_01><size:15><#6dcff6><b><hcenter><vcenter><$690000035:각성_결과>");
|
|
}
|
|
else if ( pWndCaption ) pWndCaption->SetCaption("<font:font_01><size:15><#6dcff6><b><hcenter><vcenter><$690000154:궁극_강화_옵션_결과>");
|
|
for ( int i = 0; i < COUNT_OPTION; i++ )
|
|
{
|
|
if ( !m_stOption[i].nStatus && m_stOption[i].dwTime < dwTime )
|
|
{
|
|
m_stOption[i].nStatus = SLOT_STATUS_START;
|
|
m_stOption[i].dwPreTime = m_stOption[i].dwTime;
|
|
}
|
|
|
|
if ( m_stOption[i].nStatus == SLOT_STATUS_START )
|
|
{
|
|
if ( m_stOption[i].dwOption )
|
|
SetShowSlot(i, true);
|
|
|
|
KUIWnd* pWndFrame = GetChild(arOptionNameWnd[i][0]);
|
|
KUIWnd* pWndText = GetChild(arOptionNameWnd[i][1]);
|
|
KUIWnd* pWndValue = GetChild(arOptionNameWnd[i][2]);
|
|
|
|
DWORD dwLiveTime = dwTime - m_stOption[i].dwTime;
|
|
DWORD dwElapsedTime = dwTime - m_stOption[i].dwPreTime;
|
|
|
|
if ( dwLiveTime < dwDownTime ) // 내려가기
|
|
{
|
|
int nPos = dwElapsedTime*nSlotSpeed/1000;
|
|
|
|
pWndFrame->MovePosOffset(0, nPos);
|
|
pWndText->MovePosOffset(0, nPos);
|
|
pWndValue->MovePosOffset(0, nPos);
|
|
}
|
|
else if ( dwLiveTime <= dwUpTime ) // 올라가기
|
|
{
|
|
int nPos = dwElapsedTime*nSlotSpeed/1000;
|
|
|
|
pWndFrame->MovePosOffset(0, -nPos);
|
|
pWndText->MovePosOffset(0, -nPos);
|
|
pWndValue->MovePosOffset(0, -nPos);
|
|
|
|
if ( pWndFrame->GetRect().top <= m_nOriginPosition[0] )
|
|
{
|
|
pWndFrame->MovePosOffset(0, m_nOriginPosition[0] - pWndFrame->GetRect().top);
|
|
pWndText->MovePosOffset(0, m_nOriginPosition[1] - pWndText->GetRect().top);
|
|
pWndValue->MovePosOffset(0, m_nOriginPosition[2] - pWndValue->GetRect().top);
|
|
|
|
m_stOption[i].nStatus = SLOT_STATUS_END;
|
|
}
|
|
}
|
|
else if ( dwLiveTime > dwUpTime ) // 혹시 모를 상황..
|
|
{
|
|
pWndFrame->MovePosOffset(0, m_nOriginPosition[0] - pWndFrame->GetRect().top);
|
|
pWndText->MovePosOffset(0, m_nOriginPosition[1] - pWndText->GetRect().top);
|
|
pWndValue->MovePosOffset(0, m_nOriginPosition[2] - pWndValue->GetRect().top);
|
|
|
|
m_stOption[i].nStatus = SLOT_STATUS_END;
|
|
}
|
|
|
|
m_stOption[i].dwPreTime = dwTime;
|
|
}
|
|
}
|
|
}
|