UiSerialize.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <LyShine/IDraw2d.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. #include <LyShine/Bus/UiTransform2dBus.h>
  12. #include <LyShine/Bus/UiLayoutBus.h>
  13. namespace UiSerialize
  14. {
  15. //! Define the Cry and UI types for the AZ Serialize system
  16. void ReflectUiTypes(AZ::ReflectContext* context);
  17. //! Wrapper class for animation system data file. This allows us to use the old Cry
  18. //! serialize for the animation data
  19. class AnimationData
  20. {
  21. public:
  22. virtual ~AnimationData() { }
  23. AZ_CLASS_ALLOCATOR(AnimationData, AZ::SystemAllocator);
  24. AZ_RTTI(AnimationData, "{FDC58CF7-8109-48F2-8D5D-BCBAF774ABB7}");
  25. AZStd::string m_serializeData;
  26. };
  27. //! Helper function for version conversion
  28. bool MoveToInteractableStateActions(
  29. AZ::SerializeContext& context,
  30. AZ::SerializeContext::DataElementNode& srcClassElement,
  31. const char* stateActionsElementName,
  32. const char* colorElementName,
  33. const char* alphaElementName,
  34. const char* spriteElementName);
  35. //! Setters for anchors
  36. void SetAnchorLeft(UiTransform2dInterface::Anchors* anchor, float left);
  37. void SetAnchorTop(UiTransform2dInterface::Anchors* anchor, float top);
  38. void SetAnchorRight(UiTransform2dInterface::Anchors* anchor, float right);
  39. void SetAnchorBottom(UiTransform2dInterface::Anchors* anchor, float bottom);
  40. void SetAnchors(UiTransform2dInterface::Anchors* anchor, float left, float top, float right, float bottom);
  41. //! Setters for offsets
  42. void SetOffsetLeft(UiTransform2dInterface::Offsets* offset, float left);
  43. void SetOffsetTop(UiTransform2dInterface::Offsets* offset, float top);
  44. void SetOffsetRight(UiTransform2dInterface::Offsets* offset, float right);
  45. void SetOffsetBottom(UiTransform2dInterface::Offsets* offset, float bottom);
  46. void SetOffsets(UiTransform2dInterface::Offsets* offset, float left, float top, float right, float bottom);
  47. //! Setters for padding
  48. void SetPaddingLeft(UiLayoutInterface::Padding* anchor, int left);
  49. void SetPaddingTop(UiLayoutInterface::Padding* anchor, int top);
  50. void SetPaddingRight(UiLayoutInterface::Padding* anchor, int right);
  51. void SetPaddingBottom(UiLayoutInterface::Padding* anchor, int bottom);
  52. void SetPadding(UiLayoutInterface::Padding* anchor, int left, int top, int right, int bottom);
  53. }