예제 #1
0
CCControlButton* CCControlButton::create(CCNode* label, CCScale9Sprite* backgroundSprite)
{
    CCControlButton *pRet = new CCControlButton();
    pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite);
    CC_SAFE_AUTORELEASE(pRet);
    return pRet;
}
예제 #2
0
void FMMapAvatarNode::clickAvatarBtn(cocos2d::CCObject *object, CCControlEvent event)
{
    FMSound::playEffect("click.mp3", 0.1f, 0.1f);
    int t = 1;
    if (m_includeSelf) {
        t--;
    }
    if (!m_isExpand && m_avatarList->count() > t) {
        expandAvatars(true);
    }else{
        FMDataManager* manager = FMDataManager::sharedManager();
        expandAvatars(false);
        CCControlButton * button = (CCControlButton *)object;
        
        int index = button->getParent()->getTag();
        
        if (m_dicList) {
            if (index < m_dicList->count()) {
                FMUIFriendProfile * window = (FMUIFriendProfile *)manager->getUI(kUI_FriendProfile);
                GAMEUI_Scene::uiSystem()->nextWindow(window);
                CCDictionary * dic = (CCDictionary *)m_dicList->objectAtIndex(index);
                window->setProfile(dic);
            }
        }
    }
}
예제 #3
0
void HRootLayer::updateAndAdjust(CCNode *node, float scaleX, float scaleY) {
    CCArray *children = node->getChildren();
    if (children) {
        for (int i = children->count() - 1; i >= 0; --i) {
            CCNode *child = (CCNode *)children->objectAtIndex(i);
            if (dynamic_cast<CCLabelTTF *>(child)) {
                CCLabelTTF *label = (CCLabelTTF *)child;
                label->setString(HLocalizedString(label->getString()));
            } else if (dynamic_cast<CCEditBox *>(child)) {
//                CCEditBox *editBox = (CCEditBox *)child;
//                editBox->setScaleX(scaleX);
//                editBox->setScaleY(scaleY);
            } else if (dynamic_cast<CCControlButton *>(child)) {
                CCControlButton *button = (CCControlButton *)child;
                CCString *title = button->getTitleForState(CCControlStateNormal);
                button->setTitleForState(CCString::create(HLocalizedString(title->getCString())), CCControlStateNormal);
            } else if (dynamic_cast<CCScrollView *>(child)) {
//                CCScrollView *scrollview = (CCScrollView *)child;
//                scrollview->setScaleX(scaleX);
//                scrollview->setScaleY(scaleY);
                updateAndAdjust(child, scaleX, scaleY);
            } else {
                updateAndAdjust(child, scaleX, scaleY);
            }
        }
    }
}
예제 #4
0
CCControlButton* CCControlButton::create(string title, const char * fontName, float fontSize)
{
    CCControlButton *pRet = new CCControlButton();
    pRet->initWithTitleAndFontNameAndFontSize(title, fontName, fontSize);
    CC_SAFE_AUTORELEASE(pRet);
    return pRet;
}
예제 #5
0
void AddFriendScene::toolBarTouchDownAction(CCObject *pSender, CCControlEvent pCCControlEvent) {
	CCControlButton *button = (CCControlButton *)pSender;
	if (pCCControlEvent==CCControlEventTouchDown)
	{
		btnTouched = true;
	}
	else if (pCCControlEvent==CCControlEventTouchUpInside)
	{
		switch (button->getTag()) {
		case 128:
			{
				btnTouched = false;
				MainGameScene *mainScene = (MainGameScene *)this->getParent();
				mainScene->PushLayer((CCLayer *)this->GetLayer("NewMailScene"));
			}
			break;
		case 129:
			{
				btnTouched = false;
				CCMessageDialog *box = CCMessageDialog::create();
				box->setTitle(GlobalData::getLocalString("friend_add_confirm")->getCString());
				box->setDelegate(this);
				this->addChild(box);
			}
			break;
		default:
			break;
		}
	}
}
bool GeneralDialogTest::init()
{
    if (CCLayer::init())
    {
        //正常状态按钮
        CCScale9Sprite *backgroundButton = CCScale9Sprite::create("button.png");
        //按下效果
        CCScale9Sprite *backgroundHighlightedButton = CCScale9Sprite::create("buttonHighlighted.png");
        //按钮的大小根据标题变化
        CCLabelTTF *titleButton = CCLabelTTF::create("Touch Me!", "Marker Felt", 30);
        //按钮颜色
        titleButton->setColor(ccc3(159, 168, 176));
        
        CCControlButton* controlButton = CCControlButton::create(titleButton, backgroundButton);
        controlButton->setBackgroundSpriteForState(backgroundHighlightedButton, CCControlStateHighlighted);
        controlButton->setTitleColorForState(ccWHITE, CCControlStateHighlighted);
        
//        controlButton->setAnchorPoint(ccp(0.5f, 1));
        controlButton->setPosition(ccp(640/2, 960/5));
        addChild(controlButton);
        /* 当鼠标处于按下并曾经点中按钮的状态下,鼠标松开且在按钮范围内,则触发一次 */
        controlButton->addTargetWithActionForControlEvents(this, cccontrol_selector(GeneralDialogTest::touchUpInside), CCControlEventTouchUpInside);
        return true;
    }
    return false;
}
예제 #7
0
CCControlButton* CCControlButton::create(string title, const char * fontName, float fontSize)
{
    CCControlButton *pRet = new CCControlButton();
    pRet->initWithTitleAndFontNameAndFontSize(title, fontName, fontSize);
    pRet->autorelease();
    return pRet;
}
예제 #8
0
CCTableViewCell* RPGMapItemsMenuLayer::tableCellAtIndex(CCTableView *tableView, unsigned int idx)
{
    CCTableViewCell *cell = tableView->dequeueCell();
    if (!cell)
    {
        cell = new CCTableViewCell();
        cell->autorelease();
    }
    else
        cell->removeAllChildrenWithCleanup(true);
    
    float x = 100;
    for (int i = 0; i < 4; i++)
    {
        int index = idx * 4 + i;
        
        if(index >= this->m_itemsList->count())
            break;
        
        RPGExistingItems *itemsData = (RPGExistingItems*)this->m_itemsList->objectAtIndex(index);
        
        CCControlButton *itemBtn = CCControlButton::create(CCString::createWithFormat("%s (%i)", itemsData->m_name.c_str(), itemsData->m_total)->getCString(), "Arial", 22);
        itemBtn->setPosition(ccp(x, 0));
        itemBtn->setTag(itemsData->m_dataId);
        itemBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(RPGMapItemsMenuLayer::onButton), CCControlEventTouchUpInside);
        cell->addChild(itemBtn);
        
        x += 200;
    }
    
    return cell;
}
예제 #9
0
CCControlButton* CCControlButton::create(CCScale9Sprite* sprite)
{
    CCControlButton *pRet = new CCControlButton();
    pRet->initWithBackgroundSprite(sprite);
    pRet->autorelease();
    return pRet;
}
예제 #10
0
//根据按钮跳转到相应的场景中
void MenuScene::menuCloseCallBack(CCObject* pSender)
{
    //点击音效
    SimpleAudioEngine::sharedEngine()->playEffect("ZF_Shoot_Effects_touchButton.wav");
    
    CCControlButton* button = (CCControlButton*)pSender;
    CCTransitionFade* transition;
    switch (button->getTag()) {
        case 1:
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
            transition = CCTransitionFade::create(0.2, Popularize::scene());
            CCDirector::sharedDirector()->pushScene(transition);
#endif
            break;
            
            
        case 2:
        {
            MallMarkets* mallMarketsLayer = MallMarkets::create();
            mallMarketsLayer->setPosition(CCPointZero);
            this->addChild(mallMarketsLayer,4);
            this->setMenuButtonTouchFasle();
            break;
        }

        case 4:

            break;

        case 6:

            break;
    }
    
}
예제 #11
0
CCControlButton* CCControlButton::create(CCScale9Sprite* sprite)
{
    CCControlButton *pRet = new CCControlButton();
    pRet->initWithBackgroundSprite(sprite);
    CC_SAFE_AUTORELEASE(pRet);
    return pRet;
}
예제 #12
0
CCControlButton* CCControlButton::create(CCNode* label, CCScale9Sprite* backgroundSprite)
{
    CCControlButton *pRet = new CCControlButton();
    pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite);
    pRet->autorelease();
    return pRet;
}
예제 #13
0
void QimiAlipayView::selected(cocos2d::CCNode* pSender, cocos2d::extension::CCControlEvent* pCCControlEvent)
{
    CCControlButton* btn = dynamic_cast<CCControlButton*>(pSender);
    int pay = btn->getTag();
    CCLog("%d", pay);
    upDataView(pay);
    upSelectState(btn);
}
예제 #14
0
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                        "CloseNormal.png",
                                        "CloseSelected.png",
                                        this,
                                        menu_selector(HelloWorld::menuCloseCallback));
    
	pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
                                origin.y + pCloseItem->getContentSize().height/2));

    // create menu, it's an autorelease object
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition(CCPointZero);
    this->addChild(pMenu, 1);

    /////////////////////////////
    // 3. add your codes below...

    // add a label shows "Hello World"
    // create and initialize a label
    
    CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", 24);
    
    // position the label on the center of the screen
    pLabel->setPosition(ccp(origin.x + visibleSize.width/2,
                            origin.y + visibleSize.height - pLabel->getContentSize().height));

    // add the label as a child to this layer
    this->addChild(pLabel, 1);

	CCRect rect1(133, 333, 42, 46);
	CCScale9Sprite* btnNormal = CCScale9Sprite::create("char_bluelight.png",rect1);  
	CCScale9Sprite* btnDown = CCScale9Sprite::create("char_bluelight.png",rect1);  
	CCControlButton* controlBtn = CCControlButton::create(btnNormal);  
	controlBtn->setBackgroundSpriteForState(btnDown, CCControlStateSelected);  
	controlBtn->setPosition(ccp(visibleSize.width/2, visibleSize.height/2));  
	controlBtn->setPreferredSize(CCSize(60, 50));  
	controlBtn->addTargetWithActionForControlEvents(this, cccontrol_selector(HelloWorld::touchDownAction), CCControlEventTouchDown);
	this->addChild(controlBtn);  
    
    return true;
}
bool ParticleTest::init(){
    CCControlButton *btn = CCControlButton::create("particle ", "Arial", 24);
    btn->setPosition(ccp(320, 1000));
    this->addChild(btn);
    btn->addTargetWithActionForControlEvents(this, cccontrol_selector(ParticleTest::btnClick), CCControlEventTouchDown);
    
    
    return true;
}
	CCControlButton* PluginLayerContent::createRootButton( const char* btnTitle, int btnTag )
	{
		CCControlButton* ctrlBtn = nl::ControlUtils::createButton(btnTitle);
		ctrlBtn->setTag(btnTag);
		ctrlBtn->addTargetWithActionForControlEvents(
			this, 
			cccontrol_selector(PluginLayerContent::onUIAction), 
			CCControlEventTouchUpInside);
		return ctrlBtn;
	}
