Files
Leviathan/Client/Game/game/Interface/SUIHuntaHolicResultWnd.cpp
T
2026-06-01 12:46:52 +02:00

210 lines
6.3 KiB
C++

#include "stdafx.h"
#include <mmo/ArType.h>
#include "SUIDefine.h"
#include "SGameManager.h"
#include "SGameSystem.h"
//#include "SGameMessageUI.h"
#include "SNetMessage.h"
#include "SGameMessage.h"
#include "ErrorCode/ErrorCode.h"
#include "KUIWndManager.h"
#include "KUIControlStatic.h"
#include "KUIControlButton.h"
#include "SStringDB.h"
#include "SHuntaHolicResourceDB.h"
#include "TemplateUtil.h"
#include "SHuntaHolicSystem.h"
#include "SGameSystem.h"
#include "SUIHuntaHolicResultWnd.h"
#include <toolkit/nsl.h>
#include "SDebug_Util.h"
extern SGameSystem* g_pCurrentGameSystem;
#define HUNTAHOLICSYSTEM g_pCurrentGameSystem->GetContentsMgr().acquire< SHuntaHolicSystem >( "huntaholic" )
namespace hhi = huntaholic_interface;
namespace {
const char* ctrl_complete_msg = "bearload_check_complete";
const char* ctrl_my_kill_count = "bearload_mykill_info";
const char* ctrl_my_kill_point = "bearload_mypoint_info";
const char* ctrl_our_kill_count = "bearload_uskill_info";
const char* ctrl_our_kill_point = "bearload_uspoint_info";
const char* ctrl_result_point = "bearload_mypoint_total_nfo";
const char* ctrl_finish_button = "button_enter"; //servantes 2010.10.13
const char* ctrl_stamp = "static_bearload_winner_stamp00";
}
SUIHuntaHolicResultWnd::SUIHuntaHolicResultWnd( SGameManager* pGameManager )
: SUIWnd( pGameManager )
{
}
SUIHuntaHolicResultWnd::~SUIHuntaHolicResultWnd()
{
cleanUp();
}
void SUIHuntaHolicResultWnd::Process( DWORD time )
{
SUIWnd::Process( time );
}
bool SUIHuntaHolicResultWnd::InitControls( KPoint pos )
{
cleanUp();
KUIControl* wnd = 0;
wnd = dynamicCast<KUIControl*>(GetChild( ctrl_stamp )); if( wnd ) { wnd->SetUsePos( true ); }
mResults.add( sui::MakeUpdatableWindow( "complete_msg" , sui::SCaptionUpdator( "<size:18><hcenter><left>%s" ) , GetChild( ctrl_complete_msg ) ) );
mResults.add( sui::MakeUpdatableWindow( "my_kill_count" , sui::SCaptionUpdator( "<right><vcenter><#ed1c24><size:14>%s" ) , GetChild( ctrl_my_kill_count ) ) );
mResults.add( sui::MakeUpdatableWindow( "my_kill_point" , sui::SCaptionUpdator( "<size:14><hcenter><right><#8b5236>%s" ) , GetChild( ctrl_my_kill_point ) ) );
mResults.add( sui::MakeUpdatableWindow( "our_kill_count", sui::SCaptionUpdator( "<size:14><hcenter><right><#ed1c24>%s" ) , GetChild( ctrl_our_kill_count ) ) );
mResults.add( sui::MakeUpdatableWindow( "our_kill_point", sui::SCaptionUpdator( "<size:14><hcenter><right><#8b5236>%s" ) , GetChild( ctrl_our_kill_point ) ) );
mResults.add( sui::MakeUpdatableWindow( "result_point" , sui::SCaptionUpdator( "<size:16><right><vcenter><#ffffff>%s" ) , GetChild( ctrl_result_point ) ) );
mResults.add( sui::MakeUpdatableWindow( "finish_button" , sui::SCaptionUpdator( "<size:10><#242424><hcenter><vcenter>%s" ) , GetChild( ctrl_finish_button ) ) );
mResults.add( sui::MakeUpdatableWindow( "stamp" , sui::SAniUpdator() , GetChild( ctrl_stamp ) ) );
return SUIWnd::InitControls( pos );
}
bool SUIHuntaHolicResultWnd::InitData( bool reload )
{
return SUIWnd::InitData( reload );
}
void* SUIHuntaHolicResultWnd::Perform( KID id, KArg& msg )
{
if( id == hhi::id_showResult )
{
// #define __TEST_HUNTAHOLICSYSTEM
#if defined( __TEST_HUNTAHOLICSYSTEM )
static bool testSwitch = false;
HuntaHolicScore score;
score.huntaholic_id = 0;
score.personal_kill_count = 78;
score.personal_score = 123;
score.kill_count = 456;
score.score = 9876;
score.gain_point = 1234;
score.is_retired = testSwitch;
testSwitch = !testSwitch;
#else
const HuntaHolicScore& score = HUNTAHOLICSYSTEM->getMyScore();
#endif
std::string completeMsg, finishButton, stampAni;
// sonador #2.1.2.9.3 헌터홀릭 시스템 수정(사망/실패 구분)
switch( score.is_retired )
{
case 0: // 성공
completeMsg += "<#8dc63f>";
completeMsg += S( 6641 );
finishButton.assign( S( 6653 ) );
stampAni.assign( "static_bearload_winner_stamp" );
break;
case 1: // 사망
completeMsg += "<#ed1c24>";
completeMsg += S( 6642 );
finishButton.assign( S( 6652 ) );
stampAni.assign( "static_bearload_death_stamp" );
break;
case 2: // 실패
completeMsg += "<#ed1c24>";
completeMsg += S( 6642 );
finishButton.assign( S( 6652 ) );
stampAni.assign( "static_bearload_loser_stamp" );
break;
default: // 잘못된 값 -> 실패로 처리
completeMsg += "<#ed1c24>";
completeMsg += S( 6642 );
finishButton.assign( S( 6652 ) );
stampAni.assign( "static_bearload_loser_stamp" );
break;
}
mResults[ "complete_msg" ].set_data( completeMsg.c_str() );
mResults[ "my_kill_count" ].set_data( score.personal_kill_count );
mResults[ "my_kill_point" ].set_data( score.personal_score );
mResults[ "our_kill_count" ].set_data( score.kill_count );
mResults[ "our_kill_point" ].set_data( score.score );
mResults[ "result_point" ].set_data( score.gain_point );
mResults[ "finish_button" ].set_data( finishButton.c_str() );
mResults[ "stamp" ].set_data( stampAni.c_str() );
mResults.update();
}
return SUIWnd::Perform( id, msg );
}
void SUIHuntaHolicResultWnd::PumpUpMessage( LPCTSTR controlID, DWORD msg, DWORD lparam, DWORD wparam )
{
switch( msg )
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( !::stricmp( controlID, ctrl_finish_button ) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HUNTAHOLIC_RESULT, false, false ) );
}
}
break;
}
SUIWnd::PumpUpMessage( controlID, msg, lparam, wparam );
}
void SUIHuntaHolicResultWnd::ProcMsgAtStatic( SGameMessage* msg )
{
}
void SUIHuntaHolicResultWnd::OnNotifyUIWindowOpen( bool open, bool limitWnd )
{
if( open )
{
#if defined( __TEST_HUNTAHOLICSYSTEM )
( (KObject*)this )->Perform( hhi::id_showResult );
#endif
}
}
DWORD SUIHuntaHolicResultWnd::OnMouseMessage( DWORD msg, int x, int y )
{
DWORD ret = SUIWnd::OnMouseMessage( msg, x, y );
if( KMR_NO_GET & ret )
return ret;
// do something ...
return ret;
}
void SUIHuntaHolicResultWnd::cleanUp()
{
mResults.clear();
}
void SUIHuntaHolicResultWnd::clearResults()
{
mResults[ "complete_msg" ].set_data( "" );
mResults[ "my_kill_count" ].set_data( 0 );
mResults[ "my_kill_point" ].set_data( 0 );
mResults[ "our_kill_count" ].set_data( 0 );
mResults[ "our_kill_point" ].set_data( 0 );
mResults[ "result_point" ].set_data( 0 );
mResults[ "finish_button" ].set_data( "" );
mResults[ "stamp" ].set_data( "" );
mResults.update();
}