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

100 lines
2.5 KiB
C++

/// 2011.10.12 - prodongi
#ifdef _PARTY_RENEWAL_
#include "SUIRaidSiegeStatusRaidWnd.h"
#include "KUIControlStatic.h"
#include "SGameManager.h"
#include "XStringUtil.h"
#include "SGameOption.h"
SUIRaidSiegeStatusRaidWnd::SUIRaidSiegeStatusRaidWnd(SGameManager* pGameManager) : SUIRaidSiegeStatusBaseWnd(pGameManager),
m_time(0),
m_progressTime(0),
m_isProgress(false)
{
}
SUIRaidSiegeStatusRaidWnd::~SUIRaidSiegeStatusRaidWnd()
{
}
void SUIRaidSiegeStatusRaidWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
SUIWnd::PumpUpMessage(lpszControlID, nMessage, lparam, wparam);
}
void SUIRaidSiegeStatusRaidWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch (pMsg->nType)
{
case IMSG_UI_CHANGE_RESOLUTION:
pMsg->bUse = true;
SetRect(KRect(0, 0, GetGameOption().GetResolution_Width(), GetGameOption().GetResolution_Height()));
break;
}
}
void SUIRaidSiegeStatusRaidWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
}
bool SUIRaidSiegeStatusRaidWnd::InitControls( KPoint kPos )
{
m_timer.m_wnd = new SUIWnd(m_pGameManager);
m_timer.m_wnd->CreateWnd("window_dungeon_raid_time_state.nui", m_pManager, KPoint(0, 0));
m_timer.m_wnd->SetParent(this);
m_timer.m_wnd->SetShow(true);
AddChild(m_timer.m_wnd);
m_timer.m_text = dynamicCast<KUIControlStatic*>(m_timer.m_wnd->GetChild("time_text_01"));
return true;
}
void SUIRaidSiegeStatusRaidWnd::Process(DWORD dwTime)
{
DWORD elapsedtime = 0;
if (m_time)
elapsedtime = dwTime - m_time;
m_time = dwTime;
updateProgressTime(elapsedtime);
}
void SUIRaidSiegeStatusRaidWnd::setProgressState()
{
m_isProgress = true;
m_progressTime = 0;
m_timer.m_wnd->SetShow(true);
initTimerPos();
}
void SUIRaidSiegeStatusRaidWnd::updateProgressTime(DWORD elapsedtime)
{
if (!m_isProgress)
return ;
m_progressTime += elapsedtime;
DWORD t = m_progressTime/1000;
DWORD s = t%60;
DWORD m = t/60;
DWORD h = t/3600;
std::string strT;
XStringUtil::Format(strT, "<font:font_01><size:9><#ba1414><b><right>'%02d:%02d:%02d", h, m, s);
m_timer.m_text->SetCaption(strT.c_str());
}
void SUIRaidSiegeStatusRaidWnd::initTimerPos()
{
int x = GetGameOption().GetResolution_Width() - m_timer.m_wnd->GetRect().GetWidth();
int y = GetGameOption().GetResolution_Height() - 135 - m_timer.m_wnd->GetRect().GetHeight(); /// 135는 적당한 값
m_timer.m_wnd->MovePos(x, y);
m_timer.m_wnd->SetCustomMovingRect(m_timer.m_wnd->GetRect());
}
#endif