mirror of https://github.com/axmolengine/axmol.git
fixed frame event
This commit is contained in:
parent
e060360d9b
commit
579bb3f8d8
|
@ -570,12 +570,22 @@ void EventFrame::init()
|
|||
|
||||
EventFrame::EventFrame()
|
||||
: _event("")
|
||||
, _action(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void EventFrame::setNode(cocos2d::Node* node)
|
||||
{
|
||||
Frame::setNode(node);
|
||||
_action = _timeline->getActionTimeline();
|
||||
}
|
||||
|
||||
void EventFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
||||
{
|
||||
if(currentFrameIndex>=_frameIndex)
|
||||
if(_frameIndex<_action->getStartFrame() || _frameIndex>_action->getEndFrame())
|
||||
return;
|
||||
|
||||
if(currentFrameIndex >= _frameIndex)
|
||||
emitEvent();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ THE SOFTWARE.
|
|||
NS_TIMELINE_BEGIN
|
||||
|
||||
class Timeline;
|
||||
class ActionTimeline;
|
||||
|
||||
class CC_STUDIO_DLL Frame : public cocos2d::Ref
|
||||
{
|
||||
|
@ -307,6 +308,8 @@ public:
|
|||
|
||||
EventFrame();
|
||||
|
||||
virtual void setNode(cocos2d::Node* node);
|
||||
|
||||
virtual void onEnter(Frame *nextFrame, int currentFrameIndex) override;
|
||||
virtual Frame* clone() override;
|
||||
|
||||
|
@ -315,6 +318,7 @@ public:
|
|||
|
||||
protected:
|
||||
std::string _event;
|
||||
ActionTimeline* _action;
|
||||
};
|
||||
|
||||
class CC_STUDIO_DLL ZOrderFrame : public Frame
|
||||
|
|
Loading…
Reference in New Issue