Ejemplo n.º 1
0
void Hero::blowup() {
	Animation * ani=Animation::create();
	ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("hero_blowup_n1.png"));
	ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("hero_blowup_n2.png"));	
	ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("hero_blowup_n3.png"));	
	ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("hero_blowup_n4.png"));	
	ani->setDelayPerUnit(0.3);
	ani->setLoops(1);
	CCCallFunc * fun = CCCallFunc::create(this, SEL_CallFunc(&Hero::destory));
	Sequence * sequ = Sequence::create(Animate::create(ani),fun ,NULL);
	runAction(sequ);
}
Ejemplo n.º 2
0
bool ZhuShouChatLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
    if (   (mLabelFadeInEnd && mTimeEnd)
            || TOUCH_ENABLE)
    {
        if (TOUCH_ENABLE)
        {
            //
            unschedule(schedule_selector(ZhuShouChatLayer::showChatContext));
            unschedule(schedule_selector(ZhuShouChatLayer::saidChatContextEnd));
            if (mCurMusicId != 0)
                Music::sharedMusicPlayer()->stopEffectSound(mCurMusicId);
            mCurMusicId = 0;
        }
    }
    else
    {
        return true;
    }


    CCSize winSize = CCDirector::sharedDirector()->getWinSize();

    CCSprite *board = (CCSprite*)getChildByTag(TAG_Board);
    CCSprite *nextImg = (CCSprite*)board->getChildByTag(Tag_ImgNext);
    CCSprite *actorA = (CCSprite*)getChildByTag(TAG_ActorA);
    CCSprite *actorB = (CCSprite*)getChildByTag(TAG_ActorB);
    CCLabelTTF *label = (CCLabelTTF*)getChildByTag(TAG_label);
    CCLabelTTF *nameLabel = (CCLabelTTF*)getChildByTag(Tag_Label_Name);



    if ( mLayerEnd) //避免渐渐消失的时候动作重复闪速
        return true;

    mLayerEnd = true;
    nodeAndAllChildRunAction(this,CCFadeOut::create(0.25f),CCSequence::create(
                                 CCFadeOut::create(0.25f)
                                 , CCCallFunc::create(this, SEL_CallFunc(&ZhuShouChatLayer::callbackRemove))
                                 , NULL));


    //board->runAction(CCFadeTo::create(0.0f, 0));
    //actorA->runAction(CCFadeTo::create(0.0f, 0));
    //actorB->runAction(CCFadeTo::create(0.25f, 0));
    //label->runAction(CCFadeTo::create(0.0f, 0));
    //nameLabel->runAction(CCFadeTo::create(0.0f, 0));

    //nextImg->stopAllActions();
    //nextImg->runAction(CCFadeTo::create(0.0f, 0));

    return true;
}
Ejemplo n.º 3
0
void MailListTile::selectCheckInfo(CCObject *obj)
{
	//(m_oTarger->*m_hCheckInfo)((CCMenuItem *)obj);
	if (m_lMailTanChuLayer)
	{
		m_lMailTanChuLayer->removeFromParent();
	}
	m_lMailTanChuLayer = MailTanChuLayer::create();
	m_lMailTanChuLayer->ignoreAnchorPointForPosition(false);
	m_lMailTanChuLayer->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width / 2,CCDirector::sharedDirector()->getWinSize().height / 2) );
	m_lMailTanChuLayer->setAnchorPoint(ccp(0.5,0.5));
	m_lMailTanChuLayer->setMenuHandler(this,SEL_CallFunc(&MailListTile::setMenuTanChuCallBack));
	CCDirector::sharedDirector()->getRunningScene()->addChild(m_lMailTanChuLayer,1030);
	m_lMailTanChuLayer->setSystemMail(m_sSystemMail);
}
Ejemplo n.º 4
0
void Sensors::touchSort(Ref *sender) {
  CCLOG("Sensors::touchSort");
  this->detachTouchParticle();
  // MessageBox("sorry. comming soom.", "sort");

  auto p_modal_sort = scene::modal::Sort::create();

  CallFunc *callback = CallFunc::create(
      p_modal_sort, SEL_CallFunc(&scene::modal::Sort::detachSlideIn));

  scene::layout::helper::Contents::SlideIn(
      p_modal_sort, 0.2f, scene::layout::helper::Contents::Forward_To_Right_e,
      callback, true);

  this->getParent()->addChild(p_modal_sort, Zorders_Modal_Dialog);
}
Ejemplo n.º 5
0
bool logo::init()
{
    bool flag=false;
    if(!CCLayer::init())
    {
        return false;
    }
    flag=true;
    CCSize winSize=CCDirector::sharedDirector()->getWinSize();
    CCSprite *sprite=CCSprite::create("Default.png");
    sprite->setPosition(ccp(winSize.width/2, winSize.height/2));
    this->addChild(sprite);
    CCFadeOut *out=CCFadeOut::create(2.0f);
    CCCallFunc *call=CCCallFunc::create(this, SEL_CallFunc(&logo::replace));
    CCFiniteTimeAction *finite=CCSequence::create(out,call,NULL);
    sprite->runAction(finite);
    return flag;
}
Ejemplo n.º 6
0
// 父类把手指和点击效果都准备好的,但是都是全透明的,到时子类用就是了
GuideLayer_SuperTool::GuideLayer_SuperTool(int seasonId, int sectionId)
	:BaseGuideLayer(seasonId,sectionId),
	m_nClickCount(0),
	m_bIsUseTeaching(false),
	m_tLabel(NULL),
	m_sGuide_arrowsSpr(NULL)

