#include "stdafx.h" #include "SUIArenaGameSlaughterPracticeWnd.h" #include "SUIArenaGuideTooltipWnd.h" #include "Arena\\ArenaSystem.h" //#include "SGameMessageUI.h" #include "SMessengerMgr.h" #include "SGameManager.h" #include "SGameInterface.h" #include "SGameSystem.h" #include "CommonUtil.h" #include "SChatType.h" #include "SStringDB.h" extern SGameSystem* g_pCurrentGameSystem; SUIArenaGameSlaughterPracticeWnd::SUIArenaGameSlaughterPracticeWnd(SGameManager* gameManager) : SUIArenaGameWnd(gameManager) { } SUIArenaGameSlaughterPracticeWnd::~SUIArenaGameSlaughterPracticeWnd() { } void SUIArenaGameSlaughterPracticeWnd::setTooltip() { SUIArenaGameWnd::setTooltip(); SetChildTooltip("panel_status_default_01", S(2315)); } void SUIArenaGameSlaughterPracticeWnd::getWndInfo() { SUIArenaGameWnd::getWndInfo(); /// 초대 버튼 위치 이동 KUIWnd* bgMember = GetChild("bg_member_witch_01"); m_inviteButton = dynamicCast(GetChild("button_member_invite_witch_01")); m_inviteButton->MovePos(bgMember->GetRect().left, bgMember->GetRect().top); } void SUIArenaGameSlaughterPracticeWnd::Process(DWORD dwTime) { SUIArenaGameWnd::Process(dwTime); procEnableInviteButton(); } void SUIArenaGameSlaughterPracticeWnd::procEnableInviteButton() { if (!m_inviteButton->IsShow()) return ; /// 준비 완료 상태일 때는 diable로 해준다 sArenaSystem* arenaSystem = g_pCurrentGameSystem->getArenaSystem(); int myTeam = arenaSystem->getMyTeam(); bool isMyReady = arenaSystem->isReady(myTeam); if (isMyReady) m_inviteButton->Disable(); else m_inviteButton->Enable(); } void SUIArenaGameSlaughterPracticeWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd ) { SUIArenaGameWnd::OnNotifyUIWindowOpen(bOpen, bLimitWnd); if (bOpen) { } } void SUIArenaGameSlaughterPracticeWnd::inviteTeam() { m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_REQ_INPUTTEXT( SIMSG_UI_REQ_INPUTTEXT::USAGE_ARENA_INVITE_TEAM, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ARENA_GAME_SLAUGHTER_PRACTICE, S(6786), 6583, 1901 ) ); } void SUIArenaGameSlaughterPracticeWnd::procMsgInviteTeam(SGameMessage* msg) { msg->bUse = true; SIMSG_UI_INPUTTEXT* inputMsg = dynamicCast(msg); if (inputMsg->m_strText.empty()) return ; SMSG_CHATTING_REQUEST msgChatReq; msgChatReq.type = CHAT_TYPE::CHAT_NORMAL; XStringUtil::Format(msgChatReq.strText, "/bp_oinvite %s", inputMsg->m_strText.c_str()); m_pGameManager->ProcMsgAtStatic( &msgChatReq ); } void SUIArenaGameSlaughterPracticeWnd::procMsgBattleInfo(SGameMessage* msg) { SUIArenaGameWnd::procMsgBattleInfo(msg); updateInviateButtonStatus(); setPropStateIcon(_PROP_STATE::PS_NEUTRAL); } void SUIArenaGameSlaughterPracticeWnd::procMsgBattleStatus(SGameMessage* msg) { SMSG_BATTLE_ARENA_BATTLE_STATUS* _msg = dynamicCast(msg); setPropStateIcon((int)_msg->GetPropState(0)); } void SUIArenaGameSlaughterPracticeWnd::setShow(bool show) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ARENA_GAME_SLAUGHTER_PRACTICE, show)); } void SUIArenaGameSlaughterPracticeWnd::procMsgJoinBattle(SGameMessage* msg) { SUIArenaGameWnd::procMsgJoinBattle(msg); updateInviateButtonStatus(); } void SUIArenaGameSlaughterPracticeWnd::procMsgLeave(SGameMessage* msg) { SUIArenaGameWnd::procMsgLeave(msg); updateInviateButtonStatus(); } void SUIArenaGameSlaughterPracticeWnd::procMsgPromote(SGameMessage* msg) { msg->bUse = true; SUIArenaGameWnd::procMsgPromote(msg); updateInviateButtonStatus(); } void SUIArenaGameSlaughterPracticeWnd::procMsgLogin(SGameMessage* msg) { msg->bUse = true; sArenaSystem* arenaSystem = g_pCurrentGameSystem->getArenaSystem(); if (!arenaSystem->isRecvBattleInfo()) return ; SUIArenaGameWnd::procMsgLogin(msg); updateInviateButtonStatus(); } void SUIArenaGameSlaughterPracticeWnd::updateInviateButtonStatus() { sArenaSystem* arenaSystem = g_pCurrentGameSystem->getArenaSystem(); int opponentTeam = arenaSystem->getOpponentTeam(); if (sArenaUtility::TEAM_NONE == opponentTeam) return ; /// 공대(?) 파티장만이 초대 버튼이 활성화 된다. bool activeInviteButton = false; if (m_PartyMgr.IsPartyLeader()) { if (0 == arenaSystem->getPlayerCount(opponentTeam)) activeInviteButton = true; } setActiceInviteButton(activeInviteButton); } void SUIArenaGameSlaughterPracticeWnd::setActiceInviteButton(bool activeInviate) { KUIWnd* inviteButton = GetChild("button_member_invite_witch_01"); inviteButton->SetShow(activeInviate ? true : false); KUIWnd* bgMember = GetChild("bg_member_witch_01"); bgMember->SetShow(activeInviate ? false : true); KUIWnd* member = GetChild("text_member_witch_01"); member->SetShow(activeInviate ? false : true); } void SUIArenaGameSlaughterPracticeWnd::setPropStateIcon(int status) { sArenaUtility utility; char const* aniName = utility.getSlaughterPropIconAniName(status); SetChildAniName("panel_status_default_01", aniName); }