예제 #17
0
void guankaScene::jumpBtn() {
    CCSize screenSize = CCDirector::sharedDirector()->getVisibleSize();
    
    CCLabelTTF* jumptext = CCLabelTTF::create("Jump!!", "Arial", 40);
    CCScale9Sprite* noDownbtn = CCScale9Sprite::create("button.png");
    CCScale9Sprite* downbtn = CCScale9Sprite::create("buttonDown.png");
    CCControlButton* Btnjump = CCControlButton::create(jumptext, noDownbtn);
    Btnjump->setPosition(ccp(screenSize.width-80, 50));
    Btnjump->setBackgroundSpriteForState(downbtn, extension::CCControlStateHighlighted);
    Btnjump->addTargetWithActionForControlEvents(this, cccontrol_selector(guankaScene::jumpEvent),CCControlEventTouchDown);
    this->addChild(Btnjump,1);
}
예제 #18
0
void IBBTouchElement::addTouchEventListener(cocos2d::CCNode *target)
{
	if(!target) return;
	if(m_touchListeners->containsObject(target)) return;
	
	//如果目标是一个ControlButton, 则关闭它自己的touch处理机制
	CCControlButton* b = dynamic_cast<CCControlButton*>(target);
	if(b)
	{
		b->setTouchEnabled(false);
	}
	
	m_touchListeners->addObject(target);
};
예제 #19
0
void QimiAlipayView::changePrie()
{
    std::string p = m_pEditName->getText();
    int price = atoi(p.c_str());
    for (int i =0; i < m_pButtonList->count() ; i++) {
        CCControlButton* b = dynamic_cast<CCControlButton*>(m_pButtonList->objectAtIndex(i));
        b->setEnabled(true);
    }
    CCControlButton* btn = dynamic_cast<CCControlButton*>(this->getChildByTag(100)->getChildByTag(price));
    if (btn!=NULL)
    {
        btn->setEnabled(false);
    }
    upDataView(price);
}
예제 #20
0
void QimiAlipayView::upSelectState(CCControlButton* btn)
{
    for (int i =0; i < m_pButtonList->count(); i++) {
        CCControlButton* b = dynamic_cast<CCControlButton* >(m_pButtonList->objectAtIndex(i));
        if (b == btn)
        {
            b->setEnabled(false);
            b->setTitleColorForState(ccc3(255, 255, 255), CCControlStateDisabled);
        }
        else
        {
            b->setEnabled(true);
        }
    }
}
예제 #21
0
파일: CCLobbyView.cpp 프로젝트: kaznog/t09
void CCLobbyView::tableCellTouched(cocos2d::extension::CCTableView* table, cocos2d::extension::CCTableViewCell* cell)
{
    if (this->getIsJoinRoomConfirming()) {
        return;
    }
    using namespace ExitGames::LoadBalancing;
    CCLog("CCLobbyView::tableCellTouched() -- cell touched at index: %i", cell->getIdx());
    
    CCRoomTableCell* roomCell = (CCRoomTableCell*) cell;
    ExitGames::LoadBalancing::Room* room = roomCell->getRoom();
    
    if( roomCell->getHasRoom() && room && room->getMaxPlayers() > room->getPlayerCount() )
    {
        CCLog("CCLobbyView::tableCellTouched() HasRoom");
        CCLog("room name %s", room->getName().UTF8Representation().cstr());
        this->setSelectedRoom(room);
//        CocosNetworkLogic* network = CocosNetworkLogic::getInstance();
//        network->opJoinRoom( room->getName() );

        std::string stdStr = room->toString().UTF8Representation().cstr();
        stdStr = "Join this room?";
        CCSize winSize = CCDirector::sharedDirector()->getWinSize();
        CCSprite* background = CCSprite::create( "frame.png" );

        CCScale9Sprite* controlCancelBackground = CCScale9Sprite::create("extensions/yellow_edit.png");
        CCScale9Sprite* controlOkayBackground = CCScale9Sprite::create("extensions/yellow_edit.png");
        CCLabelTTF* label = CCLabelTTF::create( stdStr.c_str(), "Arial", FONT_SIZE(24) );
        label->setColor(ccc3(0, 0, 0));
        CCLabelTTF* cancelLabel = CCLabelTTF::create(". Cancel .", "Arial", FONT_SIZE(24));
        CCLabelTTF* okayLabel     = CCLabelTTF::create(".  Okay  .", "Arial", FONT_SIZE(24));
        cancelLabel->setColor(ccc3(0, 0, 0));
        okayLabel->setColor(ccc3(0, 0, 0));
        CCControlButton* cancel = CCControlButton::create( cancelLabel, controlCancelBackground );
        CCControlButton* okay = CCControlButton::create( okayLabel, controlOkayBackground );
        okay->addTargetWithActionForControlEvents(this, cccontrol_selector(CCLobbyView::joinRoom), CCControlEventTouchUpInside);
        
        CCFadeIn* in = CCFadeIn::create(1.0f);
        CCFadeOut* out = CCFadeOut::create(1.0f);
        
        CCConfirmMessage* message = CCConfirmMessage::create( background, label, cancel, okay, in, out );
        CCSize messageSize = message->getContentSize();
        message->setPosition( ccp(winSize.width/2 - messageSize.width/2, winSize.height/2 - messageSize.height/2) );

        pBottomMenu->setVisible(false);
        this->setIsJoinRoomConfirming(true);
        this->addChild(message, 10, Child::CCConfirmDialog);
    }
}
예제 #22
0
bool CCControlButtonTest_HelloVariableSize::init()
{
    if (CCControlScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
        
        // Defines an array of title to create buttons dynamically
        CCArray *stringArray = CCArray::create(
            ccs("Hello"),
            ccs("Variable"),
            ccs("Size"),
            ccs("!"),
            NULL);
        
        CCNode *layer = CCNode::create();
        addChild(layer, 1);
        
        double total_width = 0, height = 0;
        
        // For each title in the array
        CCObject* pObj = NULL;
        CCARRAY_FOREACH(stringArray, pObj)
        {
            CCString* title = (CCString*)pObj;
            // Creates a button with this string as title
            CCControlButton *button = standardButtonWithTitle(title->getCString());
            button->setPosition(ccp (total_width + button->getContentSize().width / 2, button->getContentSize().height / 2));
            layer->addChild(button);
            
            // Compute the size of the layer
            height = button->getContentSize().height;
            total_width += button->getContentSize().width;
        }

        layer->setAnchorPoint(ccp (0.5, 0.5));
        layer->setContentSize(CCSizeMake(total_width, height));
        layer->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f));
        
        // Add the black background
        CCScale9Sprite *background = CCScale9Sprite::create("extensions/buttonBackground.png");
        background->setContentSize(CCSizeMake(total_width + 14, height + 14));
        background->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f));
        addChild(background);
        return true;
    }