{
	if (!CCUserDefault::sharedUserDefault()->getBoolForKey(FirstSuperTool,true))
	{
		return;
	}
	m_bIsUseTeaching = true;
	CCUserDefault::sharedUserDefault()->setBoolForKey(FirstSuperTool,false);
	CCUserDefault::sharedUserDefault()->flush();
	BaseScense::getCurrentScene()->getMenuLayer()->beginTeachUseSuperTool();
	BaseScense::getCurrentScene()->getMenuLayer()->setTeachCallBack(this,SEL_CallFunc(&GuideLayer_SuperTool::usedEnd));


	CCMenuItem *item = BaseScense::getCurrentScene()->getMenuLayer()->getRestartItem();
	item->setVisible(false);
	CCPoint dest = ccp(180,500);

	CCSprite* guide_arrows = CCSprite::create(getImageFile("teach_arrows.png").c_str());
	addChild(guide_arrows);
	m_sGuide_arrowsSpr = guide_arrows;
	guide_arrows->setPosition(ccp(dest.x+50, dest.y+65));
	guide_arrows->setRotationX(20);
	guide_arrows->setOpacity(0);

	guide_arrows->runAction(CCSequence::create(
		CCDelayTime::create(0.2f),
		CCFadeTo::create(1.0f,255),
		NULL));
	CCLabelTTF *guide_txt = CCLabelTTF::create(LFStrings::getValue("TeachUseSuperToolOne").c_str(), fontStr_katong,27.0f);//, CCSize(270,0), kCCTextAlignmentCenter);
	guide_txt->setColor(ccBLACK);
	guide_txt->setHorizontalAlignment(kCCTextAlignmentLeft);
	addChild(guide_txt);
	guide_txt->setPosition(ccp(dest.x + 225,guide_arrows->getPositionY() + guide_arrows->getContentSize().height-20));
	m_tLabel = guide_txt;

	BaseScense::getCurrentScene()->getMenuLayer()->getStarState()->teach_scaleChange(m_nClickCount);
}
Ejemplo n.º 7
0
bool ChatLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
	if (   (mLabelFadeInEnd && mTimeEnd)
		|| TOUCH_ENABLE)
	{
		if (TOUCH_ENABLE)
		{
			//
			unschedule(schedule_selector(ChatLayer::showChatContext));
			unschedule(schedule_selector(ChatLayer::saidChatContextEnd));
			if (mCurMusicId != 0)
				Music::sharedMusicPlayer()->stopEffectSound(mCurMusicId);
			mCurMusicId = 0;
		}
	}
	else 
	{
		return true;
	}


	CCSize winSize = CCDirector::sharedDirector()->getWinSize();

	CCSprite *board = (CCSprite*)getChildByTag(TAG_Board);
	CCSprite *nextImg = (CCSprite*)board->getChildByTag(Tag_ImgNext);
	CCSprite *actorA = (CCSprite*)getChildByTag(TAG_ActorA);
	CCSprite *actorB = (CCSprite*)getChildByTag(TAG_ActorB);
	CCLabelTTF *label = (CCLabelTTF*)getChildByTag(TAG_label);
	CCLabelTTF *nameLabel = (CCLabelTTF*)getChildByTag(Tag_Label_Name);


	if(m_index >= m_chatContext.size())
	{
		if ( mLayerEnd) //避免渐渐消失的时候动作重复闪速
			return true;

		mLayerEnd = true;

		this->runAction(CCSequence::create(
			CCFadeTo::create(0.5f, 0)
			, CCCallFunc::create(this, SEL_CallFunc(&ChatLayer::callbackRemove))
			, NULL));

		board->runAction(CCFadeTo::create(0.25f, 0));
		actorA->runAction(CCFadeTo::create(0.25f, 0));
		actorB->runAction(CCFadeTo::create(0.25f, 0));
		label->runAction(CCFadeTo::create(0.25f, 0));
		nameLabel->runAction(CCFadeTo::create(0.25f, 0));

		nextImg->stopAllActions();
		nextImg->runAction(CCFadeTo::create(0.25f, 0));
	}
	else
	{
		mTimeEnd = false;
		mLabelFadeInEnd = false;

		//label
		label->setString("");

		//下一句对话的 Speaker是谁
		string heroName = m_chatContext.at(m_index).name;
		if(heroName == "zhujue")
		{
			actorB->runAction(CCFadeTo::create(0.1f, 255));
			actorA->runAction(CCFadeTo::create(0.1f, 0));
		} 
		else
		{
			actorA->initWithFile(getFileByName(heroName).second.c_str());
			actorA->setAnchorPoint(ccp(0,0));
			actorA->setOpacity(0);
			actorA->runAction(CCFadeTo::create(0.1f, 255));
			actorB->runAction(CCFadeTo::create(0.1f, 0));
		}

		scheduleOnce(schedule_selector(ChatLayer::showChatContext), 0.05f);
		++m_index;
	}

	return true;
}
Ejemplo n.º 8
0
void GuideLayer_SuperTool::lfClick(CCPoint glPoint)
{
	if (m_bIsUseTeaching)
	{
		if (m_nClickCount == 0)
		{
			m_tLabel->runAction(CCSequence::create(CCFadeOut::create(0.5f),CCCallFunc::create(this,SEL_CallFunc(&GuideLayer_SuperTool::clickEnd)),NULL));
			m_sGuide_arrowsSpr->runAction(CCFadeOut::create(0.4f));
		}
		else if (m_nClickCount == 1)
		{
			m_tLabel->runAction(CCSequence::create(CCFadeOut::create(0.5f),CCCallFunc::create(this,SEL_CallFunc(&GuideLayer_SuperTool::guide_end)),NULL));
			m_sGuide_arrowsSpr->runAction(CCFadeOut::create(0.4f));
		}
	}
	//m_tLabel->setString(LFStrings::getValue("Teach_Click_Finger_Double").c_str());
}