Files
2026-06-01 12:46:52 +02:00

809 lines
21 KiB
C++

#include "stdafx.h"
#include "SUITopConsoleWnd.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 <kfile/KFileManager.h>
#include "KResourceDX.h"
#include <toolkit/XStringUtil.h>
#include <limits>
#include "SGameMessage.h"
//#include "SGameMessageUI.h"
#include "SStringDB.h"
#include "SUIDefine.h"
#include "KTGA_IO.h"
#include "SGameManager.h"
#include <time.h>
namespace
{
const int c_nDelta = 15;
const int c_nMaxConsoleHistory = 27;
const int c_nMinConsoleHistory = 12;
const int c_nMaxEditHistory = 10;
const char * c_szOUT_FRAME = "static_common_outframe01";
const char * c_szV_SCROLL = "static_scrollbar_backgroundable";
const char * c_szHISTORY_FRAME = "static_fulldown_outframe";
}
extern DWORD g_dwFPS;
extern int g_DP_Count[3];
extern int g_UsedMeshEXPoolCount[3];
extern int g_Poly_Count;
extern int g_TexMem;
extern int g_TexRef;
extern int g_TerrainSegments;
extern bool g_bActiveRender;
extern TCHAR BuildDate[16];
extern TCHAR BuildTime[16];
extern void MsgSplit( const char* szMsg, std::vector<std::string>& vecText, const wchar_t* lpDelimiter, bool bProcSpecialCharacter=false );
#define RP2AP(fRelativePoint, fWidth) (int)(((float)fRelativePoint * (float)fWidth) + 0.5f)
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
bool SUITopSystemInfoWnd::CreateControls( class KUIWndManager* pWndManager )
{
m_dwCheckTime = 0;
pWndManager->CreateControl( KUIWND_CREATE_ARG( "static", "info", "", GetRect(), 0, 0, this, "", "", pWndManager, 0, "" ) );
Refresh();
return true;
}
void SUITopSystemInfoWnd::Refresh()
{
static std::string strActive;
KUIWnd* pInfo = GetChild( "info" );
if( pInfo )
{
if( g_bActiveRender )
strActive = "ActiveRender On ";
else
strActive = "ActiveRender Off";
pInfo->SetCaption( CStringUtil::StringFormat( "%s %07d FPS <br> %d %d %d <br> %s %s", strActive.c_str(), g_dwFPS, g_UsedMeshEXPoolCount[0], g_UsedMeshEXPoolCount[1], g_UsedMeshEXPoolCount[2], BuildDate, BuildTime ).c_str() );
}
}
void SUITopSystemInfoWnd::Process(DWORD dwTime)
{
if( m_dwCheckTime == 0 )
m_dwCheckTime = dwTime;
if( dwTime - m_dwCheckTime > 1000 )
{
m_dwCheckTime = dwTime;
Refresh();
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
bool SUITopConsoleWnd::CreateControls( KUIWndManager* pWndManager )
{
// 에디트 박스
pWndManager->CreateControl( KUIWND_CREATE_ARG( "edit", "chatEdit", "", KRect( KPoint(0, 248), KSize(1000, 20) ), 0, 0, this, c_szOUT_FRAME, c_szDEF_SPR_NAME, pWndManager, 0, "", KANCHOR_BOTTOM | KANCHOR_LEFT ) );
// 스크롤
KUIWnd* pScrollWnd = pWndManager->CreateControl( KUIWND_CREATE_ARG( "v_scroll", "console_scroll", "", KRect( KPoint(GetRect().right-15, GetRect().top+40), KSize(15, GetRect().GetHeight()-70) ), 0, 0, this, c_szV_SCROLL, c_szDEF_SPR_NAME, pWndManager, 0, "", KANCHOR_TOP | KANCHOR_RIGHT ) );
// static
pWndManager->CreateControl( KUIWND_CREATE_ARG( "static", "history", "", KRect( KPoint(GetRect().left+5, GetRect().top+40), KSize(GetRect().right - pScrollWnd->GetRect().GetWidth() -5, GetRect().GetHeight()-70) ), 0, 0, this, c_szHISTORY_FRAME, c_szDEF_SPR_NAME, pWndManager, 0, "", KANCHOR_TOP | KANCHOR_LEFT ) );
// 리사이즈 할때 단위 설정, ( 세로, 가로, 위드, 헤잇 )
SetResizeUnit( 0, c_nDelta, KSize(GetRect().GetWidth(), GetRect().GetHeight()), KSize(GetRect().GetWidth(), GetRect().GetHeight()+(c_nDelta*15)) );
return true;
}
void SUITopConsoleWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch(nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( 0 == ::_stricmp( "idok", lpszControlID ) )
{
KUIControlEdit* pEditConsole = dynamicCast<KUIControlEdit*>(GetChild( "chatEdit" ));
if( NULL != pEditConsole )
{
std::string strConsole = pEditConsole->GetText();
// 에디트 박스 히스토리 남긴다.
if( m_vecEditHistoryList.size() >= c_nMaxEditHistory ) m_vecEditHistoryList.pop_back();
m_vecEditHistoryList.insert( m_vecEditHistoryList.begin(), strConsole );
m_vecEditHistoryList.unique();
m_nEditCurPos = -1;
if( strConsole.empty() ) break;
// 여백 단위로 자른다.
std::vector<std::string> vecStringList;
MsgSplit( strConsole.c_str(), vecStringList, L" " );
// 입력 키워드 생성
std::string strInputText;
XStringUtil::Format( strInputText, "> %s", vecStringList[0].c_str() );
// 파싱에러 처리
if( vecStringList.size() < 1 )
{
strInputText += "<br> parsing error";
AddChatText( strInputText.c_str() );
}
else
{
// 출력용
strInputText += " ";
for( int i = 1; i < static_cast<int>(vecStringList.size()); i++ )
{
strInputText += vecStringList[i];
strInputText += "; ";
}
AddChatText( strInputText.c_str() );
// 명령어 빌드
GetCommandBuilder().BuildCommand( vecStringList );
}
pEditConsole->SetText("");
vecStringList.clear();
}
}
}
break;
case KUI_MESSAGE::KSCROLL_SELECT: // 스크롤 선택
{
int nPos = int(lparam);
nPos = max( nPos, 0 );
RefreshText(nPos);
}
break;
case KUI_MESSAGE::KGENWND_RESIZE:
{
int nMoveHeight = GetRect().GetHeight() - static_cast<int>(wparam);
int nMoveCount = nMoveHeight/c_nDelta;
m_nCurLine += nMoveCount;
m_nCurLine = max( m_nCurLine, c_nMinConsoleHistory );
m_nCurLine = min( m_nCurLine, c_nMaxConsoleHistory );
KUIWnd* pStaticWnd = GetChild( "history" );
if( pStaticWnd )
{
KRect rc = pStaticWnd->GetRect();
rc.bottom += nMoveCount*c_nDelta;
pStaticWnd->Resize( rc );
}
KUIWnd* pScrollWnd = GetChild( "console_scroll" );
if( pScrollWnd )
{
KRect rc = pScrollWnd->GetRect();
rc.top = pStaticWnd->GetRect().top;
rc.bottom = pStaticWnd->GetRect().bottom;
pScrollWnd->Resize( rc );
}
RefreshText();
RefreshScrollbar();
}
break;
case KUI_MESSAGE::KEDIT_VK_UP:
{
// 에디트 히스토리
if( m_nEditCurPos >= c_nMaxEditHistory ) break;
++m_nEditCurPos;
m_nEditCurPos = min( m_nEditCurPos, c_nMaxEditHistory-1 );
RefreshEditBox();
}
break;
case KUI_MESSAGE::KEDIT_VK_DOWN:
{
// 에디트 히스토리
--m_nEditCurPos;
m_nEditCurPos = max( m_nEditCurPos, -1 );
RefreshEditBox();
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUITopConsoleWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
/*switch(pMsg->nType)
{
case IMSG_UI_CONSOLE_RELUST:
{
SIMSG_UI_CONSOLE_RELUST* pResultMsg = (SIMSG_UI_CONSOLE_RELUST*)pMsg;
if( !pResultMsg->m_strResult.empty() )
AddChatText( pResultMsg->m_strResult.c_str() );
}
break;
}*/
}
void SUITopConsoleWnd::RefreshEditBox()
{
if( m_vecEditHistoryList.empty() )
{
m_nEditCurPos = -1;
return;
}
KUIWnd* pWnd = GetChild( "chatEdit" );
if( pWnd == NULL ) return;
if( m_nEditCurPos == -1 )
{
((KUIControlEdit*)pWnd)->SetText( "" );
return;
}
int nIndex = 0;
std::list<std::string>::iterator it = m_vecEditHistoryList.begin();
while( it != m_vecEditHistoryList.end() )
{
if( m_nEditCurPos == nIndex )
{
((KUIControlEdit*)pWnd)->SetText( (*it).c_str() );
return;
}
nIndex++;
it++;
}
}
void SUITopConsoleWnd::AddChatText( const char* szText )
{
KUIWnd* pStaticWnd = GetChild( "history" );
if( pStaticWnd == NULL ) return;
std::vector<std::string> vecLineList;
dynamicCast<KUIControl*>(pStaticWnd)->SplitLine( vecLineList, szText, "바탕" );
if( vecLineList.empty() ) return;
if( vecLineList.size() == 1 ) m_vecHistoryList.push_back( vecLineList[0].c_str() );
else
{
for( std::vector<std::string>::iterator it = vecLineList.begin(); it != vecLineList.end(); it++ )
m_vecHistoryList.push_back( (*it) );
}
vecLineList.clear();
RefreshText();
RefreshScrollbar();
}
void SUITopConsoleWnd::RefreshText( int nRange )
{
if( m_vecHistoryList.size() <= 0 ) return;
std::string strCaption;
int nHistoryCount = static_cast<int>( m_vecHistoryList.size() );
// 커런트 스크롤 위치 계산 = 스크롤 위치로부터 m_nCurLine 개수 만큼 보여준다.
int nScrollPos = max( nHistoryCount - m_nCurLine, 0 );
if( nRange != -1 ) nScrollPos = nRange;
// 스크롤 위치 = 리스트 시작 인덱스
int nIndex = nScrollPos;
// <br> 태그 넣어주기 위해
bool bNextLine = false;
// 순서는 거꾸로 넣어준다. m_nCurLine 개수만큼
for( int i = nScrollPos+m_nCurLine-1; i >= nScrollPos; i-- )
{
if( i < nHistoryCount )
{
if( bNextLine ) strCaption += "<br>";
strCaption += m_vecHistoryList[nIndex];
bNextLine = true;
nIndex++;
}
else strCaption += "><br>";
}
SetChildCaption( "history", strCaption.c_str() );
}
void SUITopConsoleWnd::RefreshScrollbar()
{
int nScrollRange = max( static_cast<int>(m_vecHistoryList.size()) - m_nCurLine, 0);
KUIControlVScroll* pScrollBar = dynamicCast<KUIControlVScroll*>(GetChild( "console_scroll" ));
if( NULL != pScrollBar )
{
pScrollBar->SetMaxRange( DWORD(nScrollRange+1) );
pScrollBar->SetPosition( nScrollRange );
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////
//bool SUILoaingTextOutWnd::CreateControls( class KUIWndManager* pWndManager )
//{
// // static
// m_dwCheckTime = 0;
// pWndManager->CreateControl( KUIWND_CREATE_ARG( "static", "msg_out", "", GetRect(), 0, 0, this, "", "", pWndManager, 0, "" ) );
// return true;
//}
//
//void SUILoaingTextOutWnd::Refresh()
//{
// static std::string strActive;
// KUIWnd* pInfo = GetChild( "msg_out" );
// if( pInfo )
// {
// int nAddIndex = rand()%2;
// pInfo->SetCaption( CStringUtil::StringFormat( "<br><br><vcenter><hcenter><size:12>%s", GetStringDB().GetString( 823+nAddIndex ) ).c_str() );
// }
//}
namespace
{
const int c_nTopRatio = 9;
const int c_nBottomRatio = 7;
const int c_nAlpha = 0;
const int c_nMsgRatio = 4;
const float c_fAlpha = 600.f;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//화면 집중 효과 윈도우
bool SUIEffectWnd::CreateControls( class KUIWndManager* pWndManager )
{
KRect topRect, bottomRect;
topRect.left = 0;
topRect.right = KUIWndManager::GetResolution().cx;
topRect.top = 0;
topRect.bottom = KUIWndManager::GetResolution().cy/c_nTopRatio;
bottomRect.left = 0;
bottomRect.right = KUIWndManager::GetResolution().cx;
bottomRect.top = KUIWndManager::GetResolution().cy - KUIWndManager::GetResolution().cy/c_nBottomRatio;
bottomRect.bottom = KUIWndManager::GetResolution().cy;
// color box top
KUIWND_CREATE_ARG arg;
arg.lpszAniName = "";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "colorbox";
arg.lpszID = "color_top";
arg.dwFlag = KFLAG_NO_GET_MESSAGE;
arg.dwStyle = 0;
arg.rcRect = topRect;
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE;
KUIControlColorBox* pWndTop = (KUIControlColorBox*)pWndManager->CreateControl(arg);
pWndTop->SetIndexColor( 0, KColor( 0,0,0,255 ) );
pWndTop->SetIndexColor( 1, KColor( 0,0,0,255 ) );
pWndTop->SetIndexColor( 2, KColor( 0,0,0,c_nAlpha ) );
pWndTop->SetIndexColor( 3, KColor( 0,0,0,c_nAlpha ) );
arg.lpszID = "color_bottom";
arg.rcRect = bottomRect;
arg.pParent = this;
KUIControlColorBox* pWndBottom = (KUIControlColorBox*)pWndManager->CreateControl(arg);
pWndBottom->SetIndexColor( 0, KColor( 0,0,0,c_nAlpha ) );
pWndBottom->SetIndexColor( 1, KColor( 0,0,0,c_nAlpha ) );
pWndBottom->SetIndexColor( 2, KColor( 0,0,0,255 ) );
pWndBottom->SetIndexColor( 3, KColor( 0,0,0,255 ) );
_setState( NORMAL );
SetShow( false );
return true;
}
void SUIEffectWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{//화면 크기에 맞게 리사이즈
if( pMsg->nType == IMSG_UI_CHANGE_RESOLUTION )
{
pMsg->bUse = true;
SIMSG_UI_CHANGE_RESOLUTION* pChangeResolution = dynamicCast<SIMSG_UI_CHANGE_RESOLUTION*>(pMsg);
int nW = pChangeResolution->m_nWidth;
int nH = pChangeResolution->m_nHeight;
Resize( KRect(0,0,nW,nH) );
KUIWnd* pColorBoxTop = GetChild( "color_top" );
if( pColorBoxTop )
{
KRect topRect;
topRect.left = 0;
topRect.right = nW;
topRect.top = 0;
topRect.bottom = nH/c_nTopRatio;
pColorBoxTop->Resize( topRect );
pColorBoxTop->MovePos( 0, 0 );
}
KUIWnd* pColorBoxBottom = GetChild( "color_bottom" );
if( pColorBoxBottom )
{
KRect bottomRect;
bottomRect.left = 0;
bottomRect.right = nW;
bottomRect.top = nH - nH/c_nBottomRatio;
bottomRect.bottom = nH;
pColorBoxBottom->Resize( bottomRect );
pColorBoxBottom->MovePos( 0, bottomRect.top );
}
}
else if( pMsg->nType == IMSG_UI_SEND_DATA )
{
SIMSG_UI_SEND_DATA* pSendData = dynamicCast<SIMSG_UI_SEND_DATA*>(pMsg);
if( pSendData->m_nTarget == SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EFFECT_FOCUS )
{
if( stricmp( pSendData->m_strString.c_str(), "alpha_open" )==0 )
{
_setState( ALPHA_OPEN_INIT );
SetShow( true );
}
else if( stricmp( pSendData->m_strString.c_str(), "alpha_close" )==0 )
{
_setState( ALPHA_CLOSE_INIT );
}
}
}
}
void SUIEffectWnd::Process(DWORD dwTime)
{
m_dwTime = dwTime;
switch( _getState() )
{
case ALPHA_OPEN_INIT :
{
m_dwStartTime = m_dwTime;
ChangeAlpha( 0.f );
_setState( ALPHA_OPEN_ING );
}
break;
case ALPHA_OPEN_ING :
if( m_dwTime - m_dwStartTime < c_fAlpha )
{
float fValue = (m_dwTime - m_dwStartTime)/c_fAlpha;
ChangeAlpha( fValue );
}
else
{
ChangeAlpha( 1.f );
_setState( NORMAL );
SetShow( true );
}
break;
case NORMAL :
break;
case ALPHA_CLOSE_INIT :
{
m_dwStartTime = m_dwTime;
ChangeAlpha( 1.f );
_setState( ALPHA_CLOSE_ING );
}
break;
case ALPHA_CLOSE_ING :
{
if( m_dwTime - m_dwStartTime < c_fAlpha )
{
float fValue = 1.f-(m_dwTime - m_dwStartTime)/c_fAlpha;
ChangeAlpha( fValue );
}
else
{
ChangeAlpha( 0.f );
_setState( NORMAL );
SetShow( false );
}
break;
}
break;
}
}
extern void SetCopy( char * pSrc, const int nSrcStride, char * pDst, const int nDstStride, const int nWidth, const int nHeight );
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//SUIFadeInOutEffectWnd
bool SUIFadeInOutEffectWnd::CreateControls( class KUIWndManager* pWndManager )
{
KRect rc;
rc.left = 0;
rc.top = 0;
rc.right = KUIWndManager::GetResolution().cx;
rc.bottom = KUIWndManager::GetResolution().cy;
// color box top
KUIWND_CREATE_ARG arg;
arg.lpszAniName = "";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "colorbox";
arg.lpszID = "color_box";
arg.dwFlag = KFLAG_NO_GET_MESSAGE;
arg.dwStyle = 0;
arg.rcRect = rc;
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE;
m_pControl = (KUIControlColorBox*)pWndManager->CreateControl(arg);
m_fAlpha = 1.0f;
m_dwOldTime = 0;
m_Color = KColor( 0, 0, 0, m_fAlpha*255 );
if( m_pControl )
{
m_pControl->SetIndexColor( 0, m_Color );
m_pControl->SetIndexColor( 1, m_Color );
m_pControl->SetIndexColor( 2, m_Color );
m_pControl->SetIndexColor( 3, m_Color );
}
else
{
return false;
}
m_nFadeState = FADE_NONE;
SetShow( false );
return true;
}
void SUIFadeInOutEffectWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
if( pMsg->nType == IMSG_UI_FADE_IN_EFFECT )
{
pMsg->bUse = true;
m_nFadeState = FADE_IN;
m_dwOldTime = 0;
m_fAlpha = 1.0f;
SetShow( true );
}
else if( pMsg->nType == IMSG_UI_FADE_OUT_EFFECT )
{
pMsg->bUse = true;
m_nFadeState = FADE_OUT;
m_dwOldTime = 0;
m_fAlpha = 0.0f;
SetShow( true );
}
else if( pMsg->nType == IMSG_UI_CHANGE_RESOLUTION )
{
SIMSG_UI_CHANGE_RESOLUTION* pChangeResolution = dynamicCast<SIMSG_UI_CHANGE_RESOLUTION*>(pMsg);
if( m_pControl )
{
m_pControl->Resize( KRect( 0,0, pChangeResolution->m_nWidth, pChangeResolution->m_nHeight ) );
m_pControl->MovePos( 0, 0 );
}
pMsg->bUse = true;
}
}
void SUIFadeInOutEffectWnd::Process(DWORD dwTime)
{
if( !IsShow() ) return;
KUIWnd::Process(dwTime);
if( m_dwOldTime == 0 ) m_dwOldTime = dwTime;
if( m_pControl )
{
if( m_nFadeState == FADE_IN )
{
m_fAlpha = 1.0f-(float)(dwTime - m_dwOldTime) / 2000;
if( m_fAlpha <= 0.0f )
{
m_fAlpha = 0.0f;
m_dwOldTime = 0;
m_nFadeState = FADE_NONE;
}
}
else if( m_nFadeState == FADE_OUT )
{
m_fAlpha = (float)(dwTime - m_dwOldTime) / 2000;
if( m_fAlpha >= 1.0f )
{
m_fAlpha = 1.0f;
m_dwOldTime = 0;
m_nFadeState = FADE_NONE;
}
}
// m_pControl->ChangeAlpha( m_fAlpha * 255.0f );
m_Color.a = m_fAlpha * 255.0f;
m_pControl->SetIndexColor( 0, m_Color );
m_pControl->SetIndexColor( 1, m_Color );
m_pControl->SetIndexColor( 2, m_Color );
m_pControl->SetIndexColor( 3, m_Color );
}
else
{
SetShow( false );
}
}
bool SUIFadeInOutEffectWnd::IsEnd()
{
return m_nFadeState == FADE_NONE ? true : false;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
namespace
{
const int c_nDeltaY = 30;
};
bool SUISkinColorWnd::InitControls( KPoint kPos )
{
SetCustomMovingRect( KRect( 0,0,120,20 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area
return SUIWnd::InitControls(kPos);
}
bool SUISkinColorWnd::InitData( bool bReload /*= false*/ )
{
if( !bReload )
{
RECT rc; rc.top = c_nDeltaY; rc.left = 0; rc.right = 0; rc.bottom = c_nDeltaY;
for( int i = 0; i < 2; i++ )
{
CopyControl( CStringUtil::StringFormat("skin_color%1d0" , i).c_str(), CStringUtil::StringFormat("skin_color%1d0" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skin_color%1d1" , i).c_str(), CStringUtil::StringFormat("skin_color%1d1" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skin_color%1d2" , i).c_str(), CStringUtil::StringFormat("skin_color%1d2" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("skin_color%1d3" , i).c_str(), CStringUtil::StringFormat("skin_color%1d3" , i+1).c_str(), rc );
}
std::vector<unsigned long> vColorList;
GetSkinColorTable().GetAllColorTable( vColorList );
for( int i = 0; i < 3; i++ )
{
KUIControlColorBox* pColorBox1 = dynamicCast<KUIControlColorBox*>(GetChild( CStringUtil::StringFormat("skin_color%1d0" , i).c_str() ));
KUIControlColorBox* pColorBox2 = dynamicCast<KUIControlColorBox*>(GetChild( CStringUtil::StringFormat("skin_color%1d1" , i).c_str() ));
KUIControlColorBox* pColorBox3 = dynamicCast<KUIControlColorBox*>(GetChild( CStringUtil::StringFormat("skin_color%1d2" , i).c_str() ));
KUIControlColorBox* pColorBox4 = dynamicCast<KUIControlColorBox*>(GetChild( CStringUtil::StringFormat("skin_color%1d3" , i).c_str() ));
if( pColorBox1 ) pColorBox1->SetWeightColor( KColor(vColorList[i*4+0]) );
if( pColorBox2 ) pColorBox2->SetWeightColor( KColor(vColorList[i*4+1]) );
if( pColorBox3 ) pColorBox3->SetWeightColor( KColor(vColorList[i*4+2]) );
if( pColorBox4 ) pColorBox4->SetWeightColor( KColor(vColorList[i*4+3]) );
}
vColorList.clear();
}
return SUIWnd::InitData(bReload);
}
bool SUIChinaWarringWnd::CreateControls( class KUIWndManager* pWndManager )
{
// static
KUIWND_CREATE_ARG arg;
arg.lpszAniName = "";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszID = "notice";
arg.dwStyle = 0;
arg.rcRect = m_rcRegion;
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE;
arg.lpszCaption = S(6520);
KUIControlStatic* pStaticText = (KUIControlStatic*)( pWndManager->CreateControl(arg) );
arg.lpszClassName = "colorbox";
arg.lpszID = "notice_background";
arg.lpszCaption = "";
KUIControlColorBox* pBackground = (KUIControlColorBox*)( pWndManager->CreateControl( arg ) );
pBackground->SetWeightColor( KColor( 0xc0000000 ) );
SetChildAsTop( "notice" );
#ifdef _KUI_INVALIDATION
AddPopupControl( pStaticText );
#endif
return (pStaticText != NULL && pBackground != NULL) ? true : false;
}
bool SUIWebGameSutDownWnd::CreateControls( class KUIWndManager* pWndManager )
{
// static
KUIWND_CREATE_ARG arg;
arg.lpszAniName = "button_common";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "button";
arg.lpszID = "sutdown";
// arg.dwFlag = KFLAG_NO_GET_MESSAGE;
arg.dwStyle = 0;
arg.rcRect = m_rcRegion;
arg.pParent = this;
// arg.dwFlag = KFLAG_GET_PASS_MESSAGE;
arg.lpszCaption = S(6117);
return pWndManager->CreateControl(arg) ? true : false;
}
void SUIWebGameSutDownWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch( nMessage )
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( strcmp( lpszControlID, "sutdown" ) == 0 )
{
m_pGameManager->ProcMsgAtStatic( &SIMSG_UIWND_NOTIFY_TO_LOBBY( "Web_SutDown" ) );
}
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
#undef RP2AP