//-------------------------------------------------------------------------
void CCocos2dxDBDisplayBridge::UpdateColor( f32 p_fA, f32 p_fR, f32 p_fG, f32 p_fB, 
		f32 p_fAMultiplier, f32 p_fRMultiplier, f32 p_fGMultiplier, f32 p_fBMultiplier )
{
	if( m_pDisplayNode == NULL )
		return;

	CCNodeRGBA* pNode = dynamic_cast<CCNodeRGBA*>( m_pDisplayNode->GetNode() );
	pNode->setColor( ccc3( static_cast<GLubyte>(p_fRMultiplier * 255), 
		static_cast<GLubyte>( p_fGMultiplier * 255 ), static_cast<GLubyte>( p_fBMultiplier * 255 ) ) );
	pNode->setOpacity( static_cast<GLubyte>(p_fAMultiplier * 255) );
}
Esempio n. 2
0
void CSmeltArmor::showStrengthCallBack(CCNode* pSender)
{
	//强化成功
	PlayEffectSound(SFX_407);

	CCNode* pNode = (CCNode*)m_ui->findWidgetById("alpha_panel");
	float fTime = ShowTVLight(pNode, pSender);
	CCNodeRGBA* pWhitePanel = (CCNodeRGBA*)m_ui->findWidgetById("white_panel");
	pWhitePanel->setOpacity(0);
	pWhitePanel->runAction(CCSequence::create(CCDelayTime::create(fTime), CCFadeTo::create(0.15f, 180), CCFadeOut::create(0.03f), nullptr));

	pSender->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(fTime), CCCallFunc::create(this, callfunc_selector(CSmeltArmor::showTVLightCallBack))));
}
//--------------------------------------------------------------------
// 创建一个Toast对象实例
// 参数:owner		所有者节点(toast将被作为子节点添加到 owner中,并设置为最大Z值)
//		content		内容节点(这个将是显示的真实信息,但用户需要设置好合适的锚点和位置)
//		tag			对象标签(如果该值为-1,则可同时显示多个实例,否则不可同时显示)
//		duration	显示时常(若为默认0,则表示显示3秒)
//		inAction	显示时的动作(若为默认0,则表示使用淡入动作)
//		outAction	消失时的动作(若为默认0,则表示使用淡出动作)
FKCW_UI_ToastLayer* FKCW_UI_ToastLayer::Create(CCNode* owner, CCNode* content, int tag,
			float duration, CCFiniteTimeAction* inAction, CCFiniteTimeAction* outAction )
{
	// 检查标签是否已经存在
	if(tag != -1) 
	{
		if(owner->getChildByTag(tag)) 
		{
			return NULL;
		}
	}

	FKCW_UI_ToastLayer* t = new FKCW_UI_ToastLayer();
	t->init();
	t->setTag(tag);

	// 添加到owner
	owner->addChild(t, MAX_INT);

	// 添加子显示节点
	t->addChild(content);

	// 执行显示隐藏动作
	if(inAction == NULL) 
	{
		CCNodeRGBA* n = dynamic_cast<CCNodeRGBA*>(content);
		if(n)
			n->setOpacity(0);
		inAction = FKCW_Action_TreeFadeIn::create(0.5f);
	}
	if(outAction == NULL) 
	{
		outAction = FKCW_Action_TreeFadeOut::create(0.5f);
	}
	content->runAction(CCSequence::create(inAction,
		CCDelayTime::create(duration > 0 ? duration : 3),
		outAction,
		CCCallFunc::create(t, callfunc_selector(CCNode::removeFromParent)),
		NULL));
	t->autorelease();
	return t;
}