Ejemplo n.º 1
0
PictogramNode::~PictogramNode() {
    
    CC_SAFE_RELEASE_NULL(data_);
    removeAllChildrenWithCleanup(true);
    removeFromParentAndCleanup(true);
    CCTextureCache::purgeSharedTextureCache();
}
Ejemplo n.º 2
0
void RadioButtonSet::Clear()
{
	removeAllChildrenWithCleanup(true);
	m_vtrButtons.clear();
	m_vtrPoints.clear();
	m_pCurSel = NULL;
}
UnlockPortals::~UnlockPortals()
{
	removeAllChildrenWithCleanup(true);
	setPhysicsBody(nullptr);
	while (m_lockCollision->getReferenceCount() > 1)
		m_lockCollision->release();
	while (m_unlockCollision->getReferenceCount() > 1)
		m_unlockCollision->release();
	m_lockCollision->removeFromWorld();
	m_unlockCollision->removeFromWorld();
	try{
		m_lockCollision->release();
	}
	catch (int e)
	{

	}
	catch (std::exception& e)
	{

	}
	try{
		m_unlockCollision->release();
	}
	catch (int e)
	{

	}
	catch (std::exception& e)
	{

	}
}
void UnlockPortals::AddParticle(int count)
{
	if (IsUnlocked())
		return;

	m_numParticlesLeft -= count;
	m_curParticleTotal += count;
	if (IsUnlocked())
	{
		setSpriteFrame(m_unlockImage);
		setPhysicsBody(m_unlockCollision);
		removeAllChildrenWithCleanup(true);
		if (m_boundaryImg != "none")
		{
			auto boundary = cocos2d::Sprite::create();
			boundary->setAnchorPoint(cocos2d::Vec2(0, 0));
			boundary->setTexture(m_boundaryImg);
			boundary->setTextureRect(m_unlockRect);
			cocos2d::Texture2D::TexParams params = cocos2d::Texture2D::TexParams();
			params.magFilter = GL_LINEAR;
			params.minFilter = GL_LINEAR;
			params.wrapS = GL_REPEAT;
			params.wrapT = GL_REPEAT;
			boundary->getTexture()->setTexParameters(params);
			boundary->setCameraMask(4);
			addChild(boundary,22);
			boundary->setPosition(m_unlockRect.origin + cocos2d::Vec2(m_imgXOffset, m_imgYOffset));
		}
	}
	else
	{
		setSpriteFrame(cocos2d::SpriteFrameCache::getInstance()->spriteFrameByName(m_particleBaseImg + std::to_string(m_curParticleTotal) + m_particleBaseImgExt));
	}
}
Ejemplo n.º 5
0
void CScrollViewContainer::reset()
{
	removeAllChildrenWithCleanup(true);
	ignoreAnchorPointForPosition(true);
	setAnchorPoint(Vec2::ZERO);
	setPosition(Vec2::ZERO);
}
void UnlockPortals::SetUnlockCollision(cocos2d::Vec2 collBoxSize, cocos2d::Vec2 collBoxOffset)
{
	m_unlockCollision = cocos2d::PhysicsBody::createBox(cocos2d::Size(collBoxSize), cocos2d::PhysicsMaterial(1.0f, 0.0f, 0.0f), collBoxOffset);
	m_lockCollision->setContactTestBitmask(0x0);
	m_lockCollision->setCollisionBitmask(0x1 << curOffset);
	m_unlockCollision->setDynamic(false);
	m_unlockCollision->setGravityEnable(true);
	m_unlockCollision->setRotationEnable(false);
	m_unlockCollision->retain();
	m_unlockRect = cocos2d::Rect(collBoxOffset.x - collBoxSize.x / 2, collBoxOffset.y - collBoxSize.y /3, collBoxSize.x, collBoxSize.y);

	if (curOffset < 30)
		++curOffset;
	else
		curOffset = 27;

	if (IsUnlocked() && m_boundaryImg != "none")
	{
		setPhysicsBody(m_unlockCollision);
		removeAllChildrenWithCleanup(true);
		auto boundary = cocos2d::Sprite::create();
		boundary->setAnchorPoint(cocos2d::Vec2(0, 0));
		boundary->setTexture(m_boundaryImg);
		boundary->setTextureRect(m_unlockRect);
		cocos2d::Texture2D::TexParams params = cocos2d::Texture2D::TexParams();
		params.magFilter = GL_LINEAR;
		params.minFilter = GL_LINEAR;
		params.wrapS = GL_REPEAT;
		params.wrapT = GL_REPEAT;
		boundary->getTexture()->setTexParameters(params);
		boundary->setCameraMask(4);
		addChild(boundary,22);
		boundary->setPosition(m_unlockRect.origin + cocos2d::Vec2(m_imgXOffset, m_imgYOffset));
	}
}
Ejemplo n.º 7
0
CCRenderTexture::~CCRenderTexture()
{
    removeAllChildrenWithCleanup(true);
    ccglDeleteFramebuffers(1, &m_uFBO);

    CC_SAFE_DELETE(m_pUITextureImage);
}
NoteProgressBar::~NoteProgressBar()
{
    removeAllChildrenWithCleanup(true);
    
    _callback = nullptr;
    _callbackListener = nullptr;
}
Ejemplo n.º 9
0
void CObjectBase::clearThis()
{
    turnOffCollision();
    setObjectDictionary(NULL);
    removeAllChildrenWithCleanup(true);
    clearState();
}
Ejemplo n.º 10
0
void BloodFont::onExit()
{
	stopAllActions();
	if (labelAtlas) labelAtlas->removeAllChildrenWithCleanup(true);
	removeAllChildrenWithCleanup(true);
	CCNode::onExit();
}
Ejemplo n.º 11
0
void CScrollList::Clear()
{
	removeAllChildrenWithCleanup(true);
	m_vtrButtons.clear();
	m_vtrGroupInfo.clear();
	m_vtrUserData.clear();
	m_pCurSel = NULL;
}
Ejemplo n.º 12
0
//-----------------------------------------------------------------------------------------------------------------------------
void PersonView::onExit()
{
    setTouchEnable(false);

    removeAllChildrenWithCleanup(true);

    CCNode::onExit();
}
Ejemplo n.º 13
0
void ArtGameSquare::drawSquare(int col, int row, std::string artFile, Size size, Point scale, int artCols, int artRows)
{
	_artRows = artRows;
	_neighbors[ArtBoxSide::TOP] = false;
	_neighbors[ArtBoxSide::BOTTOM] = false;
	_neighbors[ArtBoxSide::LEFT] = false;
	_neighbors[ArtBoxSide::RIGHT] = false;

	removeAllChildrenWithCleanup(true);

	_originalCol = col;
	_originalRow = row;
	_pieceSize = size;
	_color = Color(rand() % (int)Color::COUNT);
	_scale = scale;

	float innerWidth = _pieceSize.width * 0.4f;
	float innerHeight = _pieceSize.height * 0.4f;

	_image = CCSprite::create(artFile, CCRectMake(col * _pieceSize.width / _scale.x, (_artRows - (row + 1)) * _pieceSize.height / _scale.y, _pieceSize.width / _scale.x, _pieceSize.height / _scale.y));
	_image->setScale(scale.x, scale.y);

	_arrow = CCSprite::create("hintLeft.png");
	float arrowHeight = 24 * G_assetScale;
	_arrow->setScale(arrowHeight / _arrow->getContentSize().height);
	_arrow->setVisible(false);

	Point blPoint = Point(-_pieceSize.width * 0.5f, -_pieceSize.height * 0.5f);
	Point brPoint = Point(_pieceSize.width * 0.5f, -_pieceSize.height * 0.5f);
	Point tlPoint = Point(-_pieceSize.width * 0.5f, _pieceSize.height * 0.5f);
	Point trPoint = Point(_pieceSize.width * 0.5f, _pieceSize.height * 0.5f);

	//draw the 4 border lines
	_sides[ArtBoxSide::TOP] = DrawNode::create();
	_sides[ArtBoxSide::TOP]->drawSegment(tlPoint, trPoint, 1, Color4F::BLACK);
	_sides[ArtBoxSide::BOTTOM] = DrawNode::create();
	_sides[ArtBoxSide::BOTTOM]->drawSegment(blPoint, brPoint, 1, Color4F::BLACK);
	_sides[ArtBoxSide::LEFT] = DrawNode::create();
	_sides[ArtBoxSide::LEFT]->drawSegment(tlPoint, blPoint, 1, Color4F::BLACK);
	_sides[ArtBoxSide::RIGHT] = DrawNode::create();
	_sides[ArtBoxSide::RIGHT]->drawSegment(trPoint, brPoint, 1, Color4F::BLACK);

	_cover = DrawNode::create();
	//draw the outer box
	Point points[] = { blPoint, tlPoint, trPoint, brPoint };
	_cover->drawPolygon(points, 4, ccc4f(0.96f, 0.96f, 0.96f, 0.8f), 0, ccc4f(0.86f, 0.86f, 0.86f, 0.8f));
	//draw the inner box
	Point innerPoints[] = { Point(-innerWidth * 0.5f, -innerHeight * 0.5f), Point(innerWidth * 0.5f, -innerHeight * 0.5f), Point(innerWidth * 0.5f, innerHeight * 0.5f), Point(-innerWidth * 0.5f, innerHeight * 0.5f) };
	_cover->drawPolygon(innerPoints, 4, colorToCCColor(_color), 0, ccc4f(0.86f, 0.86f, 0.86f, 0.9f));

	addChild(_image);
	addChild(_arrow);
	addChild(_sides[ArtBoxSide::LEFT]);
	addChild(_sides[ArtBoxSide::RIGHT]);
	addChild(_sides[ArtBoxSide::TOP]);
	addChild(_sides[ArtBoxSide::BOTTOM]);
	addChild(_cover);
}
CCControlSaturationBrightnessPicker::~CCControlSaturationBrightnessPicker()
{
    removeAllChildrenWithCleanup(true);

    m_background = NULL;
    m_overlay    = NULL;
    m_shadow     = NULL;
    m_slider     = NULL;
}
ControlSaturationBrightnessPicker::~ControlSaturationBrightnessPicker()
{
    removeAllChildrenWithCleanup(true);

    _background = nullptr;
    _overlay    = nullptr;
    _shadow     = nullptr;
    _slider     = nullptr;
}
Ejemplo n.º 16
0
void BloodBar::onExit()
{
	if (mProgressBar != NULL)
	{
		mProgressBar->removeAllChildrenWithCleanup(true);
	}
	removeAllChildrenWithCleanup(true);
	CCNode::onExit();
}
Ejemplo n.º 17
0
void BScene::exitGame()
{
    keyHandler->setEnabled(false);
    removeAllChildrenWithCleanup(true);
    
    HomeLayer* layer = HomeLayer::create();
    
    Director::getInstance()->replaceScene(layer->scene());
   
    layer->release();
}
EXDynamicLightLayer::~EXDynamicLightLayer()
{
    unschedule(schedule_selector(EXDynamicLightLayer::update));
    
    //CC_SAFE_RELEASE(mDayLayer);
    //CC_SAFE_RELEASE(mSun);
    //CC_SAFE_RELEASE(mGlow);
    
    removeAllChildrenWithCleanup(true);
    CCTextureCache::sharedTextureCache()->removeUnusedTextures();
}
CCRenderTexture::~CCRenderTexture()
{
    removeAllChildrenWithCleanup(true);
    ccglDeleteFramebuffers(1, &m_uFBO);

	if (NULL != m_pTextureDataBuffer)
	{
		delete []m_pTextureDataBuffer;
		m_pTextureDataBuffer = NULL;
	}
	
}
Ejemplo n.º 20
0
void HUILayer::backupAllRootLayers() {
    m_pBackupRootLayer->removeAllObjects();
    int count = getChildrenCount();
    CCArray *children = getChildren();
    for (int i = 0; i < count; ++i) {
        HRootLayer *layer = (HRootLayer *)children->objectAtIndex(i);
        layer->onShowEditbox(false);
        m_pBackupRootLayer->addObject(layer);
        layer->onEnterBackground();
    }
    removeAllChildrenWithCleanup(false);
    updateAllRootLayers();
}
Ejemplo n.º 21
0
void GameOverLayer::onExit() {
    
     NDKHelper::RemoveSelectorsInGroup("GameOverSceneSelectors");
    
    if(!Utility::isAdFree()){
        CCDictionary* prms = CCDictionary::create();
        prms->setObject(CCString::create("NO"), KBottomAd);
        prms->setObject(CCString::create("NO"), kTopAd);
        prms->setObject(CCString::create("NO"), kMenu);
        prms->setObject(CCString::create("NO"), kGameOver);
        SendMessageWithParams(string("adFunctionalty"), prms);
    }
    
    removeAllChildrenWithCleanup(true);
    CCLayer::onExit();
}
void AchievementNotification::onExit()
{
	LFLayer::onExit();
	//CCLog("AchievementNotification::onExit ----- ");

	for (size_t i=0;i<temp_Must_Delete.size();i++)
	{
		if (temp_Must_Delete[i])
		{
			delete temp_Must_Delete[i];
		}
	}
	temp_Must_Delete.clear();

	forceTermination = true;	// 设置强制终止
	unschedule(schedule_selector(AchievementNotification::tick));
	removeAllChildrenWithCleanup(true);
}
Ejemplo n.º 23
0
	GameScene::~GameScene()
	{
		removeAllChildrenWithCleanup(true);

		// remove game event listeners
		Director::getInstance()->getEventDispatcher()->removeCustomEventListeners(Event::BpmEvent::CHANGED);
		Director::getInstance()->getEventDispatcher()->removeCustomEventListeners(Event::ComboEvent::CHANGED);
		Director::getInstance()->getEventDispatcher()->removeCustomEventListeners(Event::GameConfigEvent::RESET);
		Director::getInstance()->getEventDispatcher()->removeCustomEventListeners(Event::JudgeEvent::JUDGE);
		Director::getInstance()->getEventDispatcher()->removeCustomEventListeners(Event::KeyEvent::DOWN);
		Director::getInstance()->getEventDispatcher()->removeCustomEventListeners(Event::KeyEvent::UP);
		Director::getInstance()->getEventDispatcher()->removeCustomEventListeners(Event::SpeedEvent::CHANGED);

		// clear
		clearPointerMap(mImageDictionary);
		clearPointerMap(mBgaDictionary);
		clearPointerMap(mWavDictionary);
		clearPointerMap(mChannelPlayers);
	}
