#include "stdafx.h" #include "SStringDB.h" #include #include "SGameManager.h" #include "SGameMessage.h" //#include "SGameMessageUI.h" #include "SMessengerMgr.h" #include "SChatType.h" //#include "KUIControl.h" #include "KUIControlScroll.h" #include "KTextRender.h" #include "SUIHelpWnd.h" SUIHelpWnd::SUIHelpWnd( SGameManager * pGameManager ) : SUIWnd( pGameManager ) { } SUIHelpWnd::~SUIHelpWnd() { Release(); } void SUIHelpWnd::Release() { } SUIWnd* SUIHelpWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID ) { SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID ); m_pCtrlText = dynamicCast< KUIControl * >( GetChild( "text" ) ); // 텍스트를 출력할 컨트롤. m_strFontName = "Default"; // 폰트명. m_strDeco = ""; m_pScrollBar = dynamicCast< KUIControlVScrollSmallEx * >( GetChild( "scrollbar_help" ) ); // 스크롤바. m_nScrollPos = 0; // 현재 스크롤 값. m_nLineSize = 0; // 도움말 텍스트 목록 개수. ( 폰트 사이즈에 따라 계산 ) return this; } bool SUIHelpWnd::InitControls( KPoint kPos ) { return SUIWnd::InitControls( kPos ); } void SUIHelpWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd) { //if( bOpen ) //{ // // 공식목록 출력. // //SetTextList( m_nLineSize, m_strContent, m_strDeco, const_cast< char * >( m_strFontName.c_str() ), m_pCtrlText, // // m_pScrollBar, m_nScrollPos, m_vLineList, true ); //} //else //{ // //} } void SUIHelpWnd::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 ); LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한 pMsg->bUse = true; } break; case IMSG_HELP_TEXT: { SIMSG_HELP_TEXT * pData = dynamicCast< SIMSG_HELP_TEXT * >( pMsg ); // 초기화. Clear(); if( m_strContent != pData->m_strHelp ) { m_vLineList.clear(); m_strContent = pData->m_strHelp; // 폰트명 과 텍스트 꾸미기 태그 얻기. if( m_strDeco == "" ) CStringUtil::GetTextDecoration( m_pCtrlText->GetCaption(), m_strDeco ); if( m_strFontName == "Default" ) CStringUtil::GetTextFontName( std::string( m_pCtrlText->GetCaption() ), m_strFontName ); // 도움말 텍스트 목록 개수. ( 폰트 사이즈에 따라 계산 ) m_nLineSize = m_pCtrlText->GetRect().GetHeight() / (KTextRender::GetFontHeight( m_pCtrlText->GetFontSize() ) + KTextPhrase::KDEFAULT_LINE_GAP) + 1; // 공식목록 출력. //m_nScrollPos = 0; SetTextList( m_nLineSize, m_strContent, m_strDeco, const_cast< char * >( m_strFontName.c_str() ), m_pCtrlText, m_pScrollBar, m_nScrollPos, m_vLineList, true ); } else { // 공식목록 출력. SetTextList( m_nLineSize, m_strContent, m_strDeco, const_cast< char * >( m_strFontName.c_str() ), m_pCtrlText, m_pScrollBar, m_nScrollPos, m_vLineList ); } } break; } } void SUIHelpWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch( nMessage ) { // Scroll case KUI_MESSAGE::KSCROLL_SELECT : m_nScrollPos = max( (int)lparam, 0 ); // 공식목록 출력. SetTextList( m_nLineSize, m_strContent, m_strDeco, const_cast< char * >( m_strFontName.c_str() ), m_pCtrlText, m_pScrollBar, m_nScrollPos, m_vLineList ); break; case KUI_MESSAGE::KBUTTON_CLICK : // close. if( !::_stricmp( lpszControlID, "button_close" ) ) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, false ) ); // 닫기 } break; // 윈도우 이동 case KUI_MESSAGE::KGENWND_MOVE: LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한 break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } // 초기화. void SUIHelpWnd::Clear() { m_nScrollPos = 0; m_pScrollBar->SetPosition( m_nScrollPos ); }