Cocos2d-x  v3.17
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
ActionManager Class Reference

ActionManager is a singleton that manages all the actions. More...

Inherits Ref.

Public Member Functions

virtual void addAction (Action *action, Node *target, bool paused)
 Adds an action with a target. More...
 
var addAction ( var action, var target, var paused)
 Adds an action with a target. More...
 
local addAction ( local action, local target, local paused)
 Adds an action with a target. More...
 
virtual void removeAllActions ()
 Removes all actions from all the targets.
 
local removeAllActions ()
 Removes all actions from all the targets.
 
virtual void removeAllActionsFromTarget (Node *target)
 Removes all actions from a certain target. More...
 
virtual void removeAction (Action *action)
 Removes an action given an action reference. More...
 
virtual void removeActionByTag (int tag, Node *target)
 Removes an action given its tag and the target. More...
 
local removeActionByTag ( local tag, local target)
 Removes an action given its tag and the target. More...
 
virtual void removeAllActionsByTag (int tag, Node *target)
 Removes all actions given its tag and the target. More...
 
virtual void removeActionsByFlags (unsigned int flags, Node *target)
 Removes all actions matching at least one bit in flags and the target. More...
 
virtual ActiongetActionByTag (int tag, const Node *target) const
 Gets an action given its tag an a target. More...
 
var getActionByTag ( var tag, var target)
 Gets an action given its tag an a target. More...
 
local getActionByTag ( local tag, local target)
 Gets an action given its tag an a target. More...
 
virtual ssize_t getNumberOfRunningActionsInTarget (const Node *target) const
 Returns the numbers of actions that are running in a certain target. More...
 
virtual ssize_t getNumberOfRunningActions () const
 Returns the numbers of actions that are running in all targets. More...
 
local getNumberOfRunningActions ()
 Returns the numbers of actions that are running in all targets. More...
 
ssize_t numberOfRunningActionsInTarget (Node *target) const
var numberOfRunningActionsInTarget ( var target)
local numberOfRunningActionsInTarget ( local target)
virtual size_t getNumberOfRunningActionsInTargetByTag (const Node *target, int tag)
 Returns the numbers of actions that are running in a certain target with a specific tag. More...
 
local getNumberOfRunningActionsInTargetByTag ( local target, local tag)
 Returns the numbers of actions that are running in a certain target with a specific tag. More...
 
virtual void pauseTarget (Node *target)
 Pauses the target: all running actions and newly added actions will be paused. More...
 
virtual void resumeTarget (Node *target)
 Resumes the target. More...
 
virtual Vector< Node * > pauseAllRunningActions ()
 Pauses all running actions, returning a list of targets whose actions were paused. More...
 
virtual void resumeTargets (const Vector< Node * > &targetsToResume)
 Resume a set of targets (convenience function to reverse a pauseAllRunningActions call). More...
 
var resumeTargets ( var targetsToResume)
 Resume a set of targets (convenience function to reverse a pauseAllRunningActions call). More...
 
local resumeTargets ( local targetsToResume)
 Resume a set of targets (convenience function to reverse a pauseAllRunningActions call). More...
 
virtual void update (float dt)
 Main loop of ActionManager. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
local release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

ActionManager is a singleton that manages all the actions.

Normally you won't need to use this singleton directly. 99% of the cases you will use the Node interface, which uses this singleton. But there are some cases where you might need to use this singleton. Examples:

  • When you want to run an action where the target is different from a Node.
  • When you want to pause / resume the actions.
Since
v0.8

Member Function Documentation

virtual void addAction ( Action action,
Node target,
bool  paused 
)
virtual

Adds an action with a target.

If the target is already present, then the action will be added to the existing target. If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target. When the target is paused, the queued actions won't be 'ticked'.

Parameters
actionA certain action.
targetThe target which need to be added an action.
pausedIs the target paused or not.
var addAction ( var  action,
var  target,
var  paused 
)
virtual

Adds an action with a target.

If the target is already present, then the action will be added to the existing target. If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target. When the target is paused, the queued actions won't be 'ticked'.

