CAxis * CPlotDlg::CurrentPoint2CurrentAxis(CPoint *point) { int i; for (i=0; i<gcf->nAxes; i++) { if (IsInsideRect(&gcf->ax[i]->axRect, point)) { gca = gcf->ax[i]; return gcf->ax[i]; } } return NULL; }
// ---------------------------------------------------------------------------- // Name : InsideNumXY() // Desc : // ---------------------------------------------------------------------------- void CUISelectList::InsideNumY(UIRect rc,int btnSize,int btnGap, int* n_x ,int* n_y ) { int tv_i,tv_divY,tv_sum; if( IsInsideRect(*n_x,*n_y,rc) ){ ConvertToWindow(*n_x,*n_y); tv_divY=rc.GetHeight()/btnSize; for(tv_i=1; tv_i <= tv_divY ;tv_i++){ tv_sum=btnSize*tv_i+rc.Top+btnGap*(tv_i-1); if( tv_sum > *n_y) { *n_y=tv_i-1; break; } } } }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUICheckButton::MouseMessage( MSG *pMsg ) { // If check button is disabled if( !IsEnabled() ) return WMSG_FAIL; // Mouse point int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); // Mouse message if( pMsg->message == WM_LBUTTONDOWN ) { if( IsInsideRect( nX, nY, m_rcCheckRegion ) ) { m_bChecked = !m_bChecked; return WMSG_SUCCESS; } } return WMSG_FAIL; }
bool Knowledge::IsNearOurGoal(Vector2D pos) { return IsInsideRect(pos, Vector2D(Field::MinX,Field::MaxY), Vector2D(0.25*Field::MinX,Field::MinY)); }
bool Knowledge::IsInsideFarArea(Vector2D pos) { return IsInsideRect(pos, Vector2D(0.25*Field::MaxX,Field::MaxY), Vector2D(Field::MaxX,Field::MinY)); }
bool Knowledge::IsInsideNearArea(Vector2D pos) { return IsInsideRect(pos, Vector2D(Field::MinX,Field::MaxY), Vector2D(0.8*Field::MinX,0.6*Field::MaxY)) || IsInsideRect(pos, Vector2D(Field::MinX,0.6*Field::MinY), Vector2D(0.8*Field::MinX,Field::MinY)); }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUICreateChar::MouseMessage( MSG *pMsg ) { WMSG_RESULT wmsgResult; // Mouse point int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); // Mouse message switch( pMsg->message ) { case WM_MOUSEMOVE: { if( m_btnOK.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnJobPrev.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnJobNext.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnFacePrev.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnFaceNext.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnHairPrev.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnHairNext.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnHeadPrev.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnHeadNext.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; /*else if( m_btnZoomIn.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnZoomOut.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnRotateToLeft.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_btnRotateToRight.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS;*/ } break; case WM_LBUTTONDOWN: { if( IsInsideRect( nX, nY, m_rcCharInfo ) ) { if( m_ebCharName.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnOK.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnJobPrev.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnJobNext.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnFacePrev.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnFaceNext.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnHairPrev.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnHairNext.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnHeadPrev.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnHeadNext.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } CUIManager::getSingleton()->RearrangeOrder( UI_CREATE_CHAR, TRUE ); return WMSG_SUCCESS; } } break; case WM_LBUTTONUP: { if( IsInsideRect( nX, nY, m_rcCharInfo ) ) { if( ( wmsgResult = m_btnOK.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { PressOKBtn(); } return WMSG_SUCCESS; } else if( ( wmsgResult = m_btnCancel.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { CUIManager::getSingleton()->SetUIGameState(UGS_SELCHAR); _pGameState->BackToSelChar(); } } else if( ( wmsgResult = m_btnJobPrev.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { CEntity *penMarker = m_pWorld->EntityFromID(_aiMarkerEntities[m_iSelectedJob]); penMarker->en_plPlacement.pl_OrientationAngle(1) = g_CharacterAngle[m_iSelectedJob]; m_iSelectedJob--; //_pSound->Mute(); ChangeSelJob(); //_pSound->UpdateSounds(); _pGameState->SetCameraByJob(m_iSelectedJob); } } else if( ( wmsgResult = m_btnJobNext.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { CEntity *penMarker = m_pWorld->EntityFromID(_aiMarkerEntities[m_iSelectedJob]); penMarker->en_plPlacement.pl_OrientationAngle(1) = g_CharacterAngle[m_iSelectedJob]; m_iSelectedJob++; //_pSound->Mute(); ChangeSelJob(); //_pSound->UpdateSounds(); _pGameState->SetCameraByJob(m_iSelectedJob); } } else if( ( wmsgResult = m_btnFacePrev.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { m_sbSelectedFace--; if(m_sbSelectedFace < 0) m_sbSelectedFace = TOTAL_HEAD - 1; m_sbSelectedFace = m_sbSelectedFace % TOTAL_HEAD; const int iMarker = _aiMarkerEntities[m_iSelectedJob]; CEntity *penMarker = m_pWorld->EntityFromID(iMarker); CModelInstance* pMI = penMarker->GetModelInstance(); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->ChangeFaceMesh(pMI, m_iSelectedJob, m_sbSelectedFace); } } else if( ( wmsgResult = m_btnFaceNext.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { m_sbSelectedFace++; m_sbSelectedFace = m_sbSelectedFace % TOTAL_HEAD; const int iMarker = _aiMarkerEntities[m_iSelectedJob]; CEntity *penMarker = m_pWorld->EntityFromID(iMarker); CModelInstance* pMI = penMarker->GetModelInstance(); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->ChangeFaceMesh(pMI, m_iSelectedJob, m_sbSelectedFace); } } else if( ( wmsgResult = m_btnHairPrev.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { m_sbSelectedHair--; if(m_sbSelectedHair < 0) m_sbSelectedHair = TOTAL_HAIR - 1; m_sbSelectedHair = m_sbSelectedHair % TOTAL_HAIR; const int iMarker = _aiMarkerEntities[m_iSelectedJob]; CEntity *penMarker = m_pWorld->EntityFromID(iMarker); CModelInstance* pMI = penMarker->GetModelInstance(); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->ChangeHairMesh(pMI, m_iSelectedJob, m_sbSelectedHair); //((CPlayerEntity*)CEntity::GetPlayerEntity(0))->ChangeHairTexture(pMI, m_iSelectedJob, m_sbSelectedHair); } } else if( ( wmsgResult = m_btnHairNext.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { m_sbSelectedHair++; m_sbSelectedHair = m_sbSelectedHair % TOTAL_HAIR; const int iMarker = _aiMarkerEntities[m_iSelectedJob]; CEntity *penMarker = m_pWorld->EntityFromID(iMarker); CModelInstance* pMI = penMarker->GetModelInstance(); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->ChangeHairMesh(pMI, m_iSelectedJob, m_sbSelectedHair); //((CPlayerEntity*)CEntity::GetPlayerEntity(0))->ChangeHairTexture(pMI, m_iSelectedJob, m_sbSelectedHair); } } else if( ( wmsgResult = m_btnHeadPrev.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { } } else if( ( wmsgResult = m_btnHeadNext.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { } } return WMSG_SUCCESS; } else if( IsInsideRect( nX, nY, m_rcCharControl ) ) { if( ( wmsgResult = m_btnZoomIn.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { m_fZDelta += 0.6f; } } else if( ( wmsgResult = m_btnZoomOut.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { m_fZDelta -= 0.6f; } } else if( ( wmsgResult = m_btnRotateToLeft.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { //m_bAutoRotate = !m_bAutoRotate; m_fRotDelta -= 10.0f; } } else if( ( wmsgResult = m_btnRotateToRight.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { //m_bAutoRotate = !m_bAutoRotate; m_fRotDelta += 10.0f; } } return WMSG_SUCCESS; } } break; } return WMSG_FAIL; }
bool Knowledge::IsInsideOppField(Vector2D pos) { return IsInsideRect(pos, Vector2D(0,Field::MaxY), Vector2D(Field::MaxX,Field::MinY)); }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUIRemission::MouseMessage( MSG *pMsg ) { WMSG_RESULT wmsgResult; // Title bar static BOOL bTitleBarClick = FALSE; // Extended button clicked static BOOL bLButtonDownInBtn = FALSE; // Mouse point static int nOldX, nOldY; int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); // Mouse message switch( pMsg->message ) { case WM_MOUSEMOVE: { if( IsInside( nX, nY ) ) CUIManager::getSingleton()->SetMouseCursorInsideUIs(); // Move remission if( bTitleBarClick && ( pMsg->wParam & MK_LBUTTON ) ) { int ndX = nX - nOldX; int ndY = nY - nOldY; nOldX = nX; nOldY = nY; Move( ndX, ndY ); return WMSG_SUCCESS; } // Close button else if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // Buy button else if( m_btnOK.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // Cancel button else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // List box of remission desc else if( m_lbRemissionDesc.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // Remission remission tab else { // Reset state of selected button if( bLButtonDownInBtn && m_nSelRemissionID >= 0 && ( pMsg->wParam & MK_LBUTTON ) ) { m_vectorbtnRemissions[m_nSelRemissionID].SetBtnState( UBES_IDLE ); bLButtonDownInBtn = FALSE; } // Remission icon scroll bar else if( m_sbRemissionIcon.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } } break; case WM_LBUTTONDOWN: { if( IsInside( nX, nY ) ) { CUIManager* pUIManager = CUIManager::getSingleton(); nOldX = nX; nOldY = nY; // Close button if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Title bar else if( IsInsideRect( nX, nY, m_rcTitle ) ) { bTitleBarClick = TRUE; } // Buy button else if( m_btnOK.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Cancel button else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // List box of remission desc else if( m_lbRemissionDesc.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Remission remission tab else { // Remission icon scroll bar if( m_sbRemissionIcon.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // Remission slot else if( IsInsideRect( nX, nY, m_rcIcons ) ) { int nOldSelRemissionID = m_nSelRemissionID; m_nSelRemissionID = -1; int iRowS = m_sbRemissionIcon.GetScrollPos(); int iRowE = iRowS + REMISSION_SLOT_ROW; if ( m_vectorbtnRemissions.size() < iRowE ) { iRowE = m_vectorbtnRemissions.size(); } for( int iRow = iRowS; iRow < iRowE; iRow++ ) { if( m_vectorbtnRemissions[iRow].MouseMessage( pMsg ) != WMSG_FAIL ) { // Update selected remission m_nSelRemissionID = iRow; if( nOldSelRemissionID != m_nSelRemissionID ) { GetRemissionDesc( m_vectorbtnRemissions[iRow].GetRemissionType(), m_vectorbtnRemissions[iRow].GetItemIndex(), m_vectorbtnRemissions[iRow].GetInvenIndex()); //m_vectorbtnRemissions[iRow].GetItemWearType()); } bLButtonDownInBtn = TRUE; pUIManager->RearrangeOrder( UI_REMISSION, TRUE ); return WMSG_SUCCESS; } } GetRemissionDesc( REMISSION_NONE ); } } pUIManager->RearrangeOrder( UI_REMISSION, TRUE ); return WMSG_SUCCESS; } } break; case WM_LBUTTONUP: { CUIManager* pUIManager = CUIManager::getSingleton(); bLButtonDownInBtn = FALSE; // If holding button doesn't exist if( pUIManager->GetHoldBtn().IsEmpty() ) { // Title bar bTitleBarClick = FALSE; // If remission isn't focused if( !IsFocused() ) return WMSG_FAIL; // Close button if( ( wmsgResult = m_btnClose.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) CloseRemission(); return WMSG_SUCCESS; } // Buy button else if( ( wmsgResult = m_btnOK.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) PressOK(); return WMSG_SUCCESS; } // Cancel button else if( ( wmsgResult = m_btnCancel.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) CloseRemission(); return WMSG_SUCCESS; } // List box of remission desc else if( m_lbRemissionDesc.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // Remission remission tab else { // Remission icon scroll bar if( m_sbRemissionIcon.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // Remission slot else if( IsInsideRect( nX, nY, m_rcIcons ) ) { int iRowS = m_sbRemissionIcon.GetScrollPos(); int iRowE = iRowS + REMISSION_SLOT_ROW; if ( m_vectorbtnRemissions.size() < iRowE ) { iRowE = m_vectorbtnRemissions.size(); } for( int iRow = iRowS; iRow < iRowE; iRow++ ) { if( m_vectorbtnRemissions[iRow].MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } } } } // If holding button exists else { if( IsInside( nX, nY ) ) { // Reset holding button pUIManager->ResetHoldBtn(); return WMSG_SUCCESS; } } } break; case WM_LBUTTONDBLCLK: { if( IsInside( nX, nY ) ) { // List box of remission desc if( m_lbRemissionDesc.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Remission remission tab else { // Remission icon scroll bar if( m_sbRemissionIcon.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } } return WMSG_SUCCESS; } } break; case WM_MOUSEWHEEL: { if( IsInside( nX, nY ) ) { // List box of remission desc if( m_lbRemissionDesc.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // Remission remission tab else { // Remission icon scroll bar if( m_sbRemissionIcon.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } } } break; } return WMSG_FAIL; }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUIChildQuickSlot::MouseMessage( MSG *pMsg ) { WMSG_RESULT wmsgResult; // Title bar static BOOL bDragAreaClick = FALSE; // Extended button clicked static BOOL bLButtonDownInBtn = FALSE; // Mouse point static int nOldX, nOldY; int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); // Mouse message switch( pMsg->message ) { case WM_MOUSEMOVE: { CUIManager* pUIManager = CUIManager::getSingleton(); m_bIsInside = IsInside( nX, nY ); if (m_bIsInside) { if (*(m_bRotation[m_nCurSlot]) == 0) // 0 세로 일 때 버튼 위치 설정 [12/21/2012 Ranma] { int nPosY = 16; for( int iBtn = 0; iBtn < QSLOT_BTN_COUNT; iBtn++, nPosY += 35 ) { (*m_abtnItems)[m_nCurSlot + 1][iBtn]->SetPos( m_nPosX + 3,m_nPosY + nPosY); } } else { int nPosX = 16; for( int iBtn = 0; iBtn < QSLOT_BTN_COUNT; iBtn++, nPosX += 35 ) { (*m_abtnItems)[m_nCurSlot + 1][iBtn]->SetPos( m_nPosX + nPosX, m_nPosY + 3); } } } if( IsInside( nX, nY ) ) pUIManager->SetMouseCursorInsideUIs(); int ndX = nX - nOldX; int ndY = nY - nOldY; if (pUIManager->GetDragIcon() == NULL && bLButtonDownInBtn && (pMsg->wParam & MK_LBUTTON) && (ndX != 0 || ndY != 0)&& !* (m_bLock[m_nCurSlot])) { if( m_nSelSlotBtnID >= 0 ) { ndX = abs( ndX ); ndY = abs( ndY ); static int nD = 7; CPrintF( "%d, %d", ndX, ndY ); if( ndX > nD || ndY > nD ) { int nSelTab = m_nCurSlot + 1; int nSelBtn = m_nSelSlotBtnID; pUIManager->SetHoldBtn( (*m_abtnItems)[nSelTab][nSelBtn] ); bLButtonDownInBtn = FALSE; } } } // Move quick slot if( bDragAreaClick && ( pMsg->wParam & MK_LBUTTON ) ) { nOldX = nX; nOldY = nY; Move( ndX, ndY ); SetPosEXQSlot(); return WMSG_SUCCESS; } else if( m_btnVertical.MouseMessage( pMsg ) != WMSG_FAIL ) { return WMSG_SUCCESS; } else if( m_btnHorizontal.MouseMessage( pMsg ) != WMSG_FAIL ) { return WMSG_SUCCESS; } if (*(m_bLock[m_nCurSlot])) { if( m_btnLock.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } else { if( m_btnUnLock.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } for( int iBtn = 0; iBtn < QSLOT_BTN_COUNT; iBtn++ ) { if ((*m_abtnItems)[m_nCurSlot + 1][iBtn]->MouseMessage( pMsg ) != WMSG_FAIL) return WMSG_SUCCESS; } }break; case WM_LBUTTONDOWN: { m_bIsInside = IsInside( nX, nY ); m_nSelSlotBtnID = -1; if( IsInside( nX, nY ) ) { CUIManager* pUIManager = CUIManager::getSingleton(); nOldX = nX; nOldY = nY; // DregArea if( IsInsideRect( nX, nY, m_rcDragArea ) ) { bDragAreaClick = TRUE; } else if( m_btnVertical.MouseMessage( pMsg ) != WMSG_FAIL ) { } else if( m_btnHorizontal.MouseMessage( pMsg ) != WMSG_FAIL ) { } if (*(m_bLock[m_nCurSlot])) m_btnLock.MouseMessage( pMsg ); else m_btnUnLock.MouseMessage( pMsg ); for( int iBtn = 0; iBtn < QSLOT_BTN_COUNT; iBtn++ ) { if( (*m_abtnItems)[m_nCurSlot + 1][iBtn]->MouseMessage( pMsg ) != WMSG_FAIL ) { // Update selected button m_nSelSlotBtnID = iBtn; bLButtonDownInBtn = TRUE; pUIManager->RearrangeOrder( m_nID, TRUE ); return WMSG_SUCCESS; } } pUIManager->RearrangeOrder( m_nID, TRUE ); return WMSG_SUCCESS; } }break; case WM_LBUTTONUP: { CUIManager* pUIManager = CUIManager::getSingleton(); bLButtonDownInBtn = FALSE; m_bIsInside = IsInside( nX, nY ); if (m_bIsInside) { if (*(m_bRotation[m_nCurSlot]) == 0) // 0 세로 일 때 버튼 위치 설정 [12/21/2012 Ranma] { int nPosY = 16; for( int iBtn = 0; iBtn < QSLOT_BTN_COUNT; iBtn++, nPosY += 35 ) { (*m_abtnItems)[m_nCurSlot + 1][iBtn]->SetPos( m_nPosX + 3,m_nPosY + nPosY); } } else { int nPosX = 16; for( int iBtn = 0; iBtn < QSLOT_BTN_COUNT; iBtn++, nPosX += 35 ) { (*m_abtnItems)[m_nCurSlot + 1][iBtn]->SetPos( m_nPosX + nPosX, m_nPosY + 3); } } } // If holding button doesn't exist if (pUIManager->GetDragIcon() == NULL) { // If quick slot isn't focused if( !IsFocused() ) return WMSG_FAIL; bDragAreaClick = FALSE; if (*(m_bLock[m_nCurSlot])) { if( m_btnLock.MouseMessage( pMsg ) != WMSG_FAIL ) { *(m_bLock[m_nCurSlot]) = 0; return WMSG_SUCCESS; } } else { if( m_btnUnLock.MouseMessage( pMsg ) != WMSG_FAIL ) { *(m_bLock[m_nCurSlot]) = 1; return WMSG_SUCCESS; } } if( m_btnVertical.MouseMessage( pMsg ) != WMSG_FAIL ) { *(m_bRotation[m_nCurSlot]) = 1; Rotation(); return WMSG_SUCCESS; } else if( m_btnHorizontal.MouseMessage( pMsg ) != WMSG_FAIL ) { *(m_bRotation[m_nCurSlot]) = 0; Rotation(); return WMSG_SUCCESS; } else if( IsInsideRect( nX, nY, m_rcDragArea ) ) { return WMSG_SUCCESS; } // Slot else if( IsInsideRect( nX, nY, m_rcSlot ) ) { m_nSelSlotBtnID = -1; for( int iBtn = 0; iBtn < QSLOT_BTN_COUNT; iBtn++ ) { if( ( wmsgResult = (*m_abtnItems)[m_nCurSlot + 1][iBtn]->MouseMessage( pMsg ) ) != WMSG_FAIL ) { pUIManager->GetQuickSlot()->UseQuickSlot( iBtn , m_nCurSlot + 1); return WMSG_SUCCESS; } } } } // If holding button exists else { if( IsInside( nX, nY )) { pUIManager->GetMessenger()->SetDragging(false); CUIIcon* pDrag = pUIManager->GetDragIcon(); // If holding button comes from quick slot if (pDrag->GetWhichUI() == UI_QUICKSLOT) { if( IsInsideRect( nX, nY, m_rcSlot ) ) { for( int iBtn = 0; iBtn < QSLOT_BTN_COUNT; iBtn++ ) { if ((*m_abtnItems)[m_nCurSlot + 1][iBtn]->IsInside( nX, nY ) && (*m_abtnItems)[m_nCurSlot + 1][iBtn]->GetQuickSlotID() != pDrag->GetQuickSlotID()) { int nBtnID = pDrag->GetQuickSlotID(); int nPageIndex = nBtnID / QSLOT_BTN_COUNT; int nSlotIndex = nBtnID % QSLOT_BTN_COUNT; if( !*(m_bLock[m_nCurSlot]) ) pUIManager->GetQuickSlot()->SwapBtnsInQuickSlot( nPageIndex, nSlotIndex, m_nCurSlot + 1, iBtn ); break; } } } } else if ((pDrag->getBtnType() == UBET_SKILL && (pDrag->GetWhichUI() == UI_SKILL_NEW || pDrag->GetWhichUI() == UI_CHARACTERINFO)) || (pDrag->getBtnType() == UBET_SKILL && pDrag->GetWhichUI() == UI_PETINFO) || (pDrag->getBtnType() == UBET_ACTION && pDrag->GetWhichUI() == UI_CHARACTERINFO) || (pDrag->getBtnType() == UBET_ITEM && pDrag->GetWhichUI() == UI_INVENTORY) || (pDrag->getBtnType() == UBET_SKILL && pDrag->GetWhichUI() == UI_WILDPET_INFO) || (pDrag->getBtnType() == UBET_SKILL && pDrag->GetWhichUI() == UI_GUILD)) { if( IsInsideRect( nX, nY, m_rcSlot ) ) { if (pDrag->getBtnType() == UBET_ITEM) { CItemData* pItemData = CItemData::getData(pDrag->getIndex()); if( (pItemData->GetType() == CItemData::ITEM_ETC //Etc(x) // [070604: Su-won] 1차 펫 기능 개선 // 생산품을 퀵슬롯에 넣을 수 있게... &&pItemData->GetSubType() !=CItemData::ITEM_ETC_PRODUCT ) || (pItemData->GetType() == CItemData::ITEM_ACCESSORY // Accessory(x) // [070604: Su-won] 1차 펫 기능 개선 // 펫을 퀵슬롯에 넣을 수 있게... && pItemData->GetSubType() !=CItemData::ACCESSORY_PET && pItemData->GetSubType() !=CItemData::ACCESSORY_WILDPET && pItemData->GetSubType() != CItemData::ITEM_ETC_MONSTER_MERCENARY_CARD ) || ( pItemData->GetType() == CItemData::ITEM_BULLET && // Bullet - arrow(x) pItemData->GetSubType() == CItemData::ITEM_BULLET_ARROW ) ) { // Reset holding button pUIManager->ResetHoldBtn(); return WMSG_SUCCESS; } } for( int iBtn = 0; iBtn < QSLOT_BTN_COUNT; iBtn++ ) { if( (*m_abtnItems)[m_nCurSlot+1][iBtn]->IsInside( nX, nY ) ) { if( !*(m_bLock[m_nCurSlot]) ) pUIManager->GetQuickSlot()->AddBtnToQuickSlot( iBtn, m_nCurSlot + 1 ); break; } } } } // Reset holding button pUIManager->ResetHoldBtn(); return WMSG_SUCCESS; } } }break; case WM_LBUTTONDBLCLK: { m_bIsInside = IsInside( nX, nY ); if( IsInside( nX, nY ) ) { return WMSG_SUCCESS; } }break; } return WMSG_FAIL; }
bool Knowledge::IsInsideField(Vector2D pos) { return IsInsideRect(pos, Field::upperLeftCorner, Field::bottomRightCorner); }
//********************************************************************************** U P D A T E //************************************************************************************************ void CUserInterface::Update(double timeDifference, int mx, int my, CGameData &data){ CLog *pLog = CLog::Instance(); UI_RECT uir; static double pauseTime; pauseTime += timeDifference; static double keyTime; keyTime += timeDifference; static double scaleTime; scaleTime += timeDifference; //set mouse variables //******************************** m_mouseX = mx; m_mouseY = my; if(data.m_bLeftMouseDown == true) m_bLeftButtonDown = true; else m_bLeftButtonDown = false; if(data.m_bRightMouseDown == true) m_bRightButtonDown = true; else m_bRightButtonDown = false; if(m_bLeftButtonDown == true && IsInsideRect(m_pausePlay) == true && pauseTime > 0.4){ pauseTime = 0.0; data.m_bPaused = !data.m_bPaused; m_UIstate = UI_PAUSE_PLAY; } if(m_bLeftButtonDown == true && keyTime > 0.4){ keyTime = 0; if(IsInsideRect(m_sendWaveButton) == true) m_UIstate = UI_SEND_WAVE; else if(IsInsideRect(m_quit) == true) m_UIstate = UI_QUIT; else if(IsInsideRect(m_times1) == true) m_UIstate = UI_TIMES1; else if(IsInsideRect(m_times2) == true) m_UIstate = UI_TIMES2; else if(IsInsideRect(m_help) == true) m_UIstate = UI_HELP; else if(IsInsideRect(m_def1) == true) m_UIstate = UI_DEF1; else if(IsInsideRect(m_def2) == true) m_UIstate = UI_DEF2; else if(IsInsideRect(m_def3) == true) m_UIstate = UI_DEF3; else if(IsInsideRect(m_def4) == true) m_UIstate = UI_DEF4; else if(IsInsideRect(m_def5) == true) m_UIstate = UI_DEF5; else if(IsInsideRect(m_def6) == true) m_UIstate = UI_NONE; else if(IsInsideRect(m_def7) == true) m_UIstate = UI_NONE; else if(IsInsideRect(m_def8) == true) m_UIstate = UI_NONE; else if(IsInsideRect(m_sound) == true) data.m_playSound = !data.m_playSound; else if(IsInsideRect(m_sound) == true) data.m_playMusic = !data.m_playMusic; else m_UIstate = UI_NONE; } //save last mouse position and data m_lastMouseX = m_mouseX; m_lastMouseY = m_mouseY; m_bLastLeftButtonDown = m_bLeftButtonDown; m_bLastRightButtonDown = m_bRightButtonDown; if(m_UIstate == UI_HELP){ data.m_bDisplayHelp = !data.m_bDisplayHelp; data.m_bPaused = data.m_bDisplayHelp; } //data.m_score++; //if(data.m_score > 999999) // data.m_score = 0; //data.m_credits++; //if(data.m_credits > 999999) // data.m_credits = 0; }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUISelectList::MouseMessage( MSG *pMsg ) { WMSG_RESULT wmsgResult; // Title bar static BOOL bTitleBarClick = FALSE; // Item clicked static BOOL bLButtonDownInItem = FALSE; // Mouse point static int nOldX, nOldY; int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); // TEST MOUSE POS m_x = nX; m_y = nY; // Mouse message switch( pMsg->message ) { case WM_MOUSEMOVE: { if( IsInside( nX, nY ) ) CUIManager::getSingleton()->SetMouseCursorInsideUIs(); int ndX = nX - nOldX; int ndY = nY - nOldY; // Move Window if( bTitleBarClick && ( pMsg->wParam & MK_LBUTTON ) ) { nOldX = nX; nOldY = nY; Move( ndX, ndY ); return WMSG_SUCCESS; } } break; case WM_LBUTTONDOWN: { if( IsInside( nX, nY ) ) { nOldX = nX; nOldY = nY; // Title bar if( IsInsideRect( nX, nY, m_rcTitle ) ) { bTitleBarClick = TRUE; } // Registration else if( m_btnRegist.MouseMessage( pMsg ) != WMSG_FAIL ){} // Reward else if( m_btnReward.MouseMessage( pMsg ) != WMSG_FAIL ){} // Cancel button else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ){} // Registration else if( m_btnPrev.MouseMessage( pMsg ) != WMSG_FAIL ){} // Cancel button else if( m_btnNext.MouseMessage( pMsg ) != WMSG_FAIL ){} CUIManager::getSingleton()->RearrangeOrder( UI_SELECTLIST, TRUE ); return WMSG_SUCCESS; } } break; case WM_LBUTTONUP: { bTitleBarClick = FALSE; // If message box isn't focused if( !IsFocused() ) return WMSG_FAIL; if(IsInsideRect(nX,nY,m_rcList)){ int n_x = nX; int n_y = nY; int tv_sel; InsideNumY(m_rcList,TEXT_GAP,0, &n_x,&n_y); tv_sel = n_y + m_nPageCur*m_nMaxLine; if( tv_sel >=0 && tv_sel< m_vSelList.size()) m_nSelLine =tv_sel; } // Registration if( ( wmsgResult = m_btnRegist.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND&& m_btnRegist.IsEnabled()){ // TODO : send select item index if(m_nSelLine<0 || m_nSelLine>m_vSelList.size()) return wmsgResult; _pNetwork->SendFindFriend( MSG_EVENT_SEARCHFRIEND_ADDSELECT_CHECK, &(m_vSelList[m_nSelLine].m_nIndex) ); } return WMSG_SUCCESS; } // Reward else if( ( wmsgResult = m_btnReward.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND && m_btnReward.IsEnabled()){ // TODO : send select item index if(m_nSelLine<0 || m_nSelLine>m_vSelList.size()) return wmsgResult; _pNetwork->SendFindFriend( MSG_EVENT_SEARCHFRIEND_GOODS_CHECK, &(m_nSelLine) ); } return WMSG_SUCCESS; } // Cancel button else if( ( wmsgResult = m_btnCancel.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ){ ResetSelectList(); } return WMSG_SUCCESS; } // Previous button else if( ( wmsgResult = m_btnPrev.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ){ if(m_nPageCur > 0) m_nPageCur--; } return WMSG_SUCCESS; } // Next button else if( ( wmsgResult = m_btnNext.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ){ if(m_vSelList.size() > ((m_nPageCur+1)*m_nMaxLine)){ m_nPageCur++; } } return WMSG_SUCCESS; } // If holding button exists else { if( IsInside( nX, nY ) ) { // Reset holding button CUIManager::getSingleton()->ResetHoldBtn(); return WMSG_SUCCESS; } } } break; } return WMSG_FAIL; }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUIMixNew::MouseMessage( MSG *pMsg ) { WMSG_RESULT wmsgResult; // Title bar static BOOL bTitleBarClick = FALSE; // Mouse point static int nOldX, nOldY; int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); CUIManager* pUIManager = CUIManager::getSingleton(); // TEST MOUSE POS pUIManager->m_mPosX = nX; pUIManager->m_mPosY = nY; // Mouse message switch( pMsg->message ) { case WM_MOUSEMOVE: { if( IsInside( nX, nY ) ) { pUIManager->SetMouseCursorInsideUIs(); if(m_bIsMix) { for( int iRow = 0; iRow < MIXNEW_ITEM_SLOT_COUNT; iRow++ ) { m_pIconsSlot[iRow]->MouseMessage( pMsg ); } } else { m_pIconsSlot[0]->MouseMessage( pMsg ); } } int ndX = nX - nOldX; int ndY = nY - nOldY; // Move mix if( bTitleBarClick && ( pMsg->wParam & MK_LBUTTON ) ) { nOldX = nX; nOldY = nY; Move( ndX, ndY ); return WMSG_SUCCESS; } // Close button else if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // OK button else if( m_btnOK.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // Cancel button else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } break; case WM_LBUTTONDOWN: { if( IsInside( nX, nY ) ) { nOldX = nX; nOldY = nY; // Close button if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Title bar else if( IsInsideRect( nX, nY, m_rcTitle ) ) { bTitleBarClick = TRUE; } // OK button else if( m_btnOK.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Cancel button else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } pUIManager->RearrangeOrder( UI_MIXNEW, TRUE ); return WMSG_SUCCESS; } } break; case WM_LBUTTONUP: { // If holding button doesn't exist if (pUIManager->GetDragIcon() == NULL) { // Title bar bTitleBarClick = FALSE; // If Mix isn't focused if( !IsFocused() ) return WMSG_FAIL; // Close button if( ( wmsgResult = m_btnClose.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) CloseMixNew(); return WMSG_SUCCESS; } // OK button else if( ( wmsgResult = m_btnOK.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { if(m_bIsMixMasterStone == TRUE) SendMixNewMasterStroneReq(); else SendMixNewReq(); } return WMSG_SUCCESS; } // Cancel button else if( ( wmsgResult = m_btnCancel.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) CloseMixNew(); return WMSG_SUCCESS; } } // If holding button exists else { if( IsInside( nX, nY ) ) { //!! If holding button is item and comes from inventory if (pUIManager->GetDragIcon()->getBtnType() == UBET_ITEM && pUIManager->GetDragIcon()->GetWhichUI() == UI_INVENTORY || pUIManager->GetDragIcon()->GetWhichUI() == UI_MIXNEW) { // 결합 아이템 if(m_bIsMix) { bool bChkRgn = FALSE; for( int iRow = 0; iRow < MIXNEW_ITEM_SLOT_COUNT; iRow++ ) { if( IsInsideRect( nX, nY, m_rcItemSlot[iRow] ) ) { bChkRgn = TRUE; SetMixItem ( NearPosition ( nX-BTN_SIZE/2, nY-BTN_SIZE/2 ) ); } } if(!bChkRgn) pUIManager->ResetHoldBtn(); } // 분리 아이템 else { if( IsInsideRect( nX, nY, m_rcItemSlot_UN ) ) SetMixItem ( NearPosition ( nX-BTN_SIZE/2, nY-BTN_SIZE/2 ) ); else pUIManager->ResetHoldBtn(); } } pUIManager->ResetHoldBtn(); return WMSG_SUCCESS; } else { ResetMixItem (); pUIManager->ResetHoldBtn(); return WMSG_SUCCESS; } } } break; case WM_LBUTTONDBLCLK: { if( IsInside( nX, nY )) { int i; for( i = 0; i < MIXNEW_ITEM_SLOT_COUNT; i++ ) { if (m_btnOK.IsInside(nX, nY) == TRUE) return WMSG_SUCCESS; } if(m_bIsMixMasterStone == TRUE) { ResetMixItemAll(); } else { for( i = 0; i < MIXNEW_ITEM_SLOT_COUNT; i++ ) { m_nCurItemSlot = NearPosition ( nX-BTN_SIZE/2, nY-BTN_SIZE/2 ); ResetMixItem (); pUIManager->ResetHoldBtn(); } } } return WMSG_SUCCESS; } break; } return WMSG_FAIL; }
void CPlotDlg::OnPaint() { PAINTSTRUCT ps; if (hDlg==NULL) return; HDC hdc = BeginPaint(hDlg, &ps); if (hdc==NULL) return; CDC dc(hdc, hDlg); int radius = 5; CPen **pen, **txtPen; CRect circleRt; CPoint pt; CAxis *ax; Win32xx::CRect rt; double x,y; CStdString s; CSignals signal; GetClientRect(hDlg, &rt); if (rt.Height()<15) return; dc.SolidFill(gcf->color, rt); for (int j=0; j<gcf->nAxes; j++) { ax = gcf->ax[j]; if (ax->xlim[1]<ax->xlim[0]) ax->setRangeFromLines('x'); if (ax->ylim[1]<ax->ylim[0]) ax->setRangeFromLines('y'); ax->rcAx=DrawAxis(&dc,ax); pen = new CPen*[ax->nLines]; for (int i=0; i<ax->nLines; i++) { pen[i] = new CPen; pen[i]->CreatePen(PS_SOLID, 1, ax->m_ln[i]->color); dc.SelectObject(pen[i]); if (ax->m_ln[i]->symbol!=0) { for (int k=0; k<ax->m_ln[i]->len; k++) { pt = ax->GetPixelAbs(ax->m_ln[i]->xdata[k],ax->m_ln[i]->ydata[k]); if(IsInsideRect(&ax->rcAx, &pt)) { circleRt.SetRect(pt+CPoint(-radius,-radius), pt+CPoint(radius,radius)); dc.Ellipse(circleRt); } } } if (ax->m_ln[i]->lineWidth>0) { bool fLineStarted = false; for (int k=0; k<ax->m_ln[i]->len; k++) { for (int l=0; l<2; ++l) { // to retry at the edge if (l==0) pt = ax->GetPixelAbs(ax->m_ln[i]->xdata[k],ax->m_ln[i]->ydata[k]); else if (ax->ylim[1] - ax->m_ln[i]->ydata[k] < ax->m_ln[i]->ydata[k] - ax->ylim[0]) pt = ax->GetPixelAbs(ax->m_ln[i]->xdata[k],ax->ylim[1]); // top edge else pt = ax->GetPixelAbs(ax->m_ln[i]->xdata[k],ax->ylim[0]); // bottom edge if (IsInsideRect(&ax->rcAx, &pt)) { if (fLineStarted) dc.LineTo(pt); else { dc.MoveTo(pt); fLineStarted = true; } break; } } } } pen[i]->DeleteObject(); delete pen[i]; } // add ticks and ticklabels DrawTicks(&dc, ax); delete[] pen; } //Drawing texts dc.SetTextAlign(TA_LEFT); txtPen = new CPen*[gcf->nTexts]; for (int j=0; j<gcf->nTexts; j++) { txtPen[j] = new CPen; txtPen[j]->CreatePen(PS_SOLID, 1, gcf->text[j]->color); dc.SelectObject(txtPen[j]); dc.SelectObject(&gcf->text[j]->font); pt.x = (int)((double)rt.right * gcf->text[j]->pos.x0+.5); pt.y = (int)((double)rt.bottom * gcf->text[j]->pos.y0+.5); dc.TextOut(pt.x, pt.y, gcf->text[j]->string); txtPen[j]->DeleteObject(); delete txtPen[j]; } delete[] txtPen; // Drawing coordiate if (gcmp.x!=-1 &&gcmp.y!=-1 && gca->nLines>0) { if(!GetSignalInRange(signal,0)) { return; } gca->GetCoordinate(&gcmp, x, y); s.Format("%f, %f %7.2fdBrms", x,y, signal.LevelLT()); dc.TextOut(gca->axRect.right-200, gca->axRect.top-10, s); } //Sound play buffer done (each block) if (soundID>-1) { s.Format("%d", (int)((double)soundID*block)); dc.TextOut(gca->axRect.right-200, gca->axRect.top+30, s); } EndPaint(hDlg, &ps); }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUIHelp::MouseMessage( MSG *pMsg ) { WMSG_RESULT wmsgResult; // Title bar static BOOL bTitleBarClick = FALSE; // Mouse point static int nOldX, nOldY; int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); if(!m_bVisible) return WMSG_FAIL; // Mouse message switch( pMsg->message ) { case WM_MOUSEMOVE: { if( IsInside( nX, nY ) ) CUIManager::getSingleton()->SetMouseCursorInsideUIs(); if( IsInsideRect(nX,nY,m_rcRightView)) m_bVisibleImg = TRUE; else { m_bVisibleImg = FALSE; m_bSlideImgX = 0; } // Move web board if( bTitleBarClick && ( pMsg->wParam & MK_LBUTTON ) ) { int ndX = nX - nOldX; int ndY = nY - nOldY; nOldX = nX; nOldY = nY; Move( ndX, ndY ); return WMSG_SUCCESS; } // Close button else if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // List box else if( m_lbListContent.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // List box else if( m_lbReadContent.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } break; case WM_LBUTTONDOWN: { if( IsInside( nX, nY ) ) { SetFocus ( TRUE ); CUIManager::getSingleton()->RearrangeOrder( UI_HELP, TRUE ); nOldX = nX; nOldY = nY; // Close button if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Title bar else if( IsInsideRect( nX, nY, m_rcTitle ) ) { bTitleBarClick = TRUE; } // List box if( ( wmsgResult = m_lbListContent.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) { SetViewContent( m_lbListContent.GetCurSel() ); SetListContent( m_lbListContent.GetCurSel() ); } } // List box else if( ( wmsgResult = m_lbReadContent.MouseMessage( pMsg ) ) != WMSG_FAIL ) { // Do Nothing } return WMSG_SUCCESS; } } break; case WM_LBUTTONUP: { CUIManager* pUIManager = CUIManager::getSingleton(); // If holding button doesn't exist if (pUIManager->GetDragIcon() == NULL) { // Title bar bTitleBarClick = FALSE; // If teleport isn't focused if( !IsFocused() ) return WMSG_FAIL; // Close button if( ( wmsgResult = m_btnClose.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) CloseHelp(); return WMSG_SUCCESS; } // List box else if( m_lbListContent.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // List box else if( m_lbReadContent.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } // If holding button exists else { if( IsInside( nX, nY ) ) { // Reset holding button pUIManager->ResetHoldBtn(); return WMSG_SUCCESS; } } } break; case WM_LBUTTONDBLCLK: { if( IsInside( nX, nY ) ) { // DO NOTTHING return WMSG_SUCCESS; } } break; case WM_MOUSEWHEEL: { if( IsInside( nX, nY ) ) { // List box of read type if( m_lbListContent.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // List box of read type if( m_lbReadContent.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } } break; } return WMSG_FAIL; }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUISelectResource::MouseMessage( MSG *pMsg ) { WMSG_RESULT wmsgResult; // Title bar static BOOL bTitleBarClick = FALSE; // Item clicked static BOOL bLButtonDownInItem = FALSE; // Mouse point static int nOldX, nOldY; int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); // Mouse message switch( pMsg->message ) { case WM_MOUSEMOVE: { if( IsInside( nX, nY ) ) CUIManager::getSingleton()->SetMouseCursorInsideUIs(); int ndX = nX - nOldX; int ndY = nY - nOldY; // Move shop if( bTitleBarClick && ( pMsg->wParam & MK_LBUTTON ) ) { nOldX = nX; nOldY = nY; Move( ndX, ndY ); return WMSG_SUCCESS; } // Close Button if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; for(int i = 0; i < m_vectorResourceList.size(); ++i) { if( (wmsgResult = m_vectorResourceList[i].MouseMessage( pMsg ) )!= WMSG_FAIL ) { return WMSG_SUCCESS; } } } break; case WM_LBUTTONDOWN: { if( IsInside( nX, nY ) ) { CUIManager* pUIManager = CUIManager::getSingleton(); nOldX = nX; nOldY = nY; // Close button if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Title bar else if( IsInsideRect( nX, nY, m_rcTitle ) ) { bTitleBarClick = TRUE; } else { std::vector<CUIButton>::iterator end = m_vectorResourceList.end(); std::vector<CUIButton>::iterator it = m_vectorResourceList.begin(); for(; it != end; ++it) { if( (*it).MouseMessage( pMsg ) != WMSG_FAIL )//button 누름 { int dist = std::distance(m_vectorResourceList.begin(), it); if( m_bSelectType ) { if( dist == PRODUCT_TYPE_RANDOM ) { StartProduct(); ResetSelectResource(); } else if( dist == PRODUCT_TYPE_SELECT ) { m_bSelectType = FALSE; CTString strName; CUIButton TempUIButton; TempUIButton.SetUV( UBS_IDLE, 0, 117, 131, 138, m_ptdBaseTexture->GetPixWidth(), m_ptdBaseTexture->GetPixHeight() ); TempUIButton.SetUV( UBS_CLICK, 0, 140, 131, 161, m_ptdBaseTexture->GetPixWidth(), m_ptdBaseTexture->GetPixHeight() ); TempUIButton.CopyUV( UBS_IDLE, UBS_ON ); TempUIButton.CopyUV( UBS_IDLE, UBS_DISABLE ); m_vectorResourceList.clear(); int iCurPosY = 30; for(INDEX i=0; i<3; ++i) { strName = _pNetwork->GetItemData( g_iProductItemDBIndex[m_iResourceType-1][i] )->GetName(); TempUIButton.Create(this, strName, 20, iCurPosY, BUTTON_WIDTH, BUTTON_HEIGHT ); m_vectorResourceList.push_back(TempUIButton); iCurPosY += BUTTON_HEIGHT + BUTTON_SPAN; } int nHeight = m_vectorResourceList.size() * (BUTTON_HEIGHT + BUTTON_SPAN) + TITLEBAR_HEIGHT + 10; SetSize( m_nWidth, nHeight ); pUIManager->RearrangeOrder( UI_SELECTRESOURCE, TRUE ); } } else { StartProduct( dist ); ResetSelectResource(); } return WMSG_SUCCESS; } } } pUIManager->RearrangeOrder( UI_SELECTRESOURCE, TRUE ); return WMSG_SUCCESS; } else { ResetSelectResource(); m_bKeyMove = true; } } break; case WM_LBUTTONUP: { bTitleBarClick = FALSE; // Close button if( (wmsgResult = m_btnClose.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if(wmsgResult == WMSG_COMMAND) { ResetSelectResource(); m_bKeyMove = true; } return WMSG_SUCCESS; } else { for(int i = 0; i < m_vectorResourceList.size(); ++i) { if( (wmsgResult = m_vectorResourceList[i].MouseMessage( pMsg ) )!= WMSG_FAIL ) { if(wmsgResult == WMSG_COMMAND) { } return WMSG_SUCCESS; } } } } break; } return WMSG_FAIL; }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUICompound::MouseMessage( MSG *pMsg ) { WMSG_RESULT wmsgResult; // Title bar static BOOL bTitleBarClick = FALSE; // Mouse point static int nOldX, nOldY; int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); // Mouse message switch( pMsg->message ) { case WM_MOUSEMOVE: { CUIManager* pUIManager = CUIManager::getSingleton(); if( IsInside( nX, nY ) ) { pUIManager->SetMouseCursorInsideUIs(); if( IsInsideRect( nX, nY, m_rcInsertItem ) ) { bool bShowItem = false; for( int iRow = 0; iRow < 3; iRow++ ) { m_pIconSlot[iRow]->MouseMessage(pMsg); } } } int ndX = nX - nOldX; int ndY = nY - nOldY; // Move if( bTitleBarClick && ( pMsg->wParam & MK_LBUTTON ) ) { nOldX = nX; nOldY = nY; Move( ndX, ndY ); return WMSG_SUCCESS; } // Close button else if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // OK button else if( m_btnOK.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // Cancel button else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if (pUIManager->GetDragIcon() == NULL) { if( IsInsideRect( nX, nY, m_rcInsertItem ) && ( pMsg->wParam & MK_LBUTTON ) && ( ndX != 0 || ndY != 0 ) ) { for ( int i = 0; i < COMPOUND_ITEM_SLOT_COUNT; i++ ) { if ( IsInsideRect( nX, nY, m_rcItemSlot[i] ) ) { m_nCurItemSlot = i; pUIManager->SetHoldBtn(m_pIconSlot[m_nCurItemSlot]); return WMSG_SUCCESS; } } } } } break; case WM_LBUTTONDOWN: { if( IsInside( nX, nY ) ) { nOldX = nX; nOldY = nY; // Close button if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Title bar else if( IsInsideRect( nX, nY, m_rcTitle ) ) { bTitleBarClick = TRUE; } // OK button else if( m_btnOK.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Cancel button else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } CUIManager::getSingleton()->RearrangeOrder( UI_COMPOUND, TRUE ); return WMSG_SUCCESS; } } break; case WM_LBUTTONUP: { CUIManager* pUIManager = CUIManager::getSingleton(); // If holding button doesn't exist if (pUIManager->GetDragIcon() == NULL) { // Title bar bTitleBarClick = FALSE; // If isn't focused if( !IsFocused() ) return WMSG_FAIL; // Close button if( ( wmsgResult = m_btnClose.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) CloseCompound(); return WMSG_SUCCESS; } // OK button else if( ( wmsgResult = m_btnOK.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) SendCompoundReq(); return WMSG_SUCCESS; } // Cancel button else if( ( wmsgResult = m_btnCancel.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) CloseCompound(); return WMSG_SUCCESS; } } // If holding button exists else { if( IsInside( nX, nY ) ) { CUIIcon* pDrag = pUIManager->GetDragIcon(); // If holding button is item and comes from inventory if (pDrag->getBtnType() == UBET_ITEM && pDrag->GetWhichUI() == UI_INVENTORY || pDrag->GetWhichUI() == UI_COMPOUND ) { if( IsInsideRect( nX, nY, m_rcInsertItem ) ) { /* 슬롯 0번 부터 차례 대로 입력하는 방식 for ( int i = 0; i < COMPOUND_ITEM_SLOT_COUNT; i++ ) { if ( IsInsideRect( nX-BTN_SIZE/2, nY-BTN_SIZE/2, m_rcItemSlot[i] ) ) { // Set item SetCompoundItem ( i ); return WMSG_SUCCESS; } } */ SetCompoundItem ();// NearPosition ( nX-BTN_SIZE/2, nY-BTN_SIZE/2 ) ); } } return WMSG_SUCCESS; } else { ResetCompoundItem (); pUIManager->ResetHoldBtn(); return WMSG_SUCCESS; } } } break; case WM_LBUTTONDBLCLK: { if( IsInside( nX, nY ) && IsInsideRect( nX, nY, m_rcInsertItem ) ) { m_nCurItemSlot = NearPosition ( nX-BTN_SIZE/2, nY-BTN_SIZE/2 ); ResetCompoundItem (); CUIManager::getSingleton()->ResetHoldBtn(); } return WMSG_SUCCESS; } break; } return WMSG_FAIL; }
// ---------------------------------------------------------------------------- // Name : MouseMessage() // Desc : // ---------------------------------------------------------------------------- WMSG_RESULT CUIPetItemMix::MouseMessage( MSG *pMsg ) { WMSG_RESULT wmsgResult; // Title bar static BOOL bTitleBarClick = FALSE; // Mouse point static int nOldX, nOldY; int nX = LOWORD( pMsg->lParam ); int nY = HIWORD( pMsg->lParam ); // Mouse message switch( pMsg->message ) { case WM_MOUSEMOVE: { if( IsInside( nX, nY ) ) { CUIManager::getSingleton()->SetMouseCursorInsideUIs(); int iRowS = m_sbProcessItem.GetScrollPos(); int iRowE = iRowS + PROCESS_SLOT_ROW; if ( m_vecIcons.size() < iRowE ) { iRowE = m_vecIcons.size(); } if ( IsInsideRect ( nX, nY, m_rcItem ) ) { bool bShowItem = false; for( int iRow = iRowS; iRow < iRowE; iRow++ ) { m_vecIcons[iRow]->MouseMessage( pMsg ); } } } // Move refine if( bTitleBarClick && ( pMsg->wParam & MK_LBUTTON ) ) { int ndX = nX - nOldX; int ndY = nY - nOldY; nOldX = nX; nOldY = nY; Move( ndX, ndY ); return WMSG_SUCCESS; } // Close button else if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // OK button else if( m_btnOK[1].MouseMessage( pMsg ) != WMSG_FAIL ) // 제작 타입 A return WMSG_SUCCESS; else if( m_btnOK[2].MouseMessage( pMsg ) != WMSG_FAIL ) // 제작 타입 B return WMSG_SUCCESS; else if( m_btnOK[0].MouseMessage( pMsg ) != WMSG_FAIL && m_nPetType == DRAGON_WEAPON ) // DRAGON return WMSG_SUCCESS; // Cancel button else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; // List box of skill desc else if( m_sbProcessItem.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; else if( m_lbPreconditionDesc.MouseMessage( pMsg ) != WMSG_FAIL ) return WMSG_SUCCESS; } break; case WM_LBUTTONDOWN: { if( IsInside( nX, nY ) ) { nOldX = nX; nOldY = nY; // Close button if( m_btnClose.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Title bar else if( IsInsideRect( nX, nY, m_rcTitle ) ) { bTitleBarClick = TRUE; } // OK button else if( m_btnOK[0].MouseMessage( pMsg ) != WMSG_FAIL && m_nPetType == DRAGON_WEAPON ) { // Nothing } else if( m_btnOK[1].MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_btnOK[2].MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } // Cancel button else if( m_btnCancel.MouseMessage( pMsg ) != WMSG_FAIL ) { // Nothing } else if( m_sbProcessItem.MouseMessage( pMsg ) != WMSG_FAIL ) { return WMSG_SUCCESS; } CUIManager::getSingleton()->RearrangeOrder( UI_PETITEMMIX, TRUE ); return WMSG_SUCCESS; } } break; case WM_LBUTTONUP: { // If holding button doesn't exist if (UIMGR()->GetDragIcon() == NULL) { // Title bar bTitleBarClick = FALSE; // If refine isn't focused if( !IsFocused() ) return WMSG_FAIL; // Close button if( ( wmsgResult = m_btnClose.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) ClosePetItemMix(); return WMSG_SUCCESS; } // OK button else if( ( wmsgResult = m_btnOK[0].MouseMessage( pMsg ) ) != WMSG_FAIL && m_nPetType == DRAGON_WEAPON ) { if( wmsgResult == WMSG_COMMAND ) SendPetItemMixReq( 0, DRAGON_WEAPON ); return WMSG_SUCCESS; } else if( ( wmsgResult = m_btnOK[1].MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) SendPetItemMixReq( 0, KNIGHT_AMOR ); return WMSG_SUCCESS; } else if( ( wmsgResult = m_btnOK[2].MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) SendPetItemMixReq( 1, KNIGHT_AMOR ); return WMSG_SUCCESS; } // Cancel button else if( ( wmsgResult = m_btnCancel.MouseMessage( pMsg ) ) != WMSG_FAIL ) { if( wmsgResult == WMSG_COMMAND ) ClosePetItemMix(); return WMSG_SUCCESS; } else if( m_sbProcessItem.MouseMessage( pMsg ) != WMSG_FAIL ) { return WMSG_SUCCESS; } else if( IsInsideRect( nX, nY, m_rcIcons ) ) { int iRowS = m_sbProcessItem.GetScrollPos(); int iRowE = iRowS + PROCESS_SLOT_ROW; if ( m_vecIcons.size() < iRowE ) { iRowE = m_vecIcons.size(); } for( int iRow = iRowS; iRow < iRowE; iRow++ ) { if( m_vecIcons[iRow]->MouseMessage( pMsg ) != WMSG_FAIL ) { m_nSelectProcessItem = iRow; SelectItem ( m_nSelectProcessItem ); return WMSG_SUCCESS; } } } } } break; case WM_LBUTTONDBLCLK: { if( IsInside( nX, nY ) ) return WMSG_SUCCESS; } break; case WM_MOUSEWHEEL: { if( IsInside( nX, nY ) ) { if ( IsInsideRect ( nX, nY, m_rcItem ) ) { return m_sbProcessItem.MouseMessage( pMsg ); } else if ( IsInsideRect ( nX, nY, m_rcDesc ) ) { return m_lbPreconditionDesc.MouseMessage ( pMsg ); } return WMSG_SUCCESS; } } break; } return WMSG_FAIL; }