#include "StdAfx.h" #include "UIBackWindow.h" #include "planeobject.h" #include "Label.h" cUIBackWindow::cUIBackWindow( eUINodeType type ) : cUIWindow( type ) , mpPlane(0) { } cUIBackWindow::~cUIBackWindow() { SAFE_DELETE(mpPlane); } void cUIBackWindow::Open() { cUIWindow::Open(); SetEnabled( false ); SetExceptEvent( true ); } void cUIBackWindow::Close() { SetEnabled( false ); } /// ÁÖÀÇ»çÇ× : bool cUIBackWindow::SetSkin( const cUINodeSkin* pskin ) { if( pskin->IsKindof( eUINODE_WINDOW ) == false ) { assert( 0 && "not window type" ); return false; } /// ³ëµå ½ºÅ²ÀÇ ÀûÇÕ¼º °Ë»ç if( pskin->IsValid() == false ) { assert( 0 && "invalid skin" ); return false; } /// À̹ÌÁö ¼³Á¤ if( pskin->mpTexture ) { /// ÅØ½ºÃ³ ¿µ¿ª ¼³Á¤ unsigned short tx = (unsigned short)pskin->mSkinInfo->mTexX; unsigned short ty = (unsigned short)pskin->mSkinInfo->mTexY; unsigned short tw = (unsigned short)pskin->mSkinInfo->mTexWidth; unsigned short th = (unsigned short)pskin->mSkinInfo->mTexHeight; if( mpPlane == 0 ) { mpPlane = new cPlaneObject; if( mpPlane->Create( pskin->mpTexture, 0, 0, (unsigned short)GetScreenWidth(), (unsigned short)GetScreenHeight(), tx, ty, tx + tw, ty + th ) == false ) { assert( 0 && "failed to create back image"); return false; } } else { mpPlane->SetTextureRect( tx, ty, tx + tw, ty + th ); } } else { SAFE_DELETE( mpPlane ); } /// ½ºÅ©¸°»ó À§Ä¡ ÁÂÇ¥ ¼¼ÆÃ unsigned int x = pskin->mSkinInfo->mX; unsigned int y = pskin->mSkinInfo->mY; unsigned int w = pskin->mSkinInfo->mWidth; unsigned int h = pskin->mSkinInfo->mHeight; SetRelativeRect( cUIRect(x, y, x + w, y + h) ); return true; } //void cUIBackWindow::SetAlphaEnabled( bool enabled, NiAlphaProperty::AlphaFunction srcBlend, NiAlphaProperty::AlphaFunction destBlend ) //{ // /// ¾ËÆÄ ¿É¼Ç Á¶Àý // NiAlphaProperty* alphaProp = mpPlane->GetAlphaProp(); // alphaProp->SetAlphaBlending( enabled ); // // if( enabled ) // { // alphaProp->SetSrcBlendMode( srcBlend ); // alphaProp->SetDestBlendMode( destBlend ); // } //} /// ÁÖÀÇ»çÇ× : void cUIBackWindow::UpdateSkin() { } /// ÁÖÀÇ»çÇ× : void cUIBackWindow::OnRender( cUIFontItemKeeper* fontKeeper ) { /// ¹è°æ À̹ÌÁö ·»´õ¸µ if( mpPlane ) mpPlane->Draw(); cUIWindow::OnRender( fontKeeper ); } /// ÁÖÀÇ»çÇ× : void cUIBackWindow::OnMouseMove( const cUIPos& ) { } /// ÁÖÀÇ»çÇ× : void cUIBackWindow::OnLButtonDown( const cUIPos&, bool , bool , bool ) { } void cUIBackWindow::SetBackTexture( NiTexture* tex ) { if( tex == 0 ) { SAFE_DELETE(mpPlane); return; } mpPlane = new cPlaneObject; if( mpPlane->Create( tex, 0, 0, (unsigned short)GetScreenWidth(), (unsigned short)GetScreenHeight(), 0, 0, tex->GetWidth(), tex->GetHeight() ) == false ) { assert( 0 && "failed to create back image"); NiMessageBox("failed to create back image","Error"); return; } } void cUIBackWindow::SetAlpha( float alpha ) { if( mpPlane ) mpPlane->SetColorA( 1.0f, 1.0f, 1.0f, alpha ); } ////////////////////////////////////////////////////////////////// cLoadBackWindow::cLoadBackWindow( eUINodeType type ) : cUIBackWindow( type ) //, mpGrade(0) , mpCopyRight(0) , mpAddress(0) { } cLoadBackWindow::~cLoadBackWindow() { } void cLoadBackWindow::Open() { cUIWindow::Open(); SetEnabled( false ); } void cLoadBackWindow::Close() { cUIWindow::Close(); SetEnabled( false ); SetBackTexture( 0 ); } bool cLoadBackWindow::OnCreate( cUINodeProperty* pproperty ) { if( cUIBackWindow::OnCreate( pproperty ) == false ) return false; // µî±Þ // mpGrade = new cLabel; // if( ((cUINode*)mpGrade)->CreateBySkinName( "Loding_Grade", this, 102 ) == false ) // { // assert(0); // return false; // } // copyright mpCopyRight = new cLabel; if( ((cUINode*)mpCopyRight)->CreateBySkinName( "Loding_COPYRIGHT", this, 103 ) == false ) { assert(0); return false; } // ÁÖ¼Ò mpAddress = new cLabel; if( ((cUINode*)mpAddress)->CreateBySkinName( "Loding_Address", this, 104 ) == false ) { assert(0); return false; } // if( mpGrade ) // { // ¿ìÃø»ó´Ü // cUINodeSkin* nodeSkin = mpGrade->GetNodeSkin(); // if( nodeSkin ) // { // int x = (int)( GetScreenWidth() - nodeSkin->mSkinInfo->mWidth - nodeSkin->mSkinInfo->mX ); // int y = (int)( mpGrade->GetRelativeRect().mTop ); // mpGrade->SetRelativePos( cUIPos( x, y) ); // } // } if( mpCopyRight ) { // ÇÏ´Ü Áß¾ÓÁ¤·Ä cUINodeSkin* nodeSkin = mpCopyRight->GetNodeSkin(); if( nodeSkin ) { int x = (int)(( GetScreenWidth() - mpCopyRight->GetAbsoluteRect().GetWidth() ) * 0.5f); int y = (int)( GetScreenHeight() - nodeSkin->mSkinInfo->mHeight - nodeSkin->mSkinInfo->mY ); mpCopyRight->SetRelativePos( cUIPos( x, y) ); } } if( mpAddress ) { // ÇÏ´Ü Áß¾ÓÁ¤·Ä cUINodeSkin* nodeSkin = mpAddress->GetNodeSkin(); if( nodeSkin ) { int x = (int)(( GetScreenWidth() - mpCopyRight->GetAbsoluteRect().GetWidth() ) * 0.5f); int y = (int)( GetScreenHeight() - nodeSkin->mSkinInfo->mHeight - nodeSkin->mSkinInfo->mY ); mpAddress->SetRelativePos( cUIPos( x, y) ); } mpAddress->SetTextColor( 0xFFD7C832 ); } return true; } void cLoadBackWindow::UpdateSkin() { cUIBackWindow::UpdateSkin(); // if( mpGrade ) // { // ¿ìÃø»ó´Ü // cUINodeSkin* nodeSkin = mpGrade->GetNodeSkin(); // if( nodeSkin ) // { // int x = (int)( GetScreenWidth() - nodeSkin->mSkinInfo->mWidth - nodeSkin->mSkinInfo->mX ); // int y = (int)( mpGrade->GetRelativeRect().mTop ); // mpGrade->SetRelativePos( cUIPos( x, y) ); // } // } if( mpCopyRight ) { // ÇÏ´Ü Áß¾ÓÁ¤·Ä cUINodeSkin* nodeSkin = mpCopyRight->GetNodeSkin(); if( nodeSkin ) { int x = (int)(( GetScreenWidth() - mpCopyRight->GetAbsoluteRect().GetWidth() ) * 0.5f); int y = (int)( GetScreenHeight() - nodeSkin->mSkinInfo->mHeight - nodeSkin->mSkinInfo->mY ); mpCopyRight->SetRelativePos( cUIPos( x, y) ); } } if( mpAddress ) { // ÇÏ´Ü Áß¾ÓÁ¤·Ä cUINodeSkin* nodeSkin = mpAddress->GetNodeSkin(); if( nodeSkin ) { int x = (int)(( GetScreenWidth() - mpCopyRight->GetAbsoluteRect().GetWidth() ) * 0.5f); int y = (int)( GetScreenHeight() - nodeSkin->mSkinInfo->mHeight - nodeSkin->mSkinInfo->mY ); mpAddress->SetRelativePos( cUIPos( x, y) ); } mpAddress->SetTextColor( 0xFFD7C832 ); } } ////////////////////////////////////////////////////////////////// cNpcBackWindow::cNpcBackWindow( eUINodeType type ) : cUIBackWindow( type ) { } cNpcBackWindow::~cNpcBackWindow() { } void cNpcBackWindow::Open() { SetEnabled( false ); } void cNpcBackWindow::Close() { cUIWindow::Close(); SetEnabled( false ); }