void GameAbout::onEnter()
{
	CCLayer::onEnter();
	CCSize size = CCDirector::sharedDirector()->getWinSize();

	CCNode* menu  = this->getChildByTag(4);
	menu->setPositionX(-100);
	menu->runAction(CCEaseSineIn::create(CCMoveBy::create(0.5,ccp(100,0))));

	CCNode* moon = this->getChildByTag(1);
	moon->setPosition(ccp(size.width/3*2,0));
	moon->runAction(CCEaseSineIn::create(CCMoveBy::create(0.5,ccp(-size.width/3,0))));

	CCNode* aboutTitle = this->getChildByTag(3);
	aboutTitle->setPositionY(size.height+20);
	aboutTitle->runAction(CCEaseSineIn::create(CCMoveBy::create(0.5,ccp(0,-40))));

	CCNode* tb = this->getChildByTag(2);
	tb->setPositionX(-200);
	tb->runAction(CCEaseSineIn::create(CCMoveTo::create(0.5,ccp(size.width/2,size.height/2))));

	CCNode* info = this->getChildByTag(5);
	info->setPositionX(-200);
	info->runAction(CCEaseSineIn::create(CCMoveTo::create(0.5,ccp(size.width/2,size.height/2+20))));

}
void VEScrollView::reArrange()
{
    CCArray *children = m_pContainer->getChildren();

    float posX = -m_viewSize.width/2.f;
    float posY = m_viewSize.height/2.f;

    for(int i = 0; i < m_pContainer->getChildrenCount(); i++)
    {
        CCNode *node = (CCNode*)children->objectAtIndex(i);
        CCSize nodeSize = node->getContentSize();
        node->setAnchorPoint(ccp(0.5, 0.5));
        switch (m_eType) {
        case SCROLLVIEW_HORIZONTAL:
            node->setPositionX(posX+nodeSize.width/2.f);
            posX += nodeSize.width;
            break;
        case SCROLLVIEW_VERTICAL:
            node->setPositionY(posY-nodeSize.height/2.f);
            posY -= nodeSize.height;
            break;
        default:
            CCLOG("wrong scroll type");
            break;
        }
        //float nodeY = m_pContainer->getPositionY()+h;
        //node->setVisible(nodeY<nodeSize.height && nodeY>-m_viewSize.height);
        //if(dynamic_cast<CCLayer*>(node))
        //   dynamic_cast<CCLayer*>(node)->setTouchEnabled(nodeY<nodeSize.height && nodeY>-m_viewSize.height);

    }


    switch (m_eType) {
    case SCROLLVIEW_HORIZONTAL:
        posX += m_viewSize.width/2.f;
        m_contentSize.width = abs(posX);
        m_contentSize.height = m_viewSize.height;
        break;
    case SCROLLVIEW_VERTICAL:
        posY -= m_viewSize.height/2.f;
        m_contentSize.width = m_viewSize.width;
        m_contentSize.height = abs(posY);
        break;
    default:
        CCLOG("wrong scroll type");
        break;
    }
}
Example #3
0
void GameAbout::onEnter()
{
    CCLayer::onEnter();
    
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    
    CCNode *mainMenu = this->getChildByTag(4);
    mainMenu->setPositionX(-100);
    mainMenu->runAction(CCSequence::create(CCEaseElasticIn::create(CCMoveBy::create(1.5f, ccp(100, 0))),
                                           CCCallFunc::create(this, callfunc_selector(GameAbout::menuEnter)),
                                           NULL));
    
    CCNode *aboutTitle = this->getChildByTag(3);
    aboutTitle->setPositionY(size.height + 20);
    aboutTitle->runAction(CCEaseElasticIn::create(CCMoveBy::create(1.5f, ccp(0, -40))));
    
    CCNode *frame = this->getChildByTag(2);
    frame->setPositionX(-200);
    frame->runAction(CCEaseElasticIn::create(CCMoveTo::create(1.5f, ccp(size.width/2, size.height/2))));
    
    CCNode *bgStar = this->getChildByTag(1);
    bgStar->setPositionX(size.width/3 * 2);
    bgStar->runAction(CCMoveBy::create(1.5f, ccp(-size.width/3, 0)));
}
Example #4
0
bool T27ActionMore::init()
{
	BaseLayer::init();
	CCSize winSize = CCDirector::sharedDirector()->getWinSize();
	
	CCNode* c = CCNode::create();
	_c = c;
	int actionCount = sizeof(_actionName) / sizeof(*_actionName);
	
	for (int i = 0; i < actionCount; i++)
	{
		/*
		CCSprite* bg = CCSprite::create("HelloWorld.png");
		c->addChild(bg);
		bg->setPosition(ccp(winSize.width / 2 + i*winSize.width, winSize.height / 2));
		*/
		CCLayerColor* layer;
		if (i % 2 == 0)
		{
			layer = CCLayerColor::create(ccc4(192, 192, 192, 255), winSize.width, winSize.height);
		}
		else
		{
			layer = CCLayerColor::create(ccc4(128, 128, 128, 255), winSize.width, winSize.height);
		}
		c->addChild(layer);
		layer->setPosition(ccp(i*winSize.width, 0));

		/* 设置Title */
		const char* title = _actionName[i];
		CCLabelTTF* label = CCLabelTTF::create(title, "Arial", 36);
		layer->addChild(label);
		label->setPosition(ccp(winSize.width / 2, winSize.height - 80));
	}

	CCScrollView* view = CCScrollView::create(winSize, c);
	view->setDirection(kCCScrollViewDirectionHorizontal);
	view->setContentSize(CCSize(winSize.width*actionCount, winSize.height));
	addChild(view);

	c->setPositionX((1 - actionCount)*winSize.width);

	// 能触摸
	setTouchEnabled(true);
	setTouchMode(kCCTouchesOneByOne);

	return true;
}
void GameMenuScene::onEnter(){
	CCLayer::onEnter();
	CCSize size = CCDirector::sharedDirector()->getWinSize();

	CCNode* mainmenu = this->getChildByTag(3);
	mainmenu->setPositionX(-200);
	mainmenu->runAction(CCSequence::create(
		//CCEaseElasticIn::create
		(CCMoveTo::create(0.5,ccp(0,0))),
		CCCallFuncN::create(this->getChildByTag(3), callfuncN_selector(GameMenuScene::menuEnter)
		)
		,
		NULL));

	 

}
Example #6
0
void GameMenu::onEnter(){
    CCLayer::onEnter();
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    //界面进入时,运行菜单项进入动作
    CCNode* mainmenu = this->getChildByTag(3);
    mainmenu->setPositionX(-200);
    mainmenu->runAction(CCSequence::create(CCEaseElasticIn::create(CCMoveTo::create(0.5,ccp(0,0))),CCCallFuncN::create(this, callfuncN_selector(GameMenu::menuEnter)),NULL));
    
    CCNode*title = this->getChildByTag(2);
    title->setPositionY(size.height + 20);
    title->runAction(CCEaseElasticIn::create(CCMoveBy::create(0.5,ccp(0,-100))));
    
    CCNode*bgstar = this->getChildByTag(1);
    bgstar->setPositionX(size.width/3);
    bgstar->runAction(CCMoveBy::create(0.5,ccp(size.width/3,0)));
    
}
void CPullMachPrizeRemainFontNode::showScore(LONGLONG lScore)
{
	//计算显示分数的各位数字、位数
	int nBitNum[20] = {0};
	int nBitCount = 0;
	computeBitNumOfScore(lScore, nBitNum, nBitCount);
	int nNowBitCount = m_pFontBatchNode->getChildrenCount();	//当前分数位数

	//更新显示
	if (nNowBitCount == nBitCount)
	{
		//位数相同,直接替换纹理
		for (int i = 0; i < nBitCount; ++i)
		{
			m_pResManager->resetSpriteFrameTexture(dynamic_cast<CCSprite *>(m_pFontBatchNode->getChildByTag(i + 1)),
				sm_nFontResId[nBitNum[i]]);
		}
	}
	else if (nNowBitCount > nBitCount)
	{
		//当前位数过多,删除多余的
		for (int i = 0; i < nBitCount; ++i)
		{
			m_pResManager->resetSpriteFrameTexture(dynamic_cast<CCSprite *>(m_pFontBatchNode->getChildByTag(i + 1)),
				sm_nFontResId[nBitNum[i]]);
		}
		for (int i = nBitCount; i < nNowBitCount; ++i)
		{
			m_pFontBatchNode->removeChildByTag(i + 1, true);
		}
	}
	else
	{
		//当位数不足,添加子节点
		for (int i = 0; i < nNowBitCount; ++i)
		{
			m_pResManager->resetSpriteFrameTexture(dynamic_cast<CCSprite *>(m_pFontBatchNode->getChildByTag(i + 1)),
				sm_nFontResId[nBitNum[i]]);
		}
		for (int i = nNowBitCount; i < nBitCount; ++i)
		{
			CCSprite * pSprite = NULL;
			if (m_pResManager->GenerateNodeByCfgID(eSpriteType_Base, sm_nFontResId[nBitNum[i]], pSprite))
			{
				pSprite->setAnchorPoint(CCPointZero);
				pSprite->setPosition(CCPointZero);
				m_pFontBatchNode->addChild(pSprite, 0, i + 1);
			}
		}
	}

	//调整数字位置
	float fAllWidth = 0.0f;
	for (int i = 0; i < nBitCount; ++i)
	{
		CCNode * pNode = m_pFontBatchNode->getChildByTag(i + 1);
		pNode->setPositionX(fAllWidth);
		fAllWidth += pNode->getContentSize().width;
	}

	return ;
}