bool CN3UIStatic::Load(HANDLE hFile) { if (false == CN3UIBase::Load(hFile)) return false; // m_pImageBkGnd, m_pBuffOutRef 설정하기 for(UIListItor itor = m_Children.begin(); m_Children.end() != itor; ++itor) { CN3UIBase* pChild = (*itor); if (UI_TYPE_IMAGE == pChild->UIType()) { m_pImageBkGnd = (CN3UIImage*)pChild; } else if (UI_TYPE_STRING == pChild->UIType()) { m_pBuffOutRef = (CN3UIString*)pChild; } } // 이전 uif파일을 컨버팅 하려면 사운드 로드 하는 부분 막기 int iSndFNLen = 0; DWORD dwNum; ReadFile(hFile, &iSndFNLen, sizeof(iSndFNLen), &dwNum, NULL); // 사운드 파일 문자열 길이 if (iSndFNLen>0) { std::vector<char> buffer(iSndFNLen+1, NULL); ReadFile(hFile, &buffer[0], iSndFNLen, &dwNum, NULL); __ASSERT(NULL == m_pSnd_Click, "memory leak"); m_pSnd_Click = s_SndMgr.CreateObj(&buffer[0], SNDTYPE_2D); } return true; }
void CN3UIStatic::operator = (const CN3UIStatic& other) { CN3UIBase::operator = (other); SetSndClick(other.GetSndFName_Click()); // m_pImageBkGnd, m_pBuffOutRef 설정하기 for(UIListItor itor = m_Children.begin(); m_Children.end() != itor; ++itor) { CN3UIBase* pChild = (*itor); if (UI_TYPE_IMAGE == pChild->UIType()) { m_pImageBkGnd = (CN3UIImage*)pChild; } else if (UI_TYPE_STRING == pChild->UIType()) { m_pBuffOutRef = (CN3UIString*)pChild; } } }
bool CUIManager::BroadcastIconDropMsg(__IconItemSkill* spItem) { bool bFound = false; POINT ptCur = CGameProcedure::s_pLocalInput->MouseGetPos(); // 윈도우들을 돌아 다니면서 검사.. for(UIListItor itor = m_Children.begin(); m_Children.end() != itor; ++itor) { if ( bFound ) break; CN3UIBase* pChild = (*itor); if ( pChild->UIType() == UI_TYPE_ICON_MANAGER ) { // 해당 윈도우가 보이고(활성화 되어 있고), 그 윈도우 영역 안에 있으면.. if ( ((CN3UIWndBase* )pChild)->IsVisible() && ((CN3UIWndBase* )pChild)->IsIn(ptCur.x, ptCur.y) ) // 해당 윈도우에 아이콘 드롭 메시지 함수를 호출.. if ( ((CN3UIWndBase* )pChild)->ReceiveIconDrop(spItem, ptCur) ) return true; else bFound = true; } } // 어느 누구의 영역에도 속하지 않으면.. 해당 아이콘을 가진 윈도우에게 Cancel 메시지를 날려 준다.. if ( !bFound ) { switch ( CN3UIWndBase::m_sSelectedIconInfo.UIWndSelect.UIWnd ) { case UIWND_INVENTORY: CGameProcedure::s_pProcMain->m_pUIInventory->CancelIconDrop(spItem); break; case UIWND_TRANSACTION: CGameProcedure::s_pProcMain->m_pUITransactionDlg->CancelIconDrop(spItem); break; case UIWND_WARE_HOUSE: CGameProcedure::s_pProcMain->m_pUIWareHouseDlg->CancelIconDrop(spItem); break; case UIWND_EXCHANGE_REPAIR: CGameProcedure::s_pProcMain->m_pUIItemREDlg->CancelIconDrop(spItem); break; } } return false; }
bool CN3UIBase::Save(HANDLE hFile) { CN3BaseFileAccess::Save(hFile); DWORD dwRWC = NULL; // child 정보 int iCC = m_Children.size(); WriteFile(hFile, &iCC, sizeof(iCC), &dwRWC, NULL); // Child 갯수 ㅆ고..고.. for(UIListReverseItor itor = m_Children.rbegin(); m_Children.rend() != itor; ++itor) // childadd할때 push_front이므로 저장할 때 거꾸로 저장해야 한다. { CN3UIBase* pChild = (*itor); eUI_TYPE eUIType = pChild->UIType(); WriteFile(hFile, &eUIType, sizeof(eUIType), &dwRWC, NULL); // UI Type 쓰고.. pChild->Save(hFile); } // base 정보 int iIDLen = 0; iIDLen = m_szID.size(); WriteFile(hFile, &iIDLen, sizeof(iIDLen), &dwRWC, NULL); // id length if (iIDLen>0) WriteFile(hFile, m_szID.c_str(), iIDLen, &dwRWC, NULL); // ui id WriteFile(hFile, &m_rcRegion, sizeof(m_rcRegion), &dwRWC, NULL); // m_rcRegion WriteFile(hFile, &m_rcMovable, sizeof(m_rcMovable), &dwRWC, NULL); // m_rcMovable WriteFile(hFile, &m_dwStyle, sizeof(m_dwStyle), &dwRWC, NULL); // style WriteFile(hFile, &m_dwReserved, sizeof(m_dwReserved), &dwRWC, NULL); // m_dwReserved int iTooltipLen = m_szToolTip.size(); WriteFile(hFile, &iTooltipLen, sizeof(iTooltipLen), &dwRWC, NULL); // tooltip문자열 길이 if (iTooltipLen>0) WriteFile(hFile, m_szToolTip.c_str(), iTooltipLen, &dwRWC, NULL); int iSndFNLen = 0; if (m_pSnd_OpenUI) iSndFNLen = m_pSnd_OpenUI->m_szFileName.size(); WriteFile(hFile, &iSndFNLen, sizeof(iSndFNLen), &dwRWC, NULL); // 사운드 파일 문자열 길이 if (iSndFNLen>0) WriteFile(hFile, m_pSnd_OpenUI->m_szFileName.c_str(), iSndFNLen, &dwRWC, NULL); iSndFNLen = 0; if (m_pSnd_CloseUI) iSndFNLen = m_pSnd_CloseUI->m_szFileName.size(); WriteFile(hFile, &iSndFNLen, sizeof(iSndFNLen), &dwRWC, NULL); // 사운드 파일 문자열 길이 if (iSndFNLen>0) WriteFile(hFile, m_pSnd_CloseUI->m_szFileName.c_str(), iSndFNLen, &dwRWC, NULL); return true; }
bool CN3UIButton::Load(HANDLE hFile) { if (false == CN3UIBase::Load(hFile)) return false; DWORD dwNum; ReadFile(hFile, &m_rcClick, sizeof(m_rcClick), &dwNum, NULL); // click 영역 // m_ImageRef 설정하기 for(UIListItor itor = m_Children.begin(); m_Children.end() != itor; ++itor) { CN3UIBase* pChild = (*itor); if (UI_TYPE_IMAGE != pChild->UIType()) continue; // image만 골라내기 int iBtnState = (int)(pChild->GetReserved()); if (iBtnState<NUM_BTN_STATE) { m_ImageRef[iBtnState] = (CN3UIImage*)pChild; } } // 이전 uif파일을 컨버팅 하려면 사운드 로드 하는 부분 막기 int iSndFNLen = 0; ReadFile(hFile, &iSndFNLen, sizeof(iSndFNLen), &dwNum, NULL); // 사운드 파일 문자열 길이 if (iSndFNLen>0) { std::vector<char> buffer(iSndFNLen+1, NULL); ReadFile(hFile, &buffer[0], iSndFNLen, &dwNum, NULL); __ASSERT(NULL == m_pSnd_On, "memory leak"); m_pSnd_On = s_SndMgr.CreateObj(&buffer[0], SNDTYPE_2D); } ReadFile(hFile, &iSndFNLen, sizeof(iSndFNLen), &dwNum, NULL); // 사운드 파일 문자열 길이 if (iSndFNLen>0) { std::vector<char> buffer(iSndFNLen+1, NULL); ReadFile(hFile, &buffer[0], iSndFNLen, &dwNum, NULL); __ASSERT(NULL == m_pSnd_Click, "memory leak"); m_pSnd_Click = s_SndMgr.CreateObj(&buffer[0], SNDTYPE_2D); } return true; }
bool CN3UIList::Load(HANDLE hFile) { bool bSuccess = CN3UIBase::Load(hFile); // font 정보 DWORD dwNum; int iStrLen = 0; ReadFile(hFile, &iStrLen, sizeof(iStrLen), &dwNum, NULL); // font 이름 길이 __ASSERT(iStrLen>0, "No font name"); if (iStrLen>0) { m_szFontName.assign(iStrLen, ' '); ReadFile(hFile, &(m_szFontName[0]), iStrLen, &dwNum, NULL); // string ReadFile(hFile, &m_dwFontHeight, 4, &dwNum, NULL); // font height ReadFile(hFile, &m_crFont, 4, &dwNum, NULL); // font color ReadFile(hFile, &m_bFontBold, 4, &dwNum, NULL); // font flag (bold, italic) ReadFile(hFile, &m_bFontItalic, 4, &dwNum, NULL); // font flag (bold, italic) } // Child 중에 Scroll Bar 가 있는지 찾아본다. for(UIListItor itor = m_Children.begin(); m_Children.end() != itor; ++itor) { CN3UIBase* pUI = *itor; if(pUI->UIType() == UI_TYPE_SCROLLBAR) { m_pScrollBarRef = (CN3UIScrollBar*)pUI; } // else if(pUI->Type() == UI_TYPE_STRING) // { // CN3UIString* pString = *itor; // if( pString->GetFontName != m_szFontName || // pString->GetFontHeight() != m_dwFontHeight || // m_bFontBold != (pString->GetFontFlags() & D3DFONT_BOLD) || // m_bFontItalic != (pString->GetFontFlags() & D3DFONT_ITALIC) ) // 폰트가 다르면.. 적용 // { // pString->SetFont(m_szFontName, m_dwFontHeight, m_bFontBold, m_bFontItalic); // } // } } return bSuccess; }
void CN3UIButton::operator = (const CN3UIButton& other) { CN3UIBase::operator = (other); m_rcClick = other.m_rcClick; // 클릭 영역 SetSndOn(other.GetSndFName_On()); // 사운드 SetSndClick(other.GetSndFName_Click()); // 사운드 // m_ImageRef 설정하기 for(UIListItor itor = m_Children.begin(); m_Children.end() != itor; ++itor) { CN3UIBase* pChild = (*itor); if (UI_TYPE_IMAGE != pChild->UIType()) continue; // image만 골라내기 int iBtnState = (int)(pChild->GetReserved()); if (iBtnState<NUM_BTN_STATE) { m_ImageRef[iBtnState] = (CN3UIImage*)pChild; } } }
void CN3UIBase::ArrangeZOrder() { // 보통 image가 배경그림이 되므로 child list에서 맨 뒤로 보낸다. // 왜냐하면 맨 뒤에 있는것이 맨 먼저 그려지므로 UIList tempList; for(UIListItor itor = m_Children.begin(); m_Children.end() != itor;) { CN3UIBase* pChild = (*itor); if(UI_TYPE_IMAGE == pChild->UIType()) { itor = m_Children.erase(itor); // 현재 위치에서 지우고 tempList.push_back(pChild); // 임시 버퍼에 저장 } else ++itor; } for(itor = tempList.begin(); tempList.end() != itor; ++itor) { CN3UIBase* pChild = (*itor); m_Children.push_back(pChild); // child list맨 뒤에 넣기 } tempList.clear(); }
void CUIItemExchange::Render() { if (!m_bVisible) return; // 보이지 않으면 자식들을 render하지 않는다. POINT ptCur = CGameProcedure::s_pLocalInput->MouseGetPos(); m_pUITooltipDlg->DisplayTooltipsDisable(); bool bTooltipRender = false; __IconItemSkill* spItem; for(UIListReverseItor itor = m_Children.rbegin(); m_Children.rend() != itor; ++itor) { CN3UIBase* pChild = (*itor); pChild->Render(); if ( (pChild->UIType() == UI_TYPE_ICON) && (pChild->GetStyle() & UISTYLE_ICON_HIGHLIGHT) ) { bTooltipRender = true; spItem = GetHighlightIconItem( (CN3UIIcon* )pChild ); } } if ( bTooltipRender ) m_pUITooltipDlg->DisplayTooltipsEnable(ptCur.x, ptCur.y, spItem ); }
void CN3UIBase::operator = (const CN3UIBase& other) { Init(NULL); // 일단 부모는 없게 초기화 UIListItorConst it = other.m_Children.begin(); UIListItorConst itEnd = other.m_Children.end(); CN3UIBase* pOtherChild = NULL; CN3UIBase* pChild = NULL; for(; it != itEnd; it++) { pOtherChild = *it; if(NULL == pOtherChild) continue; pChild = NULL; switch(pOtherChild->UIType()) { case UI_TYPE_BASE: { pChild = new CN3UIBase(); *pChild = *pOtherChild; } break; case UI_TYPE_BUTTON: { CN3UIButton *pUINew = new CN3UIButton(); *pUINew = *((CN3UIButton*)pOtherChild); pChild = pUINew; } break; // button case UI_TYPE_STATIC: { CN3UIStatic* pUINew = new CN3UIStatic(); *pUINew = *((CN3UIStatic*)pOtherChild); pChild = pUINew; } break; // static (배경그림과 글자가 나오는 클래스) case UI_TYPE_PROGRESS: { CN3UIProgress* pUINew = new CN3UIProgress(); *pUINew = *((CN3UIProgress*)pOtherChild); pChild = pUINew; } break; // progress case UI_TYPE_IMAGE: { CN3UIImage* pUINew = new CN3UIImage(); *pUINew = *((CN3UIImage*)pOtherChild); pChild = pUINew; } break; // image case UI_TYPE_SCROLLBAR: { CN3UIScrollBar* pUINew = new CN3UIScrollBar(); *pUINew = *((CN3UIScrollBar*)pOtherChild); pChild = pUINew; } break; // scroll bar case UI_TYPE_STRING: { CN3UIString* pUINew = new CN3UIString(); *pUINew = *((CN3UIString*)pOtherChild); pChild = pUINew; } break; // string case UI_TYPE_TRACKBAR: { CN3UITrackBar* pUINew = new CN3UITrackBar(); *pUINew = *((CN3UITrackBar*)pOtherChild); pChild = pUINew; } break; // track bar case UI_TYPE_EDIT: { CN3UIEdit* pUINew = new CN3UIEdit(); *pUINew = *((CN3UIEdit*)pOtherChild); pChild = pUINew; } break; // edit case UI_TYPE_AREA: { CN3UIArea* pUINew = new CN3UIArea(); *pUINew = *((CN3UIArea*)pOtherChild); pChild = pUINew; } break; // area case UI_TYPE_TOOLTIP: { CN3UITooltip* pUINew = new CN3UITooltip(); *pUINew = *((CN3UITooltip*)pOtherChild); pChild = pUINew; } break; // tooltip case UI_TYPE_LIST: { CN3UIList* pUINew = new CN3UIList(); *pUINew = *((CN3UIList*)pOtherChild); pChild = pUINew; } break; // tooltip // case UI_TYPE_ICON: pUIDest = new CN3UIIcon(); *pUIDest = *((CN3UIBase*)pUISrc); break; // icon // case UI_TYPE_ICON_MANAGER: pUIDest = new CN3UIIconManager(); *pUIDest = *((CN3UIBase*)pUISrc); break; // icon manager.. #ifdef _REPENT case UI_TYPE_ICONSLOT: { CN3UIIconSlot* pUINew = new CN3UIIconSlot(); *pUINew = *((CN3UIIconSlot*)pOtherChild); pChild = pUINew; } break; // icon slot #endif } if(pChild) pChild->SetParent(this); // 부모 지정 } m_bVisible = other.m_bVisible; m_dwReserved = other.m_dwReserved; m_dwStyle = other.m_dwStyle; m_eState = other.m_eState; m_eType = other.m_eType; SetSndOpen(other.GetSndFName_OpenUI()); SetSndClose(other.GetSndFName_CloseUI()); m_rcMovable = other.m_rcMovable; m_rcRegion = other.m_rcRegion; m_szID = other.m_szID; m_szToolTip = other.m_szToolTip; }