예제 #1
0
// ----------------------------------------------------------------------------
// Name : OpenSelectResource()
// Desc : iType = 1 채굴, iType = 2 채집, iType = 3 차지
// ----------------------------------------------------------------------------
void CUISelectResource::OpenSelectResource( int npcIndex, int iType )
{	
	if(iType == -1)
		return;
	if( IsVisible() )
	{
		ResetSelectResource();
		OpenSelectResource(npcIndex, iType);
		return;
	}

	CEntityProperty *pEP = CEntity::GetPlayerEntity(0)->PropertyForTypeAndID(CEntityProperty::EPT_BOOL, 221);
	if(pEP)
	{
		ENTITYPROPERTY( &*CEntity::GetPlayerEntity(0), pEP->ep_slOffset, BOOL) = FALSE;
	}
	pEP = CEntity::GetPlayerEntity(0)->PropertyForTypeAndID(CEntityProperty::EPT_INDEX, 222);
	if(pEP)
	{
		ENTITYPROPERTY( &*CEntity::GetPlayerEntity(0), pEP->ep_slOffset, INDEX) = -1;
	}
	ResetSelectResource();

	m_iResourceType = iType;
	m_iClientNPCIndex = npcIndex;

	if(iType == 4 ) //수집이면 패스
	{
		StartProduct();
		ResetSelectResource();
	}
	else 
	{
		FLOAT	fTexWidth = m_ptdBaseTexture->GetPixWidth();
		FLOAT	fTexHeight = m_ptdBaseTexture->GetPixHeight();

		CUIButton TempUIButton;
		TempUIButton.SetUV( UBS_IDLE, 0, 117, 131, 138, fTexWidth, fTexHeight );
		TempUIButton.SetUV( UBS_CLICK, 0, 140, 131, 161, fTexWidth, fTexHeight );
		TempUIButton.CopyUV( UBS_IDLE, UBS_ON );
		TempUIButton.CopyUV( UBS_IDLE, UBS_DISABLE );

		const int iStartX = 20;
		const int iStartY = 30;	
		int iCurPosX = iStartX;
		int iCurPosY = iStartY;

		CTString strName;
		for(INDEX i=0; i<2; ++i)
		{
			strName = i?_S( 1972, "선택 생산" ):_S( 1973, "무작위 생산" );
			TempUIButton.Create(this, strName, iCurPosX, 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 );
		CUIManager::getSingleton()->RearrangeOrder( UI_SELECTRESOURCE, TRUE );
	}

	// 시작 되면 키보드 이동 막기 [3/26/2013 Ranma]
	m_bKeyMove = false;
	return;
}
예제 #2
0
// ----------------------------------------------------------------------------
// 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;
}