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