Ejemplo n.º 24
0
void HUILayer::dismissAllRootLayers() {
    stopMaskAnimation();
    m_pCurrentLayer = NULL;
    m_pPreEndingLayer = NULL;
    m_pQueneRootLayers->removeAllObjects();
    
    int count = getChildrenCount();
    CCArray *children = getChildren();
    for (int i = 0; i < count; ++i) {
        HRootLayer *layer = (HRootLayer *)children->objectAtIndex(i);
        layer->onEnterBackground();
    }
    
    removeAllChildrenWithCleanup(true);
    updateAllRootLayers();
    endPresentFadeOut();
    if (this == AppDelegate::getInstance()->getGameManager()->getUILayer()) {
        AppDelegate::getInstance()->getGameManager()->onRootLayerCountChanged(getChildrenCount());
    }
}
Ejemplo n.º 25
0
void WaittClockCtrl::initClock(float duration, std::function<void()>& func)
{
    removeAllChildrenWithCleanup(true);
    Size contextSize(this->getContentSize());

    auto procTo = ProgressTo::create(duration, 100.0f);
    auto procTimer = ProgressTimer::create(UIHelper::createSprite("popup_bk_pie", "item"));
    procTimer->setAnchorPoint(Point(0.5f, 0.5f));
    procTimer->setType(ProgressTimer::Type::RADIAL);
    procTimer->setPosition(Point(contextSize.width/2.0f, contextSize.height/2.0f));
    addChild(procTimer, CZO_PROGRESS);

    Sprite* cursor = UIHelper::createSprite("popup_timer_cursor", "item");
    cursor->setAnchorPoint(Point(0.5f, 0.5f));
    cursor->setPosition(Point::ZERO);
    cursor->setPosition(Point(contextSize.width/2.0f, contextSize.height/2.0f));
    addChild(cursor, CZO_CURSOR);
    auto rotateBy = RotateBy::create(duration, 360.0f);
    auto callFunc = CallFunc::create(func);

    procTimer->runAction(procTo);
    cursor->runAction(Sequence::createWithTwoActions(rotateBy, callFunc));
}
Ejemplo n.º 26
0
void XSpriteBatchNode::cleanup()
{
	XFUNC_START();
	if(!_bResLoaded)
	{
		_bCleanUpThread = true;
		return;
	}
	_bResLoaded = false;
	CCSpriteBatchNode::cleanup();
	removeAllChildrenWithCleanup(false);
	if(XMemPool<XSpriteBatchNode>::m_pXMPParent)
	{
		XSpriteBatchNode* pSpriteBN = this;
		try
		{
			XMP_RELEASE(XSpriteBatchNode, pSpriteBN);
		}
		catch (...)
		{
		}
	}
	XFUNC_END();
}
Ejemplo n.º 27
0
void ScrollView::removeAllChildren()
{
    removeAllChildrenWithCleanup(true);
}
ResetParticles::~ResetParticles()
{
	removeAllChildrenWithCleanup(true);
}
Ejemplo n.º 29
0
ControlHuePicker::~ControlHuePicker()
{
    removeAllChildrenWithCleanup(true);
    CC_SAFE_RELEASE(_background);
    CC_SAFE_RELEASE(_slider);
}
Ejemplo n.º 30
0
void Widget::removeAllChildren()
{
    removeAllChildrenWithCleanup(true);
}