#include "stdafx.h" #include "SUIRaceDescWnd.h" #include "KUIControlQJTV.h" #include "KDeviceManager.h" #include "KRenderDevice.h" #include "SGameManager.h" #include "KUITextureManager.h" #include #include "QJTVObj.h" #include #include "SGameMessage.h" //#include "SGameMessageUI.h" #include "GameDefine.h" #include "SStringDB.h" #include "KUIControlScroll.h" //#include "KUIControl.h" #include "SUILazyToolTip.h" /// 2011.02.25 - prodongi #include "SUIDisplayInfo.h" /// 2011.02.22 - prodongi #define EXPLAIN_NUI_POSX 427 #define EXPLAIN_NUI_POSY 363 #define TREE_NUI_POSX 427 #define TREE_NUI_POSY 97 #define INFO_NUI_POSX 6 #define INFO_NUI_POSY 87 #define TAG_NUI_POSX 66 #define TAG_NUI_POSY 603 /// 2011.02.22 - prodongi void SUIRaceDescTreeWnd::PumpUpMessage(LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam) { switch( nMessage ) { case KUI_MESSAGE::KBUTTON_CLICK: { SUIRaceDescWnd* parent = dynamicCast(GetParent()); if (parent) parent->clickButton(lpszControlID); } break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } void SUIRaceDescClanExplainWnd::setSkillToolTip(SUIDisplayInfo* displayInfo) { char const* v_str = "skill_id_"; int id_offset = strlen(v_str); std::list< KUIWnd* >::const_iterator it = m_listChild.begin(); for ( ; it != m_listChild.end(); ++it ) { char const* c = strstr((*it)->GetID(), v_str); if (c) { KUIControl* control = dynamicCast(*it); int skillId = atoi(c + id_offset); control->SetLazyTooltip(new rp::KLazySkillTooltip(*displayInfo, skillId, 1, true)); } } } void SUIRaceDescJobExplainWnd::PumpUpMessage(LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam) { switch( nMessage ) { case KUI_MESSAGE::KBUTTON_CLICK: { SUIRaceDescWnd* parent = dynamicCast(GetParent()); if (parent) parent->clickButton(lpszControlID); } break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } SUIRaceDescWnd::SUILobbyProcessWnd::SUILobbyProcessWnd( SGameManager* pGameManager) : SUIWnd(pGameManager) { } void SUIRaceDescWnd::SUILobbyProcessWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch( nMessage ) { case KUI_MESSAGE::KBUTTON_CLICK: { m_pGameManager->ProcMsgAtStatic( &SIMSG_UIWND_NOTIFY_TO_LOBBY( lpszControlID ) ); } break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } /// 2011.02.25 - prodongi SUIRaceDescWnd::SUIRaceDescWnd( SGameManager* pGameManager, SUIDisplayInfo* displayInfo ) : SUIWnd(pGameManager), m_displayInfo(displayInfo) { /// 2011.02.22 - prodongi m_explainWnd = NULL; m_treeWnd = NULL; m_infoWnd = NULL; m_tagWnd = NULL; m_selectClan = -1; } SUIWnd* SUIRaceDescWnd::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID ) { SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID ); int adjustwidth = pWndManager->GetResolution().height * 4 / 3; if(adjustwidth>KUIWndManager::GetResolution().cx) adjustwidth = KUIWndManager::GetResolution().cx; int adjustheight = pWndManager->GetResolution().height; int adjustx = KUIWndManager::GetResolution().cx/2 - adjustwidth/2; if(adjustx<0) adjustx = 0; SUILobbyProcessWnd *clanprocesswnd = new SUILobbyProcessWnd( m_pGameManager ); clanprocesswnd->CreateWnd( "window_lobby_clan_sub_process.nui", pWndManager, KPoint(adjustx + 715*adjustwidth/1024, 653*adjustheight/768) ); clanprocesswnd->SetParent(this); AddChild(clanprocesswnd); clanprocesswnd->SetShow(true); //기타 텍스트 { SUILobbyProcessWnd *clantext = new SUILobbyProcessWnd( m_pGameManager ); clantext->CreateWnd( "window_lobby_clan_choice_text.nui", pWndManager, KPoint(adjustx+42*adjustwidth/1024, 677*adjustheight/768) ); clantext->SetParent(this); AddChild(clantext); clantext->SetShow(true); SUILobbyProcessWnd *topinfo = new SUILobbyProcessWnd( m_pGameManager ); topinfo->CreateWnd( "window_lobby_clan_topinfo.nui", pWndManager, KPoint(0, 9*adjustheight/768) ); topinfo->SetParent(this); AddChild(topinfo); topinfo->MovePos( adjustx+adjustwidth/2 - topinfo->GetRect().GetWidth()/2, 9*adjustheight/768 ); topinfo->SetShow(true); SUILobbyProcessWnd *downinfo = new SUILobbyProcessWnd( m_pGameManager ); downinfo->CreateWnd( "window_lobby_clan_downinfo.nui", pWndManager, KPoint(0, 700*adjustheight/768) ); downinfo->SetParent(this); AddChild(downinfo); downinfo->MovePos( adjustx+adjustwidth/2 - downinfo->GetRect().GetWidth()/2, 700*adjustheight/768 ); downinfo->SetShow(true); } return this; } void SUIRaceDescWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { switch( pMsg->nType ) { case IMSG_UI_SEND_DATA: { SIMSG_UI_SEND_DATA* pData = (SIMSG_UI_SEND_DATA*)pMsg; if( pData->m_strString == "select_race" ) { /// 2011.02.22 - prodongi m_selectClan = pData->m_nNumber.getAmount(); setTreeNui(m_selectClan); } pMsg->bUse = true; } break; } return SUIWnd::ProcMsgAtStatic( pMsg ); } /// 2011.02.22 - prodongi bool SUIRaceDescWnd::InitData(bool bReload) { initJobNuiName(); return SUIWnd::InitData(bReload); } void SUIRaceDescWnd::Process(DWORD dwTime) { procRemoveWnd(); SUIWnd::Process(dwTime); } void SUIRaceDescWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } void SUIRaceDescWnd::clickButton(char const* controlId) { if (stricmp(controlId, "race_button") == 0) { setExplainInfoNui(m_selectClan); return ; } char const* nuiName = findJobNuiName(controlId); if (nuiName) { setExplainNui(nuiName, EXPLAIN_NUI_POSX, EXPLAIN_NUI_POSY); } } void SUIRaceDescWnd::initJobNuiName() { /// deva m_jobNuiName["button_guide"] = "window_lobby_clan_sub_job_info_deva_basic_guide.nui"; m_jobNuiName["button_fighter"] = "window_lobby_clan_sub_job_info_deva_01_fighter.nui"; m_jobNuiName["button_cleric"] = "window_lobby_clan_sub_job_info_deva_01_cleric.nui"; m_jobNuiName["button_tamer"] = "window_lobby_clan_sub_job_info_deva_01_tamer.nui"; m_jobNuiName["button_knight"] = "window_lobby_clan_sub_job_info_deva_02_knight.nui"; m_jobNuiName["button_warrior"] = "window_lobby_clan_sub_job_info_deva_02_warrior.nui"; m_jobNuiName["button_mage"] = "window_lobby_clan_sub_job_info_deva_02_mage.nui"; m_jobNuiName["button_priest"] = "window_lobby_clan_sub_job_info_deva_02_priest.nui"; m_jobNuiName["button_breeder"] = "window_lobby_clan_sub_job_info_deva_02_breeder.nui"; m_jobNuiName["button_godsknight"] = "window_lobby_clan_sub_job_info_deva_master_godsknight.nui"; m_jobNuiName["button_hero"] = "window_lobby_clan_sub_job_info_deva_master_hero.nui"; m_jobNuiName["button_arcmage"] = "window_lobby_clan_sub_job_info_deva_master_arcmage.nui"; m_jobNuiName["button_saint"] = "window_lobby_clan_sub_job_info_deva_master_saint.nui"; m_jobNuiName["button_maestro"] = "window_lobby_clan_sub_job_info_deva_master_maestro.nui"; /// asura m_jobNuiName["button_staffer"] = "window_lobby_clan_sub_job_info_asura_basic_staffer.nui"; m_jobNuiName["button_strider"] = "window_lobby_clan_sub_job_info_asura_01_strider.nui"; m_jobNuiName["button_magician"] = "window_lobby_clan_sub_job_info_asura_01_magician.nui"; m_jobNuiName["button_summoner"] = "window_lobby_clan_sub_job_info_asura_01_summoner.nui"; m_jobNuiName["button_assassin"] = "window_lobby_clan_sub_job_info_asura_02_assassin.nui"; m_jobNuiName["button_ranger"] = "window_lobby_clan_sub_job_info_asura_02_ranger.nui"; m_jobNuiName["button_sorcerer"] = "window_lobby_clan_sub_job_info_asura_02_sorcerer .nui"; m_jobNuiName["button_darkmagician"] = "window_lobby_clan_sub_job_info_asura_02_darkmagician.nui"; m_jobNuiName["button_battlesummoner"] = "window_lobby_clan_sub_job_info_asura_02_battlesummoner.nui"; m_jobNuiName["button_spectre"] = "window_lobby_clan_sub_job_info_asura_master_spectre.nui"; m_jobNuiName["button_shadowstalker"] = "window_lobby_clan_sub_job_info_asura_master_shadowstalker.nui"; m_jobNuiName["button_doomsayer"] = "window_lobby_clan_sub_job_info_asura_master_doomsayer.nui"; m_jobNuiName["button_soulriver"] = "window_lobby_clan_sub_job_info_asura_master_soulriver.nui"; m_jobNuiName["button_gilgamesh"] = "window_lobby_clan_sub_job_info_asura_master_gilgamesh .nui"; /// gaia m_jobNuiName["button_bangrangza"] = "window_lobby_clan_sub_job_info_gaia_basic_bangrangza.nui"; m_jobNuiName["button_toosa"] = "window_lobby_clan_sub_job_info_gaia_01_toosa.nui"; m_jobNuiName["button_joosulsa"] = "window_lobby_clan_sub_job_info_gaia_01_joosulsa.nui"; m_jobNuiName["button_yasoosa"] = "window_lobby_clan_sub_job_info_gaia_01_yasoosa.nui"; m_jobNuiName["button_zeonsa"] = "window_lobby_clan_sub_job_info_gaia_02_zeonsa.nui"; m_jobNuiName["button_gungsa"] = "window_lobby_clan_sub_job_info_gaia_02_gungsa.nui"; m_jobNuiName["button_madosa"] = "window_lobby_clan_sub_job_info_gaia_02_madosa.nui"; m_jobNuiName["button_matoosa"] = "window_lobby_clan_sub_job_info_gaia_02_matoosa.nui"; m_jobNuiName["button_masoosa"] = "window_lobby_clan_sub_job_info_gaia_02_masoosa.nui"; m_jobNuiName["button_tooshin"] = "window_lobby_clan_sub_job_info_gaia_master_tooshin.nui"; m_jobNuiName["button_shingung"] = "window_lobby_clan_sub_job_info_gaia_master_shingung.nui"; m_jobNuiName["button_hyunza"] = "window_lobby_clan_sub_job_info_gaia_master_hyunza.nui"; m_jobNuiName["button_gumgang"] = "window_lobby_clan_sub_job_info_gaia_master_gumgang.nui"; m_jobNuiName["button_nachal"] = "window_lobby_clan_sub_job_info_gaia_master_nachal.nui"; } char const* SUIRaceDescWnd::findJobNuiName(char const* controlId) { std::map::iterator it = m_jobNuiName.find(controlId); if (it == m_jobNuiName.end()) return NULL; return it->second; } void SUIRaceDescWnd::setExplainInfoNui(int clan) { char const* nuiName; switch (clan) { case GCLAN_ASURA: nuiName = "window_lobby_clan_sub_asura_info.nui"; break; case GCLAN_GAIA: nuiName = "window_lobby_clan_sub_gaia_info.nui"; break; case GCLAN_DEVA: nuiName = "window_lobby_clan_sub_deva_info.nui"; break; default: return ; } SUIWnd* wnd = setExplainNui(nuiName, EXPLAIN_NUI_POSX, EXPLAIN_NUI_POSY); SUIRaceDescClanExplainWnd* clanWnd = dynamicCast(wnd); clanWnd->setSkillToolTip(m_displayInfo); } void SUIRaceDescWnd::setTreeNui(int clan) { char const* nuiName; switch (clan) { case GCLAN_ASURA: nuiName = "window_lobby_clan_sub_asura_job.nui";break; case GCLAN_GAIA: nuiName = "window_lobby_clan_sub_gaia_job.nui"; break; case GCLAN_DEVA: nuiName = "window_lobby_clan_sub_deva_job.nui"; break; default: return ; } setNui(m_treeWnd, nuiName, TREE_NUI_POSX, TREE_NUI_POSY); setExplainInfoNui(clan); setInfoNui(clan); setTagNui(clan); } void SUIRaceDescWnd::setInfoNui(int clan) { char const* nuiName; switch (clan) { case GCLAN_ASURA: nuiName = "window_lobby_clan_sub_asura_info_sub.nui"; break; case GCLAN_GAIA: nuiName = "window_lobby_clan_sub_gaia_info_sub.nui"; break; case GCLAN_DEVA: nuiName = "window_lobby_clan_sub_deva_info_sub.nui"; break; default: return ; } setNui(m_infoWnd, nuiName, INFO_NUI_POSX, INFO_NUI_POSY); } void SUIRaceDescWnd::setTagNui(int clan) { char const* nuiName; switch (clan) { case GCLAN_ASURA: nuiName = "window_lobby_clan_sub_name_tag_asura.nui"; break; case GCLAN_GAIA: nuiName = "window_lobby_clan_sub_name_tag_gaia.nui"; break; case GCLAN_DEVA: nuiName = "window_lobby_clan_sub_name_tag_deva.nui"; break; default: return ; } setNui(m_tagWnd, nuiName, TAG_NUI_POSX, TAG_NUI_POSY); } void SUIRaceDescWnd::adjustResolutionPos(SUIWnd* wnd, int x, int y) { int adjustwidth = m_pManager->GetResolution().height * 4 / 3; if(adjustwidth>KUIWndManager::GetResolution().cx) adjustwidth = KUIWndManager::GetResolution().cx; int adjustheight = m_pManager->GetResolution().height; int adjustx = KUIWndManager::GetResolution().cx/2 - adjustwidth/2; if(adjustx<0) adjustx = 0; wnd->MovePos( adjustx + x*adjustwidth/1024, y*adjustheight/768 ); } void SUIRaceDescWnd::procRemoveWnd() { if (m_removeWndList.empty()) return ; OffToolTipWnd(); std::vector::iterator it = m_removeWndList.begin(); for (; it != m_removeWndList.end(); ++it) { RemoveChild((*it)); } m_removeWndList.clear(); } void SUIRaceDescWnd::addRemoveWnd(SUIWnd* wnd) { if (!wnd) return ; wnd->SetShow(false); m_removeWndList.push_back(wnd); }