218 lines
4.8 KiB
C++
218 lines
4.8 KiB
C++
|
|
#include "stdafx.h"
|
|
#include "SStringDB.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include "SGameManager.h"
|
|
#include "SGameMessage.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SMessengerMgr.h"
|
|
#include "SChatType.h"
|
|
//#include "KUIControl.h"
|
|
#include "KUIControlEdit.h"
|
|
#include "SUIProgressWnd.h"
|
|
|
|
const int c_nLightPosX[2] = { 259, 653 }; // start, end
|
|
const int c_nLightPosY = 90;
|
|
|
|
namespace
|
|
{
|
|
const DWORD g_ProgressTime = 250; // 아이템합성 진행시간.
|
|
}
|
|
|
|
|
|
SUIProgressWnd::SUIProgressWnd( SGameManager * pGameManager ) :
|
|
SUIWnd( pGameManager )
|
|
{
|
|
}
|
|
|
|
|
|
SUIProgressWnd::~SUIProgressWnd()
|
|
{
|
|
Release();
|
|
}
|
|
|
|
void SUIProgressWnd::Release()
|
|
{
|
|
|
|
}
|
|
|
|
SUIWnd* SUIProgressWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
|
|
{
|
|
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
|
|
|
|
m_returnWnd = SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_NONE;
|
|
m_bStart = false;
|
|
m_oldTime = 0; // 이전시간.
|
|
m_dTime = 0; // 누적시간.
|
|
m_fProgressPercent = 0.0f; // 진행도 백분률.
|
|
|
|
m_pProgressBar = GetChild( "gauge_progress" );
|
|
m_fMaxWidth = (float)m_pProgressBar->GetRect().GetWidth(); // Progress 최대너비.
|
|
KRect rt = m_pProgressBar->GetRect();
|
|
rt.right = rt.left;
|
|
m_pProgressBar->ClipRect( rt );
|
|
|
|
m_pLightWnd = GetChild("ani_progress_light_01");
|
|
m_pLightWnd->MovePos(GetRect().left+c_nLightPosX[0], GetRect().top+c_nLightPosY);
|
|
|
|
m_pEndEffectWnd = GetChild("end_ani_01");
|
|
m_pEndEffectWnd->SetShow(false);
|
|
|
|
nEffectSpeed = 14;
|
|
|
|
return this;
|
|
}
|
|
|
|
|
|
void SUIProgressWnd::Render( KViewportObject *viewport,bool isFront )
|
|
{
|
|
KUIWnd::Render(viewport, isFront);
|
|
}
|
|
|
|
|
|
bool SUIProgressWnd::InitControls( KPoint kPos )
|
|
{
|
|
m_WndPos.x = ( m_pGameManager->GetScreenWidth() / 2 ) - ( this->GetRect().GetWidth() / 2 );
|
|
m_WndPos.y = ( m_pGameManager->GetScreenHeight() / 2 ) - ( this->GetRect().GetHeight() / 2 );
|
|
|
|
return SUIWnd::InitControls( m_WndPos );
|
|
}
|
|
|
|
void SUIProgressWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd)
|
|
{
|
|
if( bOpen )
|
|
{
|
|
/*KRect rt = this->GetRect();
|
|
|
|
if( rt.left != m_left && rt.top != m_top )
|
|
{
|
|
MovePos( m_left, m_top );
|
|
m_Rect = m_pProgressBar->GetRect();
|
|
m_Rect.right = m_Rect.left;
|
|
}*/
|
|
|
|
|
|
|
|
//this->SetShow( true );
|
|
//
|
|
//// 기존 포커스 제거.
|
|
//this->m_pManager->RemoveWnd( this );
|
|
|
|
//// wnd 출력 리스트의 최하단에 추가. ( wnd 들중 가장 상위에 뜨게 된다. )
|
|
//this->m_pManager->AddWnd( this );
|
|
|
|
//// 가장위에 뜨도록 한다.
|
|
//this->m_pManager->SetFocus( this );
|
|
}
|
|
}
|
|
|
|
|
|
void SUIProgressWnd::ProcMsgAtStatic( SGameMessage* pMsg )
|
|
{
|
|
switch( pMsg->nType )
|
|
{
|
|
case IMSG_UI_MOVE:
|
|
{
|
|
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
|
|
|
|
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
|
|
case IMSG_SYNTHETIC_ITEM:
|
|
{
|
|
pMsg->bUse = true;
|
|
m_bStart = true;
|
|
|
|
SIMSG_SYNTHETIC_ITEM * pData = dynamicCast< SIMSG_SYNTHETIC_ITEM * >( pMsg );
|
|
m_returnWnd = pData->returnWndType;
|
|
|
|
m_pLightWnd->SetShow(true);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
void SUIProgressWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
|
|
{
|
|
//switch( nMessage )
|
|
//{
|
|
//
|
|
//// 윈도우 이동
|
|
//case KUI_MESSAGE::KGENWND_MOVE:
|
|
//
|
|
// LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
|
|
//
|
|
// break;
|
|
|
|
//}
|
|
|
|
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
|
|
}
|
|
|
|
|
|
void SUIProgressWnd::Process(DWORD dwTime)
|
|
{
|
|
if( m_bStart && IsShow() )
|
|
{
|
|
//static DWORD oldTime = dwTime;
|
|
|
|
if( m_oldTime > 0 )
|
|
{
|
|
KRect rt = m_pProgressBar->GetRect();
|
|
|
|
m_dTime += dwTime - m_oldTime;
|
|
m_fProgressPercent = (float)m_dTime / (float)g_ProgressTime;
|
|
rt.right = rt.left + m_fMaxWidth * m_fProgressPercent;
|
|
|
|
m_pProgressBar->ClipRect( rt );
|
|
|
|
int nPosX = GetRect().left + c_nLightPosX[0] + ((c_nLightPosX[1]-c_nLightPosX[0])*m_fProgressPercent);
|
|
m_pLightWnd->MovePos(nPosX, GetRect().top + c_nLightPosY);
|
|
|
|
if( m_dTime >= g_ProgressTime )
|
|
{
|
|
m_pLightWnd->SetShow(false);
|
|
|
|
m_pEndEffectWnd->SetShow(true);
|
|
m_pEndEffectWnd->SetFrameTextureAnim(m_dTime-g_ProgressTime, 6, nEffectSpeed); // MaxFrame 알고 싶다.ㅠㅠ
|
|
|
|
if ( m_dTime >= g_ProgressTime + 250 )
|
|
{
|
|
m_pEndEffectWnd->SetShow(false);
|
|
clear();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
m_oldTime = dwTime;
|
|
}
|
|
}
|
|
|
|
|
|
// Progress 관련 변수 초기화.
|
|
void SUIProgressWnd::clear()
|
|
{
|
|
m_bStart = false;
|
|
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MIX_PROGRESS, false, true ) ); // 창닫기.
|
|
|
|
// 진행종료 전달.
|
|
if( m_returnWnd != SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_NONE )
|
|
{
|
|
m_pGameManager->PostMsgAtDynamic( new SIMSG_SYNTHETIC_ITEM( m_returnWnd ) );
|
|
m_returnWnd = SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_NONE;
|
|
}
|
|
|
|
m_oldTime = m_dTime = 0;
|
|
m_fProgressPercent = 0.0f;
|
|
|
|
KRect rt = m_pProgressBar->GetRect();
|
|
rt.right = rt.left;
|
|
m_pProgressBar->ClipRect( rt );
|
|
}
|