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-18 06:38:26 +00:00
|
|
|
static constexpr int32_t DefaultBehaviorId{ -1 };
|
2024-02-27 07:29:51 +00:00
|
|
|
BehaviorMessageBase(const AMFArrayValue& arguments) : m_BehaviorId{ GetBehaviorIdFromArgument(arguments) } {}
|
2024-02-18 06:38:26 +00:00
|
|
|
[[nodiscard]] int32_t GetBehaviorId() const noexcept { return m_BehaviorId; }
|
|
|
|
[[nodiscard]] bool IsDefaultBehaviorId() const noexcept { return m_BehaviorId == DefaultBehaviorId; }
|
|
|
|
|
2024-01-03 13:34:38 +00:00
|
|
|
protected:
|
2024-02-27 07:29:51 +00:00
|
|
|
[[nodiscard]] int32_t GetBehaviorIdFromArgument(const AMFArrayValue& arguments);
|
2024-11-19 02:45:24 +00:00
|
|
|
[[nodiscard]] int32_t GetActionIndexFromArgument(const AMFArrayValue& arguments, const std::string_view keyName = "actionIndex") const;
|
2024-02-18 06:38:26 +00:00
|
|
|
int32_t m_BehaviorId{ DefaultBehaviorId };
|
2023-02-14 02:55:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //!__BEHAVIORMESSAGEBASE__H__
|