本文整理汇总了C++中CItemBase::GetExtra方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemBase::GetExtra方法的具体用法?C++ CItemBase::GetExtra怎么用?C++ CItemBase::GetExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemBase
的用法示例。
在下文中一共展示了CItemBase::GetExtra方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDraw
void CWndGuildMeritCtrl::OnDraw( C2DRender* p2DRender )
{
if( m_pItemContainer.size() <= 0 )
return;
CRect rect = GetClientRect();
int nWidth = rect.Width() / 32;
int nHeight = rect.Height() / 32;
// 스크롤바 관련
CPoint pt( 0, 0 );
nWidth = 6;
int nPage = nHeight;
int nRange = m_pItemContainer.size() / nWidth;// - nPage;
if( m_pItemContainer.size() % nWidth )
nRange++;
m_wndScrollBar.SetScrollRange( 0, nRange );
m_wndScrollBar.SetScrollPage( nPage );
pt.y = 0;
pt.y += m_wndScrollBar.GetScrollPos() * nWidth;
for( int i = pt.y; i < (int)( m_pItemContainer.size() ); i++ )
{
int x = ( i - pt.x ) % 6;
int y = ( i - pt.y ) / 6;
CItemBase* pItemBase = m_pItemContainer[i];
if( pItemBase )
{
pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 32 + 13, y * 32 + 7 ) );
CRect rectHittest = CRect( x * 32 + 13, y * 32 + 7, x * 32 + 13 + 32, y * 32 + 32 + 7 );
CPoint point = GetMousePoint();
if( rectHittest.PtInRect( point ) )
{
CPoint point2 = point;
ClientToScreen( &point2 );
ClientToScreen( &rectHittest );
g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR );
}
if( i == m_nCurSel )
p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff );
CItemElem* pItemElem = (CItemElem*)pItemBase;
if( pItemElem->GetProp()->dwPackMax > 1 )
{
short nItemNum = pItemBase->GetExtra();
TCHAR szTemp[32];
_stprintf( szTemp, "%d", nItemNum );
CSize size = p2DRender->m_pFont->GetTextExtent( szTemp );
p2DRender->TextOut( x * 32 + 32 - size.cx + 17, y * 32 + 32 - size.cy + 10, szTemp, 0xff1010ff );
}
}
}
}
示例2: OnMouseMove
void CWndGuildMeritCtrl::OnMouseMove( UINT nFlags, CPoint point )
{
if( m_bDrag == FALSE )
return;
m_bDrag = FALSE;
CPoint pt( 3, 3 );
CRect rect;
CItemBase* pItemBase = m_pFocusItem;
if( pItemBase && pItemBase->GetExtra() > 0 )
{
m_GlobalShortcut.m_pFromWnd = this;
m_GlobalShortcut.m_dwShortcut = SHORTCUT_ITEM;
m_GlobalShortcut.m_dwIndex = m_nCurSel;
m_GlobalShortcut.m_dwType = 0;
m_GlobalShortcut.m_dwId = pItemBase->m_dwObjId;
m_GlobalShortcut.m_pTexture = pItemBase->GetTexture();
m_GlobalShortcut.m_dwData = (DWORD)pItemBase;
_tcscpy( m_GlobalShortcut.m_szString, pItemBase->GetProp()->szName );
}
}
示例3: OnChildNotify
//.........这里部分代码省略.........
#else // __VER >= 8 // __S8_VENDOR_REVISION
nValue = ( m_dwFocus == 0 ) ? ( (CItemElem*)m_pItemBase )->m_nItemNum: pItemProp->dwCost;
#endif // __VER >= 8 // __S8_VENDOR_REVISION
CString str;
str.Format( "%d", nValue );
pWndStatic->SetTitle(str);
}
break;
}
}
if( nID == WIDC_OK || message == EN_RETURN )
{
pWndStatic = (CWndStatic*)GetDlgItem( WIDC_SELLNUM );
LPCTSTR str = pWndStatic->GetTitle();
int nNum = 1;
nNum = atoi( str );
CItemElem* pItemElem = (CItemElem*)m_pItemBase;
if( nNum < 1 ) return TRUE; // 개수가 너무 작습니다.
if( nNum > pItemElem->m_nItemNum ) nNum = pItemElem->m_nItemNum;
int nCost = 0;
pWndStatic = (CWndStatic*)GetDlgItem( WIDC_SELLPRI );
str = pWndStatic->GetTitle();
#if __VER < 8 // __S8_VENDOR_REVISION
if( strlen( str ) > 9 ) return TRUE; // 숫자가 너무 큽니다.
#endif // __VER < 8 // __S8_VENDOR_REVISION
//nCost = atoi( str );
__int64 n64Cost = 0;
n64Cost = _atoi64(str);
if( n64Cost > INT_MAX )
n64Cost = INT_MAX;
nCost = static_cast<int>( n64Cost );
if( nCost < 1 ) return TRUE; // 비정상적인 수치가 입력되었습니다.
ItemProp* pItemProp = m_pItemBase->GetProp();
#if __VER >= 8 // __S8_VENDOR_REVISION
// if( 999999999 < ((EXPINTEGER)nCost*nNum) )
// {
// g_WndMng.OpenMessageBox( _T(prj.GetText(TID_GAME_VENDOR_MAX_ONE_GOLD)), MB_OK, this );
// return TRUE;
// }
int nGold = g_pPlayer->GetGold();
for( int iv = 0 ; iv < MAX_VENDITEM ; ++iv )
{
CItemBase *pItemBase = g_pPlayer->m_vtInfo.GetItem( iv );
if( pItemBase == NULL )
continue;
nGold += ((CItemElem*)pItemBase)->m_nCost * pItemBase->GetExtra();
}
int nOldGold = nGold;
//nGold += (nCost * nNum);
INT64 n64Sum(0);
INT64 n64Gold(nGold);
INT64 n64itemCost(nCost);
INT64 n64Num(nNum);
n64Sum = n64Gold + (n64itemCost * n64Num);
if( n64Sum <= 0 || 2100000000 <= n64Sum || nOldGold >= n64Sum )
{
g_WndMng.OpenMessageBox( _T(prj.GetText(TID_GAME_VENDOR_MAX_ALL_GOLD)), MB_OK, this );
return TRUE;
}
// if( nGold <= 0 || nOldGold >= nGold || 2100000000 <= nGold )
// {
// g_WndMng.OpenMessageBox( _T(prj.GetText(TID_GAME_VENDOR_MAX_ALL_GOLD)), MB_OK, this );
// return TRUE;
// }
#endif // __VER >= 8 // __S8_VENDOR_REVISION
#if __VER < 8 //8차게임내아이템판매가격제한풀기
if( nCost > pItemProp->dwCost * 1000 )
{
g_WndMng.OpenMessageBox( _T( prj.GetText(TID_GAME_LIMITSELL)), MB_OK, this );
return TRUE;
}
#endif // __VER < 8
g_DPlay.SendRegisterPVendorItem( m_iIndex, 0, (BYTE)( m_pItemBase->m_dwObjId ), nNum, nCost );
Destroy( FALSE );
}
else if( nID == WIDC_CANCEL ) // WIDC_CANCEL
{
Destroy( FALSE );
}
return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
示例4: OnDraw
void CWndVendorCtrl::OnDraw( C2DRender* p2DRender )
{
if( m_pMover == NULL )
return;
CRect rect = GetClientRect();
int nWidth = rect.Width() / 32;
int nHeight = rect.Height() / 35;
for( int i = 0; i < MAX_VENDITEM; i++ )
{
int x = i % 6;
int y = i / 6;
//p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff );
CRect rectHittest = CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 );
CPoint point = GetMousePoint();
if( rectHittest.PtInRect( point ) )
{
if( CWndBase::m_GlobalShortcut.m_dwData )
{
m_nCurSel = -1;
CPoint ptx = CPoint(x * 32 + 7, y * 32 + 11);
{
m_pTex->Render( p2DRender, ptx );
}
}
}
CItemBase* pItemBase = GetItem( i );
if( pItemBase )
{
if( ((CItemElem*)pItemBase)->IsFlag( CItemElem::expired ) )
{
pItemBase->GetTexture()->Render2( p2DRender, CPoint( x * 32 + 6, y * 32 + 10 ), D3DCOLOR_XRGB( 255, 100, 100 ) );
}
else
{
pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 32 + 6, y * 32 + 10 ) );
}
CPoint point = GetMousePoint();
if( rectHittest.PtInRect( point ) )
{
CPoint point2 = point;
ClientToScreen( &point2 );
ClientToScreen( &rectHittest );
g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR );
}
if( i == m_nCurSel )
p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff );
CItemElem* pItemElem = (CItemElem*)pItemBase;
if( pItemElem->GetProp()->dwPackMax > 1 )
{
short nItemNum = pItemBase->GetExtra();
TCHAR szTemp[32];
_stprintf( szTemp, "%d", nItemNum );
CSize size = p2DRender->m_pFont->GetTextExtent( szTemp );
p2DRender->TextOut( x * 32 + 32 - size.cx+5, y * 32 + 32 - size.cy+12, szTemp, 0xff1010ff );
}
}
}
}