rj-action-library-cpp/RJSequenceAction.cpp

56 lines
1.1 KiB
C++

/* RJSequenceAction.cpp */
#include "RJSequenceAction.h"
void RJSequenceAction::_bind_methods()
{
GDVIRTUAL_BIND( cancelAction, "id" );
ClassDB::bind_method( D_METHOD( "dispatchStart" ) , &RJSequenceAction::dispatchStart );
ClassDB::bind_method( D_METHOD( "dispatchCancelled" ) , &RJSequenceAction::dispatchCancelled );
ClassDB::bind_method( D_METHOD( "dispatchEnd" ) , &RJSequenceAction::dispatchEnd );
ClassDB::bind_method( D_METHOD( "getLastSequenceActionID" ) , &RJSequenceAction::getLastSequenceActionID );
ADD_SIGNAL (MethodInfo( "onSequenceDone" , PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::BOOL, "success") ) );
}
int RJSequenceAction::dispatchStart()
{
if ( idCounter > 1000000 )
{
idCounter = 0;
}
idCounter++;
return idCounter;
}
int RJSequenceAction::getLastSequenceActionID()
{
return idCounter;
}
void RJSequenceAction::dispatchCancelled( int id )
{
emit_signal( SNAME( "onSequenceDone" ), id, false );
}
void RJSequenceAction::dispatchEnd( int id )
{
emit_signal( SNAME( "onSequenceDone" ), id, true );
}
RJSequenceAction::RJSequenceAction()
{
}
RJSequenceAction::~RJSequenceAction()
{
}