2023-02-16 17:30:33 +00:00
|
|
|
#include "StripUiPosition.h"
|
|
|
|
|
2023-05-13 22:22:00 +00:00
|
|
|
#include "Amf3.h"
|
2024-05-18 09:05:55 +00:00
|
|
|
#include "tinyxml2.h"
|
2023-02-16 17:30:33 +00:00
|
|
|
|
2024-02-27 07:29:51 +00:00
|
|
|
StripUiPosition::StripUiPosition(const AMFArrayValue& arguments, const std::string& uiKeyName) {
|
|
|
|
const auto* const uiArray = arguments.GetArray(uiKeyName);
|
2023-02-16 17:30:33 +00:00
|
|
|
if (!uiArray) return;
|
|
|
|
|
2024-02-18 06:38:26 +00:00
|
|
|
const auto* const xPositionValue = uiArray->Get<double>("x");
|
|
|
|
if (!xPositionValue) return;
|
|
|
|
|
|
|
|
const auto* const yPositionValue = uiArray->Get<double>("y");
|
|
|
|
if (!yPositionValue) return;
|
2023-02-16 17:30:33 +00:00
|
|
|
|
2024-02-18 06:38:26 +00:00
|
|
|
m_YPosition = yPositionValue->GetValue();
|
|
|
|
m_XPosition = xPositionValue->GetValue();
|
2023-02-16 17:30:33 +00:00
|
|
|
}
|
2024-01-03 13:34:38 +00:00
|
|
|
|
|
|
|
void StripUiPosition::SendBehaviorBlocksToClient(AMFArrayValue& args) const {
|
2024-02-18 06:38:26 +00:00
|
|
|
auto* const uiArgs = args.InsertArray("ui");
|
|
|
|
uiArgs->Insert("x", m_XPosition);
|
|
|
|
uiArgs->Insert("y", m_YPosition);
|
2024-01-03 13:34:38 +00:00
|
|
|
}
|
2024-05-18 09:05:55 +00:00
|
|
|
|
|
|
|
void StripUiPosition::Serialize(tinyxml2::XMLElement& position) const {
|
|
|
|
position.SetAttribute("x", m_XPosition);
|
|
|
|
position.SetAttribute("y", m_YPosition);
|
|
|
|
}
|