Parameters
actionA certain action.
targetThe target which need to be added an action.
pausedIs the target paused or not.
local addAction ( local  action,
local  target,
local  paused 
)
virtual

Adds an action with a target.

If the target is already present, then the action will be added to the existing target. If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target. When the target is paused, the queued actions won't be 'ticked'.

Parameters
actionA certain action.
targetThe target which need to be added an action.
pausedIs the target paused or not.
virtual void
removeAllActionsFromTarget
( Node target)
virtual

Removes all actions from a certain target.

All the actions that belongs to the target will be removed.

Parameters
targetA certain target.
var removeAllActionsFromTarget ( var  target)
virtual

Removes all actions from a certain target.

All the actions that belongs to the target will be removed.

Parameters
targetA certain target.
local removeAllActionsFromTarget ( local  target)
virtual

Removes all actions from a certain target.

All the actions that belongs to the target will be removed.

Parameters
targetA certain target.
virtual void removeAction ( Action action)
virtual

Removes an action given an action reference.

Parameters
actionA certain target.
var removeAction ( var  action)
virtual

Removes an action given an action reference.

Parameters
actionA certain target.
local removeAction ( local  action)
virtual

Removes an action given an action reference.

Parameters
actionA certain target.
virtual void removeActionByTag ( int  tag,
Node target 
)
virtual

Removes an action given its tag and the target.

Parameters
tagThe action's tag.
targetA certain target.
var removeActionByTag ( var  tag,
var  target 
)
virtual

Removes an action given its tag and the target.

Parameters
tagThe action's tag.
targetA certain target.
local removeActionByTag ( local  tag,
local  target 
)
virtual

Removes an action given its tag and the target.

Parameters
tagThe action's tag.
targetA certain target.
virtual void removeAllActionsByTag ( int  tag,
Node target 
)
virtual

Removes all actions given its tag and the target.

Parameters
tagThe actions' tag.
targetA certain target.
local removeAllActionsByTag ( local  tag,
local  target 
)
virtual

Removes all actions given its tag and the target.

Parameters
tagThe actions' tag.
targetA certain target.
virtual void removeActionsByFlags ( unsigned int  flags,
Node target 
)
virtual

Removes all actions matching at least one bit in flags and the target.

Parameters
flagsThe flag field to match the actions' flags based on bitwise AND.
targetA certain target.
local removeActionsByFlags ( local  flags,
local  target 
)
virtual

Removes all actions matching at least one bit in flags and the target.

Parameters
flagsThe flag field to match the actions' flags based on bitwise AND.
targetA certain target.
virtual Action* getActionByTag ( int  tag,
const Node target 
) const
virtual

Gets an action given its tag an a target.

Parameters
tagThe action's tag.
targetA certain target.
Returns
The Action the with the given tag.
var getActionByTag ( var  tag,
var  target 
)
virtual

Gets an action given its tag an a target.

Parameters
tagThe action's tag.
targetA certain target.
Returns
The Action the with the given tag.
local getActionByTag ( local  tag,
local  target 
)
virtual

Gets an action given its tag an a target.

Parameters
tagThe action's tag.
targetA certain target.
Returns
The Action the with the given tag.
virtual ssize_t
getNumberOfRunningActionsInTarget
( const Node target) const
virtual

Returns the numbers of actions that are running in a certain target.

Composable actions are counted as 1 action. Example:

  • If you are running 1 Sequence of 7 actions, it will return 1.
  • If you are running 7 Sequences of 2 actions, it will return 7.
Parameters
targetA certain target.
Returns
The numbers of actions that are running in a certain target.
local
getNumberOfRunningActionsInTarget
( local  target)
virtual

Returns the numbers of actions that are running in a certain target.

Composable actions are counted as 1 action. Example:

  • If you are running 1 Sequence of 7 actions, it will return 1.
  • If you are running 7 Sequences of 2 actions, it will return 7.
