Пример #1
0
void CCMenuItemSprite::setDisabledImage(CCNode* pImage)
{
    if (pImage != m_pNormalImage)
    {
        if (pImage)
        {
            addChild(pImage, 0, kDisableTag);
            //MMDBG: for image magnifying.
            pImage->setAnchorPoint(ccp(0, 0));
//            pImage->setAnchorPoint(ccp(0.5, 0.5));
//            pImage->setPosition(ccp(pImage->getContentSize().width * 0.5, pImage->getContentSize().height * 0.5));
        }

        if (m_pDisabledImage)
        {
            removeChild(m_pDisabledImage, true);
        }

        m_pDisabledImage = pImage;
        this->updateImagesVisibility();
    }
}
Пример #2
0
void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) {
  // To preserve comments, remove only the text nodes, then add a single text
  // node.
  HeapVector<Member<Node>> textNodes;
  for (Node* n = firstChild(); n; n = n->nextSibling()) {
    if (n->isTextNode())
      textNodes.append(n);
  }
  for (const auto& text : textNodes)
    removeChild(text.get(), IGNORE_EXCEPTION);

  // Normalize line endings.
  String value = defaultValue;
  value.replace("\r\n", "\n");
  value.replace('\r', '\n');

  insertBefore(document().createTextNode(value), firstChild(),
               IGNORE_EXCEPTION);

  if (!m_isDirty)
    setNonDirtyValue(value);
}
Пример #3
0
void BonusPanel::cbCommDlg(CCObject* pObj)
{
    CommDlgRet* pRet = (CommDlgRet*)pObj;
    bool isOk = pRet->bOk;
    
    if(m_commDlg != NULL){
        removeChild(m_commDlg, true);
        m_commDlg = NULL;
    }
    
    MainScene::Inst()->enableBottomPanel(true);
    
    if(isOk == true){
        if (m_cntryDialog->assignOneCoin())
        {
            scheduleUpdate();
        }
    }
    else {
        CGameData::Inst()->clearReqStat();
    }
}
Пример #4
0
void Warrior::attackDetection()
{
	auto map = this->getParent();
	Vector<Node*> garbege;
	for (int i = 0; i < map->getChildren().size(); i++)
	{
		auto sprite = map->getChildren().at(i);
		if (sprite->getName() != "skull")
			continue;
		if (weapon->getBoundingBox().containsPoint(Vec2(sprite->getBoundingBox().getMidX(), sprite->getBoundingBox().getMidY())))
		{
			((BaseObject*)sprite)->setFeelHurt(true);
			if (((BaseObject*)sprite)->getHealth() == 0)
				((BaseObject*)sprite)->die();
				//garbege.pushBack(sprite);
		}
	}
	for (int i = 0; i < garbege.size(); i++)
	{
		map->removeChild(garbege.at(i));
	}
}
Пример #5
0
void RenderRubyAsBlock::removeChild(RenderObject& child)
{
    // If the child's parent is *this (must be a ruby run or generated content or anonymous block),
    // just use the normal remove method.
    if (child.parent() == this) {
        ASSERT(child.isRubyRun() || child.isBeforeContent() || child.isAfterContent() || isAnonymousRubyInlineBlock(&child));
        RenderBlock::removeChild(child);
        return;
    }
    // If the child's parent is an anoymous block (must be generated :before/:after content)
    // just use the block's remove method.
    if (isAnonymousRubyInlineBlock(child.parent())) {
        ASSERT(child.isBeforeContent() || child.isAfterContent());
        child.parent()->removeChild(child);
        removeChild(*child.parent());
        return;
    }

    // Otherwise find the containing run and remove it from there.
    RenderRubyRun& run = findRubyRunParent(child);
    run.removeChild(child);
}
Пример #6
0
void Dog::hitCat(Cat* cat)
{
	//是否砸到猫
	if (cat->getReady() == false)
	{
		return;
	}
	for (auto it = bullets.begin(); it != bullets.end();)
	{
		TubeBullet* temp = it->second;
		Rect temp1 = Rect(temp->getPositionX() - temp->getHitRect().size.width / 2,
			temp->getPositionY() - temp->getHitRect().size.height / 2,
			temp->getHitRect().size.width, temp->getHitRect().size.height);

		Rect temp2 = Rect(cat->getPositionX() - cat->getHitRect().size.width / 2,
			cat->getPositionY() - cat->getHitRect().size.height / 2,
			cat->getHitRect().size.width, cat->getHitRect().size.height);

		if (temp1.intersectsRect(temp2))
		{
			log("Dog Hit:: { %d }", it->second->getID());
			TubeBullet* temp = bullets.at(it->first);
			auto parent = temp->getParent();
			if (parent != NULL)
			{
				parent->removeChild(temp, true);
			}
			//猫咪爆炸
			cat->displayExplode();
			NotificationCenter::getInstance()->postNotification("HitCat");
			//下一个迭代器定位的元素位置
			it = bullets.erase(it);
		}
		else
		{
			it++;
		}
	}
}
Пример #7
0
  void ModelInModelOutJob::mergeJobImpl(const boost::shared_ptr<Job_Impl> &t_parent, const boost::shared_ptr<Job_Impl> &t_job) 
  {


    QWriteLocker l(&m_mutex);
    boost::shared_ptr<ModelInModelOutJob> mimojob = boost::dynamic_pointer_cast<ModelInModelOutJob>(t_job);

    if (!mimojob)
    {
      throw MergeJobError("Mismatched job types");
    }

    if (mimojob->jobType() != t_parent->jobType())
    {
      throw MergeJobError("Mismatched job types");
    }


    if (t_parent->finishedJob() == t_job)
    {
      throw MergeJobError("RHS is finished job - refusing to merge");
    }

    LOG(Info, "Merging Job " << openstudio::toString(t_job->uuid()) << " into " << openstudio::toString(uuid()));
    
    removeChild(t_job);
    std::vector<boost::shared_ptr<Job_Impl> > children = t_job->children();
    std::for_each(children.begin(), children.end(), boost::bind(&Job_Impl::addChild, t_parent, _1));

    std::vector<boost::shared_ptr<ModelInModelOutJob> > existing_merged_jobs = mimojob->m_mergedJobs;
    mimojob->m_mergedJobs.clear();

    m_mergedJobs.push_back(mimojob);

    // make sure we merge the already merged jobs too
    m_mergedJobs.insert(m_mergedJobs.begin(), existing_merged_jobs.begin(), existing_merged_jobs.end());
   

  }
