#include "stdafx.h" // //#include "KUIControlStatic.h" //#include "KUIControlClockBox.h" // //#include "SGameManager.h" ////#include "SGameMessageUI.h" // //#include "SUIStateEffectWnd.h" //#include "SUIDisplayInfo.h" //#include "STenacityDB.h" //#include "SkillBaseFile.h" //#include "SGameOption.h" //#include "SPlayerInfoMgr.h" // //namespace{ // const int c_nButtonClickArea = 10; //} // //bool SUIStateVEffectWnd::InitControls( KPoint kPos ) //{ // SetCustomMovingRect( KRect( 0, 0, c_nShortMoveRect, 15 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area // SetValidRect( "state_effect_v_change", KRect(-c_nButtonClickArea,0,0,0) ); // CreateItemIcon(); // 아이콘 생성 // // // state 재사용 시간 컨트롤 // KUIWnd* pWnd = NULL; // for( int i = 1; i <= c_nMaxStateIcon; i++ ) // { // KUIWnd* pIcon = GetChild( CStringUtil::StringFormat("state_effect_v_icon%02d", i).c_str() ); // if( pIcon ) // { // pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "clockbox", CStringUtil::StringFormat("state_effect_v_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 ); // } // } // // return SUIWnd::InitControls(kPos); //} //bool SUIStateVEffectWnd::InitData( bool bReload ) //{ // DisableSlot( 0, c_nMaxNum, false ); // // ToggleTitle(SHOW_MIDDLE, false); // ToggleTitle(SHOW_LONG, false); // ToggleTitle(SHOW_SHORT, true); // // return SUIWnd::InitData(bReload); //} //void SUIStateVEffectWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) //{ // switch(nMessage) // { // case KUI_MESSAGE::KBUTTON_CLICK: // { // m_pGameManager->StartSound( "ui_button_click.wav" ); // // if( ::_stricmp( lpszControlID, "state_effect_v_change" ) == 0 ) // ChangeStateMenu(); // } // break; // case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동 // { // LimitMoveWnd(0, 0); // 게임 외부로 나가지 못하게 제한 // m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STATE_H_EFFECT, GetRect().left, GetRect().top ) ); // } // break; // } // // SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); //} // // //void SUIStateVEffectWnd::ProcMsgAtStatic( SGameMessage* pMsg ) //{ // switch(pMsg->nType) // { // case MSG_STATE: // { // RefreshStateInfo(); // // pMsg->bUse = true; // } // break; // case IMSG_UI_MOVE: // { // MovePos( ((SIMSG_UI_MOVE*)pMsg)->m_nX, ((SIMSG_UI_MOVE*)pMsg)->m_nY ); // // GetGameOption().SetStateVerX( GetRect().left ); // GetGameOption().SetStateVerY( GetRect().top ); // // pMsg->bUse = true; // } // break; // case IMSG_UI_STATE_UPDATE: // { // CheckState(); // pMsg->bUse = true; // } // break; // } //} // //void SUIStateVEffectWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd ) //{ // SUIWnd::OnNotifyUIWindowOpen(bOpen); // // if( bOpen ) // RefreshStateInfo(); //} // //// ========================================= //// 윈도우 //// ========================================= //void SUIStateVEffectWnd::CloseWnd() //{ // FreeList(); // // m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STATE_H_EFFECT, false ) ); // m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STATE_V_EFFECT, false ) ); //} //void SUIStateVEffectWnd::CreateItemIcon() //{ // KUIControlIconStatic* pIcon = ( KUIControlIconStatic* )GetChild( "state_effect_v_icon01" ); // if( pIcon == NULL ) return; // // int nLeft, nTop; // // KRect rt = pIcon->GetRect(); // nLeft = rt.left; nTop = rt.top; // rt.top += c_nIconHeight; // // KUIWnd* pWnd = NULL; // for( int i = 2; i <= c_nMaxNum; i++ ) // { // rt.right = rt.left + c_nIconHeight; // rt.bottom = rt.top + c_nIconHeight; // // //마우스 포커스 안 가도록 Flag : KFLAG_GET_PASS_MESSAGE 추가 // pWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "iconstatic", CStringUtil::StringFormat( "state_effect_v_icon%02d", i ).c_str(), " ", rt, 0, KFLAG_GET_PASS_MESSAGE, this, "icon_condition00", c_szDEF_SPR_NAME, m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) ); // // if( i%10 == 0 ) // { // rt.left = nLeft + c_nIconHeight; // rt.top = nTop; // // nLeft = rt.left; // } // else // rt.top += c_nIconHeight; // } //} //void SUIStateVEffectWnd::ChangeTitleBar( int nShowType ) //{ // switch(nShowType) // { // case SHOW_SHORT: // { // SetCustomMovingRect( KRect(GetRect().left, GetRect().top, GetRect().left+c_nShortMoveRect, GetRect().bottom) ); // ToggleTitle(SHOW_MIDDLE, false); // ToggleTitle(SHOW_LONG, false); // ToggleTitle(nShowType, true); // } // break; // case SHOW_MIDDLE: // { // SetCustomMovingRect( KRect(GetRect().left, GetRect().top, GetRect().left+c_nMidMoveRect, GetRect().bottom) ); // ToggleTitle(SHOW_SHORT, false); // ToggleTitle(SHOW_LONG, false); // ToggleTitle(nShowType, true); // } // break; // case SHOW_LONG: // { // SetCustomMovingRect( KRect(GetRect().left, GetRect().top, GetRect().left+c_nLongMoveRect, GetRect().bottom) ); // ToggleTitle(SHOW_SHORT, false); // ToggleTitle(SHOW_MIDDLE, false); // ToggleTitle(nShowType, true); // } // break; // } //} //void SUIStateVEffectWnd::ToggleTitle( int nShowType, bool bShow ) //{ // const char* szName; // // switch(nShowType) // { // case SHOW_SHORT: szName = "state_effect_v_menu01"; break; // case SHOW_MIDDLE: szName = "state_effect_v_menu02"; break; // case SHOW_LONG: szName = "state_effect_v_menu03"; break; // } // // KUIWnd* pWnd = GetChild( szName ); // if( pWnd ) pWnd->SetShow(bShow); // // // 체인지 버튼 이동 // if( bShow ) // { // KUIWnd* pButton = GetChild( "state_effect_v_change" ); // if( pButton ) // { // pButton->MovePos( pWnd->GetRect().right-16, pWnd->GetRect().top ); // pButton->SetCorrectionRect( KRect(8,0,0,0) ); // } // } //} // //void SUIStateVEffectWnd::ChangeStateMenu() //{ // GetGameOption().SetVerticalStat(false); // // m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STATE_H_EFFECT, true) ); // m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STATE_V_EFFECT, false) ); // // //} ////////////////////////////////////////////////// ///////////////////////////////////////////////// // //// ========================================= //// 스테이트 리스트 //// ========================================= //bool SUIStateVEffectWnd::IsExistState( int state_handle, bool bPositive ) //{ // SStateSlot* pInfo = FindState( state_handle, bPositive ); // if( pInfo ) return true; // // return false; //} //SStateSlot* SUIStateVEffectWnd::FindState( AR_HANDLE hState, bool bPositive ) //{ // if( bPositive ) // { // std::vector::iterator it = m_vecPositiveList.begin(); // while( it != m_vecPositiveList.end() ) // { // SStateSlot* pInfo = (*it); // if( pInfo->GetStateHandle() == hState ) // return (*it); // it++; // } // } // else // { // std::vector::iterator it = m_vecNegativeList.begin(); // while( it != m_vecNegativeList.end() ) // { // SStateSlot* pInfo = (*it); // if( pInfo->GetStateHandle() == hState ) // return (*it); // it++; // } // } // return NULL; //} //void SUIStateVEffectWnd::UpdateStateInfo( SStateSlot* pInfo, bool bPositive ) //{ // if( pInfo == NULL ) return; // // SStateSlot* pState = FindState( pInfo->GetStateHandle(), bPositive ); // if( pState ) // { // pState->SetStateLevel( pInfo->GetStateLevel() ); // pState->SetEndTime( pInfo->GetEndTime() ); // } //} //void SUIStateVEffectWnd::RefreshStateInfo() //{ // std::vector vecStateList; // // m_PlayerInfoMgr.GetStateList(vecStateList); // if( vecStateList.empty() ) { CloseWnd(); return; } // // std::vector::iterator it = vecStateList.begin(); // while( it != vecStateList.end() ) // { // SStateSlot* pInfo = (*it); // // StateInfoEx* s_data = GetTenacityDB().GetTenacityData(pInfo->GetStateCode()); // if( s_data == NULL ) { it++; continue; } // // if( IsExistState(pInfo->GetStateHandle(), !(s_data->is_harmful)) ) // UpdateStateInfo( pInfo, !(s_data->is_harmful) ); // else // { // if( s_data->is_harmful ) // 나쁜거 // m_vecNegativeList.push_back( pInfo ); // else // m_vecPositiveList.push_back( pInfo ); // } // it++; // } // // RefreshStateSlot(); //} //// ========================================= //// 스테이트 슬롯 //// ========================================= //void SUIStateVEffectWnd::RefreshStateSlot() //{ // DisableSlot(0, c_nMaxNum, false); // // int nPositiveCount = static_cast(m_vecPositiveList.size()); // int nNegativeCount = static_cast(m_vecNegativeList.size()); // // if( nPositiveCount == 0 && nNegativeCount == 0 ) { CloseWnd(); return; } // // if( nNegativeCount > 0 ) // { // if( nPositiveCount == 0 ) m_nShowType = SHOW_SHORT; // else if( nPositiveCount <= 10 ) m_nShowType = SHOW_MIDDLE; // else m_nShowType = SHOW_LONG; // } // else // { // if( nPositiveCount <= 10 ) m_nShowType = SHOW_SHORT; // else m_nShowType = SHOW_MIDDLE; // } // // if( m_nShowType == SHOW_SHORT ) // { // if( nPositiveCount == 0 ) RefreshSlot( 0, false ); // 네거티브만 // else RefreshSlot( 0, true ); // 포지티브만 // } // else if( m_nShowType == SHOW_MIDDLE ) // { // if( nNegativeCount == 0 ) RefreshSlot( 0, true ); // 포지티브만 // else { RefreshSlot( 0, true ); RefreshSlot( 10, false ); }; // 둘다 // } // else // 둘다 // { // RefreshSlot( 0, true ); // RefreshSlot( 20, false ); // } // // ChangeTitleBar( m_nShowType ); //} //void SUIStateVEffectWnd::RefreshSlot( int nStart, bool bPositive ) //{ // if( bPositive ) // { // std::vector::iterator it = m_vecPositiveList.begin(); // while( it != m_vecPositiveList.end() ) // { // SStateSlot* pInfo = (*it); // // StateInfoEx* s_data = GetTenacityDB().GetTenacityData(pInfo->GetStateCode()); // if( s_data == NULL ) continue; // // if( nStart >= 20 ) return; // // KUIControlIconStatic* pIcon = ( KUIControlIconStatic* )GetChild( CStringUtil::StringFormat("state_effect_v_icon%02d", nStart+1).c_str() ); // if( pIcon ) // { // pIcon->SetShow(true); // pIcon->SetIcon( c_szDEF_SPR_NAME, GetTenacityDB().GetIconName(pInfo->GetStateCode()) ); // pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel()).c_str() ); // } // KUIControlClockBox* pClock = ( KUIControlClockBox* )GetChild( CStringUtil::StringFormat("state_effect_v_clock%02d", nStart+1).c_str() ); // if( pClock ) // { // pClock->SetMaxTime( pInfo->GetMaxTime() ); // pClock->SetCurTime( pInfo->GetRemainTime() ); // pClock->Begin( true ); // } // // it++; // nStart++; // } // } // else // { // m_nCurNegativePos = nStart+1; // // std::vector::iterator it = m_vecNegativeList.begin(); // while( it != m_vecNegativeList.end() ) // { // SStateSlot* pInfo = (*it); // // StateInfoEx* s_data = GetTenacityDB().GetTenacityData( pInfo->GetStateCode() ); // if( s_data == NULL ) continue; // // if( m_nShowType == SHOW_LONG && nStart >= 30 ) return; // if( m_nShowType == SHOW_MIDDLE && nStart >= 20 ) return; // // KUIControlIconStatic* pIcon = ( KUIControlIconStatic* )GetChild( CStringUtil::StringFormat("state_effect_v_icon%02d", nStart+1).c_str() ); // if( pIcon ) // { // pIcon->SetShow(true); // pIcon->SetIcon( c_szDEF_SPR_NAME, GetTenacityDB().GetIconName(pInfo->GetStateCode()) ); // pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel()).c_str() ); // } // KUIControlClockBox* pClock = ( KUIControlClockBox* )GetChild( CStringUtil::StringFormat("state_effect_v_clock%02d", nStart+1).c_str() ); // if( pClock ) // { // pClock->SetMaxTime( pInfo->GetMaxTime() ); // pClock->SetCurTime( pInfo->GetRemainTime() ); // pClock->Begin( true ); // } // // it++; // nStart++; // } // } //} //void SUIStateVEffectWnd::DisableSlot( int nIndex, int nEnd, bool bShow ) //{ // KUIControlIconStatic* pIcon = NULL; // KUIControlClockBox* pClock = NULL; // for( int i = nIndex; i < nEnd; i++ ) // { // pIcon = ( KUIControlIconStatic* )GetChild( CStringUtil::StringFormat("state_effect_v_icon%02d", i+1).c_str() ); // if( pIcon ) // { // pIcon->SetShow(bShow); // pIcon->SetIcon(0); // pIcon->SetTooltip(); // } // // pClock = ( KUIControlClockBox* )GetChild( CStringUtil::StringFormat("state_effect_v_clock%02d", i+1).c_str() ); // if( pClock ) // { // pClock->SetCurTime(0); // pClock->SetMaxTime(0); // pClock->Begin(); // } // } //} // //void SUIStateVEffectWnd::FreeList() //{ // m_vecPositiveList.clear(); // m_vecNegativeList.clear(); //} //// ========================================= //// 삭제 //// ========================================= //void SUIStateVEffectWnd::CheckState() //{ // int nIndex = 1; // bool bUpdate = false; // // if( m_vecPositiveList.size() > 0 ) // { // std::vector::iterator it = m_vecPositiveList.begin(); // while( it != m_vecPositiveList.end() ) // { // SStateSlot* pInfo = (*it); // // // 툴팁 갱신 // KUIControlIconStatic* pIcon = ( KUIControlIconStatic* )GetChild( CStringUtil::StringFormat("state_effect_v_icon%02d", nIndex).c_str() ); // if( pIcon ) pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel()).c_str() ); // nIndex++; // // // end_time 이 0이면 영원지속, 레벨이 0 이거나, end_time 이 지났으면 삭제 // if( pInfo->GetStateLevel() == 0 || (pInfo->GetEndTime() != 0 && GetArTime() >= pInfo->GetEndTime()) ) // { // it = m_vecPositiveList.erase(it); // bUpdate = true; // } // else // it++; // } // } // if( m_vecNegativeList.size() > 0 ) // { // nIndex = m_nCurNegativePos; // // std::vector::iterator it = m_vecNegativeList.begin(); // while( it != m_vecNegativeList.end() ) // { // SStateSlot* pInfo = (*it); // // // 툴팁 갱신 // KUIControlIconStatic* pIcon = ( KUIControlIconStatic* )GetChild( CStringUtil::StringFormat("state_effect_v_icon%02d", nIndex).c_str() ); // if( pIcon ) pIcon->SetTooltip( m_pDisplayInfo->GetStateToolTipText(pInfo->GetStateCode(), pInfo->GetEndTime(), pInfo->GetStateLevel()).c_str() ); // nIndex++; // // // end_time 이 0이면 영원지속, 레벨이 0 이거나, end_time 이 지났으면 삭제 // if( pInfo->GetStateLevel() == 0 || (pInfo->GetEndTime() != 0 && GetArTime() >= pInfo->GetEndTime()) ) // { // it = m_vecNegativeList.erase(it); // bUpdate = true; // } // else // it++; // } // } // // if( bUpdate ) // RefreshStateSlot(); //} //