mirror of https://github.com/axmolengine/axmol.git
1.fixed frame event may forword emit
This commit is contained in:
parent
400cceeae8
commit
e7de544231
|
@ -79,7 +79,7 @@ VisibleFrame::VisibleFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void VisibleFrame::onEnter(Frame *nextFrame)
|
||||
void VisibleFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
_node->setVisible(_visible);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void TextureFrame::setNode(Node* node)
|
|||
_sprite = dynamic_cast<Sprite*>(node);
|
||||
}
|
||||
|
||||
void TextureFrame::onEnter(Frame *nextFrame)
|
||||
void TextureFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
if(_sprite)
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ RotationFrame::RotationFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void RotationFrame::onEnter(Frame *nextFrame)
|
||||
void RotationFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
_node->setRotation(_rotation);
|
||||
|
||||
|
@ -216,7 +216,7 @@ SkewFrame::SkewFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void SkewFrame::onEnter(Frame *nextFrame)
|
||||
void SkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
_node->setSkewX(_skewX);
|
||||
_node->setSkewY(_skewY);
|
||||
|
@ -271,7 +271,7 @@ RotationSkewFrame::RotationSkewFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void RotationSkewFrame::onEnter(Frame *nextFrame)
|
||||
void RotationSkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
_node->setRotationSkewX(_skewX);
|
||||
_node->setRotationSkewY(_skewY);
|
||||
|
@ -325,7 +325,7 @@ PositionFrame::PositionFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void PositionFrame::onEnter(Frame *nextFrame)
|
||||
void PositionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
_node->setPosition(_position);
|
||||
|
||||
|
@ -378,7 +378,7 @@ ScaleFrame::ScaleFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void ScaleFrame::onEnter(Frame *nextFrame)
|
||||
void ScaleFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
_node->setScaleX(_scaleX);
|
||||
_node->setScaleY(_scaleY);
|
||||
|
@ -432,7 +432,7 @@ AnchorPointFrame::AnchorPointFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void AnchorPointFrame::onEnter(Frame *nextFrame)
|
||||
void AnchorPointFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
_node->setAnchorPoint(_anchorPoint);
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ InnerActionFrame::InnerActionFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void InnerActionFrame::onEnter(Frame *nextFrame)
|
||||
void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -505,7 +505,7 @@ ColorFrame::ColorFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void ColorFrame::onEnter(Frame *nextFrame)
|
||||
void ColorFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
_node->setOpacity(_alpha);
|
||||
_node->setColor(_color);
|
||||
|
@ -573,8 +573,9 @@ EventFrame::EventFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void EventFrame::onEnter(Frame *nextFrame)
|
||||
void EventFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
if(currentFrameIndex>=_frameIndex)
|
||||
emitEvent();
|
||||
}
|
||||
|
||||
|
@ -608,7 +609,7 @@ ZOrderFrame::ZOrderFrame()
|
|||
{
|
||||
}
|
||||
|
||||
void ZOrderFrame::onEnter(Frame *nextFrame)
|
||||
void ZOrderFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
if(_node)
|
||||
_node->setLocalZOrder(_zorder);
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
virtual bool isEnterWhenPassed() { return _enterWhenPassed; }
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) = 0;
|
||||
virtual void onEnter(Frame* nextFrame, int currentFrameIndex) = 0;
|
||||
virtual void apply(float percent) {}
|
||||
|
||||
virtual Frame* clone() = 0;
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
|
||||
VisibleFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
inline void setVisible(bool visible) { _visible = visible;}
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
|
||||
virtual void setNode(cocos2d::Node* node);
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
inline void setTextureName(std::string textureName) { _textureName = textureName;}
|
||||
|
@ -122,7 +122,7 @@ public:
|
|||
|
||||
RotationFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual void apply(float percent) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
|
||||
SkewFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual void apply(float percent) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
|
||||
RotationSkewFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual void apply(float percent) override;
|
||||
virtual Frame* clone() override;
|
||||
};
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
|
||||
PositionFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual void apply(float percent) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
|
||||
ScaleFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual void apply(float percent) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
|
||||
AnchorPointFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
inline void setAnchorPoint(const cocos2d::Point& point) { _anchorPoint = point; }
|
||||
|
@ -257,7 +257,7 @@ public:
|
|||
static InnerActionFrame* create();
|
||||
InnerActionFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
inline void setInnerActionType(InnerActionType type) { _innerActionType = type; }
|
||||
|
@ -278,7 +278,7 @@ public:
|
|||
static ColorFrame* create();
|
||||
ColorFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual void apply(float percent) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
|
@ -307,7 +307,7 @@ public:
|
|||
|
||||
EventFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
inline void setEvent(std::string event) { _event = event;}
|
||||
|
@ -324,7 +324,7 @@ public:
|
|||
|
||||
ZOrderFrame();
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) override;
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
inline void setZOrder(int zorder) { _zorder = zorder;}
|
||||
|
|
|
@ -202,7 +202,7 @@ void Timeline::binarySearchKeyFrame(int frameIndex)
|
|||
if(needEnterFrame || _currentKeyFrame != from)
|
||||
{
|
||||
_currentKeyFrame = from;
|
||||
_currentKeyFrame->onEnter(to);
|
||||
_currentKeyFrame->onEnter(to, frameIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ void Timeline::updateCurrentKeyFrame(int frameIndex)
|
|||
if(frameIndex > from->getFrameIndex() && frameIndex < to->getFrameIndex())
|
||||
break;
|
||||
if(from->isEnterWhenPassed())
|
||||
from->onEnter(to);
|
||||
from->onEnter(to, from->getFrameIndex());
|
||||
}
|
||||
while (true);
|
||||
|
||||
|
@ -266,7 +266,7 @@ void Timeline::updateCurrentKeyFrame(int frameIndex)
|
|||
} while (0);
|
||||
|
||||
_currentKeyFrame = from;
|
||||
_currentKeyFrame->onEnter(to);
|
||||
_currentKeyFrame->onEnter(to, frameIndex);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue