#include "stdafx.h" #include "KUIControlStatic.h" #include "KUIControlButton.h" #include "KUIControlGauge.h" #include "KUIControlScroll.h" //#include "KUIControlNumber.h" #include "KUITabControl.h" #include "KUIControlQJTV.h" #include "SGameManager.h" #include "SGameMessage.h" //#include "SGameMessageUI.h" #include "SUICreatureWnd.h" #include "SUIDisplayInfo.h" #include "SGameOption.h" #include "SSummonSlotMgr.h" #include "SInventoryMgr.h" #include "SCreatureDB.h" #include "SStringDB.h" #include "SSkillDB.h" #include "SItemDB.h" #include "SSkillSlot.h" #include "KDeviceManager.h" #include "KUITextureManager.h" #include #include "KResourceDX.h" #include "KTGA_IO.h" // 2010.05.10 - prodongi #include "SCreatureEnhanceDB.h" // 2010.05.11 - prodongi #include //#include "SUIUtil.h" namespace { const int c_nOffSetY = 12; const int c_nOffSet = 12; const int c_nMaxSlot = 6; const int c_nDeltaX = 40; const int c_nDeltaY = 65; // 2011.04.06 - servantes int g_nMainCreatureID = 0; // 2011.05.20 - servantes AR_HANDLE g_hMainCreature = NULL; // 2011.05.24 - servantes bool c_bSelectLast = false; // 2011.06.02 - servantes }; SUICreatureWnd::~SUICreatureWnd() // 2011.05.17 - servantes { GetGameOption().SetCreatureX( GetRect().left ); GetGameOption().SetCreatureY( GetRect().top ); } bool SUICreatureWnd::InitControls( KPoint kPos ) { SetCustomMovingRect( KRect( 0,0,92,20 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area SetResizeUnit( 2, 2, KSize(47, 90), KSize((GetRect().right-GetRect().left)*2, 300) ); KUIControlMultiIcon* pIcon = dynamicCast( GetChild( "creature_icon00" ) ); if( pIcon ) pIcon->SetIconLayer( 4 ); return SUIWnd::InitControls(kPos); } bool SUICreatureWnd::InitData( bool bReload ) { m_bCreaturePage = true; m_nSelctIndex = -1; m_dwTime = 0; m_dwStartTime = 0; m_nProcessCount = 0; SetChildShow( "creature_mouseover", false ); if( !bReload ) { KUIControlMultiIcon* pIcon = NULL; RECT rc; rc.top = c_nDeltaY; rc.left = 0; rc.right = 0; rc.bottom = c_nDeltaY; for( int i = 0; i < c_nMaxSlot; i++ ) { // CopyControl( CStringUtil::StringFormat("creature_bg%02d" , i).c_str(), CStringUtil::StringFormat("creature_bg%02d" , i+1).c_str(), rc ); // CopyControl( CStringUtil::StringFormat("creature_slot%02d" , i).c_str(), CStringUtil::StringFormat("creature_slot%02d" , i+1).c_str(), rc ); // CopyControl( CStringUtil::StringFormat("creature_level_font%02d" , i).c_str(), CStringUtil::StringFormat("creature_level_font%02d" , i+1).c_str(), rc ); CopyControl( CStringUtil::StringFormat("static_creature%02d" , i).c_str(), CStringUtil::StringFormat("static_creature%02d" , i+1).c_str(), rc ); CopyControl( CStringUtil::StringFormat("creature_icon%02d" , i).c_str(), CStringUtil::StringFormat("creature_icon%02d" , i+1).c_str(), rc ); pIcon = dynamicCast( GetChild( CStringUtil::StringFormat("creature_icon%02d" , i).c_str() ) ); if( pIcon ) pIcon->SetIconLayer( 4 ); CopyControl( CStringUtil::StringFormat("static_slot_number%02d" , i).c_str(), CStringUtil::StringFormat("static_slot_number%02d" , i+1).c_str(), rc ); CopyControl( CStringUtil::StringFormat("static_slot_time%02d" , i).c_str(), CStringUtil::StringFormat("static_slot_time%02d" , i+1).c_str(), rc ); CopyControl( CStringUtil::StringFormat("static_creature%02d_lv_value", i).c_str(), CStringUtil::StringFormat("static_creature%02d_lv_value", i+1).c_str(), rc ); CopyControl( CStringUtil::StringFormat("gauge_hp_creature%02d" , i).c_str(), CStringUtil::StringFormat("gauge_hp_creature%02d" , i+1).c_str(), rc ); CopyControl( CStringUtil::StringFormat("gauge_mp_creature%02d" , i).c_str(), CStringUtil::StringFormat("gauge_mp_creature%02d" , i+1).c_str(), rc ); CopyControl( CStringUtil::StringFormat("gauge_sp_creature%02d" , i).c_str(), CStringUtil::StringFormat("gauge_sp_creature%02d" , i+1).c_str(), rc ); // CopyControl( CStringUtil::StringFormat("creature_disable%02d" , i).c_str(), CStringUtil::StringFormat("creature_disable%02d" , i+1).c_str(), rc ); } // SetChildAsTop( "creature_mouseclick" ); //슬롯 넘버 for( int i = 0; i < c_nMaxSlot; i++ ) { SetChildCaption( CStringUtil::StringFormat("static_slot_number%02d" , i).c_str(), CStringUtil::StringFormat("%s<#000000>%d", S(6425), i+1).c_str() ); SetChildAsTop( CStringUtil::StringFormat("static_slot_number%02d" , i).c_str() ); int nX = i%2; int nY = i/2; int nH = (i+1)/2 + (i+1)%2; // 2011.04.06 - servantes SetMovePos( CStringUtil::StringFormat("static_creature%02d" , i).c_str(), (nX * c_nDeltaX) + c_nOffSet + ((nX-1)*4), (nY * c_nDeltaY) + 20 + 5 + (nH * 2) ); SetMovePos( CStringUtil::StringFormat("creature_icon%02d" , i).c_str(), (nX * c_nDeltaX) + c_nOffSet + 3 + ((nX-1)*4), (nY * c_nDeltaY) + 28 + 7 + (nH * 2) ); SetMovePos( CStringUtil::StringFormat("static_slot_number%02d" , i).c_str(), (nX * c_nDeltaX) + c_nOffSet + 3 + ((nX-1)*4), (nY * c_nDeltaY) + 28 + 7 + (nH * 2) ); SetMovePos( CStringUtil::StringFormat("static_creature%02d_lv_value", i).c_str(), (nX * c_nDeltaX) + c_nOffSet + 11 + ((nX-1)*4), (nY * c_nDeltaY) + 28 + 7 + (nH * 2) ); SetMovePos( CStringUtil::StringFormat("static_slot_time%02d" , i).c_str(), (nX * c_nDeltaX) + c_nOffSet + 2 + ((nX-1)*4), (nY * c_nDeltaY) + 28 + 32 + (nH * 2) ); SetMovePos( CStringUtil::StringFormat("gauge_hp_creature%02d" , i).c_str(), (nX * c_nDeltaX) + c_nOffSet + 3 + ((nX-1)*4), (nY * c_nDeltaY) + 28 + 44 + (nH * 2) ); SetMovePos( CStringUtil::StringFormat("gauge_mp_creature%02d" , i).c_str(), (nX * c_nDeltaX) + c_nOffSet + 3 + ((nX-1)*4), (nY * c_nDeltaY) + 28 + 48 + (nH * 2) ); SetMovePos( CStringUtil::StringFormat("gauge_sp_creature%02d" , i).c_str(), (nX * c_nDeltaX) + c_nOffSet + 3 + ((nX-1)*4), (nY * c_nDeltaY) + 28 + 53 + (nH * 2) ); } //rc.top = 0; rc.bottom = 0; //CopyControl( "creature_mouseclick", "creature_mouseclick_new", rc ); //RemoveChild( GetChild("creature_mouseclick") ); } // 2011.04.06 - servantes m_pFormation[0] = dynamicCast(GetChild( "formation_main" )); if(NULL == m_pFormation[0]) return false; m_pFormation[1] = dynamicCast(GetChild( "formation_sub00" )); if(NULL == m_pFormation[1]) return false; RECT rc; ::SetRect(&rc, 0, 0, 0, 0); m_pFormation[2] = dynamicCast(CopyControl( "formation_sub00", "formation_sub01", rc )); if(NULL == m_pFormation[2]) return false; m_pFormation[3] = dynamicCast(CopyControl( "formation_sub00", "formation_sub02", rc )); if(NULL == m_pFormation[3]) return false; m_pFormation[4] = dynamicCast(CopyControl( "formation_sub00", "formation_sub03", rc )); if(NULL == m_pFormation[4]) return false; m_pFormation[5] = dynamicCast(CopyControl( "formation_sub00", "formation_sub04", rc )); if(NULL == m_pFormation[5]) return false; m_pFormation[0]->SetShow( false ); m_pFormation[1]->SetShow( false ); m_pFormation[2]->SetShow( false ); m_pFormation[3]->SetShow( false ); m_pFormation[4]->SetShow( false ); m_pFormation[5]->SetShow( false ); return SUIWnd::InitData(bReload); } void SUICreatureWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd ) { SUIWnd::OnNotifyUIWindowOpen(bOpen); if( bOpen ) { if(m_CreatureSlotMgr.GetEquipedCreatureCount() <= 0 ) { //TODO : 하드 코딩 //기획팀의 요청으로 다이얼로그 박스 대신 시스템메시지로 표시 // m_pGameManager->ProcMsgAtStatic( &SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_GENERAL, S(800), false ) ); m_pDisplayInfo->AddSystemMessage( S(800), 7 ); // You do not have any creatures m_nCurCreatureCount = 0; m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, false ) ); } else { m_pGameManager->StartSound( "ui_popup_window01.wav" ); // 선택된 크리처가 없으면 첫번째 크리처를 선택한다. if( m_CreatureSlotMgr.GetSelectedCreature() == 0 ) { RequestSelectCreature(0); } RefreshSlot(); //막음 -N4- m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FULLDOWN_CREATURE, false ) ); } } GetGameOption().SetCreatureOpen( bOpen ); } void SUICreatureWnd::OnRefresh( SGameMessage* pMsg ) { if( IsShow() ) RefreshSlot(); } void SUICreatureWnd::MovePos(int x, int y) { KUIWnd::MovePos(x,y); } void SUICreatureWnd::Process(DWORD dwTime) { SUIWnd::Process( dwTime ); //대여 시간 처리 m_dwTime = dwTime; if( (m_dwTime - m_dwStartTime) > 1000 ) { m_dwStartTime = m_dwTime; ++m_nProcessCount; if( m_nProcessCount >= 60 ) { m_nProcessCount = 0; //Refresh for( int nIndex(0); c_nMaxSlot>nIndex; ++nIndex ) { if( m_CreatureRemainTime[nIndex] ) { int nRemainTime = m_InventoryMgr.GetLendingItemTime( m_CreatureRemainTime[nIndex] ); //대여 시간 표시 SetChildShow( CStringUtil::StringFormat("static_slot_time%02d" , nIndex).c_str(), true ); std::string StrTime = GetRemainTime(nRemainTime); if( !StrTime.empty() ) SetChildCaption( CStringUtil::StringFormat("static_slot_time%02d", nIndex).c_str(), StrTime.c_str() ); } } } } } std::string SUICreatureWnd::GetRemainTime( int nRemainTime ) { std::string StrTempTime = m_pDisplayInfo->GetTimeString( nRemainTime, 0, true ).c_str(); if( !StrTempTime.empty() ) return CStringUtil::StringFormat("%s<#00fff6>%s", S(6425), StrTempTime.c_str() ); // return CStringUtil::StringFormat("%s<#00fff6>%s", S(6425), StrTempTime.c_str() ); return ""; } void SUICreatureWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch(nMessage) { case KUI_MESSAGE::KBUTTON_CLICK: { if( ::_stricmp( lpszControlID, "button_close" ) == 0 ) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, false ) ); //막음 -N4- m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FULLDOWN_CREATURE, false ) ); } } break; case KUI_MESSAGE::KICON_CLICK: { m_pGameManager->StartSound( "ui_button_click.wav" ); for( int i = 0; i < c_nMaxSlot; i++ ) { if( ::_stricmp( lpszControlID, CStringUtil::StringFormat("creature_icon%02d" , i).c_str() ) == 0 ) { RequestSelectCreature(i); if( GetGameOption().IsCreatureInfoOpen() ) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE , false ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, !m_bCreaturePage ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, m_bCreaturePage ) ); } break; } } } break; // MJ 2004/12/03 // 크리쳐 정보창 열기 case KUI_MESSAGE::KICON_DBLCLK: { for( int i = 0; i < c_nMaxSlot; i++ ) { if( ::_stricmp( lpszControlID, CStringUtil::StringFormat("creature_icon%02d", i).c_str() ) == 0 ) { RequestSelectCreature(i); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE , false ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, !m_bCreaturePage ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE , m_bCreaturePage ) ); break; // 2011.07.06 - servantes } } } break; case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동 LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한 RefreshSlot(); //막음 -N4- m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FULLDOWN_CREATURE, GetRect().left-120, GetRect().top ) ); break; case KUI_MESSAGE::KFOCUS_ACTIVATED : { if( ::_stricmp( lpszControlID, "window_simple_summon" ) == 0 ) SetChildShow( "creature_mouseclick", false ); } break; //막음 -N4- // case KUI_MESSAGE::KGENWND_RIGHT_CLICK: // { // m_pGameManager->ProcMsgAtStatic( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FULLDOWN_CREATURE ) ); // m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FULLDOWN_CREATURE, GetRect().left-120, GetRect().top ) ); // } // break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); // 2011.05.17 - servantes 계속 저장 느리다 // GetGameOption().SetCreatureX( GetRect().left ); // GetGameOption().SetCreatureY( GetRect().top ); } void SUICreatureWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { switch(pMsg->nType) { #ifndef NDEBUG case MSG_SEND_DATA: { SMSG_SEND_DATA *pSendMsg = dynamicCast< SMSG_SEND_DATA * >( pMsg ); if( pSendMsg->strMessage == "creature_update" ) { AR_HANDLE hCreature = m_CreatureSlotMgr.GetSelectSummonCreature(); if( hCreature ) { int i = m_CreatureSlotMgr.GetEquipedCardIndexByCreature( hCreature ); if( i >= 0 && i < c_nMaxCard ) { // 게임에 선택된 크리쳐 넘기기 SIMSG_UI_ACT_SELECT_SUMMON msg; msg.card_handle = m_hCreatureCard[ i ]; m_pGameManager->ProcMsgAtStatic(&msg); // 위치 KUIWnd* pBgWnd = GetChild( CStringUtil::StringFormat("static_creature%02d", i).c_str() ); if( pBgWnd ) { SetMovePos( "creature_mouseclick", pBgWnd->GetRect().left-2, pBgWnd->GetRect().top-4 ); SetChildShow( "creature_mouseclick", true ); } // 소환된 크리처이면 킥슬롯 열기 if( m_CreatureSlotMgr.IsExistSummonedCreature( hCreature ) ) { m_CreatureSlotMgr.SetActiveCreatureQuickSlot( hCreature ); m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_CREATURE_QUICK_UPDATE() ); } } } } } break; #endif case MSG_EQUIP_SUMMON: // 겟한 크리쳐 { /// 2010.11.15 - prodongi int oldCreatureCount = m_nCurCreatureCount; if( m_CreatureSlotMgr.GetEquipedCreatureCount() == 0 ) { m_nCurCreatureCount = 0; m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, false ) ); } else m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, true ) ); RefreshSlot(); // 2011.04.18 - servantes //편성되는 순간 가장 마지막에 있는 크리처를 셀렉트 해준다. // RequestSelectCreature( m_nCurCreatureCount-1 ); if(c_bSelectLast) { for( int k = c_nMaxSlot; k >= 0; k-- ) { if(m_hCreatureCard[k]) { KUIWnd* pBgWnd = GetChild( CStringUtil::StringFormat("static_creature%02d", k).c_str() ); if( pBgWnd ) { SetMovePos( "creature_mouseclick", pBgWnd->GetRect().left-2, pBgWnd->GetRect().top-4 ); SetChildShow( "creature_mouseclick", true ); m_CreatureSlotMgr.SetSelectCreatureCard(m_hCreatureCard[k]); // 2011.06.02 - servnates // 선택된 크리처가 크리처 편성창에도 선택되도록 메세지 보낸다 m_pGameManager->PostMsgAtDynamic( new SIMSG_SELECT_CREATURE_2ND( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, m_hCreatureCard[k] ) ); // 크리처 편성창 } break; } } c_bSelectLast = false; } /// 2011.07.12 - prodongi if (!c_bSelectLast) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE , false ) ); } else if( GetGameOption().IsCreatureInfoOpen() ) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE , false ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, !m_bCreaturePage ) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, m_bCreaturePage ) ); } pMsg->bUse = true; } break; case IMSG_UI_TARGET_STAT: { pMsg->bUse = true; SIMSG_UI_TARGET_STAT* pUIMsg = dynamicCast(pMsg); for( int i = 0; i < c_nMaxSlot; i++ ) { if( pUIMsg->handle == m_CreatureSlotMgr.GetEquipedCreature(i) ) { const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( pUIMsg->handle ); if( !pInfo ) return; if( pUIMsg->m_nMode == SIMSG_UI_TARGET_STAT::USE_EXP ) { // RefreshExp ( nIndex, pInfo->GetCurExp(), pInfo->GetMaxExp() ); } else { RefreshHP ( i, pUIMsg->m_nVar1, pUIMsg->m_nVar3 ); RefreshMP ( i, pUIMsg->m_nVar2, pUIMsg->m_nVar4 ); } return; } } } break; case MSG_LEVEL_UPDATE: // case MSG_HPMP: { RefreshSlot(); pMsg->bUse = true; } break; case MSG_PROPERTY: { SMSG_PROPERTY* pPropertyMsg = (SMSG_PROPERTY*)pMsg; switch( pPropertyMsg->nPropertyType ) { case SMSG_PROPERTY::PROPERTY_LEVEL: case SMSG_PROPERTY::PROPERTY_EXP: case SMSG_PROPERTY::PROPERTY_JP: { RefreshSlot(); } break; } pMsg->bUse = true; } break; //2011.05.16 - servantes case IMSG_UI_SELECT_LAST_CREATURE: // 마지막 크리처를 선택하도록 알림 { SIMSG_SELECT_LAST_CREATURE* pMsgSelect = (SIMSG_SELECT_LAST_CREATURE*)pMsg; c_bSelectLast = pMsgSelect->bSelectLastCreature; pMsg->bUse = true; } break; //2011.05.16 - servantes case IMSG_UI_SELECT_CREATURE: // 크리처를 선택 미니 편성창에 선택한 번호를 알려준다 { SIMSG_SELECT_CREATURE* pMsgSelect = (SIMSG_SELECT_CREATURE*)pMsg; m_nSelctIndex = pMsgSelect->nIndex; if(m_nSelctIndex != -1) // 2011.06.02 - servantes { /// 2011.06.07 편성창의 index와 미니편성창의 index가 다르기 때문에 인덱스를 변경해 준다 - prodongi AR_HANDLE hCreatureCard = m_CreatureSlotMgr.GetEquipedCreatureCard(pMsgSelect->nIndex); int convertIndex = findCreatureCardIndex(hCreatureCard); RequestSelectCreature( convertIndex ); } else // m_nSelctIndex == -1 { /// 2011.06.07 - prodongi SetChildShow( "creature_mouseclick", false ); m_CreatureSlotMgr.SetSelectCreatureCard(-1); if (m_pGameManager->IsUIWindowOpened(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL)) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false) ); } /* for( int k = c_nMaxSlot-1; k >= 0; k-- ) { if(m_hCreatureCard[k]) { KUIWnd* pBgWnd = GetChild( CStringUtil::StringFormat("static_creature%02d", k).c_str() ); if( pBgWnd ) { SetMovePos( "creature_mouseclick", pBgWnd->GetRect().left-2, pBgWnd->GetRect().top-4 ); SetChildShow( "creature_mouseclick", true ); m_CreatureSlotMgr.SetSelectCreatureCard(m_hCreatureCard[k]); break; } } } */ } pMsg->bUse = true; } break; // 2011.05.19 - servantes case IMSG_UI_SET_MAIN_CREATURE: // 메인 크리처를 선택을 알려준다 { SIMSG_SET_MAIN_CREATURE* pMsgSetMain = (SIMSG_SET_MAIN_CREATURE*)pMsg; g_nMainCreatureID = pMsgSetMain->nIndex; g_hMainCreature = pMsgSetMain->hCreature; int nMainID=0, nSubID=0; AR_HANDLE hMainCreature=0, hSubCreature=0; // AR_HANDLE hMainCardCreature=0, hSubCardCreature=0; if(m_CreatureSlotMgr.GetSummonedCreatureCnt() > 1) // 소환된 크리처가 두 마리일 경우 주크리처를 정한다 { for(int i=0; ibUse = true; } break; // 2011.05.24 - servantes case IMSG_UI_GET_MAIN_CREATURE_HANDLE: // 미니 크리처창에 저장되어있는 메인크리처 핸들값 얻어오기 { SIMSG_GET_MAIN_CREATURE_HANDEL* pMsgSetMain = (SIMSG_GET_MAIN_CREATURE_HANDEL*)pMsg; pMsgSetMain->hCreature = g_hMainCreature; pMsg->bUse = true; } break; } } /////////////////////////////////////////////////////////// // 슬롯 /////////////////////////////////////////////////////////// void SUICreatureWnd::RefreshSlot() { // 리사이즈 if( m_nCurCreatureCount != m_CreatureSlotMgr.GetEquipedCreatureCount() ) { int nDelta = m_nCurCreatureCount - m_CreatureSlotMgr.GetEquipedCreatureCount(); //int nOffset = (nDelta*(-1)) * c_nDeltaX; //Resize( KRect(GetRect().left, GetRect().top, GetRect().right, GetRect().bottom+nOffset) ); LimitMoveWnd(); } m_nCurCreatureCount = m_CreatureSlotMgr.GetEquipedCreatureCount(); ::memset( m_hCreatureCard, 0, sizeof(m_hCreatureCard) ); ::memset( m_CreatureRemainTime, 0, sizeof(m_CreatureRemainTime) ); SetChildShow( "creature_mouseclick", false ); // 2011.04.06 - servantes m_pFormation[ 0 ]->SetShow( false ); m_pFormation[ 1 ]->SetShow( false ); m_pFormation[ 2 ]->SetShow( false ); m_pFormation[ 3 ]->SetShow( false ); m_pFormation[ 4 ]->SetShow( false ); m_pFormation[ 5 ]->SetShow( false ); int nIndex = 0; int nEnableCnt = 0; for( int i = 0; nIndex < c_nMaxSlot; i++ ) { if( i >= c_nMaxSlot ) { EnableSlot( nIndex, false ); nIndex++; continue; } const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( m_CreatureSlotMgr.GetEquipedCreature(i) ); if( pInfo == NULL ) { // EnableSlot( nIndex, false ); continue; } EnableSlot( nIndex, true ); ++nEnableCnt; // SetChildCaption( CStringUtil::StringFormat("creature_slot%02d", nIndex).c_str(), i ); SetChildCaption( CStringUtil::StringFormat("static_creature%02d_lv_value", nIndex).c_str(), CStringUtil::StringFormat("%s%d", S(6425), pInfo->GetLevel()).c_str() ); RefreshHP ( nIndex, pInfo->GetHP(), pInfo->GetMaxHP() ); RefreshMP ( nIndex, pInfo->GetMP(), pInfo->GetMaxMP() ); RefreshExp ( nIndex, pInfo->GetCurExp(), pInfo->GetMaxExp() ); KUIControlMultiIcon* pIcon = dynamicCast(GetChild( CStringUtil::StringFormat( "creature_icon%02d", nIndex ).c_str() )); if( pIcon ) { ResetMultiIcon( pIcon, 0, 4 ); // 2010.05.11 - prodongi SInventorySlot* slot = m_InventoryMgr.GetItemInfo(m_CreatureSlotMgr.GetEquipedCreatureCard(i)); if( slot ) { if( false == setSummonCardIconForPortrait( pIcon, slot ) ) { int enhance = (slot) ? slot->GetEnhance() : 0; char iconName[128]; ::getEnhanceIconName(iconName, pInfo, enhance); pIcon->SetIcon( 0, c_szDEF_SPR_NAME, iconName ); // pIcon->SetIcon( c_szDEF_SPR_NAME, GetCreatureDB().GetIconName(pInfo->GetID()) ); } } else { //slot이 없는경우도 있나? int enhance = (slot) ? slot->GetEnhance() : 0; char iconName[128]; ::getEnhanceIconName(iconName, pInfo, enhance); pIcon->SetIcon( 0, c_szDEF_SPR_NAME, iconName ); } pIcon->SetTooltip( GetStringDB().GetString( GetCreatureDB().GetTextID(pInfo->GetID()) ) ); } // 선택 크리처이면 disable if( m_CreatureSlotMgr.GetSelectedCreature() == m_CreatureSlotMgr.GetEquipedCreature(i) ) { // SetChildShow( CStringUtil::StringFormat("creature_disable%02d", nIndex).c_str(), false ); // 위치 KUIWnd* pBgWnd = GetChild( CStringUtil::StringFormat("static_creature%02d", nIndex).c_str() ); if( pBgWnd ) { SetMovePos( "creature_mouseclick", pBgWnd->GetRect().left-2, pBgWnd->GetRect().top-4 ); SetChildShow( "creature_mouseclick", true ); } } //else // SetChildShow( CStringUtil::StringFormat("creature_disable%02d", nIndex).c_str(), true ); m_hCreatureCard[nIndex] = m_CreatureSlotMgr.GetEquipedCreatureCard(i); if( m_hCreatureCard[nIndex] ) { SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_hCreatureCard[nIndex] ); if( pSlot && pSlot->GetItem()->remain_time ) { m_CreatureRemainTime[nIndex] = m_hCreatureCard[nIndex]; m_nProcessCount = 60; } } nIndex++; } if( nEnableCnt == 0 ) return; int nCountX = (nEnableCnt == 1 ? 1 : 2); int nCountY = nEnableCnt/2 + nEnableCnt%2; _oprint( "%d - %d %d\n", nEnableCnt, nCountX, nCountY ); KUIWnd * pTitleFrame = GetChild( "titlebar" ); KUIWnd * pOutFrame = GetChild( "outframe" ); KUIWnd * pCloseBtn = GetChild( "button_close" ); KUIWnd * pLastYFrame = GetChild( CStringUtil::StringFormat("static_creature%02d", nEnableCnt-1).c_str() ); KUIWnd * pLastXFrame = GetChild( CStringUtil::StringFormat("static_creature%02d", nCountX-1).c_str() ); if( pTitleFrame && pOutFrame && pCloseBtn && pLastYFrame && pLastXFrame ) { if( nCountX == 1 ) pTitleFrame->SetAniName( "static_common_titlebar03" ); else pTitleFrame->SetAniName( "static_common_titlebar02" ); KRect titleRc = pTitleFrame->GetRect(); titleRc.right = pLastXFrame->GetRect().right + 7; pTitleFrame->Resize( titleRc ); KRect newRc = pOutFrame->GetRect(); newRc.right = pLastXFrame->GetRect().right + 7; newRc.bottom = pLastYFrame->GetRect().bottom + 9; pOutFrame->Resize( newRc ); pCloseBtn->MovePos( newRc.right-pCloseBtn->GetRect().GetWidth() - 6 , pCloseBtn->GetRect().top ); //윈도우 사이즈 newRc.top = titleRc.top; Resize( newRc ); } // 2011.05.23 - servantes // if( m_nSelctIndex == -1 ) // { // if( m_CreatureSlotMgr.GetEquipedCreatureCount() != 0 ) // { // m_nSelctIndex = 0; // RequestSelectCreature( m_nSelctIndex ); // } // } SetMainCreature( g_hMainCreature ); // 2011.05.20 - servantes } void SUICreatureWnd::EnableSlot( int nIndex, bool bShow ) { // SetChildShow( CStringUtil::StringFormat("creature_bg%02d" , nIndex).c_str(), bShow ); // SetChildShow( CStringUtil::StringFormat("creature_slot%02d" , nIndex).c_str(), bShow ); // SetChildShow( CStringUtil::StringFormat("creature_level_font%02d" , nIndex).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat("static_creature%02d" , nIndex).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat("creature_icon%02d" , nIndex).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat("static_slot_number%02d" , nIndex).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat("static_slot_time%02d" , nIndex).c_str(), false ); SetChildShow( CStringUtil::StringFormat("static_creature%02d_lv_value", nIndex).c_str(), bShow ); // SetChildShow( CStringUtil::StringFormat("creature_disable%02d" , nIndex).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat("gauge_hp_creature%02d" , nIndex).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat("gauge_mp_creature%02d" , nIndex).c_str(), bShow ); SetChildShow( CStringUtil::StringFormat("gauge_sp_creature%02d" , nIndex).c_str(), bShow ); if(bShow) { char str[256]={}; // 2011.04.06 - servantes sprintf(str, "static_slot_number%02d", nIndex); KUIWnd* pWnd = GetChild( str ); if(NULL == pWnd) return ; KRect rt = pWnd->GetRect(); rt.top -= 7; m_pFormation[ nIndex ]->MovePos(rt.left, rt.top); m_pFormation[ nIndex ]->SetShow( true ); } else { m_pFormation[ nIndex ]->SetShow( false ); } } /////////////////////////////////////////////////////////// // 정보 /////////////////////////////////////////////////////////// void SUICreatureWnd::RefreshHP( int nIndex, int nHP, int nMaxHP ) { KUIControlGauge* pGuage = dynamicCast(GetChild( CStringUtil::StringFormat("gauge_hp_creature%02d", nIndex).c_str() )); if( pGuage == NULL ) return; nMaxHP = max( nHP, nMaxHP ); nHP = max( nHP, 0 ); pGuage->SetMax( (DWORD)nMaxHP ); pGuage->SetGauge( (DWORD)nHP, 0 ); if( nMaxHP <= 0 ) return; int nPer = ( static_cast(nHP) / static_cast(nMaxHP) ) * 100; // 게이지 남은 양에 따라 텍스처 바꿔줌 // 2012.02.02 - servantes setHPGaugeTexture( nPer, pGuage ); } void SUICreatureWnd::RefreshMP( int nIndex, int nMP, int nMaxMP ) { KUIControlGauge* pGuage = dynamicCast(GetChild( CStringUtil::StringFormat("gauge_mp_creature%02d", nIndex).c_str() )); if( pGuage == NULL ) return; nMaxMP = max( nMP, nMaxMP ); nMP = max( nMP, 0 ); pGuage->SetMax( (DWORD)nMaxMP ); pGuage->SetGauge( (DWORD)nMP, 0 ); } void SUICreatureWnd::RefreshExp( int nIndex, __int64 nExp, __int64 nMaxExp ) { KUIControlGauge* pGuage = dynamicCast(GetChild( CStringUtil::StringFormat("gauge_sp_creature%02d", nIndex).c_str() )); if( pGuage == NULL ) return; pGuage->SetMax( 1000 ); pGuage->SetGauge( (double)nExp / nMaxExp * 1000, 0 ); } /////////////////////////////////////////////////////////// // 선택처리 /////////////////////////////////////////////////////////// void SUICreatureWnd::RequestSelectCreature( int nIndex ) { if( nIndex < 0 || nIndex >= c_nMaxCard ) return; // 선택 초기화 SetChildShow( "creature_mouseclick", false ); m_CreatureSlotMgr.SetSelectSummonCreature(NULL); // 게임에 선택된 크리쳐 넘기기 SIMSG_UI_ACT_SELECT_SUMMON msg; msg.card_handle = m_hCreatureCard[ nIndex ]; m_pGameManager->ProcMsgAtStatic(&msg); // 선택 크리처 표시하기 AR_HANDLE hCreature = m_CreatureSlotMgr.GetEquipedCreature(m_hCreatureCard[nIndex]); if( hCreature != NULL ) { m_CreatureSlotMgr.SetSelectSummonCreature( hCreature ); //선택 m_CreatureSlotMgr.SetSelectCreatureCard(m_hCreatureCard[nIndex]); //크리처 카드 선택 // 2011.07.05 - servantes // 위치 KUIWnd* pBgWnd = GetChild( CStringUtil::StringFormat("static_creature%02d", nIndex).c_str() ); if( pBgWnd ) { SetMovePos( "creature_mouseclick", pBgWnd->GetRect().left-2, pBgWnd->GetRect().top-4 ); SetChildShow( "creature_mouseclick", true ); } // 2011.06.02 - servnates // 선택된 크리처가 크리처 편성창에도 선택되도록 메세지 보낸다 m_pGameManager->PostMsgAtDynamic( new SIMSG_SELECT_CREATURE_2ND( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, m_hCreatureCard[ nIndex ] ) ); // 크리처 편성창 } // 소환된 크리처이면 킥슬롯 열기 if( m_CreatureSlotMgr.IsExistSummonedCreature( hCreature ) ) { m_CreatureSlotMgr.SetActiveCreatureQuickSlot( hCreature ); m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_CREATURE_QUICK_UPDATE() ); } } // 2011.05.19 - servantes void SUICreatureWnd::SetMainCreature(AR_HANDLE hMainCreture, int nForceIndex) { if(hMainCreture < 0) return ; int i=0, ni=1, nMainCretureIndex=-1; for(i=0; i<6; i++) { const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfoByCardHandle( m_hCreatureCard[i] ); // 2011.05.24 - servantes if( pInfo == NULL ) { continue; } char str[256]={}; sprintf(str, "static_slot_number%02d", i); KUIWnd* pWnd = GetChild( str ); if(NULL == pWnd) return ; KRect rt = pWnd->GetRect(); rt.top -= 7; if(nForceIndex == -1) // 메인 크리처 선택 처리 { AR_HANDLE hCreature = m_CreatureSlotMgr.GetEquipedCreature( m_hCreatureCard[i] ); if(hMainCreture == hCreature || (!hMainCreture && i == 0)) // 2011.05.24 - servantes { m_pFormation[ 0 ]->MovePos(rt.left, rt.top); m_pFormation[ 0 ]->SetShow( true ); nMainCretureIndex = i; } else { if(ni >= 6) break; m_pFormation[ ni ]->MovePos(rt.left, rt.top); m_pFormation[ ni ]->SetShow( true ); ni++; } } else { if(0 == i) // 2011.05.24 - servantes { m_pFormation[ 0 ]->MovePos(rt.left, rt.top); m_pFormation[ 0 ]->SetShow( true ); nMainCretureIndex = i; } else { if(ni >= 6) break; m_pFormation[ ni ]->MovePos(rt.left, rt.top); m_pFormation[ ni ]->SetShow( true ); ni++; } } } // if(nMainCretureIndex != -1) // 2011.05.24 - servantes // RequestSelectCreature( nMainCretureIndex ); // 2011.05.23 - servantes } /// 2011.06.07 - prodongi int SUICreatureWnd::findCreatureCardIndex(AR_HANDLE equipedCardHandle) const { for (int i = 0; i < c_nMaxCard; ++i) { if (m_hCreatureCard[i] == equipedCardHandle) return i; } return -1; }