Parameters
targetA certain target.
Returns
The numbers of actions that are running in a certain target.
virtual ssize_t
getNumberOfRunningActions
( ) const
virtual

Returns the numbers of actions that are running in all targets.

Returns
The numbers of actions that are running in all target.
local getNumberOfRunningActions ( )
virtual

Returns the numbers of actions that are running in all targets.

Returns
The numbers of actions that are running in all target.
ssize_t
numberOfRunningActionsInTarget
( Node target) const
inline
var numberOfRunningActionsInTarget ( var  target)
inline
local
numberOfRunningActionsInTarget
( local  target)
inline
virtual size_t
getNumberOfRunningActionsInTargetByTag
( const Node target,
int  tag 
)
virtual

Returns the numbers of actions that are running in a certain target with a specific tag.

Like getNumberOfRunningActionsInTarget Composable actions are counted as 1 action. Example:

  • If you are running 1 Sequence of 7 actions, it will return 1.
  • If you are running 7 Sequences of 2 actions, it will return 7.
Parameters
targetA certain target.
tagTag that will be searched.
Returns
The numbers of actions that are running in a certain target with a specific tag.
See also
getNumberOfRunningActionsInTarget
local
getNumberOfRunningActionsInTargetByTag
( local  target,
local  tag 
)
virtual

Returns the numbers of actions that are running in a certain target with a specific tag.

Like getNumberOfRunningActionsInTarget Composable actions are counted as 1 action. Example:

  • If you are running 1 Sequence of 7 actions, it will return 1.
  • If you are running 7 Sequences of 2 actions, it will return 7.
Parameters
targetA certain target.
tagTag that will be searched.
Returns
The numbers of actions that are running in a certain target with a specific tag.
See also
getNumberOfRunningActionsInTarget
virtual void pauseTarget ( Node target)
virtual

Pauses the target: all running actions and newly added actions will be paused.

Parameters
targetA certain target.
var pauseTarget ( var  target)
virtual

Pauses the target: all running actions and newly added actions will be paused.

Parameters
targetA certain target.
local pauseTarget ( local  target)
virtual

Pauses the target: all running actions and newly added actions will be paused.

Parameters
targetA certain target.
virtual void resumeTarget ( Node target)
virtual

Resumes the target.

All queued actions will be resumed.

Parameters
targetA certain target.
var resumeTarget ( var  target)
virtual

Resumes the target.

All queued actions will be resumed.

Parameters
targetA certain target.
local resumeTarget ( local  target)
virtual

Resumes the target.

All queued actions will be resumed.

Parameters
targetA certain target.
virtual Vector<Node*>
pauseAllRunningActions
( )
virtual

Pauses all running actions, returning a list of targets whose actions were paused.

Returns
A list of targets whose actions were paused.
var pauseAllRunningActions ( )
virtual

Pauses all running actions, returning a list of targets whose actions were paused.

Returns
A list of targets whose actions were paused.
local pauseAllRunningActions ( )
virtual

Pauses all running actions, returning a list of targets whose actions were paused.

Returns
A list of targets whose actions were paused.
virtual void resumeTargets ( const Vector< Node * > &  targetsToResume)
virtual

Resume a set of targets (convenience function to reverse a pauseAllRunningActions call).

Parameters
targetsToResumeA set of targets need to be resumed.
var resumeTargets ( var  targetsToResume)
virtual

Resume a set of targets (convenience function to reverse a pauseAllRunningActions call).

Parameters
targetsToResumeA set of targets need to be resumed.
local resumeTargets ( local  targetsToResume)
virtual

Resume a set of targets (convenience function to reverse a pauseAllRunningActions call).

Parameters
targetsToResumeA set of targets need to be resumed.
virtual void update ( float  dt)
virtual

Main loop of ActionManager.

Parameters
dtIn seconds.
var update ( var  dt)
virtual

Main loop of ActionManager.

Parameters
dtIn seconds.
local update ( local  dt)
virtual

Main loop of ActionManager.

Parameters
dtIn seconds.

The documentation for this class was generated from the following file: