#include "stdafx.h" #include "SUIRechargeMsgBoxWnd.h" #include "SGameManager.h" //#include "SGameMessageUI.h" #include "KUIControlButton.h" #include #include "SStringDB.h" void SUIRechargeMsgBoxWnd::OnNotifyUIWindowOpen(bool bOpen, bool bLimitWnd) { if (bOpen) { /// 위치를 중앙으로 int halfSW = KUIWndManager::GetResolution().width >> 1; int halfSH = KUIWndManager::GetResolution().height >> 1; int halfWidth = GetRect().GetWidth() >> 1; int halfHeight = GetRect().GetHeight() >> 1; MovePos( halfSW - halfWidth, halfSH - halfHeight); setUnCheckStateDontAskButton(); } SUIWnd::OnNotifyUIWindowOpen(bOpen, bLimitWnd); } void SUIRechargeMsgBoxWnd::PumpUpMessage(LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam) { switch (nMessage) { case KUI_MESSAGE::KBUTTON_CLICK: msgClickButton(lpszControlID); break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } void SUIRechargeMsgBoxWnd::msgClickButton(LPCSTR lpszControlID) { if (stricmp(lpszControlID, "button_ok") == 0) { m_pGameManager->PostMsgAtDynamic(new SIMSG_RECHARGE_MSGBOX(getCheckStateDontAskButton())); closeWnd(); } else if (stricmp(lpszControlID, "button_cancel") == 0) { closeWnd(); } } void SUIRechargeMsgBoxWnd::closeWnd() { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_RECHARGE_MSGBOX, false, true ) ); } void SUIRechargeMsgBoxWnd::setUnCheckStateDontAskButton() { KUIControlCheck* control = dynamicCast(GetChild("button_checkbutton_01")); if (control) control->SetCheck(false); } bool SUIRechargeMsgBoxWnd::getCheckStateDontAskButton() { KUIControlCheck* control = dynamicCast(GetChild("button_checkbutton_01")); return control ? control->GetCheck() : false; } /// 2011.08.11 - prodongi void SUIRechargeMsgBoxWnd::ProcMsgAtStatic(SGameMessage* pMsg) { switch (pMsg->nType) { case IMSG_RECHARGE_MSGBOX_CONTENT: { SIMSG_UI_COMMON* msg = dynamicCast(pMsg); if (msg) { setContent(msg->param1); } pMsg->bUse = true; } break; } } void SUIRechargeMsgBoxWnd::setContent(int strId) { std::string caption; XStringUtil::Format(caption, "<#FFFFFF>%s", S(strId)); SetChildCaption("text_01", caption.c_str()); }