rj-action-library-cpp/RJSequenceAction.cpp

56 lines
1.1 KiB
C++
Raw Normal View History

2024-05-08 07:17:37 +00:00
/* RJSequenceAction.cpp */
#include "RJSequenceAction.h"
void RJSequenceAction::_bind_methods()
{
2024-05-12 16:25:45 +00:00
GDVIRTUAL_BIND( cancelAction );
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") ) );
2024-05-08 07:17:37 +00:00
}
2024-05-12 16:25:45 +00:00
int RJSequenceAction::dispatchStart()
2024-05-08 07:17:37 +00:00
{
2024-05-12 16:25:45 +00:00
if ( idCounter > 1000000 )
{
idCounter = 0;
}
2024-05-08 07:17:37 +00:00
2024-05-12 16:25:45 +00:00
idCounter++;
return idCounter;
}
int RJSequenceAction::getLastSequenceActionID()
{
return idCounter;
}
void RJSequenceAction::dispatchCancelled( int id )
{
emit_signal( SNAME( "onSequenceDone" ), id, false );
2024-05-08 07:17:37 +00:00
}
2024-05-12 16:25:45 +00:00
void RJSequenceAction::dispatchEnd( int id )
{
emit_signal( SNAME( "onSequenceDone" ), id, true );
}
RJSequenceAction::RJSequenceAction()
{
}
2024-05-08 07:17:37 +00:00
RJSequenceAction::~RJSequenceAction()
{
}