2023-02-14 02:55:44 +00:00
|
|
|
#ifndef __BEHAVIORMESSAGEBASE__H__
|
|
|
|
#define __BEHAVIORMESSAGEBASE__H__
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
#include <string>
|
|
|
|
|
2023-05-13 22:22:00 +00:00
|
|
|
#include "Amf3.h"
|
2023-02-14 02:55:44 +00:00
|
|
|
#include "dCommonVars.h"
|
|
|
|
|
2023-02-16 17:30:33 +00:00
|
|
|
enum class BehaviorState : uint32_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The behaviorID target of this ControlBehaviors message
|
|
|
|
*
|
|
|
|
*/
|
2023-02-14 02:55:44 +00:00
|
|
|
class BehaviorMessageBase {
|
|
|
|
public:
|
2024-02-10 19:44:40 +00:00
|
|
|
static constexpr int32_t DefaultBehaviorId = -1;
|
|
|
|
[[nodiscard]] int32_t GetBehaviorId() const { return behaviorId; };
|
|
|
|
[[nodiscard]] bool IsDefaultBehaviorId() { return behaviorId == DefaultBehaviorId; };
|
|
|
|
BehaviorMessageBase(AMFArrayValue* const arguments);
|
2024-01-03 13:34:38 +00:00
|
|
|
protected:
|
2024-02-10 19:44:40 +00:00
|
|
|
[[nodiscard]] int32_t GetBehaviorIdFromArgument(AMFArrayValue* const arguments);
|
|
|
|
[[nodiscard]] int32_t GetActionIndexFromArgument(AMFArrayValue* const arguments, const std::string& keyName = "actionIndex") const;
|
2024-01-03 13:34:38 +00:00
|
|
|
int32_t behaviorId = DefaultBehaviorId;
|
2023-02-14 02:55:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //!__BEHAVIORMESSAGEBASE__H__
|