Snail::Snail()
{
    rightAct = easyCreateAction_Retain("snail_right_%d.png", 1, 8, 0.1f,
                                      this, SEL_CallFuncO(&Snail::actionEnd));
    leftAct = easyCreateAction_Retain("snail_left_%d.png", 1, 8, 0.1f,
                                       this, SEL_CallFuncO(&Snail::actionEnd));
    
    initWithFile(resMgr->getSharedFilePath("snail_right_1.png").c_str());
    setRotation(-20.0f);
}
Monkey::Monkey()
{
    monkeyAppearAct = easyCreateAction_Retain("monkey_appear_%d.png", 1, 25, 0.1f,
                                              this, SEL_CallFuncO(&Monkey::monkeyAppearEnd));
    
    monkeyBlinkAct = easyCreateAction_Retain("monkey_blink_%d.png", 1, 6, 0.1f,true);
    
    monkeyRunAwayAct = easyCreateAction_Retain("monekey_runaway_%d.png", 1, 7, 0.1f,
                                               this, SEL_CallFuncO(&Monkey::monkeyRunEnd));
    
//    schedule(schedule_selector(Monkey::doAction),Monkey_TIME_ACTION);
}
Plant::Plant()
{
    growUpAct = easyCreateAction_Retain("plant_grow_%d.png", 1, 44, 0.2f,
                                        this, SEL_CallFuncO(&Plant::growUpEnd));
    
    devilAct = easyCreateAction_Retain("plant_devil_%d.png", 1, 2, 0.1f,true);
    
    disappearAct = easyCreateAction_Retain("plant_disappear_%d.png", 1, 8, 0.1f,
                                           this, SEL_CallFuncO(&Plant::disappearEnd));
    
//    schedule(schedule_selector(Plant::doAction),Plant_TIME_ACTION);
}
Spider::Spider()
{
    actionUp = easyCreateAction_Retain("spider_up_%d.png", 1, 14, 0.1f,
                                       this, SEL_CallFuncO(&Spider::actionUpEnd));
    
    actionDown = easyCreateAction_Retain("spider_down_%d.png", 1, 15, 0.1f,
                                         this, SEL_CallFuncO(&Spider::actionDownEnd));
    
    
    initWithFile(resMgr->getSharedFilePath("spider_down_1.png").c_str());
    
//    schedule(schedule_selector(Spider::doAction),Spider_TIME_ACTION);
}
Exemplo n.º 5
0
bool SectionGuide::showFirstSectionGuide(CCPoint redStarPos,CCPoint clickBoxPos,CCPoint arrowsPos)
{
    if (redStartPrompt!=NULL && boxClickPrompt!=NULL && redStartToTableArrows!=NULL && clickAction!= NULL)
    {
        redStartPrompt->setPosition(redStarPos);
        redStartToTableArrows->setPosition(arrowsPos);
        boxClickPrompt->setPosition(clickBoxPos);

        redStartPrompt->setPercentage(0.0f);
        redStartPrompt->setVisible(true);

        float delay = 0.8f;
        float clickTimeLast = 0.5f*5;

        CCAction* actionTouch = createAction(CCDelayTime::create(delay+clickTimeLast),
                                             SEL_CallFuncO(&SectionGuide::boxClickPromptFinishedShow),
                                             this);


        boxClickPrompt->stopAllActions();
        boxClickPrompt->init();
        boxClickPrompt->runAction(actionTouch);

        schedule(schedule_selector(SectionGuide::timeToShowFinger),delay);
        return true;
    }
    return false;
}
Exemplo n.º 6
0
void BaseScense::failed(){
    //current layer sleep
    mContentLayer->freezeLayer();

	if (LFAlert_FreeTimeOut_InGameFaild::isTimeToShowBeforePlay(seasonId,sectionId))
	{
		LFAlert_FreeTimeOut_InGameFaild::showAlert(seasonId,sectionId)->
			addAutoRemoveObserver(this,SEL_CallFuncO(&BaseScense::buySectionSuc),BUY_ONE_PLAY_TIME_SUC);
//			addAutoRemoveObserver(this,SEL_CallFuncO(&BaseScense::buySectionWithMoney),MSG_PP_SectionTimeLimiteRsp);
		return;
	}

	if (mContentLayer->getArmature())
	{
		mContentLayer->getArmature()->getAnimation()->play(g_ThiefAnimation_siwang.c_str());
        Music::sharedMusicPlayer()->playEffectSound("lost.wav");
		return;
	}

	LevelManager::getManager()->retry(false);

	//4. 20140720 scf 新需求 --- 
// 	//1.红星坠落失败
// 	//2.重新开始  
// 	AdManager::getManager()->showFuilureAd();
//	AdManager::getManager()->showAdByTimeDelay();


	//analytics
	//记录玩家开始一关游戏 --- end (faild)
	const char* pInfo = CCString::createWithFormat("%02d-%02d", LevelManager::getManager()->getLastSeasonId(), LevelManager::getManager()->getLastSectionId())->getCString();
	CmdHelper::getInstance()->getAnalyticsInstance()->onFailed(pInfo, "star fall");
}
Exemplo n.º 7
0
//红星的标示显示完毕,那么显示箭头的
void SectionGuide::redStartPromptFinishedShow(CCObject* guide)
{
    SectionGuide* _guide = (SectionGuide*)guide;
    _guide->redStartPrompt->stopAllActions();


    CCAction* action = createAction(CCProgressTo::create(0.5f,100.0f),SEL_CallFuncO(&SectionGuide::arrowsPromptFinishedShow),guide);
    _guide->redStartToTableArrows->setVisible(true);
    _guide->redStartToTableArrows->setPercentage(0.0f);
    _guide->redStartToTableArrows->runAction(action);
}
Exemplo n.º 8
0
//手指的标示显示完毕,那么显示隐藏掉,可以开始点击操作了
void SectionGuide::boxClickPromptFinishedShow(CCObject* guide)
{
    SectionGuide* _guide = (SectionGuide*)guide;
//	_guide->boxClickPrompt->stopAllActions();

    CCAction* action = createAction(CCProgressTo::create(0.5f,100.0f),SEL_CallFuncO(&SectionGuide::redStartPromptFinishedShow),_guide);
    _guide->boxClickPrompt->setVisible(true);

//    _guide->boxClickPrompt->initWithFile(ResManager::getManager()->getSharedFilePath("finger-Press.png").c_str());

    _guide->redStartPrompt->runAction(action);
}
Exemplo n.º 9
0
void EquipObserver::tryNotifyZhuangbeiScannerToGenReportNextFrame()
{
	if (trigleId == 0)
	{
		OneTrigle item = OneTrigle::makeTrigleDelay(MSG_EQUIP_ADDED_OR_JIEFENGYIN_OP_END,0,false);
		//item.type = Trigle_Delay;
		//item.loop = false;
		//item.time = 0;
		//item.notifyMsg = MSG_EQUIP_ADDED_OR_JIEFENGYIN_OP_END;
		trigleId = GlobalTickTrigle::getTrigle()->addOneTrigle(item);
		CCNotificationCenter::sharedNotificationCenter()->addObserver(this,SEL_CallFuncO(&EquipObserver::trigleAfterEquipAdded),MSG_EQUIP_ADDED_OR_JIEFENGYIN_OP_END,NULL);
	}
}
Exemplo n.º 10
0
//闪烁的显示不可点击
void SectionGuide::showForbidenPrompt(CCPoint pos)
{
    if (forbidenPrompt != NULL)
    {

        CCAction* action = createAction(CCBlink::create(0.5,3),
                                        SEL_CallFuncO(&SectionGuide::hide),
                                        forbidenPrompt);

        forbidenPrompt->setVisible(true);
        forbidenPrompt->setPosition(pos);
        forbidenPrompt->runAction(action);
    }
}
Exemplo n.º 11
0
//闪烁的显示等待
void SectionGuide::showWatingPrompt(CCPoint timmerPos)
{
    if (watingPrompt != NULL)
    {
        CCAction* action = createAction(CCBlink::create(0.5,6),
                                        SEL_CallFuncO(&SectionGuide::hide),
                                        watingPrompt);
        watingPrompt->setVisible(true);
        watingPrompt->setPosition(timmerPos);
        watingPrompt->runAction(action);
        shine->setVisible(true);
        CCAction* shineAct = createAction(CCDelayTime::create(0.5f),
                                          SEL_CallFuncO(&SectionGuide::hide), shine);
        shine->setPosition(center);
        shine->runAction(shineAct);

        //CCNode* timer = mBaseContentLayer->getTimer();
        //CCPoint timerPosCopy = timer->getPosition();
        //CCPoint startPosH = CCPointMake(timerPosCopy.x-10,timerPosCopy.y);
        //CCPoint endPosH = CCPointMake(timerPosCopy.x+10,timerPosCopy.y);
        //CCPoint startPosV = CCPointMake(timerPosCopy.x,timerPosCopy.y-10);
        //CCPoint endPosV = CCPointMake(timerPosCopy.x,timerPosCopy.y+10);
        ////CCScaleTo* scaleTo = CCScaleTo::create(0.1f,1.5f);
        //CCMoveTo* moveTo1 = CCMoveTo::create(0.06f,startPosH);
        //CCMoveTo* moveTo2 = CCMoveTo::create(0.06f,endPosH);
        ////CCMoveTo* moveTo3 = CCMoveTo::create(0.06f,startPosV);
        ////CCMoveTo* moveTo4 = CCMoveTo::create(0.06f,endPosV);
        ////CCRepeat* move = CCRepeat::create(CCSequence::create(moveTo1,moveTo3,moveTo4,moveTo2,NULL),3);
        //CCRepeat* move = CCRepeat::create(CCSequence::create(moveTo1,moveTo2,NULL),3);

        //
        ////CCAction* timmerShake = CCSequence::create(scaleTo,move,NULL);

        //timer->runAction(move);

    }
}
Exemplo n.º 12
0
//炸弹点击的,手指的标示
bool SectionGuide::showBombClickPrompt(CCPoint pos)
{
    if (bombClickPrompt != NULL && clickAction!=NULL)
    {
        //bombClickPrompt->setVisible(true);
        bombClickPrompt->setPosition(pos);

        CCAction* action = createAction(CCDelayTime::create(1.8f),
                                        SEL_CallFuncO(&SectionGuide::bombClickPromptFinishedShow),
                                        this);

        schedule(schedule_selector(SectionGuide::timeToShowFinger),0.8f);
        bombClickPrompt->runAction(action);
//        bombClickPrompt->runAction(clickAction);
        return true;
    }
    return false;
}
Exemplo n.º 13
0
void FightPrepare::prepareData(int taskId,int gridIndex)
{
	mState = Prepare_State_Loading;

	CCNotificationCenter::sharedNotificationCenter()->addObserver(this,SEL_CallFuncO(&FightPrepare::battleCallBack),MSG_BattleRsp,NULL);
	mTaskId = taskId;
	mGridIndex = gridIndex;

	BaseActorProperty pro = MyselfManager::getManager()->getMyZhuJueData()->getCurrentProperty();
	for (int i=0;i<FormationHeroAcountMax;i++)
	{
		BaseActor* actor = MyselfManager::getManager()->getMyTeamZhenShenActorByPosIndex(i+1);
		if (actor == NULL)
		{
			HeroBaseProperty pro_null;
			pro_null.hero_id = INVALID_ID;
			beforeFightPro[i] = pro_null;
			continue;
		}
		beforeFightPro[i] = actor->getCurrentProperty();
	}

	// boss 才是打的时候扣除体力
	if (gridIndex == 0 && pro.vit_current < Vitality_GuanQia_Boss)
	{
		mCallback->prepareError(TiliNotEnought);
		return;
	}
// 	if (gridIndex == 8 && pro.vit_current < Vitality_GuanQia_Boss)
// 	{
// 		mCallback->prepareError(TiliNotEnought);
// 		return;
// 	}
// 	else if (pro.vit_current < Vitality_GuanQia_Normal_Jingying)
// 	{
// 		mCallback->prepareError(TiliNotEnought);
// 		return;
// 	}

	SPCmd_Battle req;
	req.grid_id = mGridIndex;
	req.task_id = mTaskId;
	CmdHelper::getHelper()->cmdBattle(req);
}
Exemplo n.º 14
0
MainLayerStoreFrame::MainLayerStoreFrame(enumStore flag)
{
	mFlag = flag;
	mContentLayer = NULL;

	mBg = CCScale9Sprite::create("shangdian_bg.jpg");
	addChild(mBg);
	float h = mWinSize.height - BaseSprite::create("zhuangtailan_jinqian.png")->getContentSize().height
		- MainLayerBase::getCurrentMainBase()->getFooter()->getFooterSize().height;
	mBg->setContentSize(CCSize(mBg->getContentSize().width, h));
	mBg->setPosition(ccp(mWinSize.width/2,mBg->getContentSize().height/2));

	//创建按钮
	{
		CCMenuItemImage* shenbingItem = CCMenuItemImage::create(
			"shangdian_shenbin_dengdai.png",
			"shangdian_shenbin_anxia.png",
			"shangdian_shenbin_select.png",
			this,SEL_MenuHandler(&MainLayerStoreFrame::menuItemClicked));
// 		CCMenuItemImage* daojuItem = CCMenuItemImage::create(
// 			"shangdian_daoju_dengdai.png",
// 			"shangdian_daoju_anxia.png",
// 			"shangdian_daoju_select.png",
// 			this,SEL_MenuHandler(&MainLayerStoreFrame::menuItemClicked));
		CCMenuItemImage* libaoItem = CCMenuItemImage::create(
			"shangdian_libao_dengdai.png",
			"shangdian_libao_anxia.png",
			"shangdian_libao_select.png", 
			this,SEL_MenuHandler(&MainLayerStoreFrame::menuItemClicked));
		CCMenuItemImage* chongzhiItem = CCMenuItemImage::create(
			"shangdian_chongzhi_dengdai.png",
			"shangdian_chongzhi_anxia.png",
			"shangdian_chongzhi_select.png", 
			this,SEL_MenuHandler(&MainLayerStoreFrame::menuItemClicked));


		mMenu = CCMenu::create(shenbingItem, libaoItem, chongzhiItem, NULL);
//		mMenu->addChild(daojuItem);
		mBg->addChild(mMenu,1);
		mMenu->setPosition(CCPointZero);


		shenbingItem->setPosition(ccp(mBg->getContentSize().width/2-shenbingItem->getContentSize().width - 20, mBg->getContentSize().height-144));
		shenbingItem->setTag(TAG_ITEM_ShenBing);

//		daojuItem->setPosition(ccp(259,shenbingItem->getPositionY()));
//		daojuItem->setTag(TAG_ITEM_DAOJU);

		libaoItem->setPosition(ccp(mBg->getContentSize().width/2,shenbingItem->getPositionY()));
		libaoItem->setTag(TAG_ITEM_LiBao);

		chongzhiItem->setPosition(ccp(mBg->getContentSize().width/2+chongzhiItem->getContentSize().width + 20,shenbingItem->getPositionY()));
		chongzhiItem->setTag(TAG_ITEM_CHONGZHI);

	}

	//
	if(MarketManager::getManager()->itemCount() == 0)
	{
		//
		mMenu->setEnabled(false);

		//加载市场数据
		addObserver(SEL_CallFuncO(&MainLayerStoreFrame::getMarketInfoCallBack),MSG_getMarketInfoRsp);
		CmdHelper::getHelper()->cmdGetMarketInfo();
	}
	else
	{
		mFooterLayer = MainLayerBase::getCurrentMainBase();
		if (mFlag == store_ShenBing)
			menuItemClicked(mMenu->getChildByTag(TAG_ITEM_ShenBing));
		else if (mFlag == store_DaoJu)
			CCLOG("TAG_ITEM_DAOJU");
//			menuItemClicked(mMenu->getChildByTag(TAG_ITEM_DAOJU));
		else if (mFlag == store_LiBao)
			menuItemClicked(mMenu->getChildByTag(TAG_ITEM_LiBao));
		else if (mFlag == store_ChongZhi)
			menuItemClicked(mMenu->getChildByTag(TAG_ITEM_CHONGZHI));
	}
	
}
void WorldBossCityGuardManager::addCityGuardProcessNotify(Flat_CityGuardProcessNotify _notify)
{
	//CCAssert(inited,"");
	if (!inited)
	{
		// 扔掉
		return;
	}

	// 添加触发器
	if (this->notify.postTrigleId == 0)
	{
		OneTrigle t = OneTrigle::makeTrigleDelay(MSG_CLIENT_SHOW_BOSS_HP_SUB_TRIGLE,0,true);
		//t.loop = true;
		//t.time = 0; // 每帧都触发,回调函数里根据时间来发送消息
		//t.notifyMsg = MSG_CLIENT_SHOW_BOSS_HP_SUB_TRIGLE;
		//t.type = Trigle_Delay;
		this->notify.postTrigleId = GlobalTickTrigle::getTrigle()->addOneTrigle(t);
		CCNotificationCenter::sharedNotificationCenter()->addObserver(this,SEL_CallFuncO(&WorldBossCityGuardManager::timePostShangHai),MSG_CLIENT_SHOW_BOSS_HP_SUB_TRIGLE,NULL);
	}

	// 刷新,丢弃上次的数据,直接使用新数据
	notifyTaskQueue.clear();
	this->notify.start_hp = _notify.boss_hp_start;
	this->notify.end_hp = _notify.boss_hp_end;
	this->notify.startTime = ServerTime::getTime();
	this->notify.endTime = ServerTime::getTime() + _notify.play_time;
	this->notify.currentPostIndex = -1; // 设为-1,还没post过
	this->notify.isDataOk = true;// 数据可用了
	CCAssert(notify.start_hp >= notify.end_hp,"血量不可能反增");

	// 分布post伤害的数据
	int postNum = calculatePostTimeByNotifyData(notify);

	// 保存每一次post,post出多少个伤害个数
	int* shanghaiItemNumInEachPost = new int[postNum];
	AutoDelete temp((char*)shanghaiItemNumInEachPost); // 自动delete
	memset(shanghaiItemNumInEachPost,0,postNum*sizeof(int)); // 初始化为0

	// 1.先均匀散开,不够也无所谓,就把后面的空着就是了
	for (int i=0,max_count = _notify.shanghaiVec.size();i<postNum && i<max_count;i++)
	{
		shanghaiItemNumInEachPost[i] = 1;
	}
	// 2.随机添加多余的
	int shangHaiNum = _notify.shanghaiVec.size();
	for (int i=0,more_num = shangHaiNum-postNum; i<more_num; i++)
	{
		int index = CCRANDOM_0_1() * postNum; // 取值在0到postNum
		if (index >= postNum)
			index = postNum - 1;

		// 添加一个
		shanghaiItemNumInEachPost[index] += 1;
	}

	// 3.根据每个key需要post的数量,挨个取数据,初始化
	int num_used = 0;
	for (int i=0;i<postNum;i++)
	{
		// 取指定的个数
		vector<CityGuardAnotherHeroShanghai> shanghais;
		for (int num_index = 0;num_index < shanghaiItemNumInEachPost[i]; num_index++)
		{
			shanghais.push_back(_notify.shanghaiVec[num_used]);
			num_used ++;
		}
		notifyTaskQueue.insert(pair<int,vector<CityGuardAnotherHeroShanghai> >(i,shanghais));
	}
}