2023-02-16 17:30:33 +00:00
|
|
|
#include "StripUiPosition.h"
|
|
|
|
|
2023-05-13 22:22:00 +00:00
|
|
|
#include "Amf3.h"
|
2023-02-16 17:30:33 +00:00
|
|
|
|
|
|
|
StripUiPosition::StripUiPosition() {
|
|
|
|
xPosition = 0.0;
|
|
|
|
yPosition = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
StripUiPosition::StripUiPosition(AMFArrayValue* arguments, std::string uiKeyName) {
|
|
|
|
xPosition = 0.0;
|
|
|
|
yPosition = 0.0;
|
2023-05-13 22:22:00 +00:00
|
|
|
auto* uiArray = arguments->GetArray(uiKeyName);
|
2023-02-16 17:30:33 +00:00
|
|
|
if (!uiArray) return;
|
|
|
|
|
2023-05-13 22:22:00 +00:00
|
|
|
auto* xPositionValue = uiArray->Get<double>("x");
|
|
|
|
auto* yPositionValue = uiArray->Get<double>("y");
|
2023-02-16 17:30:33 +00:00
|
|
|
if (!xPositionValue || !yPositionValue) return;
|
|
|
|
|
2023-05-13 22:22:00 +00:00
|
|
|
yPosition = yPositionValue->GetValue();
|
|
|
|
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 {
|
|
|
|
auto* uiArgs = args.InsertArray("ui");
|
|
|
|
uiArgs->Insert("x", xPosition);
|
|
|
|
uiArgs->Insert("y", yPosition);
|
|
|
|
}
|