#include "stdafx.h" #include "SUIProtectSolutionWnd.h" #include "SGameMessage.h" //#include "SGameMessageUI.h" //#include "KUIControl.h" #include "KUIControlStatic.h" SUIProtectSolutionWnd::SUIProtectSolutionWnd(SGameManager* pGameManager) : SUIWnd(pGameManager) , m_pWndBackground(NULL) { } SUIProtectSolutionWnd::~SUIProtectSolutionWnd() { } bool SUIProtectSolutionWnd::CreateControls( class KUIWndManager* pWndManager ) { int nWidth = KUIWndManager::GetResolution().cx; int nHeight = KUIWndManager::GetResolution().cy; KUIWND_CREATE_ARG arg; arg.lpszAniName = ""; arg.lpszClassName = "static"; arg.lpszID = "ProtectSolutionWnd_BG"; arg.pParent = this; arg.rcRect.left = 0; arg.rcRect.right = nWidth; arg.rcRect.top = 0; arg.rcRect.bottom = nHeight; m_pWndBackground = dynamicCast( m_pManager->CreateControl( arg ) ); m_pWndBackground->SetShow( true ); m_pWndBackground->SetActivate( true ); int adjustwidth = KUIWndManager::GetResolution().cy*4/3; if(adjustwidth > KUIWndManager::GetResolution().cx) adjustwidth = KUIWndManager::GetResolution().cx; m_pWndProtectMsg = new SUIWnd( m_pGameManager ); m_pWndProtectMsg->CreateWnd( "window_lobby_protect_solution.nui", pWndManager, KPoint(0, 0) ); m_pWndProtectMsg->SetParent(this); AddChild(m_pWndProtectMsg); m_pWndProtectMsg->MovePos( (adjustwidth/2) - (m_pWndProtectMsg->GetRect().GetWidth()/2) , (KUIWndManager::GetResolution().cy/2) - (m_pWndProtectMsg->GetRect().GetHeight()/2) ); m_pWndProtectMsg->SetShow(false); return true; } void SUIProtectSolutionWnd::MsgDelay(DWORD dwdelayTime) { m_pWndProtectMsg->SetShow(false); m_dwDelayTime = dwdelayTime; m_dwPrevTime = 0; } void SUIProtectSolutionWnd::Process(DWORD dwTime) { if(m_dwDelayTime > 0) { if(m_dwPrevTime == 0) { m_dwPrevTime = dwTime; } else { if( dwTime - m_dwPrevTime > m_dwDelayTime ) { m_pWndProtectMsg->SetShow(true); m_dwDelayTime = 0; } } } } void SUIProtectSolutionWnd::ProcMsgAtStatic( SGameMessage* pMsg ) {//화면 크기에 맞게 리사이즈 if( pMsg->nType == IMSG_UI_CHANGE_RESOLUTION ) { pMsg->bUse = true; SIMSG_UI_CHANGE_RESOLUTION* pChangeResolution = dynamicCast(pMsg); int nW = pChangeResolution->m_nWidth; int nH = pChangeResolution->m_nHeight; if(m_pWndBackground) { m_pWndBackground->Resize( KRect( 0,0, nW, nH ) ); m_pWndBackground->MovePos( 0, 0 ); } int adjustwidth = KUIWndManager::GetResolution().cy*4/3; if(adjustwidth > KUIWndManager::GetResolution().cx) adjustwidth = KUIWndManager::GetResolution().cx; if(m_pWndProtectMsg) m_pWndProtectMsg->MovePos( (adjustwidth/2) - (m_pWndProtectMsg->GetRect().GetWidth()/2) , (KUIWndManager::GetResolution().cy/2) - (m_pWndProtectMsg->GetRect().GetHeight()/2) ); } }