当前位置: 首页>>代码示例>>C++>>正文


C++ CImageView::getUserData方法代码示例

本文整理汇总了C++中CImageView::getUserData方法的典型用法代码示例。如果您正苦于以下问题:C++ CImageView::getUserData方法的具体用法?C++ CImageView::getUserData怎么用?C++ CImageView::getUserData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CImageView的用法示例。


在下文中一共展示了CImageView::getUserData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onChangHeadImg

void CChangeHeadImg::onChangHeadImg(CCObject* pSender)
{
	PlayEffectSound(SFX_Button);

	CImageView *head = (CImageView *)pSender;
	int *icon = (int*)head->getUserData();
	CPlayerControl::getInstance().sendChangeHeadImg(*icon);
	LayerManager::instance()->pop();
	LayerManager::instance()->pop();
}
开发者ID:54993306,项目名称:Classes,代码行数:10,代码来源:ChangeHeadImg.cpp

示例2: onTouchItem

void CStrengthenItem::onTouchItem(CCObject* pSender)
{
	if(isVisible())
	{
		PlayEffectSound(SFX_Button);
	}

	CImageView * img = (CImageView*)pSender;
	m_item = (CItem*)img->getUserData();

	m_pItemTip->showItemProperty(m_item);

	CLayout *attribute = (CLayout*)(m_ui->findWidgetById("attr"));
	attribute->setVisible(true);

	m_selectCellImg->removeFromParent();
	img->addChild(m_selectCellImg);
	m_selectCellImg->setVisible(true);
	m_selectCellImg->setPosition(ccp(img->getContentSize().width/2,0/*img->getContentSize().height/2*/));

	CButton *select = (CButton*)(m_ui->findWidgetById("select")); //sel_font
	CLabel *selfont = (CLabel*)(m_ui->findWidgetById("sel_font"));
	if (m_toHero==m_item->armor.hero&&m_toHero>0)
	{
		select->setVisible(true);
		selfont->setVisible(false);
	}
	else if (m_toHero>0&&!m_item->canUse)
	{
		select->setVisible(false);
		selfont->setVisible(false);
	}
	else
	{
		select->setVisible(true);
		selfont->setVisible(true);
	}

	if (m_type==2)
	{
		if (m_toHero>0)
		{
			CImageView *uninstall = (CImageView*)(m_ui->findWidgetById("uninstall"));
			CImageView *change = (CImageView*)(m_ui->findWidgetById("change"));
			CImageView *selfont = (CImageView*)(m_ui->findWidgetById("sel_font"));
			uninstall->setVisible(m_toHero==m_item->armor.hero);
			change->setVisible(m_toHero!=m_item->armor.hero&&m_item->armor.hero>0&&m_item->canUse);
			selfont->setVisible(m_item->armor.hero==0&&m_item->canUse);
		}
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:51,代码来源:StrengthenItem.cpp

示例3: onPress

void CSignLayer::onPress( CCObject* pSender, CTouchPressState iState )
{
	CImageView* pImage = (CImageView*)pSender;
	CSign* sign = (CSign*)pImage->getUserData();
	int iType = sign->prize.type;

	if(m_pMonsterInfo)
	{
		m_pMonsterInfo->hide();
	}
	if(m_pItemInfo)
	{
		m_pItemInfo->hide();
	}
	
	//1 道具,2 英雄,3 铜钱,4 元宝,5 粮食
	switch (iType)
	{
	case 3:
	case 4:
	case 5:
	case 1:
		{
			if(m_pItemInfo==nullptr)
			{
				m_pItemInfo = CItemInfo::create();
				this->addChild(m_pItemInfo);
			}

			switch (iState)
			{
			case CTouchPressOn:
				{
					PlayEffectSound(SFX_429);

					CSign* sign = (CSign*)pImage->getUserData();
					m_pItemInfo->setInfo(&sign->prize);
					m_pItemInfo->bindPos(pImage);
					m_pItemInfo->changeForSign(&sign->prize);
					m_pItemInfo->show();
					CCLOG("show");
				}
				break;
			case CTouchPressOff:
				{
					m_pItemInfo->hide();
					CCLOG("hide");
				}
				break;
			default:
				break;
			}

		}break;
	case 2:
		{
			if(m_pMonsterInfo==nullptr)
			{
				m_pMonsterInfo = CMonsterInfo::create();
				this->addChild(m_pMonsterInfo);
			}

			switch (iState)
			{
			case CTouchPressOn:
				{
					PlayEffectSound(SFX_429);

					CSign* sign = (CSign*)pImage->getUserData();
					CHero pHero;
					pHero.heroid = sign->prize.id;
					pHero.thumb = sign->prize.thumb;
					pHero.quality = sign->prize.quality;
					pHero.iColor = sign->prize.color;
					pHero.level = 1;
					m_pMonsterInfo->setHero(&pHero);
					m_pMonsterInfo->bindPos(pImage);
					m_pMonsterInfo->changeForSign(&pHero);
					m_pMonsterInfo->show();
					CCLOG("show");
				}
				break;
			case CTouchPressOff:
				{
					m_pMonsterInfo->hide();
					CCLOG("hide");
				}
				break;
			default:
				break;
			}

		}break;
	default:
		break;
	}

}
开发者ID:54993306,项目名称:Classes,代码行数:98,代码来源:SignLayer.cpp


注:本文中的CImageView::getUserData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。