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); }
void DisplayManager::addDisplay(Node *display, int index) { DecorativeDisplay *decoDisplay = NULL; if(index >= 0 && (unsigned int)index < _decoDisplayList->count()) { decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index); } else { decoDisplay = DecorativeDisplay::create(); _decoDisplayList->addObject(decoDisplay); } DisplayData *displayData = NULL; if (Skin *skin = dynamic_cast<Skin *>(display)) { skin->setBone(_bone); displayData = SpriteDisplayData::create(); DisplayFactory::initSpriteDisplay(_bone, decoDisplay, skin->getDisplayName().c_str(), skin); if (SpriteDisplayData *spriteDisplayData = (SpriteDisplayData *)decoDisplay->getDisplayData()) { skin->setSkinData(spriteDisplayData->skinData); } else { BaseData baseData; skin->setSkinData(baseData); } } else if (dynamic_cast<ParticleSystemQuad *>(display)) { displayData = ParticleDisplayData::create(); } else if(Armature *armature = dynamic_cast<Armature *>(display)) { displayData = ArmatureDisplayData::create(); armature->setParentBone(_bone); } else { displayData = DisplayData::create(); } decoDisplay->setDisplay(display); decoDisplay->setDisplayData(displayData); //! if changed display index is current display index, then change current display to the new display if(index == _displayIndex) { _displayIndex = -1; changeDisplayByIndex(index, false); } }
void CCDisplayManager::addDisplay(CCNode *display, int index) { CCDecorativeDisplay *decoDisplay = NULL; if(index >= 0 && (unsigned int)index < m_pDecoDisplayList->count()) { decoDisplay = (CCDecorativeDisplay *)m_pDecoDisplayList->objectAtIndex(index); } else { decoDisplay = CCDecorativeDisplay::create(); m_pDecoDisplayList->addObject(decoDisplay); } CCDisplayData *displayData = NULL; if (CCSkin *skin = dynamic_cast<CCSkin *>(display)) { skin->setBone(m_pBone); displayData = CCSpriteDisplayData::create(); CCDisplayFactory::initSpriteDisplay(m_pBone, decoDisplay, skin->getDisplayName().c_str(), skin); if (CCSpriteDisplayData *spriteDisplayData = (CCSpriteDisplayData *)decoDisplay->getDisplayData()) { skin->setSkinData(spriteDisplayData->skinData); } else { CCBaseData baseData; skin->setSkinData(baseData); } } else if (dynamic_cast<CCParticleSystemQuad *>(display)) { displayData = CCParticleDisplayData::create(); } else if(CCArmature *armature = dynamic_cast<CCArmature *>(display)) { displayData = CCArmatureDisplayData::create(); armature->setParentBone(m_pBone); } else { displayData = CCDisplayData::create(); } decoDisplay->setDisplay(display); decoDisplay->setDisplayData(displayData); //! if changed display index is current display index, then change current display to the new display if(index == m_iDisplayIndex) { m_iDisplayIndex = -1; changeDisplayByIndex(index, false); } }
void DisplayManager::insertDisplay(DisplayData *_displayData, int _index) { DecorativeDisplay *_decoDisplay = NULL; _decoDisplay = DecorativeDisplay::create(); m_pDecoDisplayList->insertObject(_decoDisplay, _index); DisplayFactoryManager::getFactory((DisplayType)_displayData->getDisplayType())->addDisplay(m_pBone, _decoDisplay, _displayData); //! if changed display index is current display index, then change current display to the new display if(_index == m_iDisplayIndex) { m_iDisplayIndex = -1; changeDisplayByIndex(_index, false); } }
void DisplayManager::addDisplay(DisplayData *displayData, int index) { DecorativeDisplay *decoDisplay = NULL; if(index >= 0 && (unsigned int)index < _decoDisplayList->count()) { decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index); } else { decoDisplay = DecorativeDisplay::create(); _decoDisplayList->addObject(decoDisplay); } DisplayFactory::addDisplay(_bone, decoDisplay, displayData); //! if changed display index is current display index, then change current display to the new display if(index == _displayIndex) { _displayIndex = -1; changeDisplayByIndex(index, false); } }
void CCDisplayManager::addDisplay(CCDisplayData *displayData, int index) { CCDecorativeDisplay *decoDisplay = NULL; if(index >= 0 && (unsigned int)index < m_pDecoDisplayList->count()) { decoDisplay = (CCDecorativeDisplay *)m_pDecoDisplayList->objectAtIndex(index); } else { decoDisplay = CCDecorativeDisplay::create(); m_pDecoDisplayList->addObject(decoDisplay); } CCDisplayFactory::addDisplay(m_pBone, decoDisplay, displayData); //! if changed display index is current display index, then change current display to the new display if(index == m_iDisplayIndex) { m_iDisplayIndex = -1; changeDisplayByIndex(index, false); } }
void DisplayManager::addDisplay(DisplayData *_displayData, int _index) { DecorativeDisplay *_decoDisplay = NULL; if(_index >= 0 && _index < m_pDecoDisplayList->count()) { _decoDisplay = (DecorativeDisplay*)m_pDecoDisplayList->objectAtIndex(_index); } else { _decoDisplay = DecorativeDisplay::create(); m_pDecoDisplayList->addObject(_decoDisplay); } DisplayFactoryManager::getFactory((DisplayType)_displayData->getDisplayType())->addDisplay(m_pBone, _decoDisplay, _displayData); //! if changed display index is current display index, then change current display to the new display if(_index == m_iDisplayIndex) { m_iDisplayIndex = -1; changeDisplayByIndex(_index, false); } }