Example #1
0
void DisplayManager::changeDisplayByIndex(int index, bool force)
{
    CCASSERT( (_decoDisplayList ? index < (int)_decoDisplayList->count() : true), "the _index value is out of range");

    _forceChangeDisplay = force;

    //! If index is equal to current display index,then do nothing
    if ( _displayIndex == index)
        return;


    _displayIndex = index;

    //! If displayIndex < 0, it means you want to hide you display
    if (_displayIndex < 0)
    {
        if(_displayRenderNode)
        {
            _displayRenderNode->removeFromParentAndCleanup(true);
            setCurrentDecorativeDisplay(NULL);
        }
        return;
    }


    DecorativeDisplay *decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(_displayIndex);

    setCurrentDecorativeDisplay(decoDisplay);
}
Example #2
0
void CCDisplayManager::changeDisplayByIndex(int index, bool force)
{
    CCAssert( (m_pDecoDisplayList ? index < (int)m_pDecoDisplayList->count() : true), "the _index value is out of range");

    m_bForceChangeDisplay = force;

    //! If index is equal to current display index,then do nothing
    if ( m_iDisplayIndex == index)
        return;


    m_iDisplayIndex = index;

    //! If displayIndex < 0, it means you want to hide you display
    if (m_iDisplayIndex < 0)
    {
        if(m_pDisplayRenderNode)
        {
            m_pDisplayRenderNode->removeFromParentAndCleanup(true);
            setCurrentDecorativeDisplay(NULL);
        }
        return;
    }


    CCDecorativeDisplay *decoDisplay = (CCDecorativeDisplay *)m_pDecoDisplayList->objectAtIndex(m_iDisplayIndex);

    setCurrentDecorativeDisplay(decoDisplay);
}
void DisplayManager::changeDisplayWithIndex(int index, bool force)
{
    //CCASSERT( index < (int)_decoDisplayList.size(), "the _index value is out of range");

    _forceChangeDisplay = force;

    //! If index is equal to current display index,then do nothing
    if ( _displayIndex == index)
        return;


    _displayIndex = index;

    //! If displayIndex < 0, it means you want to hide you display
    if (_displayIndex < 0)
    {
        if(_displayRenderNode)
        {
            _displayRenderNode->removeFromParentAndCleanup(true);
            setCurrentDecorativeDisplay(nullptr);
        }
        return;
    }

    DecorativeDisplay *decoDisplay = getDecorativeDisplayByIndex(_displayIndex);
	if ( decoDisplay )
	{
		setCurrentDecorativeDisplay(decoDisplay);
	}
}
Example #4
0
void DisplayManager::removeDisplay(int index)
{
    _decoDisplayList->removeObjectAtIndex(index);

    if(index == _displayIndex)
    {
        setCurrentDecorativeDisplay(NULL);
    }
}
Example #5
0
void CCDisplayManager::removeDisplay(int index)
{
    m_pDecoDisplayList->removeObjectAtIndex(index);

    if(index == m_iDisplayIndex)
    {
        setCurrentDecorativeDisplay(NULL);
    }
}
Example #6
0
void DisplayManager::removeDisplay(int index)
{
    if(index == _displayIndex)
    {
        setCurrentDecorativeDisplay(nullptr);
        _displayIndex = -1;
    }

    _decoDisplayList.erase(index);
}
void CCDisplayManager::removeDisplay(int index)
{
	// zrong 2013-11-06 from https://github.com/cocos2d/cocos2d-x/commit/af754bfe5d1b28b072ec14ed5ffc1900f06a7e95
    if(index == m_iDisplayIndex)
    {
        setCurrentDecorativeDisplay(NULL);
		m_iDisplayIndex = -1;
    }

    m_pDecoDisplayList->removeObjectAtIndex(index);
}
void DisplayManager::removeDisplay(int index)
{
    if(index == _displayIndex)
    {
        setCurrentDecorativeDisplay(nullptr);
        _displayIndex = -1;
    }

	DecorativeDisplay *dd = _decoDisplayList.at(index);
	CC_SAFE_RELEASE(dd);
    _decoDisplayList.erase(_decoDisplayList.begin()+index);
}