예제 #23
0
파일: ChatLayer.cpp 프로젝트: crazyit/iGame
void ChatLayer::buttonClicked(CCObject *pSender, CCControlEvent pCCControlEvent) {
    
    CCControlButton *button = (CCControlButton*) pSender;
    
    switch (button->getTag()) {
        case 1:
        {
            CCLOG("chat");
            MainGameScene *mainScene = (MainGameScene *)this->getParent();
            mainScene->RemoveChatLayer();
            break;
        }
        case 2:
        {
            CCLOG("face");
            break;
        }
    }
}
예제 #24
0
void AddFriendScene::buttonClicked(CCObject *pSender,CCControlEvent event)
{
	CCLOG("i was clicked");
    
	MainGameScene *mainScene = (MainGameScene *)this->getParent();
	CCControlButton *button = (CCControlButton *)pSender;
	switch (button->getTag()) {
	case 101:
		CCLOG("11111");
		mainScene->PopLayer();
		break;
	case 102:
		mainScene->PopLayer();
		break;
	case 103:
		this->doSearchFriend();
		break;
	}
}
예제 #25
0
CCControlButton* ButtonUtils::createButton(const char *normalFrame, const char *highLightFrame, const char *disableFrame, cocos2d::CCSize size, const char *label,float labelSize ,ccColor3B labelColor)
{
    CCScale9Sprite *normal = CCScale9Sprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(normalFrame));
    CCScale9Sprite *highLight = CCScale9Sprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(highLightFrame));
    CCScale9Sprite *disable = CCScale9Sprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(disableFrame));
    CCControlButton *btn = CCControlButton::create(label, "Arial", labelSize);
    btn->setPreferredSize(size);
    btn->setBackgroundSpriteForState(normal, CCControlStateNormal);
    btn->setBackgroundSpriteForState(highLight, CCControlStateHighlighted);
    btn->setBackgroundSpriteForState(disable, CCControlStateDisabled);
    btn->setTitleColorForState(labelColor, CCControlStateNormal);
    btn->setTitleColorForState(labelColor, CCControlStateHighlighted);
    btn->setTitleColorForState(labelColor, CCControlStateDisabled);
    btn->setTouchPriority(0);
    
    return btn;
}
예제 #26
0
bool TutorialLayer::init(){
    if (CCLayer::init()) {
        callback = NULL;
        target = NULL;
        
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
        CCLayerColor *background = CCLayerColor::create(ccc4(0, 0, 0, 200), screenSize.width, screenSize.height);
        this->addChild(background);

        CCScale9Sprite *closeButtonSprite = Common::getCCScale9SpriteWithoutScale("CloseButton.png");
        CCControlButton *closeButton = CCControlButton::create(closeButtonSprite);
        closeButton->setPreferredSize(closeButtonSprite->getOriginalSize());
        closeButton->setContentSize(closeButtonSprite->getOriginalSize());
        closeButton->setPosition(ccp(screenSize.width*0.9, screenSize.height*0.9));
        closeButton->addTargetWithActionForControlEvents(this, cccontrol_selector(TutorialLayer::close), CCControlEventTouchUpInside);
        this->addChild(closeButton, CLOSE_BUTTON_Z);
        
        return true;
    }
    return false;
}
	void ClientChatNetPackageSender::createClientUI( PeerNode* peerNode, CCControlBase* parentLayer )	{
		CCSize preferredSize(CCSizeMake(0,0));

		_ctrlName = ControlUtils::createEditBox("Name:", preferredSize);
		_ctrlPassword = ControlUtils::createEditBox("Password:"******"Message:", preferredSize);

		ControlUtils::addCtrlNode(_ctrlName, parentLayer);
		ControlUtils::addCtrlNode(_ctrlPassword, parentLayer);
		ControlUtils::addCtrlNode(_ctrlMessage, parentLayer);

		CCControlButton* ctrlBtn;
		ctrlBtn = sl::ControlUtils::createButton("Register");
		ctrlBtn->setTag(SL_CTRLID_REGISTER);
		ctrlBtn->addTargetWithActionForControlEvents(
			this, 
			cccontrol_selector(ClientChatNetPackageSender::onUIAction), 
			CCControlEventTouchUpInside);

		ControlUtils::addCtrlNode(ctrlBtn, parentLayer);
	}
