#include "stdafx.h" // 2011.09.02 - servantes #include #include "KUITextureManager.h" #include "KDeviceManager.h" #include "KUIControlQJTV.h" #include #include "KResourceDX.h" #include "KTGA_IO.h" #include "KUIControlStatic.h" #include "KUIControlScroll.h" #include "SMonsterDB.h" #include "SUIDisplayInfo.h" #include "SGameManager.h" #include "SUIDungeonStoneExWnd.h" //#include "SGameMessageUI.h" #include "SGameMessage.h" #include "KUIControlList.h" #include "KUIControlListItem.h" #include "SStringDB.h" #include "SDungeonResourceDB.h" #include ////#include "Util.h" #include #include #include "SNpcResourceDB.h" #include "KUIControlButton.h" #include "SGameInterface.h" #include // 2011.09.02 - servantes namespace { const int nCardImgWidth = 177; const int nCardImgHeight = 97; }; extern void SetCopy( char * pSrc, const int nSrcStride, char * pDst, const int nDstStride, const int nWidth, const int nHeight ); extern void MsgSplit( const char* szMsg, std::vector& vecText, const wchar_t* lpDelimiter, bool bProcSpecialCharacter=false ); SUIDungeonStoneWnd::~SUIDungeonStoneWnd() { } bool SUIDungeonStoneWnd::InitControls( KPoint kPos ) { SetCustomMovingRect( KRect( 0, 0, m_rcRegion.GetWidth(), 20 ) ); // 2011.09.02 - servantes /* KUIControIStringList* pList = (KUIControIStringList*)(GetChild("list")); if( pList ) { pList->SetItemShowCnt(3); pList->SetScroll(true); } */ // 2011.09.02 - servantes m_strIllustImg = "game_panel_image_dungeon_01.jpg"; int nExpX, nExpY; K3DRenderDevice::GetSquareSize( nCardImgWidth, nCardImgHeight, nExpX, nExpY ); if( KUITextureManager::GetHWType() == KUITextureManager::HW_SUPPORT ) { m_spTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture( nExpX, nExpY, KUSAGE_DYNAMIC, K3DFMT_A8R8G8B8, D3DPOOL_DEFAULT ); } else { //Intel Chip 계열에서 지원 안 되는 넘들이 있음. m_spTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture( nExpX, nExpY, K3DFMT_A8R8G8B8, D3DPOOL_MANAGED ); } KUIControlDynamicTexture* pWndDynamicTex = dynamicCast(GetChild( "back_image_dungeon_01" )); if( pWndDynamicTex ) pWndDynamicTex->SetRenderTarget( m_spTexture, nCardImgWidth, nCardImgHeight ); refreshInitImg(); refreshCardImg(); m_pSlot_select = (KUIControlStatic*)(GetChild( "line_special_01" )); // 2011.09.09 - servantes : 1번 슬롯 표시 m_pSlot_leader_mark = (KUIControlStatic*)(GetChild( "mark_special_01" )); // 2011.09.09 - servantes : 리더마크 visible_staticcontrol("image_bg_01", true); visible_staticcontrol("back_inframe01", true); visible_staticcontrol("back_linframe02", true); visible_staticcontrol("line_select", false); // visible_staticcontrol("back_inframe03", true); insert_dungeon_info_help_title(); // 2011.09.07 - servantes insert_dungeon_info_title(); // 2011.09.07 - servantes insert_dungeon_title(3502); // dungeon title insert_seize_member_count(0); insert_raid_member_count(0); insert_own_guild(""); insert_guild_boss_name(""); insert_raid_situation_title(); // 2011.09.15 - servantes insert_raid_help_title(); insert_raid_help2_title(); int id=22, id2=3; for(int x=0; x(GetChild( "scrollbar_list_01" )); if(m_pScrollBar) m_pScrollBar->SetScrollRange(PART_SLOT_COUNT, PART_SLOT_COUNT); // test code // raid_slot_active(2); /* m_vecRaidList.push_back( Raid("길드1","길드장1",1,1,100) ); m_vecRaidList.push_back( Raid("길드2","길드장2",2,2,0) ); m_vecRaidList.push_back( Raid("길드3","길드장3",3,3,3000) ); m_vecRaidList.push_back( Raid("길드4","길드장4",4,4,0) ); m_vecRaidList.push_back( Raid("길드5","길드장5",5,5,0) ); m_vecRaidList.push_back( Raid("길드6","길드장6",6,6,2345) ); m_vecRaidList.push_back( Raid("길드6","길드장7",7,7,2345) ); m_vecRaidList.push_back( Raid("길드6","길드장8",8,8,2345) ); m_vecRaidList.push_back( Raid("길드6","길드장9",9,9,2345) ); m_vecRaidList.push_back( Raid("길드6","길드장10",10,10,2345) ); m_pScrollBar->SetScrollRange(4, m_vecRaidList.size()); raid_slot_active(4); raid_slot_insert_info(0, &m_vecRaidList[0]); raid_slot_insert_info(1, &m_vecRaidList[1]); raid_slot_insert_info(2, &m_vecRaidList[2]); raid_slot_insert_info(3, &m_vecRaidList[3]); */ /// 2011.10.12 - prodongi KUIControlSimpleButton* wndOk = dynamicCast(GetChild("button_ok")); if (wndOk) { wndOk->SetEnableColor("<#ffffff>"); wndOk->SetDisableColor("<#a0a0a0>"); } KUIControlSimpleButton* wndCancel = dynamicCast(GetChild("button_cancel")); if (wndCancel) { wndCancel->SetEnableColor("<#ffffff>"); wndCancel->SetDisableColor("<#a0a0a0>"); } return SUIWnd::InitControls( kPos ); } // 2011.09.02 - servantes void SUIDungeonStoneWnd::refreshInitImg() { //소프트웨어 락 char* pDstBuf = NULL; int nDstStride; if( m_spTexture == NULL ) return; m_spTexture->LockRect( NULL, (void**)&pDstBuf, nDstStride ); if( pDstBuf == NULL ) { assert( 0 && "Texture Pool Lock Failed!!!" ); return; } int nWidth = m_spTexture->GetWidth(); int nHeight = m_spTexture->GetHeight(); KColor* pColor; for(UINT y = 0; y < nHeight; y++ ) { pColor = ( KColor* )pDstBuf; for( UINT x = 0; x < nWidth; x++ ) { KColor col; col.r = 255; col.g = 255; col.b = 0; col.a = 255; pColor[x] = col; } pDstBuf += nDstStride; } m_spTexture->Unlock(); } void SUIDungeonStoneWnd::refreshCardImg() { if( m_strIllustImg == "NotFound" ) return; int offset = 0; POINT point; point.x = offset; point.y = offset; RECT rect; rect.left = offset; rect.top = offset; KStream *stream = KFileManager::Instance().CreateStreamFromResource( m_strIllustImg.c_str() ); //일러스트 없는 크리처 if( stream == NULL ) { // 크리쳐 일러파일 확장자 변경 tga->jpg // 2009-09-19 : hunee //stream = KFileManager::Instance().CreateStreamFromResource( "empty_card_red.tga" ); // 2010.09.08 - prodongi //stream = KFileManager::Instance().CreateStreamFromResource( "empty_card_red.jpg" ); stream = KFileManager::Instance().CreateStreamFromResource( "game_image_card_empty.jpg" ); } if ( stream == NULL) { char card[MAX_PATH]; sprintf(card, "%s", m_strIllustImg.c_str()); MessageBox(NULL, card, "Creature IllustImg File Not Found", MB_OK); return; } else { /// 2010.10.08 카드 이미지에 따라서 배경을 틀리게 해준다 prodongi SetChildShow("inframe", false); SetChildShow("inframe_gray", false); if (0 == m_strIllustImg.compare("game_image_card_empty.jpg")) SetChildShow("inframe_gray", true); else SetChildShow("inframe", true); K3DTextureDX * pSrcTex = new K3DTextureDX( (K3DRenderDeviceDX *)KDeviceManager::GetDeviceManager()->GetRenderDevice() ); pSrcTex->AddRef(); if( KUITextureManager::GetHWType() == KUITextureManager::HW_SUPPORT || KUITextureManager::GetHWType() == KUITextureManager::NOT_HW_SUPPORT ) { if( KUITextureManager::GetHWType() == KUITextureManager::HW_SUPPORT ) { pSrcTex->Initialize( *stream, 0, D3DPOOL_SYSTEMMEM, K3DFMT_A8R8G8B8 ); rect.right = pSrcTex->GetWidth()-offset; rect.bottom = pSrcTex->GetHeight()-offset; if( KDeviceManager::GetDeviceManager()->GetRenderDevice()->UpdateSurface( pSrcTex, &rect, m_spTexture, &point ) != D3D_OK ) { } } else if( KUITextureManager::GetHWType() == KUITextureManager::NOT_HW_SUPPORT ) { pSrcTex->Initialize( *stream, 0, D3DPOOL_MANAGED, K3DFMT_A8R8G8B8 ); rect.right = pSrcTex->GetWidth()-offset; rect.bottom = pSrcTex->GetHeight()-offset; //소프트웨어 락 char* pDstBuf = NULL; char* pSrcBuf = NULL; int nSrcStride, nDstStride; pSrcTex->LockRect( NULL, (void**)&pSrcBuf, nSrcStride ); if( pSrcBuf == NULL ) { assert( 0 && "Texture Src Lock Failed!!!" ); return; } KRect krect = KRect(point.x, point.y, point.x+rect.right, point.y+rect.bottom); m_spTexture->LockRect( &krect, (void**)&pDstBuf, nDstStride ); if( pDstBuf == NULL ) { assert( 0 && "Texture Pool Lock Failed!!!" ); return; } SetCopy( pSrcBuf, nSrcStride, pDstBuf, nDstStride, rect.right, rect.bottom ); pSrcTex->Unlock(); m_spTexture->Unlock(); } ////////////////////////////////////////////////////////////////////////// } else if( KUITextureManager::GetHWType() == KUITextureManager::NOTPOW_SUPPORT ) { _TEX_SRC_INFO _src_info; //TGA 직접 로딩 방법------------------------------------------------------ if( TGAReadImage( stream, &_src_info.nWidth, &_src_info.nHeight, &_src_info.nBitDepth, &_src_info.pSrcTexel ) ) { rect.right = _src_info.nWidth-offset; rect.bottom = _src_info.nHeight-offset; //소프트웨어 락 char* pDstBuf = NULL; char* pSrcBuf = NULL; int nDepth = (_src_info.nBitDepth/8); int nSrcStride, nDstStride; nSrcStride = _src_info.nWidth * nDepth; pSrcBuf = (char*)_src_info.pSrcTexel; KRect krect = KRect(point.x, point.y, point.x+rect.right, point.y+rect.bottom); m_spTexture->LockRect( &krect, (void**)&pDstBuf, nDstStride ); if( pDstBuf == NULL ) { assert( 0 && "Texture Pool Lock Failed!!!" ); return; } if( nDepth == 4 ) //32Bit 지원 { SetCopy( pSrcBuf, nSrcStride, pDstBuf, nDstStride, rect.right, rect.bottom ); } m_spTexture->Unlock(); } } SAFE_RELEASE( pSrcTex ); KFileManager::Instance().DeleteStream( stream ); } } void SUIDungeonStoneWnd::OnDeviceLost() { refreshInitImg(); refreshCardImg(); KUIControlDynamicTexture* pWndDynamicTex = dynamicCast(GetChild( "back_image_dungeon_01" )); if( pWndDynamicTex ) pWndDynamicTex->SetRenderTarget( m_spTexture, nCardImgWidth, nCardImgHeight ); } void SUIDungeonStoneWnd::visible_staticcontrol(const char* ptr_control_name, bool bShow) { int k=0; KUIControlStatic* pStatic = (KUIControlStatic*)(GetChild( ptr_control_name )); if(pStatic) { pStatic->SetShow(bShow); } } void SUIDungeonStoneWnd::insert_string_staticcontrol(const char* ptr_control_name, const char* ptr_option, const char* ptr_content) { KUIControlStatic* pText1 = (KUIControlStatic*)(GetChild( ptr_control_name )); if(pText1) { std::string strCaption = ptr_option; strCaption += ptr_content; pText1->SetCaption(strCaption.c_str()); } } // 던전 정보 void SUIDungeonStoneWnd::insert_dungeon_info_help_title() // 2011.09.07 - servantes { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("text_manual_01", "<#626262>", GetStringDB().GetString( 9819 )); } void SUIDungeonStoneWnd::insert_dungeon_info_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("titletext_01", "<#246771>", GetStringDB().GetString( 1849 )); } void SUIDungeonStoneWnd::insert_dungeon_title(int id_string) { insert_string_staticcontrol("dungeon_info_text_01", "<#f7941d>", GetStringDB().GetString( id_string )); } void SUIDungeonStoneWnd::insert_dungeon_title(const char* ptr_dungeon_name) { insert_string_staticcontrol("dungeon_info_text_01", "<#f7941d>", ptr_dungeon_name); } void SUIDungeonStoneWnd::insert_dungeon_grade_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("dungeon_info_text_02", "<#626262>", GetStringDB().GetString( 3503 )); } void SUIDungeonStoneWnd::insert_dungeon_grade(int id_level) { char strGrade[16]={0}; sprintf(strGrade, "%s", GetDungeonRank(id_level).c_str()); insert_string_staticcontrol("dungeon_info_text_03", "", strGrade); } void SUIDungeonStoneWnd::insert_seize_apply_level_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("dungeon_info_text_04", "<#626262>", GetStringDB().GetString( 9583 )); } void SUIDungeonStoneWnd::insert_seize_apply_level(int id_level) { char strLevel[16]={0}; sprintf(strLevel, "%s %d", GetStringDB().GetString(9501), id_level); insert_string_staticcontrol("dungeon_info_text_05", "", strLevel); } void SUIDungeonStoneWnd::insert_seize_member_count_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("dungeon_info_text_06", "<#626262>", GetStringDB().GetString( 3504 )); } void SUIDungeonStoneWnd::insert_seize_member_count(int id_member_count) { std::string playerNum, partyNum; XStringUtil::Format(playerNum, "%d", id_member_count); XStringUtil::Format(partyNum, "%d", id_member_count/8); std::string str; str = SR(12012, "#@value1@#", playerNum.c_str(), "#@value2@#", partyNum.c_str()); insert_string_staticcontrol("siege_Participation_text_02", "", str.c_str()); } void SUIDungeonStoneWnd::insert_raid_member_count_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("dungeon_info_text_08", "<#626262>", GetStringDB().GetString( 9564 )); } void SUIDungeonStoneWnd::insert_raid_member_count(int id_member_count) { std::string playerNum, partyNum; XStringUtil::Format(playerNum, "%d", id_member_count); XStringUtil::Format(partyNum, "%d", id_member_count/8); std::string str; str = SR(12012, "#@value1@#", playerNum.c_str(), "#@value2@#", partyNum.c_str()); insert_string_staticcontrol("raid_Participation_text_02", "", str.c_str()); } void SUIDungeonStoneWnd::insert_tax_rate_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("dungeon_info_text_10", "<#626262>", GetStringDB().GetString( 9565 )); } void SUIDungeonStoneWnd::insert_tax_rate(float rate) { char strRate[16]={0}; sprintf(strRate, "%3.3f", rate); insert_string_staticcontrol("dungeon_info_text_11", "", strRate); } void SUIDungeonStoneWnd::insert_dungeon_boss_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("dungeon_info_text_12", "<#626262>", GetStringDB().GetString( 9566 )); } void SUIDungeonStoneWnd::insert_dungeon_boss(int id_name_boss, int id_name_boss2) { char const* name; /// 2011.12.15 보스가 없을 때는 빈 공백 출력 - prodongi name = (id_name_boss >= 0) ? S(id_name_boss) : ""; insert_string_staticcontrol("dungeon_info_text_13", "", name); name = (id_name_boss2 >= 0) ? S(id_name_boss2) : ""; insert_string_staticcontrol("dungeon_info_text_14", "", name); } // 던전 소유 길드 정보 void SUIDungeonStoneWnd::insert_own_guild_info_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("titletext_02", "", GetStringDB().GetString( 9569 )); } void SUIDungeonStoneWnd::insert_own_guild(const char* ptr_guild_name) { insert_string_staticcontrol("guild_info_text_02", "<#f7941d>", ptr_guild_name); } void SUIDungeonStoneWnd::insert_guild_boss_name_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("guild_info_text_03", "<#626262>", GetStringDB().GetString( 1810 )); } void SUIDungeonStoneWnd::insert_guild_boss_name(const char* ptr_boss_name) { insert_string_staticcontrol("guild_info_text_04", "", ptr_boss_name); } void SUIDungeonStoneWnd::insert_alliance_guild_title(int id_string) { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("guild_info_text_05", "<#626262>", GetStringDB().GetString( 9567 )); } void SUIDungeonStoneWnd::insert_alliance_guild(const char* ptr_guild_name) { insert_string_staticcontrol("guild_info_text_06", "", ptr_guild_name); } void SUIDungeonStoneWnd::insert_guild_member_title(int id_string) { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("guild_info_text_07", "<#626262>", GetStringDB().GetString( 3509 )); } void SUIDungeonStoneWnd::insert_guild_member(int count_member) { char strCount[16]={0}; if(count_member == 0) sprintf(strCount, " "); else sprintf(strCount, "%d %s", count_member, S(1853)); insert_string_staticcontrol("guild_info_text_08", "", strCount); } // 레이드 현황 void SUIDungeonStoneWnd::insert_raid_situation_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("titletext_03", "<#246771>", GetStringDB().GetString( 9570 )); } void SUIDungeonStoneWnd::insert_raid_help_title() { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("text_manual", "<#626262>", GetStringDB().GetString( 9820 )); } void SUIDungeonStoneWnd::insert_raid_help2_title() // 2011.09.15 - servantes { /// 2011.11.15 필요 없는 부분이라서 주석 처리 함 - prodongi //insert_string_staticcontrol("text_manual_02", "<#626262>", GetStringDB().GetString( 9821 )); } // 레이드 현황 정보 void SUIDungeonStoneWnd::raid_slot_active(int count_slot) { /// 2011.12.15 슬롯 개수가 4개로 바뀌었다 - prodongi int x = 0; for (; x < count_slot; ++x) raid_slot_visible(x, true); for (; x < PART_SLOT_COUNT; ++x) raid_slot_visible(x, false); } void SUIDungeonStoneWnd::raid_slot_visible(int id_slot, bool bShow) { if(id_slot < 0 || id_slot > 3) return ; m_pSlot_number_title [id_slot]->SetShow(bShow); m_pSlot_guildName [id_slot]->SetShow(bShow); m_pSlot_timeAttack_title [id_slot]->SetShow(bShow); m_pSlot_timeAttack [id_slot]->SetShow(bShow); m_pSlot_guildMemberCount_title[id_slot]->SetShow(bShow); m_pSlot_guildMemberCount [id_slot]->SetShow(bShow); m_pSlot_guildBossName_title [id_slot]->SetShow(bShow); m_pSlot_guildBossName [id_slot]->SetShow(bShow); m_pSlot_bg [id_slot]->SetShow(bShow); } void SUIDungeonStoneWnd::raid_slot_insert_info(int id_slot, Raid* ptr_raid_info) { if(NULL == ptr_raid_info) return ; if(id_slot < 0 || id_slot > PART_SLOT_COUNT) return ; char buf[256]={0}; std::string strCaption = ""; strCaption += ptr_raid_info->strGuildName; m_pSlot_guildName[id_slot]->SetCaption(strCaption.c_str()); /// 2011.10.13 - prodongi int t = ptr_raid_info->nTime/100; int s = t%60; int m = (t/60)%60; int h = t/3600; sprintf(buf, "<#ed145a>'%02d:%02d:%02d", h, m, s); m_pSlot_timeAttack[id_slot]->SetCaption(buf); sprintf(buf, "%d %s", ptr_raid_info->nUserCnt, S(1853)); m_pSlot_guildMemberCount[id_slot]->SetCaption(buf); strCaption = ""; strCaption += ptr_raid_info->strMasterName; m_pSlot_guildBossName[id_slot]->SetCaption(strCaption.c_str()); } bool SUIDungeonStoneWnd::InitData( bool bReload /*= false*/ ) { return SUIWnd::InitData( bReload ); } void SUIDungeonStoneWnd::ClearList() { KUIControIStringList* pList = (KUIControIStringList*)(GetChild("list")); if( pList ) pList->ClearItem(); m_vecRaidList.clear(); } void SUIDungeonStoneWnd::ClearDungeonInfo() { // 2011.09.09 - servantes m_sDungeonInfo.strDungeonName.clear(); m_sDungeonInfo.nLv = 0; m_sDungeonInfo.nSiegeCnt = 0; m_sDungeonInfo.nRaidCnt = 0; m_sDungeonInfo.strGuild.clear(); m_sDungeonInfo.strMaster.clear(); m_sDungeonInfo.bAlliance = false; m_sDungeonInfo.UserCnt = 0; m_sDungeonInfo.nApplicationCnt = 0; /// 2011.10.12 빠진거 같음 - prodongi ClearList(); } void SUIDungeonStoneWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch( nMessage ) { // 2011.09.02 - servantes case KUI_MESSAGE::KSCROLL_SELECT: // 스크롤 선택 { if( ::strcmp(lpszControlID, "scrollbar_list_01") == 0 ) { int nPos = int(lparam); nPos = max( nPos, 0 ); refreshFirstRankMarks(nPos); int x=0, k=0; int cnt = m_vecRaidList.size(); for(x=nPos; x< nPos + PART_SLOT_COUNT; x++, k++) { if(x >= cnt) break; raid_slot_insert_info(k, &m_vecRaidList[x]); } } break; } case KUI_MESSAGE::KBUTTON_CLICK: { if( ::_stricmp( lpszControlID, "button_close" ) == 0 ) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DUNGEON_STONE , false) ); } else if( ::_stricmp( lpszControlID, "button_ok" ) == 0 ) //servantes 2010.10.13 { //신청 버튼 m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_DUNGEONSTONE_REQUEST, S(2804), true ) ); } else if( ::_stricmp( lpszControlID, "button_cancel" ) == 0 ) //servantes 2010.10.13 { //취소 버튼 m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_DUNGEONSTONE_CANCEL, S(2806), true ) ); } /* 2011.10.12 관리 모드는 없음 - prodongi else if( ::_stricmp( lpszControlID, "button_manage" ) == 0 ) //servantes 2010.10.13 { //관리 버튼 m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_DUNGEONSTONE_MANAGE, S(3520), true ) ); } */ // 2011.09.05 - servantes else if( ::_stricmp( lpszControlID, "button_help_01" ) == 0 ) { const KRect & rt = GetChild( "button_help_01" )->GetRect(); // 2011.09.15 - servantes : 도움말 내용 추가 m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, false ) ); // 닫기. m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, rt.left, rt.top ) ); // 위치전달. m_pGameManager->PostMsgAtDynamic( new SIMSG_HELP_TEXT( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, std::string( S( 9822 ) ) ) ); // 텍스트전달. m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, true ) ); // 열기. } else if( ::_stricmp( lpszControlID, "button_help_02" ) == 0 ) // 2011.09.15 - servantes : 도움말 내용 추가 { const KRect & rt = GetChild( "button_help_02" )->GetRect(); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, false ) ); // 닫기. m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, rt.left, rt.top ) ); // 위치전달. m_pGameManager->PostMsgAtDynamic( new SIMSG_HELP_TEXT( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, std::string( S( 9823 ) ) ) ); // 텍스트전달. m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_WND, true ) ); // 열기. } } break; case KUI_MESSAGE::KGENWND_MOVE: { LimitMoveWnd(); } } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } void SUIDungeonStoneWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { switch( pMsg->nType ) { case MSG_NPC_DIALOG: { SMSG_NPC_DIALOG* pNPCDlgMsg = (SMSG_NPC_DIALOG*)pMsg; ClearDungeonInfo(); SetDungeonInfo(pNPCDlgMsg); SetRaidList(pNPCDlgMsg); SetControlButton(pNPCDlgMsg); UpdateStoneInfo(); } break; case IMSG_UI_DUNGEONSTONE: { SIMSG_UI_DUNGEONSTONE* pDungeonMsg = (SIMSG_UI_DUNGEONSTONE*)pMsg; if( pDungeonMsg->m_nReqType == SIMSG_UI_DUNGEONSTONE::DUNGEONSTONE_REQUEST ) { if( m_strHanDle[0] != " " ) { m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_ACT_NPCDIALOG(m_strHanDle[0].c_str()) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DUNGEON_STONE, false ) ); ClearList(); // bintitle 2010.06.14. 레이드신청시, 길드UI - 길드관리 - 공격대결성 UI에 알림. this->m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE::UIWINDOW_GUILD_SUB_MANAGE, "RAID_REQUEST" ) ); m_pGameManager->GetGameInterface()->OpenMessageBox(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OKCANCEL, SIMSG_REQ_OPEN_MSGBOX::MSGBOX_COMPOSE_RAID, 0, -1, S(2805)); } } else if( pDungeonMsg->m_nReqType == SIMSG_UI_DUNGEONSTONE::DUNGEONSTONE_CANCEL ) { if( m_strHanDle[1] != " " ) { m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_ACT_NPCDIALOG(m_strHanDle[1].c_str()) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DUNGEON_STONE, false ) ); ClearList(); } } /* /// 2011.10.12 관리 모드는 없음 - prodongi else if( pDungeonMsg->m_nReqType == SIMSG_UI_DUNGEONSTONE::DUNGEONSTONE_MANAGE ) { if( m_strHanDle[2] != " " ) { m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_ACT_NPCDIALOG(m_strHanDle[2].c_str()) ); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DUNGEON_STONE, false ) ); ClearList(); } } */ } break; } } int SUIDungeonStoneWnd::GetLocalFlag() { // sonador 0.2.2 국가별 로컬 비트셋 통합 및 유럽 분리 return GameRule::GetCurrentLocalBitSet(); } void SUIDungeonStoneWnd::SetDungeonInfo(SMSG_NPC_DIALOG* pNPCDlgMsg) { if( pNPCDlgMsg == NULL ) return; std::vector DungeonStrList; GetStringList(DungeonStrList, pNPCDlgMsg->strTitle); int nDungeonNum(0); const DungeonResource* pDungeon(NULL); int nSize = DungeonStrList.size(); if( nSize >=2 ) { // 2011.09.09 - servantes m_sDungeonInfo.nDugeonID = ::atoi( DungeonStrList[0].c_str() ); m_sDungeonInfo.nApplicationCnt = ::atoi( DungeonStrList[1].c_str() ); setStatus(atoi(DungeonStrList[3].c_str())); /// 2012.01.11 던전 진행 상황 - prodongi pDungeon = GetDungeonResDB().GetDungeonRes(m_sDungeonInfo.nDugeonID, GetLocalFlag()); } if( nSize >= 7 ) { // 2011.09.09 - servantes m_sDungeonInfo.nRate = ::atoi(DungeonStrList[2].c_str()); // 2011.09.09 - servantes m_sDungeonInfo.strGuild = DungeonStrList[4]; m_sDungeonInfo.strMaster = DungeonStrList[5]; m_sDungeonInfo.bAlliance = (::atoi(DungeonStrList[6].c_str()) != 0); // 연합여부 m_sDungeonInfo.UserCnt = ::atoi(DungeonStrList[7].c_str()); insert_tax_rate(m_sDungeonInfo.nRate); } DungeonStrList.clear(); if( pDungeon ) { int nDungeonNameID( GetDungeonResDB().GetDungeonNameID(pDungeon->id) ); m_sDungeonInfo.strDungeonName = GetStringDB().GetString( nDungeonNameID ); m_sDungeonInfo.nLv = pDungeon->dungeon_level; m_sDungeonInfo.nSiegeCnt = pDungeon->num_party_guild*8 + pDungeon->num_party_mercenary*8; m_sDungeonInfo.nRaidCnt = pDungeon->num_party_raid * 8; // 2011.09.05 - servantes // 던전정보 insert_dungeon_title(nDungeonNameID); insert_dungeon_grade(m_sDungeonInfo.nLv); insert_seize_apply_level(pDungeon->dungeon_level); insert_seize_member_count(m_sDungeonInfo.nSiegeCnt); insert_raid_member_count(m_sDungeonInfo.nRaidCnt); const DungeonResource* pDRes = GetDungeonResDB().GetDungeonRes(pDungeon->id, GetLocalFlag()); if(pDRes) { ENC_INT mobId = bits_scramble< int, 3 >( pDRes->boss01_id ); int value = mobId.value(); ENC_INT mobId2 = bits_scramble< int, 3 >( pDRes->boss02_id ); int value2 = mobId2.value(); int nMonsterName2 = GetMonsterDB().GetTextID( value2 ); int nMonsterName = GetMonsterDB().GetTextID( value ); if( nMonsterName ) { insert_dungeon_boss(nMonsterName, nMonsterName2); } } //소유길드 정보 insert_own_guild(m_sDungeonInfo.strGuild.c_str()); insert_guild_boss_name(m_sDungeonInfo.strMaster.c_str()); insert_guild_member(m_sDungeonInfo.UserCnt); visible_1st_slot_select(true); // test code // 소유 길드 정보 // insert_own_guild(); // insert_guild_boss_name(); // insert_alliance_guild(); // insert_guild_member(); // 레이드 현황 } // 2011.09.05 - servantes switch(m_sDungeonInfo.nDugeonID) { case 130000: m_strIllustImg = "game_panel_image_dungeon_03.jpg"; break; //잃어버린 갱도 제 1 탄광 case 130300: m_strIllustImg = "game_panel_image_dungeon_05.jpg"; break; //제 1 수정 계곡 case 130600: m_strIllustImg = "game_panel_image_dungeon_04.jpg"; break; //잃어버린 갱도 제 2 탄광 case 130500: m_strIllustImg = "game_panel_image_dungeon_06.jpg"; break; //제 2 수정 계곡 case 130400: m_strIllustImg = "game_panel_image_dungeon_01.jpg"; break; //메마른 달빛의 유적 제 1 실 case 130700: m_strIllustImg = "game_panel_image_dungeon_02.jpg"; break; //메마른 달빛의 유적 제 2 실 case 130800: m_strIllustImg = "game_panel_image_dungeon_07.jpg"; break; //팔미르 유적 제 1 실 case 130900: m_strIllustImg = "game_panel_image_dungeon_08.jpg"; break; //팔미르 유적 제 2 실 case 121000: m_strIllustImg = "game_panel_image_dungeon_10.jpg"; break; //백룡의 쉼터 case 122000: m_strIllustImg = "game_panel_image_dungeon_11.jpg"; break; //흑룡의 그늘 case 123000: m_strIllustImg = "game_panel_image_dungeon_12.jpg"; break; //사룡의 심장 case 120700: m_strIllustImg = "game_panel_image_dungeon_09.jpg"; break; //엘 카시아 default : m_strIllustImg = "error"; break; // error } KUIControlDynamicTexture* pWndDynamicTex = dynamicCast(GetChild( "back_image_dungeon_01" )); if( pWndDynamicTex ) pWndDynamicTex->SetRenderTarget( m_spTexture, nCardImgWidth, nCardImgHeight ); refreshInitImg(); refreshCardImg(); } void SUIDungeonStoneWnd::SetRaidList(SMSG_NPC_DIALOG* pNPCDlgMsg) { /// 2011.10.13 - prodongi if( pNPCDlgMsg == NULL || pNPCDlgMsg->vtTexts.empty() ) { raid_slot_active(0); visible_leader_mark(false); visible_1st_slot_select(false); return; } std::vector GuildList; GetStringList(GuildList, pNPCDlgMsg->vtTexts[0]); int nGuildListSize( GuildList.size() ); //for( int i=0, j=0; j < m_sDungeonInfo.nApplicationCnt && i < nGuildListSize; i+=7, ++j ) //{ // if( 6+i < nGuildListSize ) // { // Raid raid( GuildList[0+i], GuildList[1+i], ::atoi( GuildList[2+i].c_str() ), GuildList[3+i], ::atoi( GuildList[4+i].c_str() ), ::atoi( GuildList[5+i].c_str() ), ::atoi( GuildList[6+i].c_str() ) ); // m_vecRaidList.push_back( raid ); // } //} // 2011.09.02 - servantes if(nGuildListSize) visible_1st_slot_select(true); // 2011.09.09 - servantes // 2010.06.11. bintitle. // 공격대장, 공경대장레벨 제외. for( int i=0, j=0; j < m_sDungeonInfo.nApplicationCnt && i < nGuildListSize; i+=5, ++j ) { if( 4+i < nGuildListSize ) { Raid raid( GuildList[0+i], GuildList[1+i], ::atoi( GuildList[2+i].c_str() ), ::atoi( GuildList[3+i].c_str() ), ::atoi( GuildList[4+i].c_str() ) ); m_vecRaidList.push_back( raid ); } } SortRaidList(); int showNum = ::min((int)MAX_SHOW_LIST, (int)m_vecRaidList.size()); raid_slot_active(showNum); for (int i = 0; i < showNum; ++i) raid_slot_insert_info(i, &m_vecRaidList[i]); // 2011.09.21 servantes : UI 리스트에 내용 추가 refreshFirstRankMarks(0); GuildList.clear(); } void SUIDungeonStoneWnd::SetControlButton(SMSG_NPC_DIALOG* pNPCDlgMsg) { for( int i(0); ivtMenus.size(); ++i ) { SMSG_NPC_DIALOG::DLGMENU dlgMenu(pNPCDlgMsg->vtMenus[i].strMenuName.c_str(), pNPCDlgMsg->vtMenus[i].strTrigger.c_str(), pNPCDlgMsg->vtMenus[i].nButtonType); if( dlgMenu.strMenuName == "REQUEST") { m_strHanDle[0] = dlgMenu.strTrigger; KUIControl* pButton = dynamicCast(GetChild("button_ok")); if( pButton ) { if( dlgMenu.strTrigger == " " ) pButton->Disable(); else pButton->Enable(); } } else if( dlgMenu.strMenuName == "CANCEL") { m_strHanDle[1] = dlgMenu.strTrigger; KUIControl* pButton = dynamicCast(GetChild("button_cancel")); if( pButton ) { if( dlgMenu.strTrigger == " " ) pButton->Disable(); else pButton->Enable(); } } /* 2011.10.12 던전 관리는 없다 - prodongi else if( dlgMenu.strMenuName == "MANAGE") { m_strHanDle[2] = dlgMenu.strTrigger; KUIControl* pButton = dynamicCast(GetChild("button02")); if( pButton ) { if( dlgMenu.strTrigger == " " ) pButton->Disable(); else pButton->Enable(); } } */ } /* 2011.10.12 던전 관리는 없다 - prodongi //현재는 던선 커스터마이징 미구현 KUIControl* pButton = dynamicCast(GetChild("button02")); if( pButton ) pButton->Disable(); */ } std::string SUIDungeonStoneWnd::GetDungeonRank(int nLv) { if( nLv <= 50 ) return GetStringDB().GetString( 9502 ); // "BASIC"; else if( nLv <= 70 ) return GetStringDB().GetString( 9503 ); // "COMMON"; else if( nLv <= 90 ) return GetStringDB().GetString( 9504 ); // "UNCOMMON"; else if( nLv <= 120 ) return GetStringDB().GetString( 9505 ); // "RARE"; else return GetStringDB().GetString( 9506 ); // "UNIQUE"; } void SUIDungeonStoneWnd::SetDungeonInfoCaption(DungeonInfo dungeon) { // 2011.09.09 - servantes insert_dungeon_title(dungeon.strDungeonName.c_str()); // 던전이름 insert_dungeon_grade(dungeon.nLv); // 던전 레벨 insert_seize_apply_level(dungeon.nLv); // 시즈 신청레벨 insert_seize_member_count(dungeon.nSiegeCnt); // 시즈 인원 insert_raid_member_count(dungeon.nRaidCnt); insert_own_guild(dungeon.strGuild.c_str()); // 길드 이름 insert_guild_boss_name(dungeon.strMaster.c_str()); // 길드장 이름 } std::string SUIDungeonStoneWnd::GetListCaption(Raid raid) { std::string TempCaption = SR(3516,"#@guild_name@#", raid.strGuildName.c_str(), "#@master_name@#", raid.strMasterName.c_str() ); TempCaption = SStringDB::ParseString( TempCaption.c_str(), "#@master_lv@#", CStringUtil::StringFormat( "%d", raid.nMasterLv ).c_str() ); TempCaption = SStringDB::ParseString( TempCaption.c_str(), "#@cnt@#", CStringUtil::StringFormat( "%d", raid.nUserCnt ).c_str() ); TempCaption = SStringDB::ParseString( TempCaption.c_str(), "#@time@#", GetTimeString( raid.nTime/100.0f ).c_str() ); return TempCaption; } std::string SUIDungeonStoneWnd::GetTimeString( float f_Time ) { std::string strTime; int hour(0); int min(0); int sec(0); if( f_Time >= 3600 ) { hour = f_Time/3600; f_Time -= 3600*hour; } if( f_Time >= 60 ) { min = f_Time/60; f_Time = f_Time -= 60*min; } sec = f_Time; strTime = CStringUtil::StringFormat( " %02d : %02d : %02d", hour, min, sec ); return strTime; } void SUIDungeonStoneWnd::UpdateStoneInfo() { SetDungeonInfoCaption( m_sDungeonInfo ); KUIControIStringList* pList = (KUIControIStringList*)(GetChild("list")); if( !pList ) return; for( int i(0); iAddItem( _STRITEM(GetListCaption(m_vecRaidList[i]).c_str()) ); } } void SUIDungeonStoneWnd::SortRaidList() { struct TRaidLess { //두인자가 같을 경우 무조건 false가 나오도록 해야한다. 흠 false가 바꾸는 것인데... bool operator () ( const Raid& a, const Raid& b ) { if ( a.nTime == 0 ) return false; else if ( b.nTime == 0 ) return true; else return a.nTime < b.nTime; } } pred; std::sort( m_vecRaidList.begin(), m_vecRaidList.end(), pred ); } void SUIDungeonStoneWnd::GetStringList( std::vector& rStrList, std::string Text ) { std::vector vStrList; MsgSplit( Text.c_str(), vStrList, L"|" ); for( int i(0); iStartSound( "ui_popup_window01.wav" ); SUIWnd::OnNotifyUIWindowOpen( bOpen, bLimitWnd ); } void SUIDungeonStoneWnd::visible_leader_mark(bool bShow) // 2011.09.09 - servantes : 공대장마크 표시 { m_pSlot_leader_mark->SetShow(bShow); } void SUIDungeonStoneWnd::visible_1st_slot_select(bool bShow) // 2011.09.09 - servantes : 1번슬롯 표시 { m_pSlot_select->SetShow(bShow); } void SUIDungeonStoneWnd::refreshFirstRankMarks(int index) { bool showLeaderMark = false; if(0 == index && !m_vecRaidList.empty()) { if (0 != m_vecRaidList[0].nTime) showLeaderMark = true; } visible_leader_mark(showLeaderMark); visible_1st_slot_select(showLeaderMark); } void SUIDungeonStoneWnd::setStatus(int status) { KUIControlStatic* staticRaid = dynamicCast(GetChild("dungeon_term_text_raid")); KUIControlStatic* staticRest_Before = dynamicCast(GetChild("dungeon_term_text_rest")); KUIControlStatic* staticSiege = dynamicCast(GetChild("dungeon_term_text_siege")); KUIControlStatic* staticRest_After = dynamicCast(GetChild("dungeon_term_text_rest_01")); /// 진행 상황 텍스트 회색으로 std::string temp; XStringUtil::Format(temp, "<#545454>%s", S(9837)); staticRaid->SetCaption(temp.c_str()); XStringUtil::Format(temp, "<#545454>%s", S(9838)); staticRest_Before->SetCaption(temp.c_str()); XStringUtil::Format(temp, "<#545454>%s", S(9839)); staticSiege->SetCaption(temp.c_str()); XStringUtil::Format(temp, "<#545454>%s", S(9838)); staticRest_After->SetCaption(temp.c_str()); char const* aniName = ""; KUIControlStatic* staticCur = staticRaid; int stringId = 0; switch (status) { case STATUS_RAID: aniName = "game_panel_titanium_dungeon_term_raid"; staticCur = staticRaid; stringId = 9837; break; case STATUS_REST_BEFORE_SIEGE: aniName = "game_panel_titanium_dungeon_term_rest"; staticCur = staticRest_Before; stringId = 9838; break; case STATUS_SIEGE: aniName = "game_panel_titanium_dungeon_term_siege"; staticCur = staticSiege; stringId = 9839; break; case STATUS_REST_AFTER_SIEGE: aniName = "game_panel_titanium_dungeon_term_rest"; staticCur = staticRest_After; stringId = 9838; break; } XStringUtil::Format(temp, "%s", S(stringId)); staticCur->SetCaption(temp.c_str()); KUIControlStatic* staticStatus = dynamicCast(GetChild("dungeon_term_raid")); staticStatus->SetBack(c_szDEF_SPR_NAME, aniName); }