#include "SunClientPrecompiledHeader.h" #include "GlobalFunc.h" #include "uiGuideSystemMan/uiGuideSystemMan.h" #include "uiGuideMessageDialog/uiGuideMessageDialog.h" #include "TotalGuideParser.h" #include "GuideMessageParser.h" //------------------------------------------------------------------------------ void uiGuideMessageDialog::RegisterControl() { RegisterControlPosition(StrToWzID("BT01"), kControl_Button_BT01); RegisterControlPosition(StrToWzID("B000"), kControl_Button_B000); RegisterControlPosition(StrToWzID("B001"), kControl_Button_B001); RegisterControlPosition(StrToWzID("B002"), kControl_Button_B002); RegisterControlPosition(StrToWzID("S000"), kControl_Text_S000); RegisterControlPosition(StrToWzID("S001"), kControl_Text_S001); } uiGuideMessageDialog::uiGuideMessageDialog(InterfaceManager* ui_manager) : uiBase(ui_manager), is_fade_in_(false) { } uiGuideMessageDialog::~uiGuideMessageDialog(void) { } void uiGuideMessageDialog::Init(CDrawBase* drawbase) { RegisterControl(); ui_guide_system_manager_ = static_cast(GetMan()); assert(ui_guide_system_manager_); SetOpenType(TotalGuideNotice::kViewAndNextView);//Test Code is_fade_in_ = true; open_type_ = TotalGuideNotice::kGuideWindow; ftext_parser_.SetDefaultFont(StrToWzID("mn12"), 0xFFFFFFFF); //ARGB CControlWZ* control_ptr = GetControlWZ_byPosition(kControl_Text_S001); if (control_ptr) { ftext_render_.Init(GetDrawBase(), control_ptr->GetSizeRect()); } guide_code_ = 0; } void uiGuideMessageDialog::Release() { ftext_render_.ClearSentence(); guide_code_ = 0; guide_message_list_.clear(); } void uiGuideMessageDialog::OnUpdateSolarDialog() { if (dialog_timer_.GetRemainedTime() <= 0) { if (is_fade_in_) { if (guide_message_list_.size() > 0) { ShowWindowFade(FALSE);// Á¤º¸°¡ ´õ ÀÖ´Ù¸é ¼­¼­È÷ ´Ý´Â´Ù. } else { fade_value_ = GetFadeValue(); GetDialogWZ()->SetTransparency(fade_value_); } } else { ShowInterface(FALSE); if (guide_message_list_.size() > 0) { PopData(); // Á¤º¸°¡ ´õ ÀÖ´Ù¸é »©°í ¿¬´Ù. } } } else { if (is_fade_in_) { fade_value_ = GetFadeValue(); GetDialogWZ()->SetTransparency(fade_value_); } else { fade_value_ = 1.0f - GetFadeValue(); GetDialogWZ()->SetTransparency(fade_value_); } } } void uiGuideMessageDialog::OnRenderSolarDialog() { CControlWZ* control = GetControlWZ_byPosition(kControl_Text_S001); if (control) { ftext_render_.SetAlphaModulate(TRUE); BYTE byte_of_fade = static_cast(fade_value_ * 255); ftext_render_.SetAlphaValue(byte_of_fade); ftext_render_.SetRect(control->GetSizeRect()); ftext_render_.Render(); } } void uiGuideMessageDialog::ShowWindowFade(BOOL val) { if (val) { dialog_timer_.SetTimer(kFade_InOut_Time + kShow_Compliment_Time); is_fade_in_ = true; keyMsg msg; ZeroMemory(&msg, sizeof(msg)); msg.dwType = eDoType_GuideMessage_Dialog; msg.wParam = IM_GUIDE_SYSTEM_MANAGER::HELP_ALERT; msg.lParam = FALSE; msg.DoSomething = uiGuideMessageDialog::ShowFade; g_KeyQueueManager.PushBack(msg); } else { dialog_timer_.SetTimer(kFade_InOut_Time); is_fade_in_ = false; g_KeyQueueManager.DeleteMsg(eDoType_GuideMessage_Dialog); } } void uiGuideMessageDialog::ShowFade(DWORD wParam,DWORD lParam) // ÄݹéÇÔ¼ö¿ë { uiGuideMessageDialog* dialog = GET_CAST_DIALOG(uiGuideMessageDialog, IM_GUIDE_SYSTEM_MANAGER::HELP_ALERT); if (dialog == NULL) { return; } if (lParam) { dialog->ShowWindowFade(TRUE); } else { dialog->ShowWindowFade(FALSE); } } void uiGuideMessageDialog::OnShowWindow(BOOL val) { fade_value_ = 0.0f; GetDialogWZ()->SetTransparency(0.0f); if (val) { is_fade_in_ = true; ShowWindowFade(TRUE); } else { is_fade_in_ = false; if (button_type_ == TotalGuideNotice::kView && open_type_ == TotalGuideNotice::kMiniWindow) { ui_guide_system_manager_->OpenGuideDialog(open_type_, guide_code_);// À§ Á¶°ÇÀ϶§ ´ÝÈù´Ù¸é ¹Ì´ÏÁ¤º¸Ã¢À» ¿¬´Ù. } } } void uiGuideMessageDialog::BlinkButton() { //dialog_timer_.IsExpiredManual(TRUE); } //------------------------------------------------------------------------------ void uiGuideMessageDialog::MessageProc(SI_MESSAGE* message) { if (IsLock()) return; switch (message->eResultMsg) { case RT_MSG_LBUTTONCLICK: OnLButtonClick(message); break; default: SolarDialog::MessageProc(message); break; } } //------------------------------------------------------------------------------ bool uiGuideMessageDialog::OnLButtonClick(SI_MESSAGE* message) { bool result = true; DWORD control_id = message->dwCtrlID; DWORD control_postion = GetControlPosition_byID(control_id); switch (control_postion) { case kControl_Button_BT01: // Á¤º¸º¸±â case kControl_Button_B001: // Á¤º¸º¸±â(´ÜÀÏ) { if (dialog_timer_.GetRemainedTime() <= 0 && fade_value_ >= 1.0f) { ShowWindowFade(FALSE); ui_guide_system_manager_->OpenGuideDialog(open_type_, guide_code_); } } break; case kControl_Button_B000: // ´ÙÀ½¿¡ º¸±â case kControl_Button_B002: // È®ÀÎ { if (dialog_timer_.GetRemainedTime() <= 0 && fade_value_ >= 1.0f) { ShowWindowFade(FALSE); } } break; default: { } break; } return result; } void uiGuideMessageDialog::AddData(WORD message_code) { const TotalGuideNotice* data = TotalGuideParser::Instance()->GetNotice(message_code); if (data) { guide_message_list_.push_back(message_code); } if (is_fade_in_ == false) // âÀÌ ´ÝÈù »óÅ¿¡¼­ { if (guide_message_list_.size() == 1) // µ¥ÀÌÅͰ¡ ÇѰ³¶ó¸é ¹Ù·Î ½ÇÇà { PopData(); } } } void uiGuideMessageDialog::PopData() { if (guide_message_list_.size() > 0) { SetData(guide_message_list_.front()); guide_message_list_.pop_front(); if(GAMEOPTION->GetShowHelp() == TRUE) { ShowDialog(TRUE); } } } void uiGuideMessageDialog::SetData(WORD message_code) { const TotalGuideNotice* data = TotalGuideParser::Instance()->GetNotice(message_code); // »ðÀԽà nullüũ ¿Ï·áÇÔ TCHAR* string_ptr = NULL; CODETYPE string_code = 0; CControlWZ* control_ptr; string_code = data->title_str_code; control_ptr = GetControlWZ_byPosition(kControl_Text_S000); if (control_ptr) { string_ptr = GuideMessageParser::Instance()->GetGuideMessage(string_code); control_ptr->SetTextWZ(string_ptr); } string_code = data->desc_str_code; control_ptr = GetControlWZ_byPosition(kControl_Text_S001); if (control_ptr) { string_ptr = GuideMessageParser::Instance()->GetGuideMessage(string_code); ftext_render_.ClearSentence(); if (ftext_parser_.Parser(string_ptr, ftext_sentence_)) { ftext_render_.Append(ftext_sentence_); ftext_sentence_.Release(); ftext_param_.eType = FORMAT_TEXT_PARAM_RETURN; ftext_param_.dwValue = 1; // 1Ä­ ¶ç¿ö¶ó. #ifdef _INTERNATIONAL_UI ftext_param_.wzFont = StrToWzID("st10"); #else ftext_param_.wzFont = StrToWzID("mn12"); #endif//_INTERNATIONAL_UI ftext_sentence_.Pushback(ftext_param_); ftext_render_.Append(ftext_sentence_); ftext_render_.convertLineInfo(); } } open_type_ = data->open_type; guide_code_ = data->guide_code; if (ui_guide_system_manager_) { ui_guide_system_manager_->AddInfoNotice(guide_code_); } SetOpenType(data->button_style); } void uiGuideMessageDialog::SetOpenType(BYTE button_type) { button_type_ = button_type; CControlWZ* control_ptr; // hide all buttons : ¸ðµç ¹öư ¼û±â±â for (int i = kControl_Button_BT01; i <= kControl_Button_B002; ++i) { control_ptr = GetControlWZ_byPosition(i); if (control_ptr) { control_ptr->ShowWindowWZ(WZ_HIDE); } } // show button(s) from type of button : ¹öư ŸÀÔ¿¡ ¸Â°Ô ¹öư º¸±â switch (button_type) { case TotalGuideNotice::kViewAndNextView: { control_ptr = GetControlWZ_byPosition(kControl_Button_BT01); if (control_ptr) { control_ptr->ShowWindowWZ(WZ_SHOW); } control_ptr = GetControlWZ_byPosition(kControl_Button_B000); if (control_ptr) { control_ptr->ShowWindowWZ(WZ_SHOW); } } break; case TotalGuideNotice::kOK: { control_ptr = GetControlWZ_byPosition(kControl_Button_B002); if (control_ptr) { control_ptr->ShowWindowWZ(WZ_SHOW); } } break; case TotalGuideNotice::kView: { control_ptr = GetControlWZ_byPosition(kControl_Button_B001); if (control_ptr) { control_ptr->ShowWindowWZ(WZ_SHOW); g_KeyQueueManager.DeleteMsg(eDoType_GuideMessage_Dialog);//Á¤º¸º¸±âOnly ÀÎ °æ¿ì ESC·Î ´ÝÀ» ¼ö ¾øÀ½ } } break; } }