Пример #8
0
void
AppCompositor::removeWindow(DFBWindowID windowID)
{
    ILOG_TRACE_W(ILX_APPCOMPOSITOR);
    ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> windowID: %u\n", windowID);
    for (WidgetList::iterator it = _children.begin(); it != _children.end(); ++it)
    {
        SurfaceView* view = dynamic_cast<SurfaceView*>(*it);
        if (view && view->dfbWindowID() == windowID)
        {
            if (removeChild(*it))
            {
                ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> removeChild( %p )\n", (*it));
                sigGeometryUpdated();
                setWindowFocus();
                update();
                break;
            } else
                ILOG_ERROR(ILX_APPCOMPOSITOR, " -> Cannot remove child window!\n");
        }
    }
}
Пример #9
0
void Element::normalize()
{
	Node* pCur = firstChild();
	while (pCur)
	{
		if (pCur->nodeType() == Node::ELEMENT_NODE)
		{
			pCur->normalize();
		}
		else if (pCur->nodeType() == Node::TEXT_NODE)
		{
			Node* pNext = pCur->nextSibling();
			while (pNext && pNext->nodeType() == Node::TEXT_NODE)
			{
				static_cast<Text*>(pCur)->appendData(pNext->nodeValue());
				removeChild(pNext);
				pNext = pCur->nextSibling();
			}
		}
		pCur = pCur->nextSibling();
	}
}
Пример #10
0
//parent child handling
void DrawingManager::parent(double x, double y){
   if(currentShapes!=NULL){
    if (_parent ==NULL){
        for(int i=0;i<currentShapes->size();i++){
            Shape* s=  (*currentShapes)[ i ]->checkSelect(x, y);
            if(s!=NULL) {
                _parent=s;
                s->parentSelected= true;
               ((*currentShapes)[ i ])->selected = false;
                //cout<<"parent_selected"<<endl;
                
            }
            
            
            break;
        }
    }
    else {
        for(int i=0;i<currentShapes->size();i++){
            Shape* s=  (*currentShapes)[ i ]->checkSelect(x, y);
            if(s!=NULL && s!=_parent) {
                if(removeChild(s)){
                    _parent->AddChildNode(s);
                    s->childSelected= true;
                    s->selected = false;
                    
                    //cout<<"parent_child created"<<endl;
                    _parent = NULL;
                    break;
                }
            }
            
        }
        _parent = NULL;
        
    }
   }
    
}
GameObject::~GameObject() {
	//dtor

	parent->removeChild(getUniqueID());

	delete mesh;
	debug("deleted mesh");
	delete behaviour;
	debug("deleted behaviour");
	delete collider;
	debug("deleted collider");
	delete colorMap;
	debug("deleted colorMap");
	for (vector<GameObject*>::iterator iter = children->begin(); iter != children->end(); ++iter) {
		removeChild(((GameObject*)* iter)->getUniqueID());
	}
	delete children;
	debug("deleted children");
	setParent(NULL);
	debug("no more parents");

}
Пример #12
0
//==============================================================================
void WorldNode::clearUnusedNodes()
{
  std::vector<dart::dynamics::Frame*> unused;
  unused.reserve(mFrameToNode.size());

  // Find unusued ShapeFrameNodes
  for(auto& node_pair : mFrameToNode)
  {
    ShapeFrameNode* node = node_pair.second;
    if(node && !node->wasUtilized())
      unused.push_back(node_pair.first);
  }

  // Clear unused ShapeFrameNodes
  for(dart::dynamics::Frame* frame : unused)
  {
    NodeMap::iterator it = mFrameToNode.find(frame);
    ShapeFrameNode* node = it->second;
    removeChild(node);
    mFrameToNode.erase(it);
  }
}
Пример #13
0
//---------------------------------------------------------
//
//
void CMessageBoxYesNo::onEnter()
{
    CCXMLLayer::onEnter();
    
    LoadPlist( "tip_1.plist" );
    
    const char *MenuButton[] = { "button_yes", "button_no" };
    
    const char *YesNo[] = { "YES", "NO" };
    for( int i = 0; i < 2; i++ )
	{
		CCSprite *pSprite= (CCSprite*)GetXMLNodeFromKey( MenuButton[i] );
		CCMenu *pMenu = CreatGameUIWithSprite( pSprite, menu_selector(CMessageBoxYesNo::menuCallback), i, this, pSprite->getPosition() );
		addChild( pMenu, pSprite->getZOrder() );
        removeChild( pSprite, true );
        
        
        CCLabelTTF* pLabelTTF = CCLabelTTF::labelWithString( YesNo[i], kFontSystem[FONT_GRAND].fontName, kFontSystem[FONT_GRAND].fontSize );
        pLabelTTF->setPosition( pMenu->getPosition() );
        CCRenderTexture* pstroke = createStroke(pLabelTTF, 1, kFontSystem[FONT_GRAND].strokeColor);
        addChild( pstroke,100 );
        addChild( pLabelTTF,100 );
	}
    
    CCNode *pNode =  GetXMLNodeFromKey( "t2dSceneObject_Message" );
	CCLabelTTF* pLabelTTF = CCLabelTTF::labelWithString( m_szBuffer, kFontSystem[FONT_THIN].fontName, kFontSystem[FONT_THIN].fontSize );
	pLabelTTF->setPosition( pNode->getPosition() );
    CCRenderTexture* pstroke = createStroke(pLabelTTF, 1, kFontSystem[FONT_THIN].strokeColor);
    addChild( pstroke,100 );
	addChild( pLabelTTF,100 );
    
    //pNode =  GetXMLNodeFromKey( "t2dSceneObject_tipname" );
	//pLabelTTF = CCLabelTTF::labelWithString( m_TitleBuffer, kFontSystem[FONT_THIN].fontName, kFontSystem[FONT_THIN].fontSize );
	//pLabelTTF->setPosition( pNode->getPosition() );
    //pstroke = createStroke(pLabelTTF, 1, kFontSystem[FONT_THIN].strokeColor);
    //addChild( pstroke,100 );
	//addChild( pLabelTTF,100 );
}
Пример #14
0
void QScriptDebuggerLocalsModelPrivate::reallySyncIndex(const QModelIndex &index,
                                                        const QScriptDebuggerObjectSnapshotDelta &delta)
{
    if (!index.isValid())
        return;
    QScriptDebuggerLocalsModelNode *node = nodeFromIndex(index);
    // update or remove existing children
    for (int i = 0; i < node->children.count(); ++i) {
        QScriptDebuggerLocalsModelNode *child = node->children.at(i);
        int j;
        for (j = 0; j < delta.changedProperties.count(); ++j) {
            if (child->property.name() == delta.changedProperties.at(j).name()) {
                child->property = delta.changedProperties.at(j);
                child->changed = true;
                emitDataChanged(index, index.sibling(0, 1));
                repopulate(child);
                break;
            }
        }
        if (j != delta.changedProperties.count())
            continue; // was changed
        for (j = 0; j < delta.removedProperties.count(); ++j) {
            if (child->property.name() == delta.removedProperties.at(j)) {
                removeChild(index, node, i);
                --i;
                break;
            }
        }
        if (j != delta.removedProperties.count())
            continue; // was removed
        // neither changed nor removed, but its children might be
        if (child->populationState == QScriptDebuggerLocalsModelNode::Populated) {
            QScriptDebuggerJob *job = new SyncModelIndexJob(indexFromNode(child), commandScheduler);
            jobScheduler->scheduleJob(job);
        }
    }
    addChildren(index, node, delta.addedProperties);
}
Пример #15
0
void UFunctionTag::setArgs(const QStringList& list)
{
    removeChild(hintTag);
    foreach(QTreeWidgetItem* item,takeChildren())
    {
        delete item;
    }

    addChild(hintTag);
    QMutableStringListIterator iterator(*((QList<QString>*)&list));
    while(iterator.hasNext())
    {
        QString item=iterator.next();
        item=item.trimmed();
        UStaticTag* child=new UStaticTag("arg");
        child->setIcon(QIcon(":/images/algorithm/var.png"));
        child->setText(item);
        addChild(child);
        iterator.setValue(item);
    }
    args=list.join(",");
    emit argsChanged(list);
}
Пример #16
0
// 运行动画
void CustomAnimation::runMyAnimation(float delta)
{
    _currentFrame++;
    
    if (_currentFrame <= _framesToAnimate) {
        if (_currentFrame < 10) {
            _someSprite->setTexture(CCSprite::create(CCString::createWithFormat("arts/game_main_scenes/%s_000%d.png", _fileNameToAnimate->getCString(), _currentFrame)->getCString())->getTexture());
        } else if (_currentFrame < 100) {
            _someSprite->setTexture(CCSprite::create(CCString::createWithFormat("arts/game_main_scenes/%s_00%d.png", _fileNameToAnimate->getCString(), _currentFrame)->getCString())->getTexture());
        } else {
            _someSprite->setTexture(CCSprite::create(CCString::createWithFormat("arts/game_main_scenes/%s_0%d.png", _fileNameToAnimate->getCString(), _currentFrame)->getCString())->getTexture());
        }
    } else {
        if (_doesTheAnimationLoop == true && _useRandomFrameToLoop == false) {
            _currentFrame = _framesToStartWith;
        } else if (_doesTheAnimationLoop == true && _useRandomFrameToLoop == true) {
            _currentFrame = arc4random() % _framesToAnimate;
        } else {
            removeChild(_someSprite, true);
            unschedule(schedule_selector(CustomAnimation::runMyAnimation));
        }
    }
}
Пример #17
0
RenderObject* RenderRubyAsBlock::removeChild(RenderObject& child)
{
    // If the child's parent is *this (must be a ruby run or generated content or anonymous block),
    // just use the normal remove method.
    if (child.parent() == this) {
#ifndef ASSERT_DISABLED
        ASSERT(isRubyChildForNormalRemoval(child));
#endif
        return RenderBlockFlow::removeChild(child);
    }
    // If the child's parent is an anoymous block (must be generated :before/:after content)
    // just use the block's remove method.
    if (isAnonymousRubyInlineBlock(child.parent())) {
        ASSERT(child.isBeforeContent() || child.isAfterContent());
        RenderObject* next = child.parent()->removeChild(child);
        removeChild(*child.parent());
        return next;
    }

    // Otherwise find the containing run and remove it from there.
    RenderRubyRun& run = findRubyRunParent(child);
    return run.removeChild(child);
}
Пример #18
0
SessionItem::SessionItem(Session* session) : AbstractSessionItem(session), m_closing(false)
{
    setTitle(session->host());
    setSubtitle(session->nickName());

    connect(session, SIGNAL(hostChanged(QString)), this, SLOT(setTitle(QString)));
    connect(session, SIGNAL(nickNameChanged(QString)), this, SLOT(setSubtitle(QString)));

    connect(session, SIGNAL(socketError(QAbstractSocket::SocketError)), this, SLOT(updateState()));
    connect(session, SIGNAL(connectedChanged(bool)), this, SLOT(updateState()));
    connect(session, SIGNAL(activeChanged(bool)), this, SLOT(updateState()));

    setSession(session);
    m_handler.setSession(session);
    m_handler.setDefaultReceiver(this);
    m_handler.setCurrentReceiver(this);
    connect(&m_handler, SIGNAL(receiverToBeAdded(QString)), SLOT(addChild(QString)));
    connect(&m_handler, SIGNAL(receiverToBeRenamed(QString,QString)), SLOT(renameChild(QString,QString)));
    connect(&m_handler, SIGNAL(receiverToBeRemoved(QString)), SLOT(removeChild(QString)));

    updateCurrent(this);
    updateState();
}
Пример #19
0
void LLPanelProfile::closePanel(LLPanel* panel)
{
	panel->setVisible(FALSE);

	if (panel->getParent() == this) 
	{
		removeChild(panel);

		// Make the underlying panel visible.
		mChildStack.pop();

		// Prevent losing focus by the floater
		const child_list_t* child_list = getChildList();
		if (child_list->size() > 0)
		{
			child_list->front()->setFocus(TRUE);
		}
		else
		{
			LL_WARNS() << "No underlying panel to focus." << LL_ENDL;
		}
	}
}
Пример #20
0
void HTMLTextAreaElement::setDefaultValue(const String& defaultValue)
{
    Ref<HTMLTextAreaElement> protectFromMutationEvents(*this);

    // To preserve comments, remove only the text nodes, then add a single text node.
    Vector<RefPtr<Text>> textNodes;
    for (Text* textNode = TextNodeTraversal::firstChild(this); textNode; textNode = TextNodeTraversal::nextSibling(textNode))
        textNodes.append(textNode);

    size_t size = textNodes.size();
    for (size_t i = 0; i < size; ++i)
        removeChild(textNodes[i].get(), IGNORE_EXCEPTION);

    // Normalize line endings.
    String value = defaultValue;
    value.replace("\r\n", "\n");
    value.replace('\r', '\n');

    insertBefore(document().createTextNode(value), firstChild(), IGNORE_EXCEPTION);

    if (!m_isDirty)
        setNonDirtyValue(value);
}
Пример #21
0
void TinyDomElement::addChild(TinyDomNode* child, 
			      const TinyDomNode* before) {

  if (!child) { return; }
  removeChild(child);

  bool inserted = false;

  if (before) {
    for (ChildList::iterator i=_children.begin(); i!=_children.end(); ++i) {
      if (*i == before) {    
	_children.insert(i, child);
	inserted = true;
	break;
      }
    }
  }

  if (!inserted) { _children.push_back(child); }

  child->_parent = this;

}
Пример #22
0
void CCSprite::reorderChild(CCNode *pChild, int zOrder)
{
    assert(pChild != NULL);
	assert(m_pChildren->containsObject(pChild));

	if (zOrder == pChild->getZOrder())
	{
		return;
	}

	if (m_bUsesBatchNode)
	{
		// XXX: Instead of removing/adding, it is more efficient to reorder manually
		pChild->retain();
		removeChild(pChild, false);
		addChild(pChild, zOrder);
		pChild->release();
	}
	else
	{
		CCNode::reorderChild(pChild, zOrder);
	}
}
Пример #23
0
void HTMLTextAreaElement::setDefaultValue(const String& defaultValue)
{
    RefPtrWillBeRawPtr<Node> protectFromMutationEvents(this);

    // To preserve comments, remove only the text nodes, then add a single text node.
    WillBeHeapVector<RefPtrWillBeMember<Node>> textNodes;
    for (Node* n = firstChild(); n; n = n->nextSibling()) {
        if (n->isTextNode())
            textNodes.append(n);
    }
    size_t size = textNodes.size();
    for (size_t i = 0; i < size; ++i)
        removeChild(textNodes[i].get(), IGNORE_EXCEPTION);

    // Normalize line endings.
    String value = defaultValue;
    value.replace("\r\n", "\n");
    value.replace('\r', '\n');

    insertBefore(document().createTextNode(value), firstChild(), IGNORE_EXCEPTION);

    if (!m_isDirty)
        setNonDirtyValue(value);
}
Пример #24
0
/*!
*/
void CAnimatedMeshSceneNode::checkJoints()
{
#ifndef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
	return;
#else

	if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
		return;

	if (!JointsUsed)
	{
		for (u32 i=0; i<JointChildSceneNodes.size(); ++i)
			removeChild(JointChildSceneNodes[i]);
		JointChildSceneNodes.clear();

		//Create joints for SkinnedMesh
		((CSkinnedMesh*)Mesh)->addJoints(JointChildSceneNodes, this, SceneManager);
		((CSkinnedMesh*)Mesh)->recoverJointsFromMesh(JointChildSceneNodes);

		JointsUsed=true;
		JointMode=EJUOR_READ;
	}
#endif
}
Пример #25
0
void CardShop::cbCfm(CCObject* pSender)
{
    CardConfirmRet* ret = (CardConfirmRet*)pSender;
    switch (ret->iBtnSel)
    {
        case 0:
        {
            CShopCardInfo* pShopCardInfo = CGameData::Inst()->getShopCards()->getObjectAtIndex(m_iSelNo);
            CCardBaseInfo* pBaseCardInfo = CGameData::Inst()->getCardBaseInfByCid(pShopCardInfo->sCid);
            
            char buf[100];
            snprintf(buf, 99, CGameData::Inst()->getLanguageValue("card_shop_tips_1"),
                     pShopCardInfo->iPrice, pBaseCardInfo->star, pBaseCardInfo->name);
            Dialog2* dlg2 = new Dialog2(this, callfuncO_selector(CardShop::Dlg2Callback),
                                        CGameData::Inst()->getLanguageValue("card_shop_tips_2"),
                                        buf, enDl2TwoBtn);
            addChild(dlg2, 15,888);
            dlg2->release();
            dlg2->setPosition(ccp(320, 480-getPosition().y));
        }
            break;
            
        case 1:
            waitShowInfo();

            break;
            
        case 2:
            removeChild(m_cfmLayer, true);
            m_cfmLayer = NULL;
            break;
            
        default:
            break;
    }
}
Пример #26
0
void WebSocketTest::startTestCallback(Ref* sender)
{
    removeChild(_startTestMenu);
    _startTestMenu = nullptr;

    _wsiSendText = new network::WebSocket();
    _wsiSendBinary = new network::WebSocket();
    _wsiError = new network::WebSocket();

    if (!_wsiSendText->init(*this, "ws://echo.websocket.org"))
    {
        CC_SAFE_DELETE(_wsiSendText);
    }

    if (!_wsiSendBinary->init(*this, "ws://echo.websocket.org"))
    {
        CC_SAFE_DELETE(_wsiSendBinary);
    }

    if (!_wsiError->init(*this, "ws://invalid.url.com"))
    {
        CC_SAFE_DELETE(_wsiError);
    }
}
Пример #27
0
void HTMLTextAreaElement::setDefaultValue(const String& defaultValue)
{
    // To preserve comments, remove only the text nodes, then add a single text node.

    Vector<RefPtr<Node> > textNodes;
    for (Node* n = firstChild(); n; n = n->nextSibling()) {
        if (n->isTextNode())
            textNodes.append(n);
    }
    ExceptionCode ec;
    size_t size = textNodes.size();
    for (size_t i = 0; i < size; ++i)
        removeChild(textNodes[i].get(), ec);

    // Normalize line endings.
    String value = defaultValue;
    value.replace("\r\n", "\n");
    value.replace('\r', '\n');

    insertBefore(document()->createTextNode(value), firstChild(), ec);

    if (!m_isDirty)
        setNonDirtyValue(value);
}
Пример #28
0
void ChainReactionScene::update(float df)
{
	for ( size_t i = 0; i < _ballClones.size(); ++i )
	{
		_ballClones[i]->update(df);
		if ( _lastExplosion && Util::collides(_lastExplosion, _ballClones[i] ) )
		{
			++_chainedExplosionCount;
			ParticleSystemQuad* particleSystem = ParticleExplosion::create();
			this->addChild(particleSystem, 10);
			particleSystem->setTexture( Director::getInstance()->getTextureCache()->addImage("Stars2.png") );
			particleSystem->setAutoRemoveOnFinish(true);
			particleSystem->setPosition( _ballClones[i]->getPosition() );
			particleSystem->setDuration(1.0f);

			// Update the score
			_currenPlayerScore->addPoints(_chainedExplosionCount);

			log("Removing child %zi", i + 1);
			removeChild(_ballClones[i]);
			_ballClones.erase( _ballClones.begin() + i );
		}
	}
}
Пример #29
0
void ModuleEditLayer::initBoard()
{
	cocos2d::Size moduleSize = GET_DATA_MANAGER()->getModuleSize();
	cocos2d::Size tileSize = GET_DATA_MANAGER()->getTileSize();

	for (auto cell : m_Cells)
	{
		removeChild(cell);
	}

	m_Cells.clear();

	tileSize.width *= 0.25;
	tileSize.height *= 0.25;

	for (int x = 0; x < moduleSize.width; x++)
	{
		for (int y = 0; y < moduleSize.height; y++)
		{
			m_Cells.push_back(makeCell(MAP_CELL_START_X + x*tileSize.width, MAP_CELL_START_Y - y*tileSize.height));
			addChild(m_Cells[m_Cells.size()-1]);
		}
	}
}
Пример #30
0
void UILayerManager::SetMainLayer(UILayer* pkLayer, const UIUserDataPtr& spUserData, bool bNeedPath)
{
	if(GetCurrentMainLayer())
	{
		if(bNeedPath)
		{
			m_kPreLayers.PushBack(m_kCurrentMainLayer);
		}
		removeChild(m_kCurrentMainLayer.m_tFirst, false);
		m_kCurrentMainLayer.m_tFirst->SetActive(false, m_kCurrentMainLayer.m_tSecond);
	}
	m_kCurrentMainLayer.m_tFirst = pkLayer;
	m_kCurrentMainLayer.m_tSecond = spUserData;
	if(pkLayer)
	{
		addChild(pkLayer, 0);
		pkLayer->SetActive(true, spUserData);
	}
	else
	{
		m_kPreLayers.Clear();
		m_kNextLayers.Clear();
	}
}