Пример #1
0
void DisplayManager::initDisplayList(BoneData *_boneData)
{
    CC_SAFE_DELETE(m_pDecoDisplayList);
    m_pDecoDisplayList = CCArray::create();
    m_pDecoDisplayList->retain();
    
    if(!_boneData)
    {
        return;
    }
    
    CCObject *_object = NULL;
    CCArray *_displayDataList = _boneData->getDisplayList();
    CCARRAY_FOREACH(_displayDataList, _object)
    {
        DisplayData *_displayData = (DisplayData*)_object;
        
        DecorativeDisplay *_decoDisplay = DecorativeDisplay::create();
        _decoDisplay->setDisplayData(_displayData);
        
        CCObject *_display = NULL;
        _display = DisplayFactoryManager::getFactory((DisplayType)_displayData->getDisplayType())->createDisplay(m_pBone, _decoDisplay);
        
        m_pDecoDisplayList->addObject(_decoDisplay);

		changeDisplayByIndex(0,false);
		setDisplayRenderNode((CCNode*)_display);
    }
Пример #2
0
void DisplayManager::changeDisplayByIndex(int _index, bool _force)
{
    CCAssert(_index>=-1 && (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;
    
    /*
     *	m_iDisplayIndex == -1, it means you want to hide you display
     */
    if (-1 == m_iDisplayIndex)
    {
		setDisplayRenderNode(NULL);
        return;
    }
    
    
    DecorativeDisplay *_decoDisplay = (DecorativeDisplay*)m_pDecoDisplayList->objectAtIndex(m_iDisplayIndex);
    
    m_pCurrentDecoDisplay = _decoDisplay;
    
    DisplayFactoryManager::getFactory((DisplayType)_decoDisplay->getDisplayData()->getDisplayType())->changeDisplay(m_pBone, _decoDisplay);
    
}
Пример #3
0
void DisplayManager::removeDisplay(int _index)
{
    m_pDecoDisplayList->removeObjectAtIndex(_index);
    
    if(_index == m_iDisplayIndex)
    {
        setDisplayRenderNode(NULL);
    }
    
}
Пример #4
0
DisplayManager::~DisplayManager()
{
    
    CC_SAFE_RELEASE_NULL(m_pDecoDisplayList);
    setDisplayRenderNode(NULL);
}