#include "SunClientPrecompiledHeader.h" #include "herogaugedialog2control.h" #include "Hero.h" #include "CommonCharacterFormula.h" #include "InterfaceManager.h" #include "Mouse.h" #include "HeroActionInput.h" #include "uiPartyMan/uiPartyMan.h" #include "uiPartyLeavePopup/uiPartyLeavePopup.h" #include "GameFramework.h" #include "BattleScene.h" #include "uiToolTipMan/uiToolTipMan.h" #include "uiCommunityDlg/uiCommunityDlg.h" #include "uiCommunityMan/uiCommunityMan.h" #include "uiCashItemShopMan/uiCashItemShopMan.h" #include "StateInfoParser.h" #include "GameOptionParser.h" #include "StatusIconManager.h" #include "uiGuideSystemMan/uiGuideSystemMan.h" #include "TotalGuideParser.h" #ifdef _NA_0_20110613_GAME_SHOP_RENEWAL #include "uiConvenienceStore/CashShop.h" #endif #ifdef _DH_BATTLEZONE2_ #include "uiBattlezone2Man/uiBattlezone2Man.h" #endif //_DH_BATTLEZONE2_ #include "uiPerkDialog/uiPerkDialog.h" #include "uiSkillMan/uiNewSkillMan.h" #include "SCPerkSlot.h" #include "ItemUnitRenderer.h" #include "GlobalFunc.h" #ifdef _NA_005026_20120527_CHAOS_ZONE_BATTLE_GROUND #include "ChaosSystem/ChaosSystemData.h" #endif //_NA_005026_20120527_CHAOS_ZONE_BATTLE_GROUND #ifdef _NA_000000_20130114_RENEWER_UI WzID HeroGaugeDialog2Control::m_wzId[HGAUGE_MAX] = { StrToWzID("T012"),//eControl_TEXT_LevelT012 StrToWzID("B100"),//eControl_Button_B100 StrToWzID("P029"),//eControl_Picture_P029 StrToWzID("B101"),//eControl_Button_B101 StrToWzID("C100"),//eControl_Button_C100 StrToWzID("C200"),//eControl_Button_C200 StrToWzID("CT01"),//eControl_Button_CT01 }; HeroGaugeDialog2Control::HeroGaugeDialog2Control(void): tooltip_string_code_(0) { } HeroGaugeDialog2Control::~HeroGaugeDialog2Control(void) { } void HeroGaugeDialog2Control::Process( DWORD dwTick ) { CheckChattingMessage(dwTick); CheckNoteMessage(dwTick); CheckPresentMessage(dwTick); } VOID HeroGaugeDialog2Control::Init( CDrawBase * pDrawBase ) { m_pChkChatMsg = static_cast(getControl(eControl_Button_C100)); if(m_pChkChatMsg) { m_pChkChatMsg->SetCheckState(false); } m_pChkPresentMsg = static_cast(getControl(eControl_Button_C200)); if(m_pChkPresentMsg) { m_pChkPresentMsg->SetCheckState(false); #ifdef __CHINA_BLOCK_ITEM_SHOP_PRESENT m_pChkPresentMsg->ShowWindowWZ( WZ_HIDE ); m_pChkPresentMsg->EnableWindowWZ( FALSE ); #endif } m_pChkNoteMsg = static_cast( getControl( eControl_Button_CT01 ) ); if( m_pChkNoteMsg != NULL ) { m_pChkNoteMsg->SetCheckState( false ); } tooltip_index_map_.clear(); tooltip_index_map_[eControl_Button_C100] = 5921; tooltip_index_map_[eControl_Button_C200] = 5980; tooltip_index_map_[eControl_Button_CT01] = TOOLTIP_STRING_NOTE_CODE; } VOID HeroGaugeDialog2Control::MessageProc( SI_MESSAGE * pMessage ) { switch( pMessage->eResultMsg ) { case RT_MSG_LBUTTONCLICK: { POSTYPE pos = getCtrlIDToPos( pMessage->dwCtrlID ); switch( pos ) { case eControl_Button_B101: { uiPartyMan * pPartyMan = (uiPartyMan *)g_InterfaceManager.GetUserInterfaceManager( UIMAN_PARTY ); if ((pPartyMan != NULL) && (pPartyMan->IsParty() == false) && (g_pHero != NULL)) { g_pHero->SendZONE_EX_QUEST_PORTAL_ENTER_SYN(); } else { LeaveParty(); } } break; case eControl_Button_C100: { if (GameFramework::GetCurScene() == SCENE_TYPE_SSQ) { break; } uiCommunityMan* pCommMan = static_cast(g_InterfaceManager.GetUserInterfaceManager(UIMAN_COMMUNITY)); if(pCommMan) { pCommMan->ShowFriendChatDlg(NULL); } } break; case eControl_Button_C200: { #ifdef _NA_0_20110613_GAME_SHOP_RENEWAL #if defined(_SUNGAME_VER) if (PROGRAMPARAM->is_block_cash_shop() == false) #endif //defined(_SUNGAME_VER) { ConvenienceStore::CashShop::instance()->OpenCashShopWithGiftMenu(); } #else uiCashItemShopMan *pMan = static_cast(g_InterfaceManager.GetUserInterfaceManager(UIMAN_CASH_ITEM_SHOP)); if(pMan && pMan->GetNewPresentRcvCount()) { pMan->SetRqstState(eRqstState_Present_List); pMan->Send_CG_SHOP_CASH_REQ_SYN(); } #endif //#ifdef _NA_0_20110613_GAME_SHOP_RENEWAL } break; case eControl_Button_CT01: { if (GameFramework::GetCurScene() == SCENE_TYPE_SSQ) { break; } uiCommunityMan* pCommMan = GET_DIALOG_MANAGER( uiCommunityMan, UIMAN_COMMUNITY ); if( pCommMan ) { pCommMan->ShowCommunityDlg(); uiCommunityDlg *pCommunityDlg =(uiCommunityDlg*)g_InterfaceManager.GetDialog(InterfaceManager::DIALOG_COMMUNITY_DLG); if(pCommunityDlg) { pCommunityDlg->ChangeMode(eCM_MAIL); } } } break; default: break; } } break; case RT_MSG_MOUSEOVER: { POSTYPE pos = getCtrlIDToPos( pMessage->dwCtrlID ); tooltip_string_code_ = 0; map::iterator iter; iter = tooltip_index_map_.find(pos); if (iter != tooltip_index_map_.end()) { tooltip_string_code_ = iter->second; } } break; default: { SolarDialog::MessageProc( pMessage ); } break; } } VOID HeroGaugeDialog2Control::NetworkProc( MSG_BASE * pMsg ) { } VOID HeroGaugeDialog2Control::OnRenderSolarDialog() { Render_Tooltip(); } VOID HeroGaugeDialog2Control::OnUpdateSolarDialog() { if(g_pHero) { LEVELTYPE CurLevel = g_pHero->GetLevel(); SetLevel(CurLevel); uiPartyMan* partyMan = static_cast(g_InterfaceManager.GetUserInterfaceManager(UIMAN_PARTY)); CControlWZ* is_hide = getControl(eControl_Picture_P029); CControlWZ* is_exit_party = getControl(eControl_Button_B101); if (partyMan && is_hide) { if(partyMan->IsLeader()) { //Àϵý À̹ÌÁö ¸¶Å©¸¦ ±×·ÁÁØ´Ù is_hide->ShowWindowWZ(WZ_SHOW); } else { is_hide->ShowWindowWZ(WZ_HIDE); } } uiPartyMan * pPartyMan = (uiPartyMan *)g_InterfaceManager.GetUserInterfaceManager( UIMAN_PARTY ); if ( pPartyMan ) { if ( GetCtrlLeavePartyBtn() ) { if ((g_pHero != NULL) && (g_pHero->FixedPortalState.has_portal_info() == true)) { ShowLeavePartyBtn(TRUE); } else { ShowLeavePartyBtn( pPartyMan->IsParty() ); } } } if ( GetCtrlPCModeBtn() ) { ShowPCModeBtn( g_pHero->GetPCBangMode() ); } } } void HeroGaugeDialog2Control::CheckChattingMessage( DWORD Tick ) { static DWORD show_tick = 0; static bool check_chatting_state = false; uiCommunityMan* pCommMan = GET_DIALOG_MANAGER( uiCommunityMan, UIMAN_COMMUNITY ); if( pCommMan == NULL || m_pChkChatMsg == NULL ) return; if( pCommMan->GetNewFriendChatCount() && !pCommMan->GetRejectChat() ) { m_pChkChatMsg->ShowWindowWZ( WZ_SHOW ); show_tick += Tick; if( show_tick >= BLINK_RANGE_TICK ) { show_tick = 0; check_chatting_state = !check_chatting_state; } m_pChkChatMsg->SetCheckState( check_chatting_state ); } else { m_pChkChatMsg->ShowWindowWZ( WZ_HIDE ); } } void HeroGaugeDialog2Control::CheckNoteMessage( DWORD Tick ) { static DWORD show_tick = 0; static bool Note_state = false; uiCommunityMan* pCommMan = GET_DIALOG_MANAGER( uiCommunityMan, UIMAN_COMMUNITY ); if( pCommMan == NULL || m_pChkNoteMsg == NULL ) return; if( pCommMan->HaveNewNote() ) { m_pChkNoteMsg->ShowWindowWZ( WZ_SHOW ); show_tick += Tick; if( show_tick >= BLINK_RANGE_TICK ) { show_tick = 0; Note_state = !Note_state; } m_pChkNoteMsg->SetCheckState( Note_state ); } else { m_pChkNoteMsg->ShowWindowWZ( WZ_HIDE ); } } void HeroGaugeDialog2Control::CheckPresentMessage( DWORD Tick ) { static DWORD show_tick = 0; static bool present_state = false; #ifdef _NA_0_20110613_GAME_SHOP_RENEWAL //! 2011.7.22 / i4u4me / ij½Ã¼¥ ÀÛ¾÷ if( m_pChkPresentMsg == NULL ) return; ConvenienceStore::CashShop* pInstance = ConvenienceStore::CashShop::instance(); if( pInstance == NULL ) return; if( pInstance->HasNewPresent() ) { m_pChkPresentMsg->ShowWindowWZ( WZ_SHOW ); show_tick += Tick; if( show_tick >= BLINK_RANGE_TICK ) { show_tick = 0; present_state = !present_state; } m_pChkPresentMsg->SetCheckState(present_state); } else { m_pChkPresentMsg->ShowWindowWZ( WZ_HIDE ); } #else uiCashItemShopMan *pMan = GET_DIALOG_MANAGER( uiCashItemShopMan, UIMAN_CASH_ITEM_SHOP ); if( pMan == NULL || m_pChkPresentMsg == NULL ) return; if( pMan->GetNewPresentRcvCount() ) { m_pChkPresentMsg->ShowWindowWZ( WZ_SHOW ); show_tick += Tick; if( show_tick >= BLINK_RANGE_TICK ) { show_tick = 0; present_state = !present_state; } m_pChkPresentMsg->SetCheckState( present_state ); } else { m_pChkPresentMsg->ShowWindowWZ( WZ_HIDE ); } #endif //#ifdef _NA_0_20110613_GAME_SHOP_RENEWAL } void HeroGaugeDialog2Control::LeaveParty() { // ÆÄƼ Leave if ( (GameFramework::GetCurScene() == SCENE_TYPE_VILLAGE) #ifdef _NA_006088_20120910_CHAOS_ZONE_FREE_PVP || (GameFramework::GetCurScene() == SCENE_TYPE_FREEPVP) #endif //_NA_006088_20120910_CHAOS_ZONE_FREE_PVP ) { // ¸¶À» uiPartyMan* partyMan = static_cast(g_InterfaceManager.GetUserInterfaceManager(UIMAN_PARTY)); if (partyMan) { partyMan->LeaveParty(); } } #ifdef _NA_005026_20120527_CHAOS_ZONE_BATTLE_GROUND else if ((GameFramework::GetCurScene() == SCENE_TYPE_BATTLEGROUND) && (ChaosSystem::GetBattleGroundData().battle_ground_progress() != ChaosSystem::BattleGroundData::PROGRESS_END)) { TCHAR temp_string[INTERFACE_STRING_LENGTH] = {0,}; // 2720 Á¤¸» ÆÄƼ ¶°³²? g_InterfaceManager.GetInterfaceString(2720, temp_string, INTERFACE_STRING_LENGTH); uiSystemMan* system_manager = GET_DIALOG_MANAGER(uiSystemMan, UIMAN_SYSTEM); if (system_manager) { system_manager->Sys_Confirm(temp_string, GlobalFunc::BattleGroundBackToTheVillageConfirm); } } #endif //_NA_005026_20120527_CHAOS_ZONE_BATTLE_GROUND #ifdef _NA_007114_20140313_CHAOSZONE_GOLDRUSH else if ((GameFramework::GetCurScene() == SCENE_TYPE_GOLDRUSH) && (ChaosSystem::GetGoldRushData().gold_rush_progress() != ChaosSystem::GoldRushData::PROGRESS_END)) { TCHAR temp_string[INTERFACE_STRING_LENGTH] = {0, }; // 2720 ÆÄƼ¸¦ ¶°³ª¸é ÀüÀå¿¡¼­ ÀÌÅ»ÇÏ°Ô µË´Ï´Ù. ÀüÀå ÀÌÅ»½Ã µµ¸ÁÀÚ ÆÐ³ÎƼ¸¦ ¹Þ°Ô µÇ¸ç, ÀÏÁ¤ ½Ã°£µ¿¾È ÀüÀå¿¡ ÀÔÀå ÇÒ ¼ö ¾÷½À´Ï´Ù. Á¤¸» ÆÄƼ¸¦ ¶°³ª½Ã°Ú½À´Ï±î? g_InterfaceManager.GetInterfaceString(2720, temp_string, INTERFACE_STRING_LENGTH); uiSystemMan* system_manager_ptr = GET_DIALOG_MANAGER(uiSystemMan, UIMAN_SYSTEM); if (system_manager_ptr) { system_manager_ptr->Sys_Confirm(temp_string, GlobalFunc::BattleGroundBackToTheVillageConfirm); } } #endif // _NA_007114_20140313_CHAOSZONE_GOLDRUSH else { // ±âŸ º£Æ² uiBase *partyLeavePopup = GET_DIALOG( IM_PARTY_MANAGER::PARTY_LEAVE_POPUP ); if (partyLeavePopup) { partyLeavePopup->ShowInterface(TRUE); } } } void HeroGaugeDialog2Control::SetLevel( DWORD dwLevel ) { TCHAR level_string[64]; Sprintf( level_string, _T("%d"), dwLevel ); CControlWZ * pControl = getControl(eControl_TEXT_LevelT012); if( pControl ) { pControl->SetTextWZ( level_string ); } } CControlWZ * HeroGaugeDialog2Control::getControl( POSTYPE AtPos ) { assert( AtPos < HGAUGE_MAX ); return GetControlWZ( m_wzId[AtPos] ); } POSTYPE HeroGaugeDialog2Control::getCtrlIDToPos( WzID wzId ) { for( POSTYPE i = 0 ; i < HGAUGE_MAX ; ++i ) { if( m_wzId[i] == wzId ) { return i; } } return HGAUGE_MAX; } void HeroGaugeDialog2Control::GetMessage( DWORD messageID,LPARAM lParam,WPARAM wParam ) { if(WM_CLICK_EVENT) { #if WZENGINEVER >= 590 CDialogManager* pDialogManager = g_InterfaceManager.GetDialogManager(); pDialogManager->MoveTail( GetDialogKey() ); #endif // WZENGINEVER >= 590 } } void HeroGaugeDialog2Control::MoveWindowForce( float addx, float addy ) { float x = this->GetDialogWZ()->GetDlgX(); float y = this->GetDialogWZ()->GetDlgY(); x += addx; y += addy; this->GetDialogWZ()->MoveWindowWZ(x,y); } VOID HeroGaugeDialog2Control::OnShowWindow( BOOL val ) { if(val) { } } void HeroGaugeDialog2Control::MoveDefaultWindowPos() { uiBase::MoveDefaultWindowPos(); MoveWindowForce(0.0f,-6.0f); } void HeroGaugeDialog2Control::Render() { CControlWZ* constroller = getControl(eControl_TEXT_LevelT012); if(constroller) { constroller->OnDraw(true); } constroller = getControl(eControl_Button_B100); if(constroller) { constroller->OnDraw(true); } constroller = getControl(eControl_Picture_P029); if(constroller) { constroller->OnDraw(true); } constroller = getControl(eControl_Button_B101); if(constroller) { constroller->OnDraw(true); } constroller = getControl(eControl_Button_C100); if(constroller) { constroller->OnDraw(true); } constroller = getControl(eControl_Button_C200); if(constroller) { constroller->OnDraw(true); } constroller = getControl(eControl_Button_CT01); if(constroller) { constroller->OnDraw(true); } } void HeroGaugeDialog2Control::Render_Tooltip() { uiToolTipMan * pUIMan = GET_DIALOG_MANAGER( uiToolTipMan, UIMAN_TOOLTIP ); if( pUIMan == NULL ) return; int x = Mouse::Instance()->GetMouseX(); int y = Mouse::Instance()->GetMouseY(); CControlWZ* constroller = getControl(eControl_Button_C100); RECT postion; if(constroller && constroller->GetState() == WZ_SHOW) { postion = constroller->GetSizeRect(); if( x > postion.left && x < postion.right && y > postion.top && y < postion.bottom ) { uiCommunityMan* pCommMan = static_cast(g_InterfaceManager.GetUserInterfaceManager(UIMAN_COMMUNITY)); if(pCommMan) { if(pCommMan->GetFriendNameForTooltip()) { TCHAR szMessage[INTERFACE_STRING_LENGTH] = {0,}; TCHAR szTemp[INTERFACE_STRING_LENGTH] = {0,}; g_InterfaceManager.GetInterfaceString(5921, szTemp, INTERFACE_STRING_LENGTH); Sprintf(szMessage, szTemp, pCommMan->GetFriendNameForTooltip()); pUIMan->RegisterTooltipSimpleText(szMessage); pUIMan->SetTooltipDialogID(GetDialogKey()); } } } } constroller = getControl(eControl_Button_C200); if(constroller && constroller->GetState() == WZ_SHOW) { postion = constroller->GetSizeRect(); if( x > postion.left && x < postion.right && y > postion.top && y < postion.bottom ) { #ifdef _NA_0_20110613_GAME_SHOP_RENEWAL //! 2011.7.22 / i4u4me / ij½Ã¼¥ ÀÛ¾÷ if( ConvenienceStore::CashShop* pInstance = ConvenienceStore::CashShop::instance() ) { if( pInstance->HasNewPresent() ) { pUIMan->RegisterTooltipWithStringCode(tooltip_string_code_); pUIMan->SetTooltipDialogID(GetDialogKey()); } } #else uiCashItemShopMan *pMan = static_cast(g_InterfaceManager.GetUserInterfaceManager(UIMAN_CASH_ITEM_SHOP)); if(pMan && pMan->GetNewPresentRcvCount()) { pUIMan->RegisterTooltipWithStringCode(tooltip_string_code_); pUIMan->SetTooltipDialogID(GetDialogKey()); } #endif //#ifdef _NA_0_20110613_GAME_SHOP_RENEWAL } } constroller = getControl(eControl_Button_CT01); if(constroller && constroller->GetState() == WZ_SHOW) { postion = constroller->GetSizeRect(); if( x > postion.left && x < postion.right && y > postion.top && y < postion.bottom ) { if( m_pChkNoteMsg != NULL ) { if( m_pChkNoteMsg->GetState() == WZ_SHOW ) { pUIMan->RegisterTooltipWithStringCode( tooltip_string_code_ ); pUIMan->SetTooltipDialogID(GetDialogKey()); } } } } } #endif// _NA_000000_20130114_RENEWER_UI