#include "SunClientPrecompiledHeader.h" #ifdef _NA_003027_20111013_HONOR_SYSTEM #include "uiCharacterStatusTitleList.h" #include "uiCharacterStatusMan/uiCharacterStatusMan.h" #include "uiSystemMan/uiSystemMan.h" #include "HonorSystem/HonorSystem.h" #include "TitleListParser.h" #include "TreeMenuInfoParser.h" #include "TextureListInfoHandleManager.h" #include "InterfaceManager.h" #include "Hero.h" #include "GlobalFunc.h" const DWORD uiCharacterStatusTitleList::kDialog_ID = StrToWzID("0405"); uiCharacterStatusTitleList::uiCharacterStatusTitleList(InterfaceManager* interface_manager) :uiBase(interface_manager), confirm_title_code_(0), confirm_dialog_key_(0) { } uiCharacterStatusTitleList::~uiCharacterStatusTitleList() { } void uiCharacterStatusTitleList::Init(CDrawBase* draw_base) { uiBase::Init(draw_base); RegisterControlPosition(StrToWzID("B004"), kControl_Button_B004); RegisterControlPosition(StrToWzID("S000"), kControl_Text_S000); RegisterControlPosition(StrToWzID("L000"), kControl_List_L000); RegisterControlPosition(StrToWzID("V000"), kControl_VScroll_V000); title_list_menu().Release(); TCHAR no_title_name[INTERFACE_STRING_LENGTH] = {'\0', }; g_InterfaceManager.GetInterfaceString(HonorSystem::kNoTitleMenuStringCode, no_title_name); GetControlWZ_byPosition(kControl_Text_S000)->SetTextWZ(no_title_name); } void uiCharacterStatusTitleList::Release() { title_list_menu().Release(); } void uiCharacterStatusTitleList::OnShowWindow(BOOL is_show) { if (is_show == TRUE) { InitTitleListInfo(); // Űťµî·Ï keyMsg key_message; ZeroMemory(&key_message, sizeof(key_message)); key_message.dwType = eDoType_HonorTitleList_Dialog; key_message.wParam = uiCharacterStatusTitleList::kDialog_ID; key_message.DoSomething = GlobalFunc::DoShowWindowEx; g_KeyQueueManager.PushBack(key_message); } else { OnClose(); // Å°Å¥ÇØÁ¦ g_KeyQueueManager.DeleteMsg(eDoType_HonorTitleList_Dialog); } } void uiCharacterStatusTitleList::OnUpdateSolarDialog() { title_list_menu().UpdateMouseWheel(); } void uiCharacterStatusTitleList::MessageProc(SI_MESSAGE* message) { if (IsLock()) { return; } if (GetMan() == NULL) { return; } TreeMenuGroup::TreeObject* tree_object = NULL; if (title_list_menu().MessageProc(message, OUT tree_object) == true) { if (tree_object != NULL) { DWORD title_code = g_pHero->GetTitleCode(); if (title_code == HonorSystem::kNoTitleCode) { title_code = HonorSystem::kNoTitleMenuIndex; } TreeMenuGroup::TreeObject* menu_info = title_list_menu().Find(title_code); switch (message->eResultMsg) { case RT_MSG_LBUTTONCLICK: { tree_object->is_check = false; if (menu_info != NULL) { menu_info->is_check = true; } } break; case RT_MSG_LBUTTONDCLICK: { OnDClickToUseTitle(static_cast(tree_object->info->menu_index)); tree_object->is_check = false; if (menu_info != NULL) { menu_info->is_check = true; } } break; default: { } } } } switch (message->eResultMsg) { case RT_MSG_LBUTTONCLICK: OnLButtonClick(message); break; default: SolarDialog::MessageProc(message); break; } } bool uiCharacterStatusTitleList::OnLButtonClick(SI_MESSAGE* message) { bool result = true; switch (GetControlPosition_byID(message->dwCtrlID)) { case kControl_Button_B004: { // ´Ý±â ¹öư ShowInterfaceWithSound(FALSE); } break; default: { } } return result; } void uiCharacterStatusTitleList::InitTitleListInfo() { // ¸®½ºÆ® ¸Þ´º ÇØÁ¦ title_list_menu().Release(); if (g_pHero == NULL) { return; } // Īȣ ¸®½ºÆ® ¸Þ´º Á¤º¸ °»½Å HonorSystem::HonorSystemFunction::RefreshTitleListMenu(); // Īȣ ¸®½ºÆ® ¸Þ´º ÃʱâÈ­ title_list_menu().Init(BASE_TreeMenuInfo::kGroupType_Title_List, static_cast(GetControlWZ_byPosition(kControl_List_L000)), static_cast(GetControlWZ_byPosition(kControl_VScroll_V000)), false, uiCharacterStatusTitleList::Callback_TitleListMenuRender); // ¸®½ºÆ®ÄÁÆ®·Ñ¿¡ Īȣ ¸®½ºÆ® ä¿ì±â title_list_menu().Fill(); // ÇöÀç »ç¿ëÁßÀΠĪȣ ¼±ÅÃ/üũµÇ¾î ÀÖµµ·Ï TreeMenuGroup::TreeObject* current_menu_info = NULL; DWORD current_title_code = g_pHero->GetTitleCode(); if (current_title_code == HonorSystem::kNoTitleCode) { current_menu_info = title_list_menu().Find(HonorSystem::kNoTitleMenuIndex); } else { current_menu_info = title_list_menu().Find(current_title_code); } if (current_menu_info != NULL) { title_list_menu().Select(current_menu_info); current_menu_info->is_check = true; TCHAR title_name[INTERFACE_STRING_LENGTH] = {'\0', }; g_InterfaceManager.GetInterfaceString(current_menu_info->info->string_code, title_name, INTERFACE_STRING_LENGTH - 1); GetControlWZ_byPosition(kControl_Text_S000)->SetTextWZ(title_name); } } void uiCharacterStatusTitleList::OnChangeTitle(WORD title_code) { if ((IsVisible() == FALSE) || (g_pHero == NULL)) { return; } TreeMenuGroup::TreeObject* menu_info = title_list_menu().Find(prev_title_code_); if (menu_info != NULL) { menu_info->is_check = false; } // »õ·Î ¼±ÅÃµÈ ÄªÈ£ if (title_code == HonorSystem::kNoTitleCode) { title_code = HonorSystem::kNoTitleMenuIndex; } menu_info = title_list_menu().Find(title_code); if (menu_info != NULL) { title_list_menu().Select(menu_info); menu_info->is_check = true; TCHAR title_name[INTERFACE_STRING_LENGTH] = {'\0', }; g_InterfaceManager.GetInterfaceString(menu_info->info->string_code, title_name, INTERFACE_STRING_LENGTH - 1); GetControlWZ_byPosition(kControl_Text_S000)->SetTextWZ(title_name); } prev_title_code_ = title_code; } void uiCharacterStatusTitleList::OnDClickToUseTitle(WORD title_code) { if (g_pHero == NULL) { return; } if (confirm_dialog_key_ != 0) { return; } if (title_code == HonorSystem::kNoTitleMenuIndex) { title_code = HonorSystem::kNoTitleCode; } WORD current_title_code = g_pHero->GetTitleCode(); if (current_title_code == title_code) { return; } prev_title_code_ = current_title_code; if (prev_title_code_ == HonorSystem::kNoTitleCode) { prev_title_code_ = HonorSystem::kNoTitleMenuIndex; } uiSystemMan* system_manager = GET_DIALOG_MANAGER(uiSystemMan, UIMAN_SYSTEM); if ((GENERALPARAM->IsNet() == TRUE) && (system_manager != NULL)) { // ÆË¾÷/ÄݹéÀ» ÅëÇÑ ÆÐŶ º¸³»±â TCHAR confirm_message[INTERFACE_STRING_LENGTH] = {'\0', }; if (title_code == HonorSystem::kNoTitleCode) { g_InterfaceManager.GetInterfaceString(6766, confirm_message, INTERFACE_STRING_LENGTH - 1); } else { TitleListParser::TitleInfo* title_info = TitleListParser::Instance()->GetTitleInfo(title_code); if (title_info != NULL) { TCHAR title_name[INTERFACE_STRING_LENGTH] = {'\0', }; g_InterfaceManager.GetInterfaceString(title_info->title_name_code, title_name, INTERFACE_STRING_LENGTH - 1); g_InterfaceManager.GetInterfaceStringFormat(confirm_message, INTERFACE_STRING_LENGTH - 1, 6765, title_name); } } confirm_title_code_ = title_code; confirm_dialog_key_ = system_manager->Sys_Confirm(confirm_message, uiCharacterStatusTitleList::CallBack_ConfirmUseTitle, NULL, NULL, 100, 101, true); } else { HonorSystem::HonorSystemFunction::SetTitleName(g_pHero->GetObjectKey(), title_code); HonorSystem::HonorSystemFunction::OnChangeTitle(title_code); } } void uiCharacterStatusTitleList::OnClose() { // Á¾·á ó¸® - ÆË¾÷⠴ݱ⠵î uiSystemMan* system_manager = GET_DIALOG_MANAGER(uiSystemMan, UIMAN_SYSTEM); if (system_manager != NULL) { system_manager->Destroy_Sys_Confirm(confirm_dialog_key_); } confirm_title_code_ = 0; confirm_dialog_key_ = 0; } void uiCharacterStatusTitleList::Callback_TitleListMenuRender(CCtrlListWZ* list_control, CCtrlListWZ::CListSellData* sell_data, int sell_index, RECT& render_area) { if (list_control == NULL || sell_data == NULL || sell_data->user_data == NULL) { return; } TreeMenuGroup::TreeObject* tree_object = static_cast(sell_data->user_data); if (tree_object == NULL) { return; } int select_sell = list_control->GetCurSel(); int over_sell = list_control->GetOverSel(); // ¼±ÅõǾî Àִ Īȣ¿¡ ´ëÇÑ ¼±ÅÃÀ̹ÌÁö Ãâ·Â bool is_check = tree_object->is_check; if (is_check == true) { DWORD checkon_image_code = tree_object->info->image_code[BASE_TreeMenuInfo::kIconType_CheckOn]; BASE_TextureListInfo* tex_info = NULL; HANDLE tex_handle = TextureListInfoHandleManager::Instance()->GetTexture(checkon_image_code, tex_info);; if ((tex_handle != INVALID_HANDLE_VALUE) && (tex_info != NULL)) { RECT dest_area = render_area; dest_area.right -= dest_area.left; dest_area.bottom -= dest_area.top; g_pSunRenderer->RenderTexture(tex_handle, (float)dest_area.left, (float)dest_area.top, (float)dest_area.right, (float)dest_area.bottom, (float)tex_info->tex_size.left, (float)tex_info->tex_size.top, (float)tex_info->tex_size.right, (float)tex_info->tex_size.bottom); } } //! ±ÛÀÚ DWORD font_ID = StrToWzID("mn12"); COLORREF font_color = sell_data->SelFontColor; if (over_sell == sell_index) { font_ID = tree_object->info->font_id[BASE_TreeMenuInfo::kFontType_Select]; font_color = tree_object->info->font_color[BASE_TreeMenuInfo::kFontType_Select]; } else { font_ID = tree_object->info->font_id[BASE_TreeMenuInfo::kFontType_Enable]; font_color = tree_object->info->font_color[BASE_TreeMenuInfo::kFontType_Enable]; } g_pSunRenderer->x_pManagerTextOut->StartToUseFont(font_ID); { g_pSunRenderer->x_pManagerTextOut->DrawText(sell_data->stdStrText.c_str(), &render_area, font_color, WzColor_RGBA(0, 0, 0, 0), TP_HCENTER | TP_VCENTER); } g_pSunRenderer->x_pManagerTextOut->EndUseFont(); } void uiCharacterStatusTitleList::CallBack_ConfirmUseTitle(bool is_yes) { uiCharacterStatusTitleList* title_list = GET_CAST_DIALOG(uiCharacterStatusTitleList, uiCharacterStatusTitleList::kDialog_ID); if (title_list == NULL) { return; } if (is_yes == true) { HonorSystem::HonorSystemFunction::UseTitleNameForHero(title_list->confirm_title_code()); } title_list->reset_confirm_dialog_key(); } #endif //_NA_003027_20111013_HONOR_SYSTEM