change interface

This commit is contained in:
yinkaile 2014-01-02 11:07:31 +08:00
parent 3f544b8fc4
commit 1f38fc28a6
8 changed files with 39 additions and 22 deletions

View File

@ -155,7 +155,7 @@ bool Armature::init(const std::string& name)
CC_BREAK_IF(!frameData);
bone->getTweenData()->copy(frameData);
bone->changeDisplayByIndex(frameData->displayIndex, false);
bone->changeDisplayWithIndex(frameData->displayIndex, false);
}
while (0);
}
@ -222,7 +222,7 @@ Bone *Armature::createBone(const std::string& boneName)
}
bone->setBoneData(boneData);
bone->getDisplayManager()->changeDisplayByIndex(-1, false);
bone->getDisplayManager()->changeDisplayWithIndex(-1, false);
return bone;
}

View File

@ -236,7 +236,7 @@ void ArmatureAnimation::play(const std::string& animationName, int durationTo,
if(!bone->isIgnoreMovementBoneData())
{
//! this bone is not include in this movement, so hide it
bone->getDisplayManager()->changeDisplayByIndex(-1, false);
bone->getDisplayManager()->changeDisplayWithIndex(-1, false);
tween->stop();
}

View File

@ -418,13 +418,22 @@ void Bone::removeDisplay(int index)
void Bone::changeDisplayByIndex(int index, bool force)
{
_displayManager->changeDisplayByIndex(index, force);
changeDisplayWithIndex(index, force);
}
void Bone::changeDisplayByName(const std::string& name, bool force)
void Bone::changeDisplayByName(const std::string &name, bool force)
{
_displayManager->changeDisplayByName(name, force);
changeDisplayWithName(name, force);
}
void Bone::changeDisplayWithIndex(int index, bool force)
{
_displayManager->changeDisplayWithIndex(index, force);
}
void Bone::changeDisplayWithName(const std::string& name, bool force)
{
_displayManager->changeDisplayWithName(name, force);
}
ColliderDetector* Bone::getColliderDetector() const

View File

@ -91,8 +91,11 @@ public:
void removeDisplay(int index);
void changeDisplayByIndex(int index, bool force);
void changeDisplayByName(const std::string& name, bool force);
CC_DEPRECATED_ATTRIBUTE void changeDisplayByIndex(int index, bool force);
CC_DEPRECATED_ATTRIBUTE void changeDisplayByName(const std::string& name, bool force);
void changeDisplayWithIndex(int index, bool force);
void changeDisplayWithName(const std::string& name, bool force);
/**
* Add a child to this bone, and it will let this child call setParent(Bone *parent) function to set self to it's parent

View File

@ -108,7 +108,7 @@ void DisplayManager::addDisplay(DisplayData *displayData, int index)
if(index == _displayIndex)
{
_displayIndex = -1;
changeDisplayByIndex(index, false);
changeDisplayWithIndex(index, false);
}
}
@ -193,7 +193,7 @@ void DisplayManager::addDisplay(Node *display, int index)
if(index == _displayIndex)
{
_displayIndex = -1;
changeDisplayByIndex(index, false);
changeDisplayWithIndex(index, false);
}
}
@ -213,7 +213,7 @@ const cocos2d::Vector<DecorativeDisplay*>& DisplayManager::getDecorativeDisplayL
return _decoDisplayList;
}
void DisplayManager::changeDisplayByIndex(int index, bool force)
void DisplayManager::changeDisplayWithIndex(int index, bool force)
{
CCASSERT( index < (int)_decoDisplayList.size(), "the _index value is out of range");
@ -243,13 +243,13 @@ void DisplayManager::changeDisplayByIndex(int index, bool force)
setCurrentDecorativeDisplay(decoDisplay);
}
void CCDisplayManager::changeDisplayByName(const std::string& name, bool force)
void CCDisplayManager::changeDisplayWithName(const std::string& name, bool force)
{
for (int i = 0; i<_decoDisplayList.size(); i++)
{
if (_decoDisplayList.at(i)->getDisplayData()->displayName == name)
{
changeDisplayByIndex(i, force);
changeDisplayWithIndex(i, force);
break;
}
}

View File

@ -74,6 +74,12 @@ public:
const cocos2d::Vector<DecorativeDisplay*>& getDecorativeDisplayList() const;
/*
* @deprecated, please use changeDisplayWithIndex and changeDisplayWithName
*/
CC_DEPRECATED_ATTRIBUTE void changeDisplayByIndex(int index, bool force);
CC_DEPRECATED_ATTRIBUTE void changeDisplayByName(const std::string& name, bool force);
/**
* Change display by index. You can just use this method to change display in the display list.
* The display list is just used for this bone, and it is the displays you may use in every frame.
@ -83,9 +89,8 @@ public:
* @param index The index of the display you want to change
* @param force If true, then force change display to specified display, or current display will set to display index edit in the flash every key frame.
*/
void changeDisplayByIndex(int index, bool force);
void changeDisplayByName(const std::string& name, bool force);
void changeDisplayWithIndex(int index, bool force);
void changeDisplayWithName(const std::string& name, bool force);
cocos2d::Node *getDisplayRenderNode() const;
DisplayType getDisplayRenderNodeType() const;

View File

@ -330,7 +330,7 @@ void Tween::arriveKeyFrame(FrameData *keyFrameData)
if (!displayManager->isForceChangeDisplay())
{
displayManager->changeDisplayByIndex(displayIndex, false);
displayManager->changeDisplayWithIndex(displayIndex, false);
}
//! Update bone zorder, bone's zorder is determined by frame zorder and bone zorder

View File

@ -635,7 +635,7 @@ void TestParticleDisplay::onEnter()
Bone *bone = Bone::create("p1");
bone->addDisplay(p1, 0);
bone->changeDisplayByIndex(0, true);
bone->changeDisplayWithIndex(0, true);
bone->setIgnoreMovementBoneData(true);
bone->setZOrder(100);
bone->setScale(1.2f);
@ -643,7 +643,7 @@ void TestParticleDisplay::onEnter()
bone = Bone::create("p2");
bone->addDisplay(p2, 0);
bone->changeDisplayByIndex(0, true);
bone->changeDisplayWithIndex(0, true);
bone->setIgnoreMovementBoneData(true);
bone->setZOrder(100);
bone->setScale(1.2f);
@ -727,7 +727,7 @@ void TestUseMutiplePicture::onTouchesEnded(const std::vector<Touch*>& touches,
{
++displayIndex;
displayIndex = (displayIndex) % 8;
armature->getBone("weapon")->changeDisplayByIndex(displayIndex, true);
armature->getBone("weapon")->changeDisplayWithIndex(displayIndex, true);
}
TestColliderDetector::~TestColliderDetector()
@ -1230,7 +1230,7 @@ void Hero::changeMount(Armature *armature)
//Add hero as a display to this bone
bone->addDisplay(this, 0);
//Change this bone's display
bone->changeDisplayByIndex(0, true);
bone->changeDisplayWithIndex(0, true);
bone->setIgnoreMovementBoneData(true);
setPosition(Point(0,0));