| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- /*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
- #pragma once
- #include <LyShine/Bus/UiInteractableBus.h>
- #include <LyShine/Bus/UiButtonBus.h>
- #include <LyShine/UiComponentTypes.h>
- #include "UiInteractableComponent.h"
- #include <AzCore/Serialization/SerializeContext.h>
- #include <AzCore/Math/Vector3.h>
- #include <LmbrCentral/Rendering/TextureAsset.h>
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- class UiButtonComponent
- : public UiInteractableComponent
- , public UiButtonBus::Handler
- {
- public: // member functions
- AZ_COMPONENT(UiButtonComponent, LyShine::UiButtonComponentUuid, UiInteractableComponent);
- UiButtonComponent();
- ~UiButtonComponent() override;
- // UiInteractableInterface
- bool HandleReleased(AZ::Vector2 point) override;
- bool HandleEnterReleased() override;
- // ~UiInteractableInterface
- // UiButtonInterface
- OnClickCallback GetOnClickCallback() override;
- void SetOnClickCallback(OnClickCallback onClick) override;
- const LyShine::ActionName& GetOnClickActionName() override;
- void SetOnClickActionName(const LyShine::ActionName& actionName) override;
- // ~UiButtonInterface
- protected: // member functions
- // AZ::Component
- void Activate() override;
- void Deactivate() override;
- // ~AZ::Component
- protected: // static member functions
- static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
- {
- provided.push_back(AZ_CRC("UiInteractableService", 0x1d474c98));
- provided.push_back(AZ_CRC("UiNavigationService"));
- provided.push_back(AZ_CRC("UiStateActionsService"));
- }
- static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
- {
- incompatible.push_back(AZ_CRC("UiInteractableService", 0x1d474c98));
- incompatible.push_back(AZ_CRC("UiNavigationService"));
- incompatible.push_back(AZ_CRC("UiStateActionsService"));
- }
- static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
- {
- required.push_back(AZ_CRC("UiElementService", 0x3dca7ad4));
- required.push_back(AZ_CRC("UiTransformService", 0x3a838e34));
- }
- static void Reflect(AZ::ReflectContext* context);
- private: // member functions
- AZ_DISABLE_COPY_MOVE(UiButtonComponent);
- bool HandleReleasedCommon(const AZ::Vector2& point);
- private: // static member functions
- static bool VersionConverter(AZ::SerializeContext& context,
- AZ::SerializeContext::DataElementNode& classElement);
- private: // data
- OnClickCallback m_onClick;
- LyShine::ActionName m_actionName;
- };
|