Exemplo n.º 1
0
//SetContentAccess
//state
//1 - active
//2 - passive
void CurrentGroupLayer::setContentAccess(bool state)
{
	CCLayer* spr = (CCLayer*)this->getChildByTag(ID_CONTROLLAYER);
	spr->stopAllActions();
	CCActionInterval* scalein = CCScaleTo::actionWithDuration(0.2f,1.2f,1.2f);
	CCActionInterval* scaleout = CCScaleTo::actionWithDuration(0.2f,1.0f,1.0f);

	CCActionInterval* fadetoin = CCFadeTo::actionWithDuration(0.2f,255);
	CCActionInterval* fadetoout = CCFadeTo::actionWithDuration(0.2f,180);

	if(state)
	{
		((CCSprite*)(spr->getChildByTag(ID_TEXTFIELD)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoin->copy()->autorelease(),2.0f));
		((CCSprite*)(spr->getChildByTag(ID_COLORBOX)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoin->copy()->autorelease(),2.0f));
		((CCSprite*)(spr->getChildByTag(ID_STRIPE)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoin->copy()->autorelease(),2.0f));
		spr->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)scalein->copy()->autorelease(),2.0f));
		m_isAccessable = true;
        
	} else {
		((CCSprite*)(spr->getChildByTag(ID_TEXTFIELD)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoout->copy()->autorelease(),2.0f));
		((CCSprite*)(spr->getChildByTag(ID_COLORBOX)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoout->copy()->autorelease(),2.0f));
		((CCSprite*)(spr->getChildByTag(ID_STRIPE)))->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)fadetoout->copy()->autorelease(),2.0f));
		spr->runAction(CCEaseInOut::actionWithAction((CCActionInterval*)scaleout->copy()->autorelease(),2.0f));
		
		//hide keyboard
		this->onClickTrackNode(0);
		m_isAccessable = false;
	}
}