#include "stdafx.h" #include "SUIPopupPartyMenuCharacterWnd.h" #include "SUIPartyTypes.h" #include "SGameManager.h" #include "SGameInterface.h" #include "SPlayerInfoMgr.h" #include "KUIControlButton.h" #include "SGameAvatarEx.h" #include "SGameSystem.h" #include "SMessengerMgr.h" #include "SStringDB.h" #include "SGameOption.h" #include "SUIAuthorityChecker.h" extern SGameSystem * g_pCurrentGameSystem; namespace { const char* STR_BTN_WHISPER = "whisper_button"; // 귓말하기 const char* STR_BTN_ADD_FRIEND = "add_friend_button"; // 친구추가 const char* STR_BTN_BLOCK = "block_button"; // 차단설정 const char* STR_BTN_TRADE = "trade_button"; // 거래요청 const char* STR_BTN_REPORT_DIVE = "dive_button_01"; // 2012.05.22 잠수신고 - prodongi const char* STR_BTN_CHALLENGE = "challenge_button"; // 대련신청 const char* STR_BTN_KICK_PARTY = "kick_party_button"; // 파티추방 const char* STR_BTN_TAKEOVER_PARTY = "takeover_party_button"; // 파티장인계 const char* STR_BTN_BUFF_ON = "buff_on_button"; // 버프 보이기 const char* STR_BTN_CREATURE_ON = "creature_on_button"; // 크리처 보이기 const char* STR_BTN_SHOW_UI_SMALL = "ui_small_view_button"; // UI 작게 보기 const char* STR_BTN_BUFF_OFF = "buff_off_button"; // 버프 안보이기 const char* STR_BTN_CREATURE_OFF = "creature_off_button"; // 크리처 안보이기 const char* STR_BTN_SHOW_UI_BIG = "ui_default_view_button"; // UI 크게 보기 const char* STR_BTN_FOLLOW = "follow_button"; // 따라가기 const int WIDTH_SMALL = 97; const int WIDTH_BIG = 138; }; /// 우클릭 메뉴1 : 2011.09.16 - servantes bool SUIPopupPartyMenuCharacterWnd::InitControls( KPoint kPos ) { m_pBtnWhisper = dynamicCast(GetChild(STR_BTN_WHISPER)); m_pBtnAddFriend = dynamicCast(GetChild(STR_BTN_ADD_FRIEND)); m_pBtnBlock = dynamicCast(GetChild(STR_BTN_BLOCK)); m_pBtnRequestDeal = dynamicCast(GetChild(STR_BTN_TRADE)); m_pBtnRequestFight = dynamicCast(GetChild(STR_BTN_CHALLENGE)); m_pBtnKickOut = dynamicCast(GetChild(STR_BTN_KICK_PARTY)); m_pBtnChangeLeader = dynamicCast(GetChild(STR_BTN_TAKEOVER_PARTY)); m_pBtnShowBuf = dynamicCast(GetChild(STR_BTN_BUFF_ON)); m_pBtnShowCreature = dynamicCast(GetChild(STR_BTN_CREATURE_ON)); m_pBtnShowSmallUI = dynamicCast(GetChild(STR_BTN_SHOW_UI_SMALL)); m_pBtnHideBuf = dynamicCast(GetChild(STR_BTN_BUFF_OFF)); m_pBtnHideCreature = dynamicCast(GetChild(STR_BTN_CREATURE_OFF)); m_pBtnShowBigUI = dynamicCast(GetChild(STR_BTN_SHOW_UI_BIG)); m_pBtnFollow = dynamicCast(GetChild(STR_BTN_FOLLOW)); m_pBtnReportDive = dynamicCast(GetChild(STR_BTN_REPORT_DIVE)); m_pBtnWhisper->SetEnableColor("<#ffffff>"); m_pBtnAddFriend->SetEnableColor("<#ffffff>"); m_pBtnBlock->SetEnableColor("<#ffffff>"); m_pBtnRequestDeal->SetEnableColor("<#ffffff>"); m_pBtnRequestFight->SetEnableColor("<#ffffff>"); m_pBtnKickOut->SetEnableColor("<#ffffff>"); m_pBtnChangeLeader->SetEnableColor("<#ffffff>"); m_pBtnShowBuf->SetEnableColor("<#ffffff>"); m_pBtnShowCreature->SetEnableColor("<#ffffff>"); m_pBtnShowSmallUI->SetEnableColor("<#ffffff>"); m_pBtnHideBuf->SetEnableColor("<#ffffff>"); m_pBtnHideCreature->SetEnableColor("<#ffffff>"); m_pBtnShowBigUI->SetEnableColor("<#ffffff>"); m_pBtnFollow->SetEnableColor("<#ffffff>"); m_pBtnReportDive->SetEnableColor("<#ffffff>"); KRect rt; /// creature rt = m_pBtnShowCreature->GetRect(); m_pBtnHideCreature->MovePos(rt.left, rt.top); /// buff rt = m_pBtnShowBuf->GetRect(); m_pBtnHideBuf->MovePos(rt.left, rt.top); /// ui rt = m_pBtnShowSmallUI->GetRect(); m_pBtnShowBigUI->MovePos(rt.left, rt.top); /// rt = m_pBtnRequestFight->GetRect(); m_pBtnReportDive->MovePos(rt.left, rt.top); /// 2011.11.17 우선 기능 비활성화 한다 - prodongi //m_pBtnShowCreature->Disable(); //m_pBtnHideCreature->Disable(); return SUIWnd::InitControls( kPos ); } bool SUIPopupPartyMenuCharacterWnd::InitData( bool bReload ) { // 2011.11.09 - prodongi m_pGameManager->GetGameInterface()->addPopupList(TOGGLE_WINDOW::UIWINDOW_POPUP_PARTY_MENU_CHARACTER); return SUIWnd::InitData(bReload); } /// 2011.11.17 안쓰임 - prodongi /* void SUIPopupPartyMenuCharacterWnd::ArrangeMenuByUISizeState(int nState) { int startx = 6, starty = 84, W = 114, H = 19; if (nState == PARTY_UI_SIZE_SMALL) // 작게 보이는 상태일 경우 { KRect rt = m_pBtnShowSmallUI->GetRect(); m_pBtnShowBig->SetShow(true); m_pBtnShowSmallUI->SetShow(false); m_pBtnShowBig->MovePos(rt.left, rt.top); } else if(nState == PARTY_UI_SIZE_BIG) // 크게 보이는 상태일 경우 { KRect rt = m_pBtnShowSmallUI->GetRect(); m_pBtnShowBig->SetShow(false); m_pBtnShowSmallUI->SetShow(true); m_pBtnShowSmallUI->MovePos(rt.left, rt.top); } } */ void SUIPopupPartyMenuCharacterWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch(nMessage) { case KUI_MESSAGE::KBUTTON_CLICK: { BOOL bPushButton = FALSE; if ( ::_stricmp( lpszControlID, STR_BTN_WHISPER ) == 0 ) // 귓말하기 { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "whisper_chatting", m_strSelectPartyWnd.c_str() ) ); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID, STR_BTN_ADD_FRIEND ) == 0 ) // 친구추가 { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "add_friend", m_strSelectPartyWnd.c_str(), unsigned int(m_nSelectIndex) ) ); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID, STR_BTN_BLOCK ) == 0 ) // 차단설정 { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "block_friend", m_strSelectPartyWnd.c_str(), unsigned int(m_nSelectIndex) ) ); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID, STR_BTN_TRADE ) == 0 ) // 거래요청 { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "select_member_request_trade", m_strSelectPartyWnd.c_str() ) ); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID, STR_BTN_CHALLENGE ) == 0 ) // 대련신청 { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "request_compete", m_strSelectPartyWnd.c_str() ) ); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID, STR_BTN_REPORT_DIVE ) == 0 ) // 잠수 신고 { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "report_dive", m_strSelectPartyWnd.c_str() ) ); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID, STR_BTN_KICK_PARTY ) == 0 ) // 파티추방 { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "kick_out_party", m_strSelectPartyWnd.c_str(), unsigned int(m_nSelectIndex) ) ); // m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "kick_out_party", m_strSelectPartyWnd.c_str() ); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID, STR_BTN_TAKEOVER_PARTY ) == 0 ) // 파티장인계 { /// 2011.11.16 파티장 인계는 일반 파티만 된다 - prodongi if(m_nSelectPartyType == PARTY_NORMAL/* || m_nSelectPartyType == PARTY_BEARROAD*/) { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "take_over_party", m_strSelectPartyWnd.c_str() ) ); bPushButton = TRUE; } } else if( ::_stricmp( lpszControlID, STR_BTN_BUFF_ON ) == 0 ) // 버프 보이기 { number_t type(TS_ENTER::GAME_PLAYER); number_t index(m_nSelectIndex); m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "one_state_on", m_strSelectPartyWnd.c_str(), type, index)); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID,STR_BTN_BUFF_OFF ) == 0 ) // 버프 안보이기 { number_t type(TS_ENTER::GAME_PLAYER); number_t index(m_nSelectIndex); m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "one_state_off", m_strSelectPartyWnd.c_str(), type, index)); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID, STR_BTN_CREATURE_ON ) == 0 ) // 크리처 보이기 { number_t index(m_nSelectIndex); m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_one_creature", m_strSelectPartyWnd.c_str(), index, number_t(0))); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID,STR_BTN_CREATURE_OFF ) == 0 ) // 크리처 안보이기 { number_t index(m_nSelectIndex); m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "hide_one_creature", m_strSelectPartyWnd.c_str(), index, number_t(0))); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID,STR_BTN_SHOW_UI_SMALL ) == 0 ) // UI 작게 보기 { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_small_ui", m_strSelectPartyWnd.c_str() ) ); /// 2011.11.17 안 쓰임 - prodongi //ArrangeMenuByUISizeState(PARTY_UI_SIZE_SMALL); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID,STR_BTN_SHOW_UI_BIG ) == 0 ) // UI 크게 보기 { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_SEND_DATA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "show_big_ui", m_strSelectPartyWnd.c_str() ) ); /// 2011.11.17 안 쓰임 - prodongi //ArrangeMenuByUISizeState(PARTY_UI_SIZE_BIG); bPushButton = TRUE; } else if( ::_stricmp( lpszControlID,STR_BTN_FOLLOW ) == 0 ) // 따라가기 { if( m_PlayerInfoMgr.GetTarget() ) { m_pGameManager->PostMsgAtDynamic( new SMSG_AUTO_FOLLOW() ); } bPushButton = TRUE; } if(bPushButton) m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPUP_PARTY_MENU_CHARACTER, false ) ); } } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } void SUIPopupPartyMenuCharacterWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { switch( pMsg->nType ) { case IMSG_UI_MOVE: { SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg; MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY ); pMsg->bUse = true; } break; case IMSG_UI_SEND_DATA: { SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg; if ( pData->m_strString == "select_party" ) // to small { m_strSelectPartyWnd = pData->m_strText; // select party wnd name m_nSelectPartyType = (int)pData->m_nNumber.getAmount(); // select party type m_nSelectIndex = (int)pData->m_nNumber2.getAmount(); // select index /* if(m_nSelectPartyType == PARTY_NORMAL || m_nSelectPartyType == PARTY_BEARROAD) m_pBtnChangeLeader->Disable(); else m_pBtnChangeLeader->Enable(); */ /// 2011.11.16 파티장 인계는 일반 파티만 된다 - prodongi // if(m_nSelectPartyType == PARTY_NORMAL) // m_pBtnChangeLeader->Enable(); // else // m_pBtnChangeLeader->Disable(); } else if( pData->m_strString == "position" ) // ui position { int w=WIDTH_SMALL; if((int)pData->m_nNumber3.getAmount() == PARTY_UI_ID_BIG) w = WIDTH_BIG; int x = pData->m_nNumber.getAmount(); int y = pData->m_nNumber2.getAmount(); if( GetGameOption().GetResolution_Width() < x + GetRect().GetWidth() ) x -= (w + GetRect().GetWidth()); if( GetGameOption().GetResolution_Height() < y + GetRect().GetHeight() ) y -= ( (y + GetRect().GetHeight()) - GetGameOption().GetResolution_Height() ); MovePos( x, y ); } /* else if( pData->m_strString == "off_show_creature_button" ) // 크리처 보이기 버튼 비활성 { KRect rt = m_pBtnHideCreature->GetRect(); m_pBtnHideCreature->SetShow(false); m_pBtnShowCreature->MovePos(rt.left, rt.top); m_pBtnShowCreature->SetShow(true); } */ else if( pData->m_strString == "leader" ) // 2011.11.09 - servantes : 리더이면 { setActivityButton(true, pData->m_strText, (bool)pData->m_dwData, m_nSelectPartyType, pData->m_nNumber3.getAmount() > 0 ); } else if( pData->m_strString == "not_leader" ) // 2011.11.09 - servantes : 리더가 아니면 { setActivityButton(false, pData->m_strText, (bool)pData->m_dwData, m_nSelectPartyType, pData->m_nNumber3.getAmount() > 0 ); } /// 2011.11.09 - prodongi else if ( pData->m_strString == "popup_update") { updatePopup(pData->m_nNumber.getAmount(), pData->m_nNumber2.getAmount()); } /// 2011.11.17 - prodongi else if (pData->m_strString == "set_status") { setActivityButton(m_pBtnShowBuf, m_pBtnHideBuf, pData->m_nNumber.getAmount() == 0 ? false : true); setActivityButton(m_pBtnShowCreature, m_pBtnHideCreature, pData->m_nNumber2.getAmount() == 0 ? false : true); setActivityButton(m_pBtnShowBigUI, m_pBtnShowSmallUI, pData->m_nNumber3.getAmount() == 0 ? PARTY_UI_ID_SMALL : PARTY_UI_ID_BIG); setActivityButton(m_pBtnReportDive, m_pBtnRequestFight, g_pCurrentGameSystem->isInArena() ? true : false); } } break; } } void SUIPopupPartyMenuCharacterWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd ) { int k=0; k=0; SUIWnd::OnNotifyUIWindowOpen(bOpen); } void SUIPopupPartyMenuCharacterWnd::updatePopup(int x, int y) { if (!IsShow()) return ; if (!IsInRect(x, y)) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPUP_PARTY_MENU_CHARACTER, false) ); } } void SUIPopupPartyMenuCharacterWnd::setActivityButton(bool isLeader, std::string const& playerName, bool isLogin, int nPartyType, bool isMeLeader) { sAuthorityList checker; checkAuthority(checker, &m_PartyMgr, &m_RaidMgr, &m_FriendMgr, &m_CutMgr, &m_PlayerInfoMgr, playerName.c_str(), isLogin); (checker.m_whisper) ? m_pBtnWhisper->Enable() : m_pBtnWhisper->Disable(); (0 == checker.m_friend) ? m_pBtnAddFriend->Disable() : m_pBtnAddFriend->Enable(); (0 == checker.m_block) ? m_pBtnBlock->Disable() : m_pBtnBlock->Enable(); (checker.m_trade) ? m_pBtnRequestDeal->Enable() : m_pBtnRequestDeal->Disable(); (checker.m_challenge) ? m_pBtnRequestFight->Enable() : m_pBtnRequestFight->Disable(); (checker.m_kick) ? m_pBtnKickOut->Enable() : m_pBtnKickOut->Disable(); (checker.m_takeOver) ? m_pBtnChangeLeader->Enable() : m_pBtnChangeLeader->Disable(); // AziaMafia No Follow //(checker.m_follow) ? m_pBtnFollow->Enable() : m_pBtnFollow->Disable(); (checker.m_follow) ? m_pBtnFollow->Disable() : m_pBtnFollow->Disable(); (checker.m_reportDive) ? m_pBtnReportDive->Enable() : m_pBtnReportDive->Disable(); /* bool isSelectedLocal = false; SGameAvatarEx* localPlayer = g_pCurrentGameSystem->GetLocalPlayer(); if (playerName == localPlayer->GetName()) isSelectedLocal = true; */ if(isLogin == false) // 로그인하지 않은 상태면 { /* m_pBtnWhisper ->Disable(); m_pBtnAddFriend ->Disable(); m_pBtnBlock ->Disable(); m_pBtnRequestDeal ->Disable(); m_pBtnRequestFight->Disable(); m_pBtnFollow ->Disable(); m_pBtnKickOut ->Enable(); m_pBtnChangeLeader->Disable(); */ m_pBtnShowBuf->Disable(); m_pBtnHideBuf->Disable(); } else // 로그인한 상태일 때 { m_pBtnShowBuf->Enable(); m_pBtnHideBuf->Enable(); /* if (isSelectedLocal) { m_pBtnWhisper->Disable(); m_pBtnAddFriend->Disable(); m_pBtnBlock->Disable(); m_pBtnRequestDeal->Disable(); m_pBtnRequestFight->Disable(); m_pBtnFollow->Disable(); m_pBtnKickOut->Disable(); m_pBtnChangeLeader->Disable(); } else if(isMeLeader == true) // 내가 리더일 때 { m_pBtnWhisper ->Enable(); m_pBtnAddFriend ->Enable(); m_pBtnBlock ->Enable(); m_pBtnRequestDeal ->Enable(); m_pBtnRequestFight->Enable(); m_pBtnFollow ->Enable(); if(isLeader == true) // 선택한 캐릭터가 리더일 경우 - 나 다 { m_pBtnKickOut ->Disable(); m_pBtnChangeLeader->Disable(); } else // 선택한 캐릭터가 리더가 아닐 경우 { if(nPartyType == PARTY_NORMAL) m_pBtnChangeLeader->Enable(); else m_pBtnChangeLeader->Disable(); m_pBtnKickOut->Enable(); } } else // 내가 리더가 아닐 때 { m_pBtnWhisper ->Enable(); m_pBtnAddFriend ->Enable(); m_pBtnBlock ->Enable(); m_pBtnRequestDeal ->Enable(); m_pBtnRequestFight->Enable(); m_pBtnFollow ->Enable(); m_pBtnKickOut ->Disable(); m_pBtnChangeLeader->Disable(); } */ } /// 파티장 인계는 select_party에서 설정함, 같은 곳에서 하면 좋을 텐데,, - prodongi std::string str; // 차단 스트링 if (m_CutMgr.IsExistMember(playerName.c_str())) { str = CStringUtil::StringFormat("%s", S( 6603 )); //차단 해제 스트링 아이디 } else { str = CStringUtil::StringFormat("%s", S( 6579 )); //차단 설정 스트링 아이디 } m_pBtnBlock->SetCaption(str.c_str()); // 친구 스트링 if( m_FriendMgr.IsExistMember( playerName.c_str())) { str = CStringUtil::StringFormat("%s", S( 6602 )); //친구 삭제 스트링 아이디 } else { str = CStringUtil::StringFormat("%s", S( 6577 )); //친구 추가 스트링 아이디 } m_pBtnAddFriend->SetCaption(str.c_str()); } void SUIPopupPartyMenuCharacterWnd::setActivityButton(KUIControlButton* buttonShow, KUIControlButton* buttonHide, bool show) { buttonShow->SetShow(false); buttonHide->SetShow(false); if (show) { buttonShow->SetShow(true); } else { buttonHide->SetShow(true); } }