mirror of https://github.com/axmolengine/axmol.git
fix the issue the sequence action will not be invoked (#17906)
* fix the issue the sequence action will not be invoked * add comment * update _done in update() function
This commit is contained in:
parent
84463dbab4
commit
61386b0a40
|
@ -62,12 +62,11 @@ void ActionInstant::step(float /*dt*/)
|
|||
}
|
||||
#endif
|
||||
update(updateDt);
|
||||
_done = true;
|
||||
}
|
||||
|
||||
void ActionInstant::update(float /*time*/)
|
||||
{
|
||||
// nothing
|
||||
_done = true;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -86,8 +85,9 @@ Show* Show::create()
|
|||
return ret;
|
||||
}
|
||||
|
||||
void Show::update(float /*time*/)
|
||||
void Show::update(float time)
|
||||
{
|
||||
ActionInstant::update(time);
|
||||
_target->setVisible(true);
|
||||
}
|
||||
|
||||
|
@ -117,8 +117,9 @@ Hide * Hide::create()
|
|||
return ret;
|
||||
}
|
||||
|
||||
void Hide::update(float /*time*/)
|
||||
void Hide::update(float time)
|
||||
{
|
||||
ActionInstant::update(time);
|
||||
_target->setVisible(false);
|
||||
}
|
||||
|
||||
|
@ -148,8 +149,9 @@ ToggleVisibility * ToggleVisibility::create()
|
|||
return ret;
|
||||
}
|
||||
|
||||
void ToggleVisibility::update(float /*time*/)
|
||||
void ToggleVisibility::update(float time)
|
||||
{
|
||||
ActionInstant::update(time);
|
||||
_target->setVisible(!_target->isVisible());
|
||||
}
|
||||
|
||||
|
@ -185,8 +187,9 @@ bool RemoveSelf::init(bool isNeedCleanUp)
|
|||
return true;
|
||||
}
|
||||
|
||||
void RemoveSelf::update(float /*time*/)
|
||||
void RemoveSelf::update(float time)
|
||||
{
|
||||
ActionInstant::update(time);
|
||||
_target->removeFromParentAndCleanup(_isNeedCleanUp);
|
||||
}
|
||||
|
||||
|
@ -225,8 +228,9 @@ bool FlipX::initWithFlipX(bool x)
|
|||
return true;
|
||||
}
|
||||
|
||||
void FlipX::update(float /*time*/)
|
||||
void FlipX::update(float time)
|
||||
{
|
||||
ActionInstant::update(time);
|
||||
static_cast<Sprite*>(_target)->setFlippedX(_flipX);
|
||||
}
|
||||
|
||||
|
@ -264,8 +268,9 @@ bool FlipY::initWithFlipY(bool y)
|
|||
return true;
|
||||
}
|
||||
|
||||
void FlipY::update(float /*time*/)
|
||||
void FlipY::update(float time)
|
||||
{
|
||||
ActionInstant::update(time);
|
||||
static_cast<Sprite*>(_target)->setFlippedY(_flipY);
|
||||
}
|
||||
|
||||
|
@ -316,8 +321,9 @@ Place * Place::reverse() const
|
|||
return this->clone();
|
||||
}
|
||||
|
||||
void Place::update(float /*time*/)
|
||||
void Place::update(float time)
|
||||
{
|
||||
ActionInstant::update(time);
|
||||
_target->setPosition(_position);
|
||||
}
|
||||
|
||||
|
@ -405,8 +411,9 @@ CallFunc * CallFunc::reverse() const
|
|||
return this->clone();
|
||||
}
|
||||
|
||||
void CallFunc::update(float /*time*/)
|
||||
void CallFunc::update(float time)
|
||||
{
|
||||
ActionInstant::update(time);
|
||||
this->execute();
|
||||
}
|
||||
|
||||
|
|
|
@ -285,6 +285,12 @@ bool Sequence::initWithTwoActions(FiniteTimeAction *actionOne, FiniteTimeAction
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Sequence::isDone() const
|
||||
{
|
||||
// fix issue #17884
|
||||
return (ActionInterval::isDone() && _actions[1]->isDone());
|
||||
}
|
||||
|
||||
Sequence* Sequence::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
|
|
|
@ -185,6 +185,7 @@ public:
|
|||
virtual Sequence* reverse() const override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void stop(void) override;
|
||||
virtual bool isDone() const override;
|
||||
/**
|
||||
* @param t In seconds.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue