#include "stdafx.h" #include "SUILoadingWnd.h" //#include "KUIControl.h" #include "KUIControlEdit.h" #include "KUIControlStatic.h" #include "KUIControlScroll.h" #include "KUIControlClockBox.h" #include "KUIControlQJTV.h" #include "KDeviceManager.h" #include "KRenderDevice.h" #include "KUITextureManager.h" //#include "Util.h" #include "KCommandBuilder.h" #include #include "KResourceDX.h" #include #include #include "SGameMessage.h" //#include "SGameMessageUI.h" #include "SStringDB.h" #include "SUIDefine.h" #include "KTGA_IO.h" #include "SGameManager.h" #include #include "GameRule.h" #include "SGameOption.h" #include "SGameSystem.h" #include "SGameAvatarEx.h" #include "SBattleArenaDB.h" extern SGameSystem * g_pCurrentGameSystem; #define RP2AP(fRelativePoint, fWidth) (int)(((float)fRelativePoint * (float)fWidth) + 0.5f) ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //SUILoadingWnd namespace { int nFixImgWidth = 1024; int nFixImgHeight = 768; //850/270 경고문 사이즈 int nKoreaWarringWidth = 850; int nKoreaWarringHeight = 270; const char *szPanelImg = "loading_type01_pane.png"; const char* pLoadImgFileName[] = { "loading_image01.jpg", "loading_image02.jpg", "loading_image03.jpg", "loading_image04.jpg", "loading_image05.jpg", "loading_image06.jpg", "loading_image07.jpg", "loading_image08.jpg", "loading_image09.jpg", "loading_image10.jpg", "loading_image11.jpg", "loading_image12.jpg", "loading_image13.jpg", "loading_image14.jpg", "loading_image15.jpg", "loading_image16.jpg", "loading_image17.jpg", "loading_image18.jpg", "loading_image19.jpg", "loading_image20.jpg", "loading_image21.jpg", "loading_image22.jpg", "loading_image23.jpg", "loading_image24.jpg", "loading_image25.jpg", "loading_image26.jpg", "loading_image27.jpg", "loading_image28.jpg", "loading_image29.jpg", // 에픽 9.1 "loading_image30.jpg", "loading_image31.jpg", "loading_image32.jpg", "loading_image33.jpg", "loading_image34.jpg", }; const int c_nMsgRatio = 4; }; extern void SetCopy( char * pSrc, const int nSrcStride, char * pDst, const int nDstStride, const int nWidth, const int nHeight ); short SUILoadingWnd::s_nForceRenderKoreaWarring = 1; bool SUILoadingWnd::s_bFirstLoading = true; bool g_AdultMode = false; extern void LoadTexture(const char *filename, K3DTexture* texture); void LoadTexture(const char *filename, K3DTexture* texture) { POINT point; point.x = 0; point.y = 0; RECT rect; rect.left = 0; rect.top = 0; KStream *stream = KFileManager::Instance().CreateStreamFromResource( filename); if( stream != NULL ) { 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(); rect.bottom = pSrcTex->GetHeight(); if( KDeviceManager::GetDeviceManager()->GetRenderDevice()->UpdateSurface( pSrcTex, &rect, texture, &point ) != D3D_OK ) { } } else if( KUITextureManager::GetHWType() == KUITextureManager::NOT_HW_SUPPORT ) { pSrcTex->Initialize( *stream, 0, D3DPOOL_MANAGED, K3DFMT_A8R8G8B8 ); rect.right = pSrcTex->GetWidth(); rect.bottom = pSrcTex->GetHeight(); //소프트웨어 락 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); texture->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(); texture->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; rect.bottom = _src_info.nHeight; //소프트웨어 락 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); texture->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 ); } texture->Unlock(); } } SAFE_RELEASE( pSrcTex ); KFileManager::Instance().DeleteStream( stream ); } } SUILoadingWnd::SUILoadingWnd(SGameManager* pGameManager) : SUIWnd(pGameManager) , m_dwTime( 0 ) , m_dwWarringTime( 0 ) , m_pMessageSelector( 0 ) , m_spLoadingTexture(NULL) , m_spPanelTexture(NULL) , m_pkWndLoadingProgress(NULL) , m_pWndUpinfo(NULL) , m_pWndDowninfo(NULL) , m_pWndGamerating_15(NULL) , m_pWndGamerating_18(NULL) , m_pWndRappelzLogo(NULL) , m_pWndPublisherLogo(NULL) , m_pWndNFlaverLogo(NULL) , m_pWndNowLoading(NULL) , m_wndCopyRight(NULL) // 2010.07.14 - prodongi { } SUILoadingWnd::~SUILoadingWnd() { SAFE_DELETE( m_pkWndLoadingProgress ); SAFE_DELETE( m_pMessageSelector ); } bool SUILoadingWnd::CreateControls( class KUIWndManager* pWndManager ) { KRect colorRect, loadRect, msgRect; colorRect.left = 0; colorRect.right = KUIWndManager::GetResolution().cx; colorRect.top = 0; colorRect.bottom = KUIWndManager::GetResolution().cy; int nWidth = KUIWndManager::GetResolution().cx; int nHeight = KUIWndManager::GetResolution().cy; float fWidth = (float)KUIWndManager::GetResolution().cx; float fHeight = (float)KUIWndManager::GetResolution().cy; int nHalfWidth = nWidth/2; int nHalfHeight = nHeight/2; loadRect.left = nHalfWidth - nHeight * 4 / 3 / 2; loadRect.right = nHalfWidth - nHeight * 4 / 3 / 2 + KUIWndManager::GetResolution().cy * 4 / 3;////nFixImgWidth; loadRect.top = 0; loadRect.bottom = KUIWndManager::GetResolution().cy;//nFixImgHeight; // color box inside KUIWND_CREATE_ARG arg; arg.lpszAniName = ""; arg.lpszSprName = m_sSprName.c_str(); arg.lpszClassName = "colorbox"; arg.lpszID = "color_inside"; arg.dwFlag = KFLAG_NO_GET_MESSAGE; arg.dwStyle = 0; arg.rcRect = colorRect; arg.pParent = this; arg.dwFlag = KFLAG_GET_PASS_MESSAGE; KUIControlColorBox* pWndInside = (KUIControlColorBox*)pWndManager->CreateControl(arg); pWndInside->SetWeightColor( KColor( 0,0,0,255 ) ); //Load Image arg.lpszSprName = m_sSprName.c_str(); arg.lpszClassName = "dynamictexture_static"; arg.lpszID = "load_img"; arg.rcRect = loadRect; KUIControlDynamicTexture* pWndDynamicTex = (KUIControlDynamicTexture*)pWndManager->CreateControl(arg); //pWndDynamicTex->MovePos( nHalfWidth - nWidth*4/3/2 , nHalfHeight - nHeight/2 ); //Panel Image arg.lpszSprName = m_sSprName.c_str(); arg.lpszClassName = "dynamictexture_static"; arg.lpszID = "panel_img"; arg.rcRect = loadRect; KUIControlDynamicTexture* pWndPanelTex = (KUIControlDynamicTexture*)pWndManager->CreateControl(arg); //pWndPanelTex->MovePos( nHalfWidth - nWidth*4/3/2 , nHalfHeight - nHeight/2 ); //Loading msgRect.left = KUIWndManager::GetResolution().cx - KUIWndManager::GetResolution().cx/10; msgRect.right = KUIWndManager::GetResolution().cx; msgRect.top = KUIWndManager::GetResolution().cy - 100; msgRect.bottom = KUIWndManager::GetResolution().cy; //pWndManager->CreateControl( KUIWND_CREATE_ARG( "static", "loading_out", "", msgRect, 0, 0, this, "", "", pWndManager, 0, "" ) ); if(GameRule::GetCurrentLocalBitSet() == GameRule::LOCAL_BITSET::KR) { //850/270 경고문 사이즈 msgRect.left = ( KUIWndManager::GetResolution().cx / 2 ) - ( nKoreaWarringWidth / 2 ); msgRect.right = msgRect.left + nKoreaWarringWidth; msgRect.top = ( KUIWndManager::GetResolution().cy / 2 ) - ( nKoreaWarringHeight / 2 ); msgRect.bottom = msgRect.top + nKoreaWarringHeight; KUIWND_CREATE_ARG warringarg; warringarg.lpszAniName = ""; warringarg.lpszSprName = m_sSprName.c_str(); warringarg.lpszClassName = "static"; warringarg.lpszID = "warring"; warringarg.dwFlag = KFLAG_NO_GET_MESSAGE; warringarg.dwStyle = 0; warringarg.rcRect = msgRect; warringarg.pParent = this; warringarg.dwFlag = KFLAG_GET_PASS_MESSAGE; warringarg.lpszCaption = S(6441); pWndManager->CreateControl( warringarg ); } int nExpX, nExpY; K3DRenderDevice::GetSquareSize( nFixImgWidth, nFixImgHeight, nExpX, nExpY ); if( KUITextureManager::GetHWType() == KUITextureManager::HW_SUPPORT ) { m_spLoadingTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture(nExpX, nExpY, KUSAGE_DYNAMIC, K3DFMT_A8R8G8B8, D3DPOOL_DEFAULT); m_spPanelTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture( nExpX, nExpY, KUSAGE_DYNAMIC, K3DFMT_A8R8G8B8, D3DPOOL_DEFAULT ); } else { //Intel Chip 계열에서 지원 안 되는 넘들이 있음. m_spLoadingTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture( nExpX, nExpY, K3DFMT_A8R8G8B8, D3DPOOL_MANAGED ); m_spPanelTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture( nExpX, nExpY, K3DFMT_A8R8G8B8, D3DPOOL_MANAGED ); } if( pWndDynamicTex ) pWndDynamicTex->SetRenderTarget(m_spLoadingTexture, nFixImgWidth, nFixImgHeight); if( pWndPanelTex ) pWndPanelTex->SetRenderTarget( m_spPanelTexture, nFixImgWidth, nFixImgHeight ); // 로딩화면 프로그래스바 { m_pkWndLoadingProgress = new SUILoadingProgressWnd( m_pGameManager ); m_pkWndLoadingProgress->CreateWnd("window_lobby_loading_bar_gage.nui", pWndManager, KPoint(0,0)/*, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_LOADING_PROGRESSBAR */); m_pkWndLoadingProgress->SetParent(this); if (m_pkWndLoadingProgress) { ((SUILoadingProgressWnd *)m_pkWndLoadingProgress)->SetProgress(0.0f); m_pkWndLoadingProgress->MovePos( fWidth/2 - m_pkWndLoadingProgress->GetRect().GetWidth()/2, 631*nHeight/768 ); m_pkWndLoadingProgress->SetShow(true); } } int adjustwidth = KUIWndManager::GetResolution().cy * 4 / 3; if(adjustwidth > KUIWndManager::GetResolution().cx) adjustwidth = KUIWndManager::GetResolution().cx; int adjustx = KUIWndManager::GetResolution().cx/2 - adjustwidth/2; if(adjustx < 0) adjustx = 0; { m_pWndGamerating_15 = new SUIWnd( m_pGameManager ); m_pWndGamerating_15->CreateWnd("window_lobby_gamerating_15years.nui", pWndManager, KPoint(0, 0) ); m_pWndGamerating_15->SetParent(this); AddChild(m_pWndGamerating_15); m_pWndGamerating_15->MovePos( (adjustx + adjustwidth) - m_pWndGamerating_15->GetRect().GetWidth(), 0 ); m_pWndGamerating_15->SetShow(true); m_pWndGamerating_18 = new SUIWnd( m_pGameManager ); m_pWndGamerating_18->CreateWnd("window_lobby_gamerating_18years.nui", pWndManager, KPoint(0, 0) ); m_pWndGamerating_18->SetParent(this); AddChild(m_pWndGamerating_18); m_pWndGamerating_18->MovePos( (adjustx + adjustwidth) - m_pWndGamerating_18->GetRect().GetWidth(), 0 ); m_pWndGamerating_18->SetShow(true); } //라펠즈 로고 { if(GetLocaleOption().GetValueString("LOADING_RAPPELZ_LOGO",NULL) != NULL) { m_pWndRappelzLogo = new SUIWnd( m_pGameManager ); m_pWndRappelzLogo->CreateWnd( GetLocaleOption().GetValueString("LOADING_RAPPELZ_LOGO", "window_lobby_loading_game_logo.nui"), pWndManager, KPoint(adjustx, 0) ); m_pWndRappelzLogo->SetParent(this); AddChild(m_pWndRappelzLogo); m_pWndRappelzLogo->SetShow(true); } else { m_pWndRappelzLogo = NULL; } } //퍼블리셔로고 { if( GetLocaleOption().GetValueString("LOADING_PUBLISHER_LOGO",NULL) != NULL ) { m_pWndPublisherLogo = new SUIWnd( m_pGameManager ); m_pWndPublisherLogo->CreateWnd( GetLocaleOption().GetValueString("LOADING_PUBLISHER_LOGO", "window_lobby_pubilshed_logo.nui"), pWndManager, KPoint(0, 0) ); m_pWndPublisherLogo->SetParent(this); AddChild(m_pWndPublisherLogo); m_pWndPublisherLogo->MovePos( adjustx, KUIWndManager::GetResolution().cy - m_pWndPublisherLogo->GetRect().GetHeight() ); m_pWndPublisherLogo->SetShow(true); } else { m_pWndPublisherLogo = NULL; } } //엔플레버 로고 { if(GetLocaleOption().GetValueString("LOADING_NFLAVOR_LOGO",NULL)!=NULL) { m_pWndNFlaverLogo = new SUIWnd( m_pGameManager ); m_pWndNFlaverLogo->CreateWnd( GetLocaleOption().GetValueString("LOADING_NFLAVOR_LOGO", "window_lobby_copyright_logo.nui"), pWndManager, KPoint(0, 0) ); m_pWndNFlaverLogo->SetParent(this); AddChild(m_pWndNFlaverLogo); m_pWndNFlaverLogo->MovePos( (adjustx + adjustwidth) - m_pWndNFlaverLogo->GetRect().GetWidth(), KUIWndManager::GetResolution().cy - m_pWndNFlaverLogo->GetRect().GetHeight() ); m_pWndNFlaverLogo->SetShow(true); } else { m_pWndNFlaverLogo = NULL; } } //nowload text { m_pWndNowLoading = new SUIWnd( m_pGameManager ); m_pWndNowLoading->CreateWnd("window_lobby_now_loading_text.nui", pWndManager, KPoint(0, 0) ); m_pWndNowLoading->SetParent(this); AddChild(m_pWndNowLoading); m_pWndNowLoading->MovePos( adjustx + (41*adjustwidth/1024), 627*KUIWndManager::GetResolution().cy/768); m_pWndNowLoading->SetShow(true); } //up,down tool tip { if(GetLocaleOption().GetValueString("LOADING_UPINFO_NUI", NULL) != NULL) { m_pWndUpinfo = new SUIWnd( m_pGameManager ); m_pWndUpinfo->CreateWnd( GetLocaleOption().GetValueString("LOADING_UPINFO_NUI", "window_lobby_loading_up_info.nui"), pWndManager, KPoint(0, 0) ); m_pWndUpinfo->SetParent(this); AddChild(m_pWndUpinfo); m_pWndUpinfo->MovePos( KUIWndManager::GetResolution().cx/2 - m_pWndUpinfo->GetRect().GetWidth()/2, 95*KUIWndManager::GetResolution().cy/768); m_pWndUpinfo->SetShow(true); } else { m_pWndUpinfo = NULL; } } { if(GetLocaleOption().GetValueString("LOADING_DOWNINFO_NUI", NULL) != NULL) { m_pWndDowninfo = new SUIWnd( m_pGameManager ); m_pWndDowninfo->CreateWnd( GetLocaleOption().GetValueString("LOADING_DOWNINFO_NUI", "window_lobby_loading_down_info.nui"), pWndManager, KPoint(0, 0) ); m_pWndDowninfo->SetParent(this); AddChild(m_pWndDowninfo); m_pWndDowninfo->MovePos( KUIWndManager::GetResolution().cx/2 - m_pWndDowninfo->GetRect().GetWidth()/2, 673*KUIWndManager::GetResolution().cy/768); m_pWndDowninfo->SetShow(true); } else { m_pWndDowninfo = NULL; } } // 2010.07.14 로그인 화면이 아닐때는 copyright가 엔딩 페널 뒤로 가버리기 때문에 엔딩쪽을 따로 만들어줘야됨- prodongi m_wndCopyRight = new SUIWnd( m_pGameManager ); m_wndCopyRight->CreateWnd("window_copyrights_marking01.nui", pWndManager, KPoint(0, 0) ); m_wndCopyRight->SetParent(this); AddChild(m_wndCopyRight); m_wndCopyRight->MovePos( adjustx + 730 * adjustwidth / 1024, 148*KUIWndManager::GetResolution().cy/768); m_wndCopyRight->SetShow(true); return true; } void SUILoadingWnd::Render(KViewportObject *pViewport, bool isFront/* = false*/) { KUIWnd::Render(pViewport, isFront); // 로딩화면 프로그래스바 if ((m_pkWndLoadingProgress) && (m_pkWndLoadingProgress->IsShow())) { m_pkWndLoadingProgress->Render(pViewport, isFront); } } void SUILoadingWnd::OnDeviceLost() { refreshLoadImage(); KUIControlDynamicTexture* pWndDynamicTex = dynamicCast(GetChild("load_img")); if( pWndDynamicTex ) pWndDynamicTex->SetRenderTarget( m_spLoadingTexture, nFixImgWidth, nFixImgHeight ); KUIControlDynamicTexture* pWndDynamicTex2 = dynamicCast(GetChild("panel_img")); if( pWndDynamicTex2 ) pWndDynamicTex2->SetRenderTarget( m_spPanelTexture, nFixImgWidth, nFixImgHeight ); } void SUILoadingWnd::SetGameguardIintMode( bool guardmode ) { } void SUILoadingWnd::SetAdultMode( bool adultmode ) { m_pWndGamerating_18->SetShow(true); m_pWndGamerating_15->SetShow(true); g_AdultMode = adultmode; if(adultmode) m_pWndGamerating_18->SetShow(true); else m_pWndGamerating_15->SetShow(true); } void SUILoadingWnd::SetChangeKoreaWarringCaption( int nStringID ) { KUIWnd* pWarring = GetChild( "warring" ); if( pWarring ) { pWarring->SetCaption( S(nStringID) ); } } void SUILoadingWnd::InitLoadingBar() { UpdateLoadingProgress(0); } void SUILoadingWnd::UpdateAddLoadingProcess(float fAddValue) { UpdateLoadingProgress( m_fLoadingPercent + fAddValue ); } void SUILoadingWnd::UpdateLoadingProgress(float fPercent) { // 로딩화면 프로그래스바 if (m_pkWndLoadingProgress) { if(fPercent > 1.0) fPercent = 1.0; if(fPercent < 0) fPercent = 0; ((SUILoadingProgressWnd *)m_pkWndLoadingProgress)->SetProgress(fPercent); _oprint("SUILoadingWnd::UpdateLoadingProgress - %2.2f\n",fPercent); m_fLoadingPercent = fPercent; } } void SUILoadingWnd::RefreshImage(unsigned int warpx, unsigned int warpy) { refreshLoadImage(warpx, warpy); } void SUILoadingWnd::refreshLoadImage(unsigned int warpx, unsigned int warpy) { if(GameRule::GetCurrentLocalBitSet() == GameRule::LOCAL_BITSET::KR) { if( s_nForceRenderKoreaWarring == 1 && s_bFirstLoading == false ) { return; } } static std::string strActive; KUIWnd* pInfo = m_pWndDowninfo->GetChild("static_text01"); if( pInfo && m_pMessageSelector ) { /// 2012.05.02 아레나 전용 팁 설정 - prodongi if (isCurArenaLocation(warpx, warpy)) pInfo->SetCaption(getArenaTipMessage()); else pInfo->SetCaption( m_pMessageSelector->selectMessage().c_str() ); } m_nCount = 0; POINT point; point.x = 0; point.y = 0; RECT rect; rect.left = 0; rect.top = 0; #ifndef _DEV if( s_bFirstLoading && GameRule::GetCurrentLocalBitSet() == GameRule::LOCAL_BITSET::KR ) { s_nForceRenderKoreaWarring = 1; s_bFirstLoading = false; KUIControlColorBox* pColorBox = dynamicCast(GetChild( "color_inside" )); if( pColorBox ) pColorBox->SetWeightColor( KColor( 255,255,255,255 ) ); KUIWnd* pWarring = GetChild( "warring" ); if( pWarring ) pWarring->SetShow( true ); KUIWnd* pLoadImg = GetChild( "load_img" ); if( pLoadImg ) pLoadImg->SetShow( false ); KUIWnd* pPanelImg = GetChild( "panel_img" ); if( pPanelImg ) pPanelImg->SetShow( false ); if(m_pWndUpinfo) m_pWndUpinfo->SetShow(false); if(m_pWndDowninfo) m_pWndDowninfo->SetShow(false); if(m_pkWndLoadingProgress) m_pkWndLoadingProgress->SetShow(false); if(m_pWndUpinfo) m_pWndUpinfo->SetShow(false); if(m_pWndDowninfo) m_pWndDowninfo->SetShow(false); if(m_pWndGamerating_18) m_pWndGamerating_18->SetShow(false); if( m_pWndGamerating_15) m_pWndGamerating_15->SetShow(false); if(m_pWndRappelzLogo) m_pWndRappelzLogo->SetShow(false); if(m_pWndPublisherLogo) m_pWndPublisherLogo->SetShow(false); if(m_pWndNFlaverLogo) m_pWndNFlaverLogo->SetShow(false); if(m_pWndNowLoading) m_pWndNowLoading->SetShow(false); // 2010.07.14 - prodongi if (m_wndCopyRight) m_wndCopyRight->SetShow(false); //KUIWnd* pInfoMsg = GetChild( "msg_out" ); //if( pInfoMsg ) pInfoMsg->SetShow( false ); //KUIWnd* pTip = GetChild( "tip_out" ); //if( pTip ) pTip->SetShow( false ); //KUIWnd* pLoading = GetChild( "loading_out" ); //if( pLoading ) pLoading->SetShow( false ); } // 2010.07.06 - prodongi //else if( s_CurIndex == 0 ) else #endif { KUIControlColorBox* pColorBox = dynamicCast(GetChild( "color_inside" )); if( pColorBox ) pColorBox->SetWeightColor( KColor( 0,0,0,255 ) ); KUIWnd* pWarring = GetChild( "warring" ); if( pWarring ) pWarring->SetShow( false ); KUIWnd* pLoadImg = GetChild( "load_img" ); if( pLoadImg ) pLoadImg->SetShow( true ); KUIWnd* pPanelImg = GetChild( "panel_img" ); if( pPanelImg ) pPanelImg->SetShow( true ); //KUIWnd* pInfoMsg = GetChild( "msg_out" ); //if( pInfoMsg ) pInfoMsg->SetShow( true ); //KUIWnd* pTip = GetChild( "tip_out" ); //if( pTip ) pTip->SetShow( true ); if(m_pWndUpinfo) m_pWndUpinfo->SetShow(true); if(m_pWndDowninfo) m_pWndDowninfo->SetShow(true); if(m_pkWndLoadingProgress) m_pkWndLoadingProgress->SetShow(true); if(m_pWndUpinfo) m_pWndUpinfo->SetShow(true); if(m_pWndDowninfo) m_pWndDowninfo->SetShow(true); if(g_AdultMode && m_pWndGamerating_18) m_pWndGamerating_18->SetShow(true); if(!g_AdultMode && m_pWndGamerating_15) m_pWndGamerating_15->SetShow(true); if(m_pWndRappelzLogo) m_pWndRappelzLogo->SetShow(true); if(m_pWndPublisherLogo) m_pWndPublisherLogo->SetShow(true); if(m_pWndNFlaverLogo) m_pWndNFlaverLogo->SetShow(true); if(m_pWndNowLoading) m_pWndNowLoading->SetShow(true); // 2010.07.14 - prodongi if (m_wndCopyRight) m_wndCopyRight->SetShow(true); //KUIWnd* pLoading = GetChild( "loading_out" ); //if( pLoading ) pLoading->SetShow( true ); } /// 2012.05.02 아레나 전용 로딩 이미지 설정 - prodongi if (isCurArenaLocation(warpx, warpy)) LoadTexture(getArenaLoadingImgName(), m_spLoadingTexture); else LoadTexture( pLoadImgFileName[rand()%_countof(pLoadImgFileName)], m_spLoadingTexture ); LoadTexture( szPanelImg, m_spPanelTexture ); } void SUILoadingWnd::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; #ifdef _KUI_INVALIDATION // { [sonador] // resize this SetResizeUnit( 1, 1, KSize( m_minSize.cx, m_minSize.cy ), KSize( nW, nH ) ); Resize( KRect( 0, 0, nW, nH ) ); // } #endif KUIWnd* pColorBox = GetChild( "color_inside" ); if( pColorBox ) { pColorBox->Resize( KRect( 0,0, nW, nH ) ); pColorBox->MovePos( 0, 0 ); } if(GameRule::GetCurrentLocalBitSet() == GameRule::LOCAL_BITSET::KR) { KUIWnd* pWarring = GetChild( "warring" ); if( pWarring ) { //850/270 경고문 사이즈 KRect msgRect; msgRect.left = ( nW / 2 ) - ( nKoreaWarringWidth / 2 ); msgRect.right = msgRect.left + nKoreaWarringWidth; msgRect.top = ( nH / 2 ) - ( nKoreaWarringHeight / 2 ); msgRect.bottom = msgRect.top + nKoreaWarringHeight; pWarring->Resize( msgRect ); } } int nHalfWidth = nW/2; int nHalfHeight = nH/2; int ScreenPosSX = nHalfWidth - nH * 4 / 3 / 2; int ScreenPosEX = nHalfWidth + nH * 4 / 3 / 2; if(ScreenPosSX<0) ScreenPosSX = 0; if(ScreenPosEX>nW) ScreenPosEX = nW; KRect rect; rect.left = ScreenPosSX; rect.top = 0; rect.right = ScreenPosEX; rect.bottom = nH; KUIControlDynamicTexture* pWndDynamicTex = dynamicCast(GetChild("load_img")); if( pWndDynamicTex ) { pWndDynamicTex->MovePos(nHalfWidth - nH * 4 / 3 / 2, nHalfHeight - nH / 2); pWndDynamicTex->Resize( rect ); pWndDynamicTex->SetRenderTarget( m_spLoadingTexture, nFixImgWidth, nFixImgHeight ); } KUIControlDynamicTexture* pWndDynamicTex2 = dynamicCast(GetChild("panel_img")); if( pWndDynamicTex2 ) { pWndDynamicTex2->MovePos(nHalfWidth - nH * 4 / 3 / 2, nHalfHeight - nH / 2); pWndDynamicTex2->Resize( rect ); pWndDynamicTex2->SetRenderTarget( m_spPanelTexture, nFixImgWidth, nFixImgHeight ); } //pLoadImg->SetRect( rect ); /*KUIWnd* pInfoMsg = GetChild( "msg_out" ); if( pInfoMsg ) { KRect msgRect; msgRect.left = 0; msgRect.right = nW; msgRect.top = nH - nH/c_nMsgRatio; msgRect.bottom = nH; pInfoMsg->Resize( msgRect ); pInfoMsg->MovePos( 0, msgRect.top ); } KUIWnd* pTip = GetChild( "tip_out" ); if( pTip ) { KRect msgRect; msgRect.left = 0; msgRect.right = nW; msgRect.top = 0; msgRect.bottom = nH/c_nMsgRatio; pTip->Resize( msgRect ); pTip->MovePos( 0, msgRect.top ); }*/ KUIWnd* pLoading = GetChild( "loading_out" ); if( pLoading ) { //Loading KRect msgRect; msgRect.left = nW-nW/10; msgRect.right = nW; msgRect.top = nH - 100; msgRect.bottom = nH; pLoading->MovePos( msgRect.left, msgRect.top ); } m_pkWndLoadingProgress->MovePos( nW/2 - m_pkWndLoadingProgress->GetRect().GetWidth()/2, 631*nH/768 ); int adjustwidth = KUIWndManager::GetResolution().cy * 4 / 3; if(adjustwidth > KUIWndManager::GetResolution().cx) adjustwidth = KUIWndManager::GetResolution().cx; int adjustx = KUIWndManager::GetResolution().cx/2 - adjustwidth/2; if(adjustx < 0) adjustx = 0; m_pWndGamerating_15->MovePos( (adjustx + adjustwidth) - m_pWndGamerating_15->GetRect().GetWidth(), 0 ); m_pWndGamerating_18->MovePos( (adjustx + adjustwidth) - m_pWndGamerating_18->GetRect().GetWidth(), 0 ); if(m_pWndRappelzLogo) m_pWndRappelzLogo->MovePos( adjustx, 0 ); if(m_pWndPublisherLogo) m_pWndPublisherLogo->MovePos( adjustx, KUIWndManager::GetResolution().cy - m_pWndPublisherLogo->GetRect().GetHeight() ); if(m_pWndNFlaverLogo) m_pWndNFlaverLogo->MovePos( (adjustx + adjustwidth) - m_pWndNFlaverLogo->GetRect().GetWidth(), KUIWndManager::GetResolution().cy - m_pWndNFlaverLogo->GetRect().GetHeight() ); m_pWndNowLoading->MovePos( adjustx + (41*adjustwidth/1024), 627*KUIWndManager::GetResolution().cy/768); if(m_pWndUpinfo) m_pWndUpinfo->MovePos( KUIWndManager::GetResolution().cx/2 - m_pWndUpinfo->GetRect().GetWidth()/2, 95*KUIWndManager::GetResolution().cy/768); if(m_pWndDowninfo) m_pWndDowninfo->MovePos( KUIWndManager::GetResolution().cx/2 - m_pWndDowninfo->GetRect().GetWidth()/2, 673*KUIWndManager::GetResolution().cy/768); // 2010.07.14 - prodongi if (m_wndCopyRight) m_wndCopyRight->MovePos( adjustx + 730 * adjustwidth / 1024, 148*KUIWndManager::GetResolution().cy/768); } } void SUILoadingWnd::Process(DWORD dwTime) { if( !IsShow() ) return; KUIWnd::Process(dwTime); if( m_dwTime == 0 ) m_dwTime = dwTime; #ifndef _DEV if(GameRule::GetCurrentLocalBitSet() == GameRule::LOCAL_BITSET::KR) { if( s_nForceRenderKoreaWarring == 1 ) //3초간 강제 렌더 { if( m_dwWarringTime == 0 ) m_dwWarringTime = dwTime; if( ( dwTime-m_dwWarringTime ) > 3000 ) { s_nForceRenderKoreaWarring = 0; m_dwWarringTime = 0; RefreshImage(0, 0); } } } #endif if( dwTime-m_dwTime > 150 ) { m_dwTime = dwTime; m_nCount++; if( m_nCount > 5 ) m_nCount = 0; /*KUIWnd* pTip = GetChild( "loading_out" ); if( pTip ) { std::string strLoad = CStringUtil::StringFormat( "<#FF8040>%s", S(6441) ).c_str(); for( int i(0); m_nCount>i; i++ ) strLoad += "."; pTip->SetCaption( strLoad.c_str() ); }*/ if(m_pWndNowLoading) { //다운되는 주 범인인지 모르겠음 //2009-10-19: hunee KUIWnd *aniwnd = m_pWndNowLoading->GetChild( "key_info_point_ani" ); /*if(aniwnd) { _ASSERTE( _CrtCheckMemory( ) ); std::string strLoad2 = "<#392f29>"; for( int i(0); m_nCount>i; i++ ) strLoad2 += "."; aniwnd->SetCaption( strLoad2.c_str() ); }*/ } } if (m_pkWndLoadingProgress) m_pkWndLoadingProgress->Process(dwTime); } bool SUILoadingWnd::isCurArenaLocation(unsigned int warpx, unsigned int warpy) const { return GetBattleArenaDB().isInArena(warpx, warpy); } char const* SUILoadingWnd::getArenaLoadingImgName() const { char const* filename; switch (rand()%ARENA_LOADING_IMG_COUNT) { case 0: filename = "loading_image_arena_01.jpg"; break; case 1: filename = "loading_image_arena_02.jpg"; break; case 2: filename = "loading_image_arena_03.jpg"; break; default: filename = "loading_image_arena_01.jpg"; break; } return filename; } char const* SUILoadingWnd::getArenaTipMessage() const { int count = ARENA_TIP_MESSAGE_END_ID - ARENA_TIP_MESSAGE_START_ID + 1; int id = ARENA_TIP_MESSAGE_START_ID + rand()%count; return S(id); } ////////////////////////////////////////////////////////////////////////// //--------------------------------------------------------------------------- // class SUILoadingProgressWnd //--------------------------------------------------------------------------- SUILoadingProgressWnd::SUILoadingProgressWnd( class SGameManager* pGameManager ) : SUIWnd(pGameManager) , m_fWidth(1024.0f), m_fHeight(768.0f), m_fCurrentPercent(0.0f) { m_kGaugeOpen = KRect(406, 639, 415, 658); m_kGaugeMiddle = KRect(415, 639, 417, 658); m_kGaugeClose = KRect(417, 639, 623, 658); } //--------------------------------------------------------------------------- SUILoadingProgressWnd::~SUILoadingProgressWnd() { } //--------------------------------------------------------------------------- bool SUILoadingProgressWnd::SetProgress(float fPercent) { KUIWnd *pkGaguge01 = GetChild("loading_frame_01"); // 왼쪽 시작지점 KUIWnd *pkGaguge02 = GetChild("loading_frame_02"); // 가운데 KUIWnd *pkGaguge03 = GetChild("loading_frame_03"); // 끝 m_fCurrentPercent = fPercent; if ((NULL == pkGaguge01) || (NULL == pkGaguge02) || (NULL == pkGaguge03)) { return false; } if (0.0f >= m_fCurrentPercent) { pkGaguge01->MovePos(m_kGaugeOpen.left, m_kGaugeOpen.top); pkGaguge02->Resize(m_kGaugeMiddle); pkGaguge03->MovePos(m_kGaugeClose.left, m_kGaugeClose.top); m_fCurrentPercent = 0.0f; } else if (1.0f <= m_fCurrentPercent) { KRect kRect = pkGaguge02->GetRect(); kRect.right = kRect.left + 198; // 613- 415 pkGaguge02->Resize(kRect); pkGaguge03->MovePos(kRect.right, kRect.top); m_fCurrentPercent = 1.0f; } else { KRect kRect = pkGaguge02->GetRect(); kRect.right = kRect.left + (int)(198.0f * fPercent); // 613- 415 pkGaguge02->Resize(kRect); pkGaguge03->MovePos(kRect.right, kRect.top); } return true; } //--------------------------------------------------------------------------- bool SUILoadingProgressWnd::SetProgress(int nMin, int nMax, int nCurrent) { return SetProgress((float)nCurrent / (float)(nMax - nMin)); } //--------------------------------------------------------------------------- SUIWnd* SUILoadingProgressWnd::CreateWnd( const char* szNUIFileName, KUIWndManager* pWndManager, KPoint kPos, int nWindowID/* = -1*/ ) { SUIWnd::CreateWnd(szNUIFileName, pWndManager, kPos, nWindowID); KUIWnd *pkGaguge01 = GetChild("loading_frame_01"); // 왼쪽 시작지점 KUIWnd *pkGaguge02 = GetChild("loading_frame_02"); // 가운데 KUIWnd *pkGaguge03 = GetChild("loading_frame_03"); // 끝 if (pkGaguge01) m_kGaugeOpen = pkGaguge01->GetRect(); if (pkGaguge02) m_kGaugeMiddle = pkGaguge02->GetRect(); if (pkGaguge03) m_kGaugeClose = pkGaguge03->GetRect(); return this; } //--------------------------------------------------------------------------- void SUILoadingProgressWnd::OnPosChangeNofity(int offsetx,int offsety) { SUIWnd::OnPosChangeNofity(offsetx,offsety); KUIWnd *pkGaguge01 = GetChild("loading_frame_01"); // 왼쪽 시작지점 KUIWnd *pkGaguge02 = GetChild("loading_frame_02"); // 가운데 KUIWnd *pkGaguge03 = GetChild("loading_frame_03"); // 끝 /* if (pkGaguge01) pkGaguge01->MovePosOffset( offsetx, offsety); if (pkGaguge02) pkGaguge02->MovePosOffset( offsetx, offsety); if (pkGaguge03) pkGaguge03->MovePosOffset( offsetx, offsety);*/ if (pkGaguge01) m_kGaugeOpen = pkGaguge01->GetRect(); if (pkGaguge02) m_kGaugeMiddle = pkGaguge02->GetRect(); if (pkGaguge03) m_kGaugeClose = pkGaguge03->GetRect(); } //--------------------------------------------------------------------------- /* void SUILoadingProgressWnd::ChangeResoultion(float fWidth, float fHeight) { //m_kGaugeOpen.OffsetRect (RP2AP(0.3964f, fWidth), RP2AP(0.832f, fHeight)); //m_kGaugeMiddle.OffsetRect (RP2AP(0.4052f, fWidth), RP2AP(0.832f, fHeight)); //m_kGaugeClose.OffsetRect (RP2AP(0.4072f, fWidth), RP2AP(0.832f, fHeight)); m_fWidth = fWidth; m_fHeight = fHeight; KUIWnd *pkGaguge01 = GetChild("loading_frame_01"); // 왼쪽 시작지점 KUIWnd *pkGaguge02 = GetChild("loading_frame_02"); // 가운데 KUIWnd *pkGaguge03 = GetChild("loading_frame_03"); // 끝 if (pkGaguge01) pkGaguge01->MovePos(m_kGaugeOpen.left, m_kGaugeOpen.top); if (pkGaguge02) pkGaguge02->MovePos(m_kGaugeMiddle.left, m_kGaugeMiddle.top); if (pkGaguge03) pkGaguge03->MovePos(m_kGaugeClose.left, m_kGaugeClose.top); } //--------------------------------------------------------------------------- */ #undef RP2AP