static void FighterWithEnemy(Fighter * fighter, EnemyFighter * enemy, const int * score) { auto layer = fighter->getParent(); enemy->stopAllActions(); layer->addChild(Effect::CreateExplosionOnce(enemy->getPosition())); layer->removeChild(enemy); layer->unscheduleUpdate(); fighter->Hurt(); if (!fighter->Alive()) { fighter->stopAllActions(); layer->addChild(Effect::CreateExplosionOnce(fighter->getPosition())); layer->removeChild(fighter); layer->unscheduleUpdate(); auto delay = cocos2d::DelayTime::create(2.0); auto transition = cocos2d::CallFunc::create([score]{ int s = *score; auto t = cocos2d::TransitionFade::create(2.0, GameOverScene::CreateScene(s)); cocos2d::Director::getInstance()->replaceScene(t); }); layer->runAction(cocos2d::Sequence::create(delay, transition, nullptr)); } }
void MainScene::onExitTransitionDidStart() { CCScene::onExitTransitionDidStart(); // Turn off updates unscheduleUpdate(); }
void AssetsUpdateLayer::update(float delta) { if (1 || m_curBigVersion >= m_endBigVersion && m_curSmallVersion >= m_endSmallVersion) { CCLOG("Version check Ok"); unscheduleUpdate(); //MD5Check(); gameEnter(); return; } if (!m_isDownloading && checkUpdate()) { createLayerItem(); char str[128]; sprintf(str, "%s%s%d.%d.%d.zip", SERVER_ADDRESS, ASSETS_SERVER_PATH, m_curBigVersion, m_curMidVersion, m_curSmallVersion + 1); getAssetsManager()->setPackageUrl(str); sprintf(str, "%d.%d.%d", m_curBigVersion, m_curMidVersion, m_curSmallVersion + 1); getAssetsManager()->setVersionFileUrl(str); getAssetsManager()->setStoragePath(m_pathToSave.c_str()); //sprintf(str, Localization::getInstance()->getValueByKey("Loading_download_restBag_num"), m_endSmallVersion - m_curSmallVersion); //m_packegNumberLabel->setString(str); m_curPackageLength = 0; //getAssetsManager()->getPackageLength((long&)m_packageLength); m_isDownloading = true; download(); } }
void TextFieldTTF::setCursorEnabled(bool enabled) { if (_currentLabelType == LabelType::TTF) { if (_cursorEnabled != enabled) { _cursorEnabled = enabled; if (_cursorEnabled) { _cursorPosition = _charCount; scheduleUpdate(); } else { _cursorPosition = 0; unscheduleUpdate(); } } } else { CCLOG("TextFieldTTF cursor worked only LabelType::TTF"); } }
void TextTip::onExit() { unscheduleAllCallbacks(); unscheduleUpdate(); Layout::onExit(); }
void BPElevatorNode::update(float delta) { m_fDelayStart -= delta; // end delay if (m_fDelayStart < 0) { if (!m_pHumanSprite->isVisible()) { m_pHumanSprite->setVisible(true); } CCPoint p = m_pHumanSprite->getPosition(); p = ccpAdd(p, m_tVelocity); m_pHumanSprite->setPosition(p); if (m_pTargetPosition->boundingBox().containsPoint(p)) { m_bArrivedHuman = true; m_bHumanAppearUpdate = false; unscheduleUpdate(); m_pHumanSprite->setVisible(false); m_pHumanSprite->setPosition(m_pSpawnPosition->getPosition()); m_pAlertBoardNode->setColor(ccRED); m_pAlertLabelNode->setFontFillColor(ccWHITE); if (m_pDelegate) { m_pDelegate->arrivedHuman(this); } } } }
LevelThree::~LevelThree() { // // 停止计时器 // unschedule(schedule_selector(LevelThree::timeCounter)); // 停止默认定时器 unscheduleUpdate(); }
void MonsterTortoise::setInvalidStatus() { if (m_bIsDie) return; setMonsterStatus(MonsterStatus_Invalid); //复位怪兽信息 setPosition(getBeginPos()); stopAllActions(); m_lastPos = getBeginPos(); setVisible(false); getBody()->SetLinearVelocity(b2Vec2(0.0f, 0.0f)); m_bLeft = true; if (m_bIsDefend) { //改变防守状态框架为正常框架 updateFixStatus = UpdateTortoise_Normal; changeFixture(); } updateFixStatus = UpdateTortoise_Invalid; m_bIsDefend = false; m_bIsRoll = false; unscheduleUpdate(); }
LevelTwentytwo::~LevelTwentytwo() { // 停止计时器 unschedule(schedule_selector(LevelTwentytwo::timeCounter)); // 停止默认定时器 unscheduleUpdate(); }
LevelFifteen::~LevelFifteen() { // 停止计时器 unschedule(schedule_selector(LevelFifteen::timeCounter)); // 停止默认定时器 unscheduleUpdate(); }
void SkeletonRenderer::onExit () { #if CC_ENABLE_SCRIPT_BINDING if (_scriptType == kScriptTypeJavascript && ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnExit)) return; #endif Node::onExit(); unscheduleUpdate(); }
//------------------------------------------------------- CDistortLayer::~CDistortLayer() { unscheduleUpdate(); free( m_pSpring ); free( m_pMass ); }
void HelloWorld::stopTimer(){ if(timerRunning){ unscheduleUpdate(); timerRunning = false; } }
void HelloWorld::update(float delta) { if(m_bStart) { CCArmature *pHero = (CCArmature*)(m_pGameScene->getChildByTag(10005)->getComponent("CCArmature")->getNode()); pHero->getParent()->setPositionX(pHero->getParent()->getPositionX() + m_fSpeed); CCArmature *pEnemy = (CCArmature*)(m_pGameScene->getChildByTag(10006)->getComponent("CCArmature")->getNode()); if(ccpDistance(ccp(pHero->getParent()->getPositionX(), 0), ccp(pEnemy->getParent()->getPositionX(), 0)) < m_fAttackDis) { pHero->getAnimation()->play("attack"); pHero->getAnimation()->setMovementEventCallFunc(this, movementEvent_selector(HelloWorld::animationEvent)); m_bStart = false; } } if(m_bDead) { CCComRender *pUIRender = static_cast<CCComRender*>(m_pGameScene->getChildByTag(10007)->getComponent("GUIComponent")); UILayer *pUILayer = static_cast<UILayer*>(pUIRender->getNode()); UILoadingBar *pHPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("hp02_LoadingBar")); UILoadingBar *pMPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("mp02_LoadingBar")); pHPLoadingBar->setPercent(m_fPercentage); pMPLoadingBar->setPercent(m_fPercentage); m_fPercentage -= 2.0f; if (m_fPercentage < 0.0f) { unscheduleUpdate(); } } }
void LoadingScene::update(float dt) { ++updatecount; log("updateCount:%d........",updatecount); if (m_curPreload_fodder_count<PRELOAD_FODDER_COUNT) { LoadingEnemy(kEnemyFodder); m_curPreload_fodder_count++; } else if(m_curPreload_fodderL_count<PRELOAD_FODDERL_COUNT) { LoadingEnemy(kEnemyFodderL); m_curPreload_fodderL_count++; } else if (m_curPreload_BigDude_count<PRELOAD_BIGDUDE_COUBR) { LoadingEnemy(kEnemyBigDude); m_curPreload_BigDude_count++; } else if (m_curPreload_Missile_count<PRELOAD_MISSILE_COUNT) { LoadingBullet(kPlayerMissiles); m_curPreload_Missile_count++; } else if (m_curPreload_Boss_count<PRElOAD_BOSS_COUNT) { LoadingEnemy(kEnemyBoss); m_curPreload_Boss_count++; } else { unscheduleUpdate(); } }
void Block::update(float dt) { setPositionX(getPositionX() - 3); if (getPositionX() < 0) { unscheduleUpdate(); removeFromParent(); } }
void CSKillMenuLayer::onExit() { _eventDispatcher->removeEventListener(m_pListener); CBaseLayer::onExit(); NotificationCenter::getInstance()->removeObserver(this,"CloseSkillGuide"); unscheduleUpdate(); }
MiniGameScene::~MiniGameScene() { _eventDispatcher->removeEventListener(m_pSightListner); unscheduleUpdate(); if (isScheduled(schedule_selector(MiniGameScene::startAction))) { unschedule(schedule_selector(MiniGameScene::startAction)); } }
void SGSHero::onDelay(SGMessage* message) { float time; message->getFloat("time", &time); unscheduleUpdate(); scheduleOnce(schedule_selector(SGSHero::startUpdate), time); }
void WaitingLayer::HideWaiting() { this->setVisible(false); unscheduleUpdate(); m_bShow = false; m_sumHideTimer = 0; m_hidingTimer = 0 ; }
void UILoadingBarTest_Left::nextCallback(CCObject* sender, TouchEventType type) { if (type == TOUCH_EVENT_ENDED) { unscheduleUpdate(); UIScene::nextCallback(sender, type); } }
void UILoadingBarTest_Right_Scale9::restartCallback(CCObject* sender, TouchEventType type) { if (type == TOUCH_EVENT_ENDED) { unscheduleUpdate(); UIScene::restartCallback(sender, type); } }
CCMenuItem::~CCMenuItem() { unregisterScriptTapHandler(); // only when it's enabled as of now if(m_isHoldingEnabled) unscheduleUpdate(); }
void HelloWorld::onExit() { cocos2d::extension::CCArmatureDataManager::purge(); cocos2d::extension::ActionManager::shareManager()->purge(); unscheduleUpdate(); CCLayer::onExit(); }
void ResetParticles::Delete() { setPosition(cocos2d::Vec2(-100,-100)); setVisible(false); m_isFollowing = false; unscheduleUpdate(); m_isDeleted = true; }
void Plane::update(float dt) { setPositionX(getPositionX()+speedX); if (getScaleX()>0) { if (getPositionX()<-getContentSize().width) { unscheduleUpdate(); planes->removeObject(this); getParent()->removeChild(this); } } else { if (getPositionX()>visibleSize.width+getContentSize().width) { unscheduleUpdate(); planes->removeObject(this); getParent()->removeChild(this); } } }
void PlanePixelNode::update(float dt) { const float speed = 0.05; if (_baseXDiff_current < _baseXDiff_target) { _baseXDiff_current += dt*speed; if (_baseXDiff_current > _baseXDiff_target) { _baseXDiff_current = _baseXDiff_target; unscheduleUpdate(); } } else if (_baseXDiff_current > _baseXDiff_target) { _baseXDiff_current -= dt*speed; if (_baseXDiff_current < _baseXDiff_target) { _baseXDiff_current = _baseXDiff_target; unscheduleUpdate(); } } }
//结束计时 void JiejiScene::stopTimer() { if(timeRunning) { unscheduleUpdate(); timeRunning = false; } }
void HelloWorld::update(float dt){ label->setPosition(label->getPosition()+Point(1,1)); if (label->getPositionX()>500) { unscheduleUpdate(); } }
void UILoadingBarTest_Left::previousCallback(Ref* sender, TouchEventType type) { if (type == TOUCH_EVENT_ENDED) { unscheduleUpdate(); UIScene::previousCallback(sender, type); } }