예제 #28
0
//    按下按钮事件回调
void MailListScene::toolBarTouchDownAction(CCObject * sender , CCControlEvent controlEvent)
{
	CCControlButton *button = (CCControlButton *)sender;
	switch (button->getTag()) 
	{
	case 128:
		{
			MainGameScene *mainScene = (MainGameScene *)this->getParent();
			mainScene->PushLayer((CCLayer *)this->GetLayer("NewMailScene"));
			break;
		}
	case 130:
		{
			CCMessageDialog *box = CCMessageDialog::create();
			box->setTitle("Are you sure add this guy as your friends?");
			box->setDelegate(this);
			this->addChild(box);

			break;
		}
	}
}
void QuestionLayer::simulateAnswerRight()
{
    this->unschedule(schedule_selector(QuestionLayer::timerCB));

    CCDictionary* results = questionObj->rightAnswer;
    for (int i=0; i<results->allKeys()->count(); i++) {
        CCString* key = (CCString *)(results->allKeys()->objectAtIndex(i));
        results->setObject(CCString::createWithFormat("%d", 1), key->getCString());
    }

    //回答完成所有正确答案
    for (int i=0; i<results->allKeys()->count(); i++) {
        CCString* key = (CCString *)(results->allKeys()->objectAtIndex(i));
        CCControlButton* btn = (CCControlButton *)(this->getChildByTag(key->intValue()));
        CCSprite* spr = CCSprite::create("star000.png");
        spr->setAnchorPoint(ccp(0.5f, 0.5f));
        spr->setPosition(ccp(btn->getContentSize().width/2, btn->getContentSize().height/2));
        btn->addChild(spr);
        CCBlink* blink = CCBlink::create(1.0f, 3);
        if (i < results->allKeys()->count()-1) {
            spr->runAction(blink);
        } else {
            CCAction* pAction = CCCallFuncND::create(this, callfuncND_selector(QuestionLayer::noticeDelegate), NULL);
            spr->runAction(CCSequence::create(blink, pAction, NULL));
        }
    }

    rightAnswer++;
    if (timerCount >= timerTotal*2/3) {
        rightLimit += 1;
        //播放快速答题音效
        GameSoundManager::shareManager()->playAnswerCool();
    } else {
        //播放普通答题正确音效
        GameSoundManager::shareManager()->playAnswerRight();
    }

    isAnswerFinished = true;
}
예제 #30
0
void GUIBase::resetPriority(CCNode* pNode, int priority)
{
	CCArray* pChildren = pNode->getChildren();

	CCObject* pObj = NULL;
	CCARRAY_FOREACH(pChildren, pObj)
	{
		CCNode* pChild = (CCNode*)pObj;
		if (pChild->getChildrenCount() > 0)
		{
			resetPriority(pChild, priority);
		}

		// CCMenu
		CCMenu* pMenu = dynamic_cast<CCMenu*>(pChild);
		if (pMenu)
		{
			pMenu->setTouchPriority(priority  - 1);
			continue;
		}

		// CCScrollView
		CCScrollView* pCCScrollView = dynamic_cast<CCScrollView*>(pChild);
		if (pCCScrollView)
		{
			pCCScrollView->setTouchPriority(priority  - 1);
			continue;
		}

		// CCControlButton
		CCControlButton* pCCControlButton = dynamic_cast<CCControlButton*>(pChild);
		if (pCCControlButton)
		{
			pCCControlButton->setTouchPriority(priority  - 1);
			continue;
		}
	}