Sequences

This commit is contained in:
Josef 2024-05-12 18:25:45 +02:00
parent 26aea1a20d
commit 9d3814f8d4
7 changed files with 66 additions and 26 deletions

View File

@ -1,7 +1,7 @@
/* RJAction.h */
#ifndef ROKOJORI_CORE__ACTION_H
#define ROKOJORI_CORE__ACTION_H
#ifndef ROKOJORI__ACTION_H
#define ROKOJORI__ACTION_H
#include "./RJNetworkNode.h"
@ -25,4 +25,4 @@ public:
};
#endif // ROKOJORI_CORE__ACTION_H
#endif // ROKOJORI__ACTION_H

View File

@ -1,7 +1,7 @@
/* RJNetworkNode.h */
#ifndef ROKOJORI_CORE__NETWORK_NODE_H
#define ROKOJORI_CORE__NETWORK_NODE_H
#ifndef ROKOJORI__NETWORK_NODE_H
#define ROKOJORI__NETWORK_NODE_H
#include "scene/main/node.h"
@ -20,4 +20,4 @@ public:
};
#endif // ROKOJORI_CORE__NETWORK_NODE_H
#endif // ROKOJORI__NETWORK_NODE_H

View File

@ -1,7 +1,7 @@
/* RJSelector.h */
#ifndef ROKOJORI_CORE__SELECTOR_H
#define ROKOJORI_CORE__SELECTOR_H
#ifndef ROKOJORI__SELECTOR_H
#define ROKOJORI__SELECTOR_H
#include "scene/main/node.h"
#include "core/io/resource.h"
@ -24,4 +24,4 @@ public:
};
#endif // ROKOJORI_CORE__SELECTOR_H
#endif // ROKOJORI__SELECTOR_H

View File

@ -1,7 +1,7 @@
/* RJSensor.h */
#ifndef ROKOJORI_CORE__SENSOR_H
#define ROKOJORI_CORE__SENSOR_H
#ifndef ROKOJORI__SENSOR_H
#define ROKOJORI__SENSOR_H
#include "./RJNetworkNode.h"
@ -25,4 +25,4 @@ public:
};
#endif // ROKOJORI_CORE__SENSOR_H
#endif // ROKOJORI__SENSOR_H

View File

@ -6,16 +6,48 @@
void RJSequenceAction::_bind_methods()
{
GDVIRTUAL_BIND( dispatchStartEvent );
GDVIRTUAL_BIND( dispatchCancelEvent );
GDVIRTUAL_BIND( dispatchEndEvent );
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") ) );
}
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()
{

View File

@ -1,8 +1,9 @@
/* RJSequenceAction.h */
#ifndef ROKOJORI_CORE__SEQUENCE_ACTION_H
#define ROKOJORI_CORE__SEQUENCE_ACTION_H
#ifndef ROKOJORI__SEQUENCE_ACTION_H
#define ROKOJORI__SEQUENCE_ACTION_H
#include "./RJAction.h"
@ -14,12 +15,18 @@ class RJSequenceAction : public RJAction
protected:
static void _bind_methods();
int idCounter = 0;
public:
GDVIRTUAL0( dispatchStartEvent );
GDVIRTUAL0( dispatchCancelEvent );
GDVIRTUAL0( dispatchEndEvent );
int dispatchStart();
void dispatchCancelled( int id );
void dispatchEnd( int id );
int getLastSequenceActionID();
GDVIRTUAL1( cancelAction, int );
/* signal onSequenceDone */
RJSequenceAction();
@ -27,4 +34,4 @@ public:
};
#endif // ROKOJORI_CORE__SEQUENCE_ACTION_H
#endif // ROKOJORI__SEQUENCE_ACTION_H

View File

@ -1,8 +1,9 @@
/* RJUpdatable.h */
#ifndef ROKOJORI_CORE__UPDATABLE_H
#define ROKOJORI_CORE__UPDATABLE_H
#ifndef ROKOJORI__UPDATABLE_H
#define ROKOJORI__UPDATABLE_H
#include "./RJNetworkNode.h"
@ -25,4 +26,4 @@ public:
};
#endif // ROKOJORI_CORE__UPDATABLE_H
#endif // ROKOJORI__UPDATABLE_H