Merge branch 'development' into redcode/driller_removal
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -35,7 +35,6 @@
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/INavigationSystem.h>
|
||||
#include <CryCommon/LyShine/ILyShine.h>
|
||||
#include <CryCommon/MainThreadRenderRequestBus.h>
|
||||
|
||||
// Editor
|
||||
@@ -595,13 +594,6 @@ void CGameEngine::SwitchToInEditor()
|
||||
// Enable accelerators.
|
||||
GetIEditor()->EnableAcceleratos(true);
|
||||
|
||||
|
||||
// reset UI system
|
||||
if (gEnv->pLyShine)
|
||||
{
|
||||
gEnv->pLyShine->Reset();
|
||||
}
|
||||
|
||||
// [Anton] - order changed, see comments for CGameEngine::SetSimulationMode
|
||||
//! Send event to switch out of game.
|
||||
GetIEditor()->GetObjectManager()->SendEvent(EVENT_OUTOFGAME);
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/EBus/EBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
class UndoStack;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that the UI Editor needs to implement
|
||||
class UiEditorDLLInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorDLLInterface(){}
|
||||
|
||||
//! Get the selected elements in the UiEditor
|
||||
virtual LyShine::EntityArray GetSelectedElements() = 0;
|
||||
|
||||
//! Get the id of the active Canvas the UiEditor
|
||||
virtual AZ::EntityId GetActiveCanvasId() = 0;
|
||||
|
||||
//! Get the active undo stack for the UI Editor
|
||||
virtual UndoStack* GetActiveUndoStack() = 0;
|
||||
|
||||
//! Soft-switch to the given file. Note that this should prompt for unsaved changes, etc.
|
||||
virtual void OpenSourceCanvasFile(QString absolutePathToFile) = 0;
|
||||
|
||||
public: // static member functions
|
||||
|
||||
static const char* GetUniqueName() { return "UiEditorDLLInterface"; }
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorDLLInterface> UiEditorDLLBus;
|
||||
@@ -13,7 +13,6 @@ set(FILES
|
||||
EditorCommonAPI.h
|
||||
ActionOutput.h
|
||||
ActionOutput.cpp
|
||||
UiEditorDLLBus.h
|
||||
DockTitleBarWidget.cpp
|
||||
DockTitleBarWidget.h
|
||||
SaveUtilities/AsyncSaveRunner.h
|
||||
|
||||
@@ -29,6 +29,13 @@ namespace InputUnitTests
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class InputTest : public ScopedAllocatorSetupFixture
|
||||
{
|
||||
public:
|
||||
InputTest() : ScopedAllocatorSetupFixture()
|
||||
{
|
||||
// Many input tests are only valid if the GamePad device is supported on this platform.
|
||||
m_gamepadSupported = InputDeviceGamepad::GetMaxSupportedGamepads() > 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void SetUp() override
|
||||
@@ -46,6 +53,7 @@ namespace InputUnitTests
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AZStd::unique_ptr<InputSystemComponent> m_inputSystemComponent;
|
||||
bool m_gamepadSupported;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -78,12 +86,17 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputContext_ActivateDeactivate_Successfull)
|
||||
#else
|
||||
TEST_F(InputTest, InputContext_ActivateDeactivate_Successfull)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputContext_ActivateDeactivate_Successfull";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputContext_ActivateDeactivate_Successfull";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
// Create an input context (they are inactive by default).
|
||||
InputContext inputContext("TestInputContext");
|
||||
|
||||
@@ -148,12 +161,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputContext_AddRemoveInputMapping_Successfull)
|
||||
#else
|
||||
TEST_F(InputTest, InputContext_AddRemoveInputMapping_Successfull)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputContext_AddRemoveInputMapping_Successfull";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputContext_AddRemoveInputMapping_Successfull";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -256,12 +275,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputContext_ConsumeProcessedInput_Consumed)
|
||||
#else
|
||||
TEST_F(InputTest, InputContext_ConsumeProcessedInput_Consumed)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputContext_ConsumeProcessedInput_Consumed";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputContext_ConsumeProcessedInput_Consumed";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
InputContext::InitData initData;
|
||||
|
||||
// Create a high priority input context that consumes input processed by any of its mappings.
|
||||
@@ -340,12 +365,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputContext_FilteredInput_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputContext_FilteredInput_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputContext_FilteredInput_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputContext_FilteredInput_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context that initially only listens for keyboard input.
|
||||
InputContext::InitData initData;
|
||||
initData.autoActivate = true;
|
||||
@@ -413,12 +444,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingOr_AddRemoveSourceInput_Successful)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingOr_AddRemoveSourceInput_Successful)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingOr_AddRemoveSourceInput_Successful";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingOr_AddRemoveSourceInput_Successful";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -491,12 +528,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingOr_SingleSourceInput_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingOr_SingleSourceInput_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingOr_SingleSourceInput_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingOr_SingleSourceInput_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -558,12 +601,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingOr_MultipleSourceInputs_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingOr_MultipleSourceInputs_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingOr_MultipleSourceInputs_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingOr_MultipleSourceInputs_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -650,12 +699,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_AddRemoveSourceInput_Successful)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_AddRemoveSourceInput_Successful)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_AddRemoveSourceInput_Successful";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_AddRemoveSourceInput_Successful";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -728,12 +783,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_SingleSourceInput_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_SingleSourceInput_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_SingleSourceInput_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_SingleSourceInput_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -795,12 +856,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_MultipleSourceInputs_Mapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_MultipleSourceInputs_Mapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_MultipleSourceInputs_Mapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_MultipleSourceInputs_Mapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -909,12 +976,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_MultipleSourceInputsWithDifferentValues_ValuesAveraged)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_MultipleSourceInputsWithDifferentValues_ValuesAveraged)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_MultipleSourceInputsWithDifferentValues_ValuesAveraged";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_MultipleSourceInputsWithDifferentValues_ValuesAveraged";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
@@ -969,12 +1042,18 @@ namespace InputUnitTests
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
TEST_F(InputTest, DISABLED_InputMappingAnd_MultipleSourceInputsFromTheSameInputDeviceTypeWithDifferentIndicies_NotMapped)
|
||||
#else
|
||||
TEST_F(InputTest, InputMappingAnd_MultipleSourceInputsFromTheSameInputDeviceTypeWithDifferentIndicies_NotMapped)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS
|
||||
{
|
||||
if (!m_gamepadSupported)
|
||||
{
|
||||
#if defined(GTEST_SKIP)
|
||||
GTEST_SKIP() << "Skipping test InputMappingAnd_MultipleSourceInputsFromTheSameInputDeviceTypeWithDifferentIndicies_NotMapped";
|
||||
#else
|
||||
SUCCEED() << "Skipping test InputMappingAnd_MultipleSourceInputsFromTheSameInputDeviceTypeWithDifferentIndicies_NotMapped";
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an input context and activate it.
|
||||
InputContext inputContext("TestInputContext");
|
||||
inputContext.Activate();
|
||||
|
||||
@@ -53,7 +53,6 @@ static void OptimizedSetParent(QWidget* widget, QWidget* parent)
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
static const FancyDockingDropZoneConstants g_FancyDockingConstants;
|
||||
|
||||
// Constant for the threshold in pixels for snapping to edges while dragging for docking
|
||||
static const int g_snapThresholdInPixels = 15;
|
||||
@@ -155,7 +154,7 @@ namespace AzQtComponents
|
||||
|
||||
// Timer for updating our hovered drop zone opacity
|
||||
QObject::connect(m_dropZoneHoverFadeInTimer, &QTimer::timeout, this, &FancyDocking::onDropZoneHoverFadeInUpdate);
|
||||
m_dropZoneHoverFadeInTimer->setInterval(g_FancyDockingConstants.dropZoneHoverFadeUpdateIntervalMS);
|
||||
m_dropZoneHoverFadeInTimer->setInterval(FancyDockingDropZoneConstants::dropZoneHoverFadeUpdateIntervalMS);
|
||||
QIcon dragIcon = QIcon(QStringLiteral(":/Cursors/Grabbing.svg"));
|
||||
m_dragCursor = QCursor(dragIcon.pixmap(16), 5, 2);
|
||||
}
|
||||
@@ -333,13 +332,13 @@ namespace AzQtComponents
|
||||
*/
|
||||
void FancyDocking::onDropZoneHoverFadeInUpdate()
|
||||
{
|
||||
const qreal dropZoneHoverOpacity = g_FancyDockingConstants.dropZoneHoverFadeIncrement + m_dropZoneState.dropZoneHoverOpacity();
|
||||
const qreal dropZoneHoverOpacity = FancyDockingDropZoneConstants::dropZoneHoverFadeIncrement + m_dropZoneState.dropZoneHoverOpacity();
|
||||
|
||||
// Once we've reached the full drop zone opacity, cut it off in case we
|
||||
// went over and stop the timer
|
||||
if (dropZoneHoverOpacity >= g_FancyDockingConstants.dropZoneOpacity)
|
||||
if (dropZoneHoverOpacity >= FancyDockingDropZoneConstants::dropZoneOpacity)
|
||||
{
|
||||
m_dropZoneState.setDropZoneHoverOpacity(g_FancyDockingConstants.dropZoneOpacity);
|
||||
m_dropZoneState.setDropZoneHoverOpacity(FancyDockingDropZoneConstants::dropZoneOpacity);
|
||||
m_dropZoneHoverFadeInTimer->stop();
|
||||
}
|
||||
else
|
||||
@@ -792,12 +791,12 @@ namespace AzQtComponents
|
||||
QPoint mainWindowTopLeft = multiscreenMapFromGlobal(mainWindow->mapToGlobal(mainWindowRect.topLeft()));
|
||||
QPoint mainWindowTopRight = multiscreenMapFromGlobal(mainWindow->mapToGlobal(mainWindowRect.topRight()));
|
||||
QPoint mainWindowBottomLeft = multiscreenMapFromGlobal(mainWindow->mapToGlobal(mainWindowRect.bottomLeft()));
|
||||
QSize absoluteLeftRightSize(g_FancyDockingConstants.absoluteDropZoneSizeInPixels, mainWindowRect.height());
|
||||
QSize absoluteLeftRightSize(FancyDockingDropZoneConstants::absoluteDropZoneSizeInPixels, mainWindowRect.height());
|
||||
QRect absoluteLeftDropZone(mainWindowTopLeft, absoluteLeftRightSize);
|
||||
QRect absoluteRightDropZone(mainWindowTopRight - QPoint(g_FancyDockingConstants.absoluteDropZoneSizeInPixels, 0), absoluteLeftRightSize);
|
||||
QSize absoluteTopBottomSize(mainWindowRect.width(), g_FancyDockingConstants.absoluteDropZoneSizeInPixels);
|
||||
QRect absoluteRightDropZone(mainWindowTopRight - QPoint(FancyDockingDropZoneConstants::absoluteDropZoneSizeInPixels, 0), absoluteLeftRightSize);
|
||||
QSize absoluteTopBottomSize(mainWindowRect.width(), FancyDockingDropZoneConstants::absoluteDropZoneSizeInPixels);
|
||||
QRect absoluteTopDropZone(mainWindowTopLeft, absoluteTopBottomSize);
|
||||
QRect absoluteBottomDropZone(mainWindowBottomLeft - QPoint(0, g_FancyDockingConstants.absoluteDropZoneSizeInPixels), absoluteTopBottomSize);
|
||||
QRect absoluteBottomDropZone(mainWindowBottomLeft - QPoint(0, FancyDockingDropZoneConstants::absoluteDropZoneSizeInPixels), absoluteTopBottomSize);
|
||||
|
||||
// If the drop target is a main window, then we will only show the absolute
|
||||
// drop zone if the cursor is in that zone already
|
||||
@@ -986,16 +985,16 @@ namespace AzQtComponents
|
||||
switch (m_dropZoneState.absoluteDropZoneArea())
|
||||
{
|
||||
case Qt::LeftDockWidgetArea:
|
||||
dockRect.setX(dockRect.x() + g_FancyDockingConstants.absoluteDropZoneSizeInPixels);
|
||||
dockRect.setX(dockRect.x() + FancyDockingDropZoneConstants::absoluteDropZoneSizeInPixels);
|
||||
break;
|
||||
case Qt::RightDockWidgetArea:
|
||||
dockRect.setWidth(dockRect.width() - g_FancyDockingConstants.absoluteDropZoneSizeInPixels);
|
||||
dockRect.setWidth(dockRect.width() - FancyDockingDropZoneConstants::absoluteDropZoneSizeInPixels);
|
||||
break;
|
||||
case Qt::TopDockWidgetArea:
|
||||
dockRect.setY(dockRect.y() + g_FancyDockingConstants.absoluteDropZoneSizeInPixels);
|
||||
dockRect.setY(dockRect.y() + FancyDockingDropZoneConstants::absoluteDropZoneSizeInPixels);
|
||||
break;
|
||||
case Qt::BottomDockWidgetArea:
|
||||
dockRect.setHeight(dockRect.height() - g_FancyDockingConstants.absoluteDropZoneSizeInPixels);
|
||||
dockRect.setHeight(dockRect.height() - FancyDockingDropZoneConstants::absoluteDropZoneSizeInPixels);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1034,15 +1033,15 @@ namespace AzQtComponents
|
||||
// Set the drop zone width/height to the default, but if the dock widget
|
||||
// width and/or height is below the threshold, then switch to scaling them
|
||||
// down accordingly
|
||||
int dropZoneWidth = g_FancyDockingConstants.dropZoneSizeInPixels;
|
||||
if (dockWidth < g_FancyDockingConstants.minDockSizeBeforeDropZoneScalingInPixels)
|
||||
int dropZoneWidth = FancyDockingDropZoneConstants::dropZoneSizeInPixels;
|
||||
if (dockWidth < FancyDockingDropZoneConstants::minDockSizeBeforeDropZoneScalingInPixels)
|
||||
{
|
||||
dropZoneWidth = aznumeric_cast<int>(dockWidth * g_FancyDockingConstants.dropZoneScaleFactor);
|
||||
dropZoneWidth = aznumeric_cast<int>(dockWidth * FancyDockingDropZoneConstants::dropZoneScaleFactor);
|
||||
}
|
||||
int dropZoneHeight = g_FancyDockingConstants.dropZoneSizeInPixels;
|
||||
if (dockHeight < g_FancyDockingConstants.minDockSizeBeforeDropZoneScalingInPixels)
|
||||
int dropZoneHeight = FancyDockingDropZoneConstants::dropZoneSizeInPixels;
|
||||
if (dockHeight < FancyDockingDropZoneConstants::minDockSizeBeforeDropZoneScalingInPixels)
|
||||
{
|
||||
dropZoneHeight = aznumeric_cast<int>(dockHeight * g_FancyDockingConstants.dropZoneScaleFactor);
|
||||
dropZoneHeight = aznumeric_cast<int>(dockHeight * FancyDockingDropZoneConstants::dropZoneScaleFactor);
|
||||
}
|
||||
|
||||
// Calculate the inner corners to be used when constructing the drop zone polygons
|
||||
@@ -1078,7 +1077,7 @@ namespace AzQtComponents
|
||||
int innerDropZoneWidth = m_dropZoneState.innerDropZoneRect().width();
|
||||
int innerDropZoneHeight = m_dropZoneState.innerDropZoneRect().height();
|
||||
int centerDropZoneDiameter = (innerDropZoneWidth < innerDropZoneHeight) ? innerDropZoneWidth : innerDropZoneHeight;
|
||||
centerDropZoneDiameter = aznumeric_cast<int>(centerDropZoneDiameter * g_FancyDockingConstants.centerTabDropZoneScale);
|
||||
centerDropZoneDiameter = aznumeric_cast<int>(centerDropZoneDiameter * FancyDockingDropZoneConstants::centerTabDropZoneScale);
|
||||
|
||||
// Setup our center tab drop zone
|
||||
const QSize centerDropZoneSize(centerDropZoneDiameter, centerDropZoneDiameter);
|
||||
@@ -1986,7 +1985,7 @@ namespace AzQtComponents
|
||||
// hasn't faded in all the way yet, then ignore the drop zone area
|
||||
// which will make the widget floating
|
||||
bool modifiedKeyPressed = FancyDockingDropZoneWidget::CheckModifierKey();
|
||||
if (modifiedKeyPressed || m_dropZoneState.dropZoneHoverOpacity() != g_FancyDockingConstants.dropZoneOpacity)
|
||||
if (modifiedKeyPressed || m_dropZoneState.dropZoneHoverOpacity() != FancyDockingDropZoneConstants::dropZoneOpacity)
|
||||
{
|
||||
area = Qt::NoDockWidgetArea;
|
||||
}
|
||||
@@ -3026,7 +3025,7 @@ namespace AzQtComponents
|
||||
{
|
||||
bool modifiedKeyPressed = FancyDockingDropZoneWidget::CheckModifierKey();
|
||||
|
||||
m_ghostWidget->setWindowOpacity(modifiedKeyPressed ? 1.0f : g_FancyDockingConstants.draggingDockWidgetOpacity);
|
||||
m_ghostWidget->setWindowOpacity(modifiedKeyPressed ? 1.0f : FancyDockingDropZoneConstants::draggingDockWidgetOpacity);
|
||||
m_ghostWidget->setPixmap(m_state.dockWidgetScreenGrab.screenGrab, m_state.placeholder(), m_state.placeholderScreen());
|
||||
}
|
||||
}
|
||||
|
||||
+7
-27
@@ -19,26 +19,6 @@
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
static const FancyDockingDropZoneConstants g_Constants;
|
||||
|
||||
FancyDockingDropZoneConstants::FancyDockingDropZoneConstants()
|
||||
{
|
||||
draggingDockWidgetOpacity = 0.6;
|
||||
dropZoneOpacity = 0.4;
|
||||
dropZoneSizeInPixels = 40;
|
||||
minDockSizeBeforeDropZoneScalingInPixels = dropZoneSizeInPixels * 3;
|
||||
dropZoneScaleFactor = 0.25;
|
||||
centerTabDropZoneScale = 0.5;
|
||||
centerTabIconScale = 0.5;
|
||||
dropZoneColor = QColor(155, 155, 155);
|
||||
dropZoneBorderColor = Qt::black;
|
||||
dropZoneBorderInPixels = 1;
|
||||
absoluteDropZoneSizeInPixels = 25;
|
||||
dockingTargetDelayMS = 110;
|
||||
dropZoneHoverFadeUpdateIntervalMS = 20;
|
||||
dropZoneHoverFadeIncrement = dropZoneOpacity / (dockingTargetDelayMS / dropZoneHoverFadeUpdateIntervalMS);
|
||||
centerDropZoneIconPath = QString(":/stylesheet/img/UI20/docking/tabs_icon.svg");
|
||||
}
|
||||
|
||||
FancyDockingDropZoneWidget::FancyDockingDropZoneWidget(QMainWindow* mainWindow, QWidget* coordinatesRelativeTo, QScreen* screen, FancyDockingDropZoneState* dropZoneState)
|
||||
// NOTE: this will not work with multiple monitors if this widget has a parent. The floating drop zone
|
||||
@@ -154,7 +134,7 @@ namespace AzQtComponents
|
||||
|
||||
// Draw all of the normal drop zones if they exist (if a dock widget is hovered over)
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setOpacity(g_Constants.dropZoneOpacity);
|
||||
painter.setOpacity(FancyDockingDropZoneConstants::dropZoneOpacity);
|
||||
auto dropZones = m_dropZoneState->dropZones();
|
||||
for (auto it = dropZones.cbegin(); it != dropZones.cend(); ++it)
|
||||
{
|
||||
@@ -189,7 +169,7 @@ namespace AzQtComponents
|
||||
// Otherwise, set the normal color
|
||||
else
|
||||
{
|
||||
painter.setBrush(g_Constants.dropZoneColor);
|
||||
painter.setBrush(FancyDockingDropZoneConstants::dropZoneColor);
|
||||
}
|
||||
|
||||
// negate the window position to offset everything by that much
|
||||
@@ -214,8 +194,8 @@ namespace AzQtComponents
|
||||
// Scale the tabs icon based on the drop zone size and our specified offset
|
||||
// Doing this through QIcon to make sure that SVG is rendered already in desired resolution
|
||||
const QSize& dropZoneSize = dropZoneRect.size();
|
||||
const QSize requestedIconSize = dropZoneSize * g_Constants.centerTabIconScale;
|
||||
const QIcon dropZoneIcon = QIcon(g_Constants.centerDropZoneIconPath);
|
||||
const QSize requestedIconSize = dropZoneSize * FancyDockingDropZoneConstants::centerTabIconScale;
|
||||
const QIcon dropZoneIcon = QIcon(FancyDockingDropZoneConstants::centerDropZoneIconPath);
|
||||
const QPixmap dropZonePixmap = dropZoneIcon.pixmap(requestedIconSize);
|
||||
const QSize receivedIconSize = dropZoneIcon.actualSize(requestedIconSize);
|
||||
|
||||
@@ -264,7 +244,7 @@ namespace AzQtComponents
|
||||
}
|
||||
else
|
||||
{
|
||||
painter.setBrush(g_Constants.dropZoneColor);
|
||||
painter.setBrush(FancyDockingDropZoneConstants::dropZoneColor);
|
||||
}
|
||||
painter.drawRect(absoluteDropZoneRect);
|
||||
|
||||
@@ -313,8 +293,8 @@ namespace AzQtComponents
|
||||
const QPoint innerBottomRight = innerDropZoneRect.bottomRight();
|
||||
|
||||
// Draw the lines using the appropriate pen
|
||||
QPen dropZoneBorderPen(g_Constants.dropZoneBorderColor);
|
||||
dropZoneBorderPen.setWidth(g_Constants.dropZoneBorderInPixels);
|
||||
QPen dropZoneBorderPen(FancyDockingDropZoneConstants::dropZoneBorderColor);
|
||||
dropZoneBorderPen.setWidth(FancyDockingDropZoneConstants::dropZoneBorderInPixels);
|
||||
painter.setPen(dropZoneBorderPen);
|
||||
painter.setOpacity(1);
|
||||
painter.drawLine(topLeft, innerTopLeft);
|
||||
|
||||
+16
-21
@@ -28,63 +28,58 @@ class QPainter;
|
||||
|
||||
namespace AzQtComponents
|
||||
{
|
||||
struct AZ_QT_COMPONENTS_API FancyDockingDropZoneConstants
|
||||
namespace FancyDockingDropZoneConstants
|
||||
{
|
||||
// Constant for the opacity of the screen grab for the dock widget being dragged
|
||||
qreal draggingDockWidgetOpacity;
|
||||
static constexpr qreal draggingDockWidgetOpacity = 0.6;
|
||||
|
||||
// Constant for the opacity of the normal drop zones
|
||||
qreal dropZoneOpacity;
|
||||
static constexpr qreal dropZoneOpacity = 0.4;
|
||||
|
||||
// Constant for the default drop zone size (in pixels)
|
||||
int dropZoneSizeInPixels;
|
||||
static constexpr int dropZoneSizeInPixels = 40;
|
||||
|
||||
// Constant for the dock width/height size (in pixels) before we need to start
|
||||
// scaling down the drop zone sizes, or else they will overlap with the center
|
||||
// tab icon or each other
|
||||
int minDockSizeBeforeDropZoneScalingInPixels;
|
||||
static constexpr int minDockSizeBeforeDropZoneScalingInPixels = dropZoneSizeInPixels * 3;
|
||||
|
||||
// Constant for the factor by which we must scale down the drop zone sizes once
|
||||
// the dock width/height size is too small
|
||||
qreal dropZoneScaleFactor;
|
||||
static constexpr qreal dropZoneScaleFactor = 0.25;
|
||||
|
||||
// Constant for the percentage to scale down the inner drop zone rectangle for the center tab drop zone
|
||||
qreal centerTabDropZoneScale;
|
||||
static constexpr qreal centerTabDropZoneScale = 0.5;
|
||||
|
||||
// Constant for the percentage to scale down the center tab drop zone for the center tab icon
|
||||
qreal centerTabIconScale;
|
||||
static constexpr qreal centerTabIconScale = 0.5;
|
||||
|
||||
// Constant for the drop zone hotspot default color
|
||||
QColor dropZoneColor;
|
||||
static const QColor dropZoneColor = QColor(155, 155, 155);
|
||||
|
||||
// Constant for the drop zone border color
|
||||
QColor dropZoneBorderColor;
|
||||
static const QColor dropZoneBorderColor = Qt::black;
|
||||
|
||||
// Constant for the border width in pixels separating the drop zones
|
||||
int dropZoneBorderInPixels;
|
||||
static constexpr int dropZoneBorderInPixels = 1;
|
||||
|
||||
// Constant for the border width in pixels separating the drop zones
|
||||
int absoluteDropZoneSizeInPixels;
|
||||
static constexpr int absoluteDropZoneSizeInPixels = 25;
|
||||
|
||||
// Constant for the delay (in milliseconds) before a drop zone becomes active
|
||||
// once it is hovered over
|
||||
int dockingTargetDelayMS;
|
||||
static constexpr int dockingTargetDelayMS = 110;
|
||||
|
||||
// Constant for the rate at which we will update (fade in) the drop zone opacity
|
||||
// when hovered over (in milliseconds)
|
||||
int dropZoneHoverFadeUpdateIntervalMS;
|
||||
static constexpr int dropZoneHoverFadeUpdateIntervalMS = 20;
|
||||
|
||||
// Constant for the incremental opacity increase for the hovered drop zone
|
||||
// that will fade in to the full drop zone opacity in the desired time
|
||||
qreal dropZoneHoverFadeIncrement;
|
||||
static constexpr qreal dropZoneHoverFadeIncrement = dropZoneOpacity / (dockingTargetDelayMS / dropZoneHoverFadeUpdateIntervalMS);
|
||||
|
||||
// Constant for the path to the center drop zone tabs icon
|
||||
QString centerDropZoneIconPath;
|
||||
|
||||
FancyDockingDropZoneConstants();
|
||||
|
||||
FancyDockingDropZoneConstants(const FancyDockingDropZoneConstants&) = delete;
|
||||
FancyDockingDropZoneConstants& operator=(const FancyDockingDropZoneConstants&) = delete;
|
||||
static const QString centerDropZoneIconPath = QStringLiteral(":/stylesheet/img/UI20/docking/tabs_icon.svg");
|
||||
};
|
||||
|
||||
class FancyDockingDropZoneState
|
||||
|
||||
+4
-3
@@ -323,7 +323,7 @@ namespace AzQtComponents
|
||||
saturation *= 2.0 - lightness;
|
||||
}
|
||||
double value = (lightness + saturation) / 2.0;
|
||||
saturation = (2.0 * saturation) / (lightness + saturation);
|
||||
saturation = qFuzzyIsNull(lightness + saturation) ? 0 : (2.0 * saturation) / (lightness + saturation);
|
||||
|
||||
m_hsv.saturation = AZ::GetClamp(saturation, 0.0, 1.0);
|
||||
m_hsv.value = AZ::GetClamp(value, 0.0, 12.5);
|
||||
@@ -341,11 +341,12 @@ namespace AzQtComponents
|
||||
double saturation = m_hsv.saturation * m_hsv.value;
|
||||
if (lightness <= 1.0)
|
||||
{
|
||||
saturation /= lightness;
|
||||
saturation = (qFuzzyIsNull(lightness)) ? 0.0 : saturation / lightness;
|
||||
}
|
||||
else
|
||||
{
|
||||
saturation /= 2.0 - lightness;
|
||||
double two_minus_lightness = 2.0 - lightness;
|
||||
saturation = (qFuzzyIsNull(two_minus_lightness)) ? 0.0 : saturation / two_minus_lightness;
|
||||
}
|
||||
lightness /= 2.0;
|
||||
|
||||
|
||||
@@ -164,11 +164,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ZERO_COLOR_CONVERSION_TEST
|
||||
TEST(AzQtComponents, DISABLED_ColorConversionsTestAllZeros)
|
||||
#else
|
||||
TEST(AzQtComponents, ColorConversionsTestAllZeros)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ZERO_COLOR_CONVERSION_TEST
|
||||
{
|
||||
TestConversions({ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 });
|
||||
}
|
||||
|
||||
@@ -18,12 +18,11 @@
|
||||
|
||||
#define AZ_TRAIT_DISABLE_FAILED_ATOM_RPI_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_ZERO_COLOR_CONVERSION_TEST true
|
||||
|
||||
#define AZ_TRAIT_DISABLE_FAILED_FRAMEPROFILER_TEST true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_FRAMEWORK_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_GRADIENT_SIGNAL_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_MULTIPLAYER_GRIDMATE_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_INPUT_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_NATIVE_WINDOWS_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_PROCESS_LAUNCHER_TESTS true
|
||||
#define AZ_TRAIT_DISABLE_FAILED_EMOTION_FX_TESTS true
|
||||
|
||||
@@ -521,21 +521,18 @@ namespace AzToolsFramework
|
||||
nestedInstanceLink.has_value(),
|
||||
"A valid link was not found for one of the instances provided as input for the CreatePrefab operation.");
|
||||
|
||||
PrefabDomReference nestedInstanceLinkDom = nestedInstanceLink->get().GetLinkDom();
|
||||
AZ_Assert(
|
||||
nestedInstanceLinkDom.has_value(),
|
||||
"A valid DOM was not found for the link corresponding to one of the instances provided as input for the "
|
||||
"CreatePrefab operation.");
|
||||
|
||||
PrefabDomValueReference nestedInstanceLinkPatches =
|
||||
PrefabDomUtils::FindPrefabDomValue(nestedInstanceLinkDom->get(), PrefabDomUtils::PatchesName);
|
||||
AZ_Assert(
|
||||
nestedInstanceLinkPatches.has_value(),
|
||||
"A valid DOM for patches was not found for the link corresponding to one of the instances provided as input for the "
|
||||
"CreatePrefab operation.");
|
||||
|
||||
PrefabDom patchesCopyForUndoSupport;
|
||||
patchesCopyForUndoSupport.CopyFrom(nestedInstanceLinkPatches->get(), patchesCopyForUndoSupport.GetAllocator());
|
||||
PrefabDomReference nestedInstanceLinkDom = nestedInstanceLink->get().GetLinkDom();
|
||||
if (nestedInstanceLinkDom.has_value())
|
||||
{
|
||||
PrefabDomValueReference nestedInstanceLinkPatches =
|
||||
PrefabDomUtils::FindPrefabDomValue(nestedInstanceLinkDom->get(), PrefabDomUtils::PatchesName);
|
||||
if (nestedInstanceLinkPatches.has_value())
|
||||
{
|
||||
patchesCopyForUndoSupport.CopyFrom(nestedInstanceLinkPatches->get(), patchesCopyForUndoSupport.GetAllocator());
|
||||
}
|
||||
}
|
||||
|
||||
PrefabUndoHelpers::RemoveLink(
|
||||
sourceInstance->GetTemplateId(), targetTemplateId, sourceInstance->GetInstanceAlias(), sourceInstance->GetLinkId(),
|
||||
AZStd::move(patchesCopyForUndoSupport), undoBatch);
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
|
||||
#include <Prefab/PrefabTestComponent.h>
|
||||
#include <Prefab/PrefabTestDomUtils.h>
|
||||
#include <Prefab/PrefabTestFixture.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
using PrefabDeleteTest = PrefabTestFixture;
|
||||
|
||||
TEST_F(PrefabDeleteTest, DeleteEntitiesInInstance_DeleteSingleEntitySucceeds)
|
||||
{
|
||||
PrefabEntityResult createEntityResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
|
||||
// Verify that a valid entity is created.
|
||||
AZ::EntityId testEntityId = createEntityResult.GetValue();
|
||||
ASSERT_TRUE(testEntityId.IsValid());
|
||||
AZ::Entity* testEntity = AzToolsFramework::GetEntityById(testEntityId);
|
||||
ASSERT_TRUE(testEntity != nullptr);
|
||||
|
||||
m_prefabPublicInterface->DeleteEntitiesInInstance(AzToolsFramework::EntityIdList{ testEntityId });
|
||||
|
||||
// Verify that entity can't be found after deletion.
|
||||
testEntity = AzToolsFramework::GetEntityById(testEntityId);
|
||||
EXPECT_TRUE(testEntity == nullptr);
|
||||
}
|
||||
|
||||
TEST_F(PrefabDeleteTest, DeleteEntitiesInInstance_DeleteSinglePrefabSucceeds)
|
||||
{
|
||||
PrefabEntityResult createEntityResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
|
||||
// Verify that a valid entity is created.
|
||||
AZ::EntityId createdEntityId = createEntityResult.GetValue();
|
||||
ASSERT_TRUE(createdEntityId.IsValid());
|
||||
AZ::Entity* createdEntity = AzToolsFramework::GetEntityById(createdEntityId);
|
||||
ASSERT_TRUE(createdEntity != nullptr);
|
||||
|
||||
// Rather than hardcode a path, use a path from settings registry since that will work on all platforms.
|
||||
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
|
||||
AZ::IO::FixedMaxPath path;
|
||||
registry->Get(path.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder);
|
||||
CreatePrefabResult createPrefabResult =
|
||||
m_prefabPublicInterface->CreatePrefabInMemory(AzToolsFramework::EntityIdList{ createdEntityId }, path);
|
||||
|
||||
AZ::EntityId createdPrefabContainerId = createPrefabResult.GetValue();
|
||||
ASSERT_TRUE(createdPrefabContainerId.IsValid());
|
||||
AZ::Entity* prefabContainerEntity = AzToolsFramework::GetEntityById(createdPrefabContainerId);
|
||||
ASSERT_TRUE(prefabContainerEntity != nullptr);
|
||||
|
||||
// Verify that the prefab container entity and the entity within are deleted.
|
||||
m_prefabPublicInterface->DeleteEntitiesInInstance(AzToolsFramework::EntityIdList{ createdPrefabContainerId });
|
||||
prefabContainerEntity = AzToolsFramework::GetEntityById(createdPrefabContainerId);
|
||||
EXPECT_TRUE(prefabContainerEntity == nullptr);
|
||||
createdEntity = AzToolsFramework::GetEntityById(createdEntityId);
|
||||
EXPECT_TRUE(createdEntity == nullptr);
|
||||
}
|
||||
|
||||
TEST_F(PrefabDeleteTest, DeleteEntitiesAndAllDescendantsInInstance_DeletingEntityDeletesChildEntityToo)
|
||||
{
|
||||
PrefabEntityResult parentEntityCreationResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
|
||||
// Verify that valid parent entity is created.
|
||||
AZ::EntityId parentEntityId = parentEntityCreationResult.GetValue();
|
||||
ASSERT_TRUE(parentEntityId.IsValid());
|
||||
AZ::Entity* parentEntity = AzToolsFramework::GetEntityById(parentEntityId);
|
||||
ASSERT_TRUE(parentEntity != nullptr);
|
||||
|
||||
// Verify that valid child entity is created.
|
||||
PrefabEntityResult childEntityCreationResult = m_prefabPublicInterface->CreateEntity(parentEntityId, AZ::Vector3());
|
||||
AZ::EntityId childEntityId = childEntityCreationResult.GetValue();
|
||||
ASSERT_TRUE(childEntityId.IsValid());
|
||||
AZ::Entity* childEntity = AzToolsFramework::GetEntityById(childEntityId);
|
||||
ASSERT_TRUE(childEntity != nullptr);
|
||||
|
||||
// PrefabTestFixture won't add required editor components by default. Hence we add them here.
|
||||
AddRequiredEditorComponents(childEntity);
|
||||
AddRequiredEditorComponents(parentEntity);
|
||||
|
||||
// Parent the child entity under the parent entity.
|
||||
AZ::TransformBus::Event(childEntityId, &AZ::TransformBus::Events::SetParent, parentEntityId);
|
||||
|
||||
// Delete parent entity and its children.
|
||||
m_prefabPublicInterface->DeleteEntitiesAndAllDescendantsInInstance(AzToolsFramework::EntityIdList{ parentEntityId });
|
||||
|
||||
// Verify that both the parent and child entities are deleted.
|
||||
parentEntity = AzToolsFramework::GetEntityById(parentEntityId);
|
||||
EXPECT_TRUE(parentEntity == nullptr);
|
||||
childEntity = AzToolsFramework::GetEntityById(childEntityId);
|
||||
EXPECT_TRUE(childEntity == nullptr);
|
||||
}
|
||||
|
||||
TEST_F(PrefabDeleteTest, DeleteEntitiesAndAllDescendantsInInstance_DeletingEntityDeletesChildPrefabToo)
|
||||
{
|
||||
PrefabEntityResult entityToBePutUnderPrefabResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
|
||||
// Verify that a valid entity is created that will be put in a prefab later.
|
||||
AZ::EntityId entityToBePutUnderPrefabId = entityToBePutUnderPrefabResult.GetValue();
|
||||
ASSERT_TRUE(entityToBePutUnderPrefabId.IsValid());
|
||||
AZ::Entity* entityToBePutUnderPrefab = AzToolsFramework::GetEntityById(entityToBePutUnderPrefabId);
|
||||
ASSERT_TRUE(entityToBePutUnderPrefab != nullptr);
|
||||
|
||||
// Verify that a valid parent entity is created.
|
||||
PrefabEntityResult parentEntityCreationResult = m_prefabPublicInterface->CreateEntity(AZ::EntityId(), AZ::Vector3());
|
||||
AZ::EntityId parentEntityId = parentEntityCreationResult.GetValue();
|
||||
ASSERT_TRUE(parentEntityId.IsValid());
|
||||
AZ::Entity* parentEntity = AzToolsFramework::GetEntityById(parentEntityId);
|
||||
ASSERT_TRUE(parentEntity != nullptr);
|
||||
|
||||
// Rather than hardcode a path, use a path from settings registry since that will work on all platforms.
|
||||
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
|
||||
AZ::IO::FixedMaxPath path;
|
||||
registry->Get(path.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder);
|
||||
CreatePrefabResult createPrefabResult =
|
||||
m_prefabPublicInterface->CreatePrefabInMemory(AzToolsFramework::EntityIdList{ entityToBePutUnderPrefabId }, path);
|
||||
|
||||
// Verify that a valid prefab container entity is created.
|
||||
AZ::EntityId createdPrefabContainerId = createPrefabResult.GetValue();
|
||||
ASSERT_TRUE(createdPrefabContainerId.IsValid());
|
||||
AZ::Entity* prefabContainerEntity = AzToolsFramework::GetEntityById(createdPrefabContainerId);
|
||||
ASSERT_TRUE(prefabContainerEntity != nullptr);
|
||||
|
||||
// PrefabTestFixture won't add required editor components by default. Hence we add them here.
|
||||
AddRequiredEditorComponents(parentEntity);
|
||||
AddRequiredEditorComponents(prefabContainerEntity);
|
||||
|
||||
// Parent the prefab under the parent entity.
|
||||
AZ::TransformBus::Event(createdPrefabContainerId, &AZ::TransformBus::Events::SetParent, parentEntityId);
|
||||
|
||||
// Delete the parent entity.
|
||||
m_prefabPublicInterface->DeleteEntitiesAndAllDescendantsInInstance(AzToolsFramework::EntityIdList{ parentEntityId });
|
||||
|
||||
// Validate that the parent and the prefab under it and the entity inside the prefab are all deleted.
|
||||
parentEntity = AzToolsFramework::GetEntityById(parentEntityId);
|
||||
ASSERT_TRUE(parentEntity == nullptr);
|
||||
entityToBePutUnderPrefab = AzToolsFramework::GetEntityById(entityToBePutUnderPrefabId);
|
||||
ASSERT_TRUE(entityToBePutUnderPrefab == nullptr);
|
||||
prefabContainerEntity = AzToolsFramework::GetEntityById(createdPrefabContainerId);
|
||||
EXPECT_TRUE(prefabContainerEntity == nullptr);
|
||||
}
|
||||
} // namespace UnitTest
|
||||
@@ -57,6 +57,11 @@ namespace UnitTest
|
||||
return AZStd::make_unique<PrefabTestToolsApplication>("PrefabTestApplication");
|
||||
}
|
||||
|
||||
void PrefabTestFixture::PropagateAllTemplateChanges()
|
||||
{
|
||||
m_prefabSystemComponent->OnSystemTick();
|
||||
}
|
||||
|
||||
AZ::Entity* PrefabTestFixture::CreateEntity(const char* entityName, const bool shouldActivate)
|
||||
{
|
||||
// Circumvent the EntityContext system and generate a new entity with a transformcomponent
|
||||
@@ -125,4 +130,13 @@ namespace UnitTest
|
||||
EXPECT_EQ(entityInInstance->GetState(), AZ::Entity::State::Active);
|
||||
}
|
||||
}
|
||||
|
||||
void PrefabTestFixture::AddRequiredEditorComponents(AZ::Entity* entity)
|
||||
{
|
||||
ASSERT_TRUE(entity != nullptr);
|
||||
entity->Deactivate();
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
|
||||
&AzToolsFramework::EditorEntityContextRequests::AddRequiredComponents, *entity);
|
||||
entity->Activate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ namespace UnitTest
|
||||
|
||||
AZStd::unique_ptr<ToolsTestApplication> CreateTestApplication() override;
|
||||
|
||||
void PropagateAllTemplateChanges();
|
||||
|
||||
AZ::Entity* CreateEntity(const char* entityName, const bool shouldActivate = true);
|
||||
|
||||
void CompareInstances(const Instance& instanceA, const Instance& instanceB, bool shouldCompareLinkIds = true,
|
||||
@@ -62,6 +64,8 @@ namespace UnitTest
|
||||
//! Validates that all entities within a prefab instance are in 'Active' state.
|
||||
void ValidateInstanceEntitiesActive(Instance& instance);
|
||||
|
||||
void AddRequiredEditorComponents(AZ::Entity* entity);
|
||||
|
||||
PrefabSystemComponent* m_prefabSystemComponent = nullptr;
|
||||
PrefabLoaderInterface* m_prefabLoaderInterface = nullptr;
|
||||
PrefabPublicInterface* m_prefabPublicInterface = nullptr;
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace UnitTest
|
||||
void ProcessDeferredUpdates()
|
||||
{
|
||||
// Force a prefab propagation for updates that are deferred to the next tick.
|
||||
m_prefabSystemComponent->OnSystemTick();
|
||||
PropagateAllTemplateChanges();
|
||||
|
||||
// Ensure the model process its entity update queue
|
||||
m_model->ProcessEntityUpdates();
|
||||
|
||||
@@ -69,6 +69,7 @@ set(FILES
|
||||
Prefab/PrefabFocus/PrefabFocusTests.cpp
|
||||
Prefab/MockPrefabFileIOActionValidator.cpp
|
||||
Prefab/MockPrefabFileIOActionValidator.h
|
||||
Prefab/PrefabDeleteTests.cpp
|
||||
Prefab/PrefabDuplicateTests.cpp
|
||||
Prefab/PrefabEntityAliasTests.cpp
|
||||
Prefab/PrefabInstanceToTemplatePropagatorTests.cpp
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/EBus/EBus.h>
|
||||
|
||||
// Forward declarations
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of changes to the sprite settings
|
||||
class UiSpriteSettingsChangeNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
/**
|
||||
* Overrides the default AZ::EBusTraits address policy so that the bus
|
||||
* has multiple addresses at which to receive messages. This bus is
|
||||
* identified by Sprite pointer. Messages addressed to an ID are received by
|
||||
* handlers connected to that ID.
|
||||
*/
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
/**
|
||||
* Overrides the default AZ::EBusTraits ID type so that Sprite pointers are
|
||||
* used to access the addresses of the bus.
|
||||
*/
|
||||
typedef ISprite* BusIdType;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual ~UiSpriteSettingsChangeNotification() {}
|
||||
|
||||
//! Called when the sprite settings such as number of cells etc change
|
||||
virtual void OnSpriteSettingsChanged() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiSpriteSettingsChangeNotification> UiSpriteSettingsChangeNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Notify listeners when sprite image sources change.
|
||||
class UiSpriteSourceNotificationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiSpriteSourceNotificationInterface() {}
|
||||
|
||||
//! A sprite image (or sequence of images) has changed file sources.
|
||||
virtual void OnSpriteSourceChanged() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiSpriteSourceNotificationInterface> UiSpriteSourceNotificationBus;
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/Serialization/ObjectStream.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
class FileIOStream;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus interface for tools to talk to the LyShine system
|
||||
//! It is valid to use this bus from resource compilers or the UI Editor
|
||||
class UiSystemToolsInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // types
|
||||
|
||||
class CanvasAssetHandle
|
||||
{
|
||||
public:
|
||||
virtual ~CanvasAssetHandle() {};
|
||||
};
|
||||
|
||||
public:
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
|
||||
// Public functions
|
||||
|
||||
//! Load a canvas but do not init or activate the entities
|
||||
//! The CanvasAssetHandle is an opaque pointer only valid to be passed to the
|
||||
//! methods below.
|
||||
virtual CanvasAssetHandle* LoadCanvasFromStream(AZ::IO::GenericStream& stream, const AZ::ObjectStream::FilterDescriptor& filterDesc) = 0;
|
||||
|
||||
//! Save a canvas to a stream
|
||||
virtual void SaveCanvasToStream(CanvasAssetHandle* canvas, AZ::IO::FileIOStream& stream) = 0;
|
||||
|
||||
//! Get the slice component for a loaded canvas
|
||||
virtual AZ::SliceComponent* GetRootSliceSliceComponent(CanvasAssetHandle* canvas) = 0;
|
||||
|
||||
//! Get the slice entity for a loaded canvas
|
||||
virtual AZ::Entity* GetRootSliceEntity(CanvasAssetHandle* canvas) = 0;
|
||||
|
||||
//! Get the canvas entity for a loaded canvas
|
||||
virtual AZ::Entity* GetCanvasEntity(CanvasAssetHandle* canvas) = 0;
|
||||
|
||||
//! Replace the slice component with a new one. The old slice component is not deleted.
|
||||
//! The client is responsible for that.
|
||||
virtual void ReplaceRootSliceSliceComponent(CanvasAssetHandle* canvas, AZ::SliceComponent* newSliceComponent) = 0;
|
||||
|
||||
//! Replace the canvas entity with a new one. The old canvas entity is not deleted.
|
||||
//! The client is responsible for that.
|
||||
virtual void ReplaceCanvasEntity(CanvasAssetHandle* canvas, AZ::Entity* newCanvasEntity) = 0;
|
||||
|
||||
//! Delete the canvas file object and its canvas entity and slice entity.
|
||||
virtual void DestroyCanvas(CanvasAssetHandle* canvas) = 0;
|
||||
};
|
||||
|
||||
using UiSystemToolsBus = AZ::EBus<UiSystemToolsInterface>;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
// Forward declarations
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiAnimateEntityInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiAnimateEntityInterface() {}
|
||||
|
||||
//! Called when the animation system has updated the data members of an entity's components
|
||||
virtual void PropertyValuesChanged() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! More than one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiAnimateEntityInterface> UiAnimateEntityBus;
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/EBus/EBus.h>
|
||||
|
||||
#include <LyShine/Animation/IUiAnimation.h>
|
||||
|
||||
struct IUiAnimNode;
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class Entity;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiAnimNodeInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
typedef IUiAnimNode* BusIdType;
|
||||
//! Only one implementation for an IAnimNode* can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiAnimNodeInterface() {}
|
||||
|
||||
virtual AZ::EntityId GetAzEntityId() = 0;
|
||||
virtual void SetAzEntity(AZ::Entity* entity) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiAnimNodeInterface> UiAnimNodeBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiAnimationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiAnimationInterface() {}
|
||||
|
||||
//! Start a sequence
|
||||
virtual void StartSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Play a sequence from startTime to endTime
|
||||
virtual void PlaySequenceRange(const AZStd::string& sequenceName, float startTime, float endTime) = 0;
|
||||
|
||||
//! Stop a sequence
|
||||
virtual void StopSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Abort a sequence
|
||||
virtual void AbortSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Pause a sequence
|
||||
virtual void PauseSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Resume a sequence
|
||||
virtual void ResumeSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Reset a sequence
|
||||
virtual void ResetSequence(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Get the speed of a sequence
|
||||
virtual float GetSequencePlayingSpeed(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Set the speed of a sequence
|
||||
virtual void SetSequencePlayingSpeed(const AZStd::string& sequenceName, float speed) = 0;
|
||||
|
||||
//! Get the current time of a sequence
|
||||
virtual float GetSequencePlayingTime(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Get whether a sequence is currently playing
|
||||
virtual bool IsSequencePlaying(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Get the length of a sequence in seconds
|
||||
virtual float GetSequenceLength(const AZStd::string& sequenceName) = 0;
|
||||
|
||||
//! Set the behavior a sequence will exhibit when it stops playing
|
||||
virtual void SetSequenceStopBehavior(IUiAnimationSystem::ESequenceStopBehavior stopBehavior) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiAnimationInterface> UiAnimationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiAnimationNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiAnimationNotifications(){}
|
||||
|
||||
//! Called on an animation event
|
||||
virtual void OnUiAnimationEvent(IUiAnimationListener::EUiAnimationEvent uiAnimationEvent, AZStd::string animSequenceName) = 0;
|
||||
|
||||
//! Called on animation track event triggered
|
||||
virtual void OnUiTrackEvent(AZStd::string eventName, AZStd::string valueName, AZStd::string animSequenceName) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiAnimationNotifications> UiAnimationNotificationBus;
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiButtonInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
typedef AZStd::function<void(AZ::EntityId, AZ::Vector2)> OnClickCallback;
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiButtonInterface() {}
|
||||
|
||||
//! Get the on-click callback
|
||||
virtual OnClickCallback GetOnClickCallback() = 0;
|
||||
|
||||
//! Set the on-click callback
|
||||
virtual void SetOnClickCallback(OnClickCallback onClick) = 0;
|
||||
|
||||
//! Get the action name
|
||||
virtual const LyShine::ActionName& GetOnClickActionName() = 0;
|
||||
|
||||
//! Set the action name
|
||||
virtual void SetOnClickActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiButtonInterface> UiButtonBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiButtonNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiButtonNotifications() {}
|
||||
|
||||
//! Notify listeners that the button was clicked
|
||||
virtual void OnButtonClick() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiButtonNotifications> UiButtonNotificationBus;
|
||||
@@ -1,483 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Matrix4x4.h>
|
||||
#include <AzFramework/Input/Channels/InputChannelDigitalWithSharedModifierKeyStates.h>
|
||||
#include <AzFramework/Input/User/LocalUserId.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
// Forward declarations
|
||||
struct IUiAnimationSystem;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiCanvasInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
//! Deleting a canvas will delete all its child elements recursively and all of their components
|
||||
virtual ~UiCanvasInterface() {}
|
||||
|
||||
//! Get the asset ID path name of this canvas. If not loaded or saved yet this will be ""
|
||||
virtual const AZStd::string& GetPathname() = 0;
|
||||
|
||||
//! Get the ID of this canvas. This will remain the same while this canvas is loaded.
|
||||
virtual LyShine::CanvasId GetCanvasId() = 0;
|
||||
|
||||
//! Get the unique ID of this canvas
|
||||
virtual AZ::u64 GetUniqueCanvasId() = 0;
|
||||
|
||||
//! Get the draw order of this canvas. Rendering is back-to-front, so higher numbers render in front of lower numbers.
|
||||
virtual int GetDrawOrder() = 0;
|
||||
|
||||
//! Set the draw order of this canvas. Rendering is back-to-front, so higher numbers render in front of lower numbers.
|
||||
virtual void SetDrawOrder(int drawOrder) = 0;
|
||||
|
||||
//! Get the flag indicating if this canvas will stay loaded through a level unload.
|
||||
virtual bool GetKeepLoadedOnLevelUnload() = 0;
|
||||
|
||||
//! Set the flag indicating if this canvas will stay loaded through a level unload.
|
||||
virtual void SetKeepLoadedOnLevelUnload(bool keepLoaded) = 0;
|
||||
|
||||
//! Force a layout recompute. Layouts marked for a recompute are handled on the canvas update,
|
||||
//! so this can be used if an immediate recompute is desired
|
||||
virtual void RecomputeChangedLayouts() = 0;
|
||||
|
||||
//! Get the number child elements of this canvas
|
||||
virtual int GetNumChildElements() = 0;
|
||||
|
||||
//! Get the specified child element, index must be less than GetNumChildElements()
|
||||
virtual AZ::Entity* GetChildElement(int index) = 0;
|
||||
|
||||
//! Get the specified child entity Id, index must be less than GetNumChildElements()
|
||||
virtual AZ::EntityId GetChildElementEntityId(int index) = 0;
|
||||
|
||||
//! Get the child elements of this canvas
|
||||
virtual LyShine::EntityArray GetChildElements() = 0;
|
||||
|
||||
//! Get the child entity Ids of this canvas
|
||||
virtual AZStd::vector<AZ::EntityId> GetChildElementEntityIds() = 0;
|
||||
|
||||
//! Create a new element that is a child of the canvas, the canvas has ownership of the child
|
||||
virtual AZ::Entity* CreateChildElement(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the element on this canvas with the given id or nullptr if no match
|
||||
virtual AZ::Entity* FindElementById(LyShine::ElementId id) = 0;
|
||||
|
||||
//! Return the first element on this canvas with the given name or nullptr if no match
|
||||
virtual AZ::Entity* FindElementByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first element on this canvas with the given name or nullptr if no match
|
||||
virtual AZ::EntityId FindElementEntityIdByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Find all elements on this canvas with the given name
|
||||
virtual void FindElementsByName(const LyShine::NameType& name, LyShine::EntityArray& result) = 0;
|
||||
|
||||
//! Return the element with the given hierarchical name or nullptr if no match
|
||||
//! \param name, a hierarchical name relative to the root with '/' as the separator
|
||||
virtual AZ::Entity* FindElementByHierarchicalName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Find all elements on this canvas matching the predicate
|
||||
virtual void FindElements(AZStd::function<bool(const AZ::Entity*)> predicate, LyShine::EntityArray& result) = 0;
|
||||
|
||||
//! Get the front-most element whose bounds include the given point in canvas space
|
||||
//! \return nullptr if no match
|
||||
virtual AZ::Entity* PickElement(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Get all element whose bounds intersect with the given box in canvas space
|
||||
//! \return empty EntityArray if no match
|
||||
virtual LyShine::EntityArray PickElements(const AZ::Vector2& bound0, const AZ::Vector2& bound1) = 0;
|
||||
|
||||
//! Look for an entity with interactable component to handle an event at given point
|
||||
virtual AZ::EntityId FindInteractableToHandleEvent(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Save this canvas to the given path in XML
|
||||
//! \return true if no error
|
||||
virtual bool SaveToXml(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname) = 0;
|
||||
|
||||
//! Initialize a set of entities that have been added to the canvas
|
||||
//! Used when instantiating a slice or for undo/redo, copy/paste
|
||||
//! \param topLevelEntities - The elements that were created
|
||||
//! \param makeUniqueNamesAndIds If false the entity names and ElementIds in the string are kept, else unique ones are generated
|
||||
//! \param insertionPoint The parent element for the created elements, if nullptr the root element is the parent
|
||||
virtual void FixupCreatedEntities(LyShine::EntityArray topLevelEntities, bool makeUniqueNamesAndIds, AZ::Entity* optionalInsertionPoint) = 0;
|
||||
|
||||
//! Add an existing entity to the canvas (only for internal use from editor)
|
||||
//! \param element The newly created element to add to the canvas
|
||||
//! \param parent The parent element for the created element, if nullptr the root element is the parent
|
||||
//! \param insertBefore The sibling element to place this element before, if nullptr then add as last child
|
||||
virtual void AddElement(AZ::Entity* element, AZ::Entity* parent, AZ::Entity* insertBefore) = 0;
|
||||
|
||||
//! Go through all elements in the canvas and reinitialize them
|
||||
//! This is done whenever a slice asset changes and the entity context is rebuilt from the root slice asset
|
||||
virtual void ReinitializeElements() = 0;
|
||||
|
||||
//! Save this canvas to an XML string
|
||||
//! \return the resulting string
|
||||
virtual AZStd::string SaveToXmlString() = 0;
|
||||
|
||||
//! Get an element name that is unique to the children of the specified parent and to an optional array of elements
|
||||
//! \param parentEntityId The entityId of the parent who's children's names must not match the returned name
|
||||
//! \param baseName The name to append a unique identifier to
|
||||
//! \param includedChildren An array of any other elements who's names must not match the returned name
|
||||
//! \return Unique name that does not match the specified parent's children or the optional array of children
|
||||
virtual AZStd::string GetUniqueChildName(AZ::EntityId parentEntityId, AZStd::string baseName, const LyShine::EntityArray* includeChildren) = 0;
|
||||
|
||||
//! Clone an element and add it to this canvas as a child of the given parent element
|
||||
//! The entity and all its components/children are cloned and new IDs are generated
|
||||
//! NOTE: Only state that is persistent/reflected is cloned
|
||||
//! \param sourceEntity The entity to clone
|
||||
//! \param parentEntity The parent element for the created elements, if nullptr the root element is the parent
|
||||
//! \return The new entity
|
||||
virtual AZ::Entity* CloneElement(AZ::Entity* sourceEntity, AZ::Entity* parentEntity) = 0;
|
||||
|
||||
//! Clone an element and add it to this canvas as a child of the given parent element
|
||||
//! The entity and all its components/children are cloned and new IDs are generated
|
||||
//! NOTE: Only state that is persistent/reflected is cloned
|
||||
//! \param sourceEntity The entity to clone (may be from a different canvas)
|
||||
//! \param parentEntity The parent element for the created elements, if invalid the root element is the parent
|
||||
//! \param insertBefore The child of the parent element that the new element should be inserted before, if invalid the new element is the last child element
|
||||
//! \return The new entity
|
||||
virtual AZ::EntityId CloneElementEntityId(AZ::EntityId sourceEntity, AZ::EntityId parentEntity, AZ::EntityId insertBefore) = 0;
|
||||
|
||||
//! Create a clone of this canvas entity
|
||||
//! \param canvasSize The resolution to display the canvas at
|
||||
virtual AZ::Entity* CloneCanvas(const AZ::Vector2& canvasSize) = 0;
|
||||
|
||||
//! Set the transformation from canvas space to viewport space
|
||||
virtual void SetCanvasToViewportMatrix(const AZ::Matrix4x4& matrix) = 0;
|
||||
|
||||
//! Get the transformation from canvas space to viewport space
|
||||
virtual const AZ::Matrix4x4& GetCanvasToViewportMatrix() = 0;
|
||||
|
||||
//! Get the transformation from viewport space to canvas space
|
||||
virtual void GetViewportToCanvasMatrix(AZ::Matrix4x4& matrix) = 0;
|
||||
|
||||
//! Returns the "target" size of the canvas (in pixels)
|
||||
//
|
||||
//! The target canvas size changes depending on whether you're running in
|
||||
//! the UI Editor or in-game. While in-game, we assume that the canvas size
|
||||
//! fills the screen, so the target canvas size is the size of the viewport.
|
||||
//
|
||||
//! When using the editor, however, the target size is the "authored" size of
|
||||
//! the canvas. The canvas is authored in one resolution, but it may be
|
||||
//! displayed by the game at whatever the game resolution is set to.
|
||||
virtual AZ::Vector2 GetCanvasSize() = 0;
|
||||
|
||||
//! Set the authored size of the canvas (in pixels)
|
||||
virtual void SetCanvasSize(const AZ::Vector2& canvasSize) = 0;
|
||||
|
||||
//! Set the target size of the canvas (in pixels)
|
||||
//!
|
||||
//! This should be called before the UpdateCanvas and RenderCanvas methods.
|
||||
//! When running in game in full screen mode the target canvas size should be set to the viewport size
|
||||
virtual void SetTargetCanvasSize(bool isInGame, const AZ::Vector2& targetCanvasSize) = 0;
|
||||
|
||||
//! Get scale to adjust for the difference between canvas size (authored size)
|
||||
//! and the viewport size (target canvas size) when running on current device
|
||||
virtual AZ::Vector2 GetDeviceScale() = 0;
|
||||
|
||||
//! Get flag that indicates whether visual element's vertices should snap to the nearest pixel
|
||||
virtual bool GetIsPixelAligned() = 0;
|
||||
|
||||
//! Set flag that indicates whether visual element's vertices should snap to the nearest pixel
|
||||
virtual void SetIsPixelAligned(bool isPixelAligned) = 0;
|
||||
|
||||
//! Get flag that indicates whether text should snap to the nearest pixel
|
||||
virtual bool GetIsTextPixelAligned() = 0;
|
||||
|
||||
//! Set flag that indicates whether text should snap to the nearest pixel
|
||||
virtual void SetIsTextPixelAligned(bool isTextPixelAligned) = 0;
|
||||
|
||||
//! Get the animation system for this canvas
|
||||
virtual IUiAnimationSystem* GetAnimationSystem() = 0;
|
||||
|
||||
//! Get flag that governs whether the canvas is enabled
|
||||
//
|
||||
//! A canvas that's enabled will be updated and rendered each frame.
|
||||
virtual bool GetEnabled() = 0;
|
||||
|
||||
//! Set flag that governs whether the canvas is enabled
|
||||
//
|
||||
//! A canvas that's enabled will be updated and rendered each frame.
|
||||
virtual void SetEnabled(bool enabled) = 0;
|
||||
|
||||
//! Get flag that controls whether the canvas is rendering to a texture
|
||||
virtual bool GetIsRenderToTexture() = 0;
|
||||
|
||||
//! Set flag that controls whether the canvas is rendering to a texture
|
||||
virtual void SetIsRenderToTexture(bool isRenderToTexture) = 0;
|
||||
|
||||
//! Get the render target name that this canvas will render to
|
||||
virtual AZStd::string GetRenderTargetName() = 0;
|
||||
|
||||
//! Set the render target name that this canvas will render to
|
||||
virtual void SetRenderTargetName(const AZStd::string& name) = 0;
|
||||
|
||||
//! Get flag that controls whether this canvas automatically handles positional input (mouse/touch)
|
||||
virtual bool GetIsPositionalInputSupported() = 0;
|
||||
|
||||
//! Set flag that controls whether this canvas automatically handles positional input (mouse/touch)
|
||||
virtual void SetIsPositionalInputSupported(bool isSupported) = 0;
|
||||
|
||||
//! Get flag that controls whether this canvas consumes all input events while it is enabled
|
||||
virtual bool GetIsConsumingAllInputEvents() = 0;
|
||||
|
||||
//! Set flag that controls whether this canvas consumes all input events while it is enabled
|
||||
virtual void SetIsConsumingAllInputEvents(bool isConsuming) = 0;
|
||||
|
||||
//! Get flag that controls whether this canvas automatically handles multi-touch input
|
||||
virtual bool GetIsMultiTouchSupported() = 0;
|
||||
|
||||
//! Set flag that controls whether this canvas automatically handles multi-touch input
|
||||
virtual void SetIsMultiTouchSupported(bool isSupported) = 0;
|
||||
|
||||
//! Get flag that controls whether this canvas automatically handles navigation input (via keyboard/gamepad)
|
||||
virtual bool GetIsNavigationSupported() = 0;
|
||||
|
||||
//! Set flag that controls whether this canvas automatically handles navigation input (via keyboard/gamepad)
|
||||
virtual void SetIsNavigationSupported(bool isSupported) = 0;
|
||||
|
||||
//! Get the analog (eg. thumb-stick) input value that must be exceeded before a navigation command will be processed
|
||||
virtual float GetNavigationThreshold() = 0;
|
||||
|
||||
//! Set the analog (eg. thumb-stick) input value that must be exceeded before a navigation command will be processed
|
||||
virtual void SetNavigationThreshold(float navigationThreshold) = 0;
|
||||
|
||||
//! Get the delay (milliseconds) before a held navigation command will begin repeating
|
||||
virtual AZ::u64 GetNavigationRepeatDelay() = 0;
|
||||
|
||||
//! Set the delay (milliseconds) before a held navigation command will begin repeating
|
||||
virtual void SetNavigationRepeatDelay(AZ::u64 navigationRepeatDelay) = 0;
|
||||
|
||||
//! Get the delay (milliseconds) before a held navigation command will continue repeating
|
||||
virtual AZ::u64 GetNavigationRepeatPeriod() = 0;
|
||||
|
||||
//! Set the delay (milliseconds) before a held navigation command will continue repeating
|
||||
virtual void SetNavigationRepeatPeriod(AZ::u64 navigationRepeatPeriod) = 0;
|
||||
|
||||
//! Get the local user id that is being used to filter incoming input events
|
||||
virtual AzFramework::LocalUserId GetLocalUserIdInputFilter() = 0;
|
||||
|
||||
//! Set the local user id that will be used to filter incoming input events
|
||||
virtual void SetLocalUserIdInputFilter(AzFramework::LocalUserId localUserId) = 0;
|
||||
|
||||
//! Handle an input event for the canvas
|
||||
virtual bool HandleInputEvent(const AzFramework::InputChannel::Snapshot& inputSnapshot,
|
||||
const AZ::Vector2* viewportPos = nullptr,
|
||||
AzFramework::ModifierKeyMask activeModifierKeys = AzFramework::ModifierKeyMask::None) = 0;
|
||||
|
||||
//! Handle a unicode text event for the canvas
|
||||
virtual bool HandleTextEvent(const AZStd::string& textUTF8) = 0;
|
||||
|
||||
//! Handle a positional input event for the canvas, this could come from
|
||||
//! a ray cast intersection for example
|
||||
virtual bool HandleInputPositionalEvent(const AzFramework::InputChannel::Snapshot& inputSnapshot, AZ::Vector2 viewportPos) = 0;
|
||||
|
||||
//! Get the mouse position of the last input event
|
||||
virtual AZ::Vector2 GetMousePosition() = 0;
|
||||
|
||||
//! Get the element to be displayed when hovering over an interactable
|
||||
virtual AZ::EntityId GetTooltipDisplayElement() = 0;
|
||||
|
||||
//! Set the element to be displayed when hovering over an interactable
|
||||
virtual void SetTooltipDisplayElement(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Force the active interactable for the canvas to be the given one,
|
||||
//! also force AutoActivation of interactable,
|
||||
//! intended for internal use by UI components
|
||||
virtual void ForceFocusInteractable(AZ::EntityId interactableId) = 0;
|
||||
|
||||
//! Force the active interactable for the canvas to be the given one,
|
||||
//! also set last mouse pos to point,
|
||||
//! intended for internal use by UI components
|
||||
virtual void ForceActiveInteractable(AZ::EntityId interactableId, bool shouldStayActive, AZ::Vector2 point) = 0;
|
||||
|
||||
//! Get the hover interactable
|
||||
virtual AZ::EntityId GetHoverInteractable() = 0;
|
||||
|
||||
//! Force the hover interactable for the canvas to be the given one, this can be useful when using
|
||||
//! keyboard/gamepad navigation and the current hover interactable is deleted by a script and the script
|
||||
//! wants to specify the new hover interactable
|
||||
virtual void ForceHoverInteractable(AZ::EntityId interactableId) = 0;
|
||||
|
||||
//! Clear all active interactables, and all hover interactables if last input was positional (mouse/touch).
|
||||
//! This is intended for internal use by UI components
|
||||
virtual void ClearAllInteractables() = 0;
|
||||
|
||||
//! Generate Enter pressed/released input events on an interactable.
|
||||
//! Useful for automated testing to simulate button clicks
|
||||
virtual void ForceEnterInputEventOnInteractable(AZ::EntityId interactableId) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on an entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasInterface> UiCanvasBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! The canvas component implements this bus and it is provided for C++ implementations of
|
||||
//! UI components to use to talk to the canvas
|
||||
class UiCanvasComponentImplementationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCanvasComponentImplementationInterface() {}
|
||||
|
||||
//! Mark the render graph for the canvas as dirty. This will cause the render graph to get
|
||||
//! cleared and rebuilt on the next render.
|
||||
virtual void MarkRenderGraphDirty() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on an entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasComponentImplementationInterface> UiCanvasComponentImplementationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of canvas actions
|
||||
class UiCanvasActionNotification
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCanvasActionNotification(){}
|
||||
|
||||
//! Called when the canvas sends an action to the listener
|
||||
virtual void OnAction(AZ::EntityId entityId, const LyShine::ActionName& actionName) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasActionNotification> UiCanvasNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified when the draw order of any
|
||||
//! canvas changes
|
||||
class UiCanvasOrderNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
virtual ~UiCanvasOrderNotification(){}
|
||||
|
||||
//! Called when the draw order setting for a canvas changes
|
||||
//! Note this is used to update the order in the UiCanvasManager so that
|
||||
//! order has not been updated when this fires.
|
||||
virtual void OnCanvasDrawOrderChanged(AZ::EntityId canvasEntityId) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasOrderNotification> UiCanvasOrderNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified when any canvas has been
|
||||
//! enabled or disabled
|
||||
class UiCanvasEnabledStateNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
virtual ~UiCanvasEnabledStateNotification() {}
|
||||
|
||||
//! Called when the canvas was enabled or disabled
|
||||
virtual void OnCanvasEnabledStateChanged(AZ::EntityId canvasEntityId, bool enabled) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasEnabledStateNotification> UiCanvasEnabledStateNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of canvas size or scale changes
|
||||
class UiCanvasSizeNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasSizeNotification() {}
|
||||
|
||||
//! Called when the target canvas size or uniform device scale changes.
|
||||
virtual void OnCanvasSizeOrScaleChange(AZ::EntityId canvasEntityId) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasSizeNotification> UiCanvasSizeNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of changes to the canvas
|
||||
//! pixel alignment settings
|
||||
class UiCanvasPixelAlignmentNotification
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasPixelAlignmentNotification() {}
|
||||
|
||||
//! Called when the pixel alignment setting for the canvas changes
|
||||
virtual void OnCanvasPixelAlignmentChange() {}
|
||||
|
||||
//! Called when the text pixel alignment setting for the canvas changes
|
||||
virtual void OnCanvasTextPixelAlignmentChange() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasPixelAlignmentNotification> UiCanvasPixelAlignmentNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of canvas input.
|
||||
//! Note that interactables already get methods called on them when they themselves are interacted
|
||||
//! with. This notification bus is intended for other entities or Lua to know when some other
|
||||
//! entities are interacted with.
|
||||
class UiCanvasInputNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCanvasInputNotifications() {}
|
||||
|
||||
//! Called when an element is pressed. Will return an invalid entity id if no interactable was
|
||||
//! pressed.
|
||||
virtual void OnCanvasPrimaryPressed([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when an element is released. The released entity that is sent is the entity that was
|
||||
//! active (if any).
|
||||
virtual void OnCanvasPrimaryReleased([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when an element is pressed. Will be an invalid entity id if no interactable was
|
||||
//! pressed.
|
||||
virtual void OnCanvasMultiTouchPressed([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int multiTouchIndex) {};
|
||||
|
||||
//! Called when an element is released. The released entity that is sent is the entity that was
|
||||
//! active (if any).
|
||||
virtual void OnCanvasMultiTouchReleased([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int multiTouchIndex) {};
|
||||
|
||||
//! Called when an element starts being hovered
|
||||
virtual void OnCanvasHoverStart([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when an element ends being hovered
|
||||
virtual void OnCanvasHoverEnd([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when the enter key is pressed
|
||||
virtual void OnCanvasEnterPressed([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
|
||||
//! Called when the enter key is released
|
||||
virtual void OnCanvasEnterReleased([[maybe_unused]] AZ::EntityId entityId) {};
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasInputNotifications> UiCanvasInputNotificationBus;
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzFramework/Input/User/LocalUserId.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiCanvasManagerInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // types
|
||||
|
||||
typedef std::vector<AZ::EntityId> CanvasEntityList;
|
||||
|
||||
public:
|
||||
//! Create a canvas
|
||||
virtual AZ::EntityId CreateCanvas() = 0;
|
||||
|
||||
//! Load a canvas
|
||||
virtual AZ::EntityId LoadCanvas(const AZStd::string& canvasPathname) = 0;
|
||||
|
||||
//! Unload a canvas
|
||||
virtual void UnloadCanvas(AZ::EntityId canvasEntityId) = 0;
|
||||
|
||||
//! Find a canvas by path, optionally load the canvas if it was not found
|
||||
virtual AZ::EntityId FindLoadedCanvasByPathName(const AZStd::string& canvasPathname, bool loadIfNotFound = false) = 0;
|
||||
|
||||
//! Get a list of canvases that are loaded in game, this is sorted by draw order
|
||||
virtual CanvasEntityList GetLoadedCanvases() = 0;
|
||||
|
||||
//! Set the local user id that will be used to filter incoming input events for all canvases.
|
||||
//! Can be overriden for an individual canvas using UiCanvasInterface::SetLocalUserIdInputFilter.
|
||||
virtual void SetLocalUserIdInputFilterForAllCanvases(AzFramework::LocalUserId localUserId) = 0;
|
||||
};
|
||||
typedef AZ::EBus<UiCanvasManagerInterface> UiCanvasManagerBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to be notified of canvas manager changes
|
||||
class UiCanvasManagerNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual ~UiCanvasManagerNotification() {}
|
||||
|
||||
//! Called when a canvas has been loaded
|
||||
virtual void OnCanvasLoaded([[maybe_unused]] AZ::EntityId canvasEntityId) {}
|
||||
|
||||
//! Called when a canvas has been unloaded/destroyed
|
||||
virtual void OnCanvasUnloaded([[maybe_unused]] AZ::EntityId canvasEntityId) {}
|
||||
|
||||
//! Called when a canvas has been reloaded (due to hot-loading)
|
||||
//! For a hot-load, the OnCanvasLoaded/OnCanvasUnloaded notifications are not sent - only this one is
|
||||
virtual void OnCanvasReloaded([[maybe_unused]] AZ::EntityId canvasEntityId) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasManagerNotification> UiCanvasManagerNotificationBus;
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Elements that require update notifications should connect to this bus using the entity id of their
|
||||
//! containing canvas.
|
||||
class UiCanvasUpdateNotification
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCanvasUpdateNotification() {}
|
||||
|
||||
//! Update the component. This is called when the game is running.
|
||||
//! It is different from the TickBus in that it is called only when the canvas is updated.
|
||||
//! So it is not called if the canvas is disabled.
|
||||
virtual void Update(float deltaTime) = 0;
|
||||
|
||||
//! Update the component while in the editor.
|
||||
//! This is called every frame when in the editor and the game is NOT running.
|
||||
virtual void UpdateInEditor(float /*deltaTime*/) {}
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Multiple components on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCanvasUpdateNotification> UiCanvasUpdateNotificationBus;
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiCheckboxInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! params: sending entity id, new state
|
||||
typedef AZStd::function<void(AZ::EntityId, AZ::Vector2, bool)> StateChangeCallback;
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCheckboxInterface() {}
|
||||
|
||||
//! Query the state of the checkbox
|
||||
//! \return The current state for the checkbox.
|
||||
virtual bool GetState() = 0;
|
||||
|
||||
//! Manually override the state of the checkbox
|
||||
//! \param isOn The new desired state of the checkbox.
|
||||
virtual void SetState(bool checked) = 0;
|
||||
|
||||
//! Toggle the state of the checkbox
|
||||
//! \return The new state of the checkbox.
|
||||
virtual bool ToggleState() = 0;
|
||||
|
||||
//! Get the state change callback
|
||||
virtual StateChangeCallback GetStateChangeCallback() = 0;
|
||||
|
||||
//! Set the state change callback
|
||||
virtual void SetStateChangeCallback(StateChangeCallback onChange) = 0;
|
||||
|
||||
//! Set the optional checked (ON) entity
|
||||
virtual void SetCheckedEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional checked (ON) entity
|
||||
virtual AZ::EntityId GetCheckedEntity() = 0;
|
||||
|
||||
//! Set the optional unchecked (OFF) entity
|
||||
virtual void SetUncheckedEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional unchecked (OFF) entity
|
||||
virtual AZ::EntityId GetUncheckedEntity() = 0;
|
||||
|
||||
//! Get the action triggered when turned on
|
||||
virtual const LyShine::ActionName& GetTurnOnActionName() = 0;
|
||||
|
||||
//! Set the action triggered when turned on
|
||||
virtual void SetTurnOnActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the action triggered when turned off
|
||||
virtual const LyShine::ActionName& GetTurnOffActionName() = 0;
|
||||
|
||||
//! Set the action triggered when turned off
|
||||
virtual void SetTurnOffActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the action triggered when changed
|
||||
virtual const LyShine::ActionName& GetChangedActionName() = 0;
|
||||
|
||||
//! Set the action triggered when changed
|
||||
virtual void SetChangedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCheckboxInterface> UiCheckboxBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiCheckboxNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiCheckboxNotifications() {}
|
||||
|
||||
//! Notify listeners that the checkbox state has changed
|
||||
virtual void OnCheckboxStateChange([[maybe_unused]] bool checked) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiCheckboxNotifications> UiCheckboxNotificationBus;
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDraggableInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! States that the component can be in during a drag. Lua scripts can switch the state to alert the user
|
||||
enum class DragState
|
||||
{
|
||||
Normal,
|
||||
Valid,
|
||||
Invalid
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDraggableInterface() {}
|
||||
|
||||
//! Get the state of the drag
|
||||
virtual DragState GetDragState() = 0;
|
||||
|
||||
//! Set the state of the drag. This is only relevant during a drag.
|
||||
//! The state affects the visual state of the draggable and can be used to indicate when it is
|
||||
//! over a valid drop target.
|
||||
virtual void SetDragState(DragState dragState) = 0;
|
||||
|
||||
//! Redo the drag, this is not usually needed but if a UiDraggableNotificationBus handler causes
|
||||
//! drop targets to move, and keyboard or console navigation is being used, it can be needed.
|
||||
//! In that case the handler should call this method after moving drop targets.
|
||||
virtual void RedoDrag(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Set this draggable element to be a proxy for another draggable element and start a drag on
|
||||
//! this draggable element at the specified point
|
||||
virtual void SetAsProxy(AZ::EntityId originalDraggableId, AZ::Vector2 point) = 0;
|
||||
|
||||
//! Conclude the drag of a proxy. This should be called from the OnDragEnd callback of the proxy and
|
||||
//! will result in calling OnDragEnd on the draggable element that this is a proxy for
|
||||
virtual void ProxyDragEnd(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Check if this draggable element is a proxy
|
||||
virtual bool IsProxy() = 0;
|
||||
|
||||
//! Get the original draggable element that this element is a proxy for
|
||||
//! Returns an invalid entity id if this is not a proxy
|
||||
virtual AZ::EntityId GetOriginalFromProxy() = 0;
|
||||
|
||||
//! Get the flag that indicates if this draggable can be dropped on any canvas
|
||||
virtual bool GetCanDropOnAnyCanvas() = 0;
|
||||
|
||||
//! Set the flag that indicates if this draggable can be dropped on any canvas
|
||||
virtual void SetCanDropOnAnyCanvas(bool anyCanvas) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDraggableInterface> UiDraggableBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDraggableNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDraggableNotifications() {}
|
||||
|
||||
//! Called on drag start
|
||||
virtual void OnDragStart(AZ::Vector2 position) = 0;
|
||||
|
||||
//! Called on position change during drag
|
||||
virtual void OnDrag(AZ::Vector2 position) = 0;
|
||||
|
||||
//! Called on drag end
|
||||
virtual void OnDragEnd(AZ::Vector2 position) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDraggableNotifications> UiDraggableNotificationBus;
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDropTargetInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
using DropState = int;
|
||||
enum
|
||||
{
|
||||
DropStateNormal = 0,
|
||||
DropStateValid,
|
||||
DropStateInvalid,
|
||||
|
||||
NumDropStates
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropTargetInterface() {}
|
||||
|
||||
//! Get the OnDrop action name
|
||||
virtual const LyShine::ActionName& GetOnDropActionName() = 0;
|
||||
|
||||
//! Set the OnDrop action name
|
||||
virtual void SetOnDropActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Called when mouse/touch enters the bounds of this drop target while dragging a UiDraggableComponent
|
||||
virtual void HandleDropHoverStart(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Called on the currently drop hovered drop target component when mouse/touch moves outside of bounds
|
||||
virtual void HandleDropHoverEnd(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Called when a draggable is dropped on this drop target
|
||||
virtual void HandleDrop(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Get the state of the drop
|
||||
virtual DropState GetDropState() = 0;
|
||||
|
||||
//! Set the state of the drop target.
|
||||
//! The state affects the visual state of the drop target and can be used to indicate when it has
|
||||
//! a valid draggable hovering over it.
|
||||
virtual void SetDropState(DropState dropState) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropTargetInterface> UiDropTargetBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDropTargetNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropTargetNotifications() {}
|
||||
|
||||
//! Called on starting hovering over a drop target
|
||||
virtual void OnDropHoverStart(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Called on ending hovering over a drop target
|
||||
virtual void OnDropHoverEnd(AZ::EntityId draggable) = 0;
|
||||
|
||||
//! Called on drop
|
||||
virtual void OnDrop(AZ::EntityId draggable) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropTargetNotifications> UiDropTargetNotificationBus;
|
||||
@@ -1,123 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! The UI Dropdown Component is an interactable component which displays a list of options when clicked.
|
||||
//! In its default state, the dropdown display a simple button, next to an arrow indicating the dropdown
|
||||
//! functionality. When the arrow / option is clicked, the dropdown list appears, displaying the options available.
|
||||
//! If the list is too long to be displayed, a scrollbar can be added to scroll up and down the list of options.
|
||||
class UiDropdownInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropdownInterface() {}
|
||||
|
||||
//! Get the currently selected option
|
||||
virtual AZ::EntityId GetValue() = 0;
|
||||
|
||||
//! Set the currently selected option manually
|
||||
virtual void SetValue(AZ::EntityId value) = 0;
|
||||
|
||||
//! Get the content element this dropdown will expand
|
||||
virtual AZ::EntityId GetContent() = 0;
|
||||
|
||||
//! Set the content element this dropdown will expand
|
||||
virtual void SetContent(AZ::EntityId content) = 0;
|
||||
|
||||
//! Get whether this dropdown should expand automatically on hover
|
||||
virtual bool GetExpandOnHover() = 0;
|
||||
|
||||
//! Set whether this dropdown should expand automatically on hover
|
||||
virtual void SetExpandOnHover(bool expandOnHover) = 0;
|
||||
|
||||
//! Get how long to wait before expanding upon hover / collapsing upon exit
|
||||
virtual float GetWaitTime() = 0;
|
||||
|
||||
//! Set how long to wait before expanding upon hover / collapsing upon exit
|
||||
virtual void SetWaitTime(float waitTime) = 0;
|
||||
|
||||
//! Get whether this dropdown should collapse when the user clicks outside
|
||||
virtual bool GetCollapseOnOutsideClick() = 0;
|
||||
|
||||
//! Set whether this dropdown should collapse when the user clicks outside
|
||||
virtual void SetCollapseOnOutsideClick(bool collapseOnOutsideClick) = 0;
|
||||
|
||||
//! Get the element the dropdown content will parent to when expanded (the canvas by default)
|
||||
virtual AZ::EntityId GetExpandedParentId() = 0;
|
||||
|
||||
//! Set the element the dropdown content will parent to when expanded
|
||||
virtual void SetExpandedParentId(AZ::EntityId expandedParentId) = 0;
|
||||
|
||||
//! Get the text element to display to show the currently selected option
|
||||
virtual AZ::EntityId GetTextElement() = 0;
|
||||
|
||||
//! Set the text element to display to show the currently selected option
|
||||
virtual void SetTextElement(AZ::EntityId textElement) = 0;
|
||||
|
||||
//! Get the icon element to display to show the currently selected option
|
||||
virtual AZ::EntityId GetIconElement() = 0;
|
||||
|
||||
//! Set the icon element to display to show the currently selected option
|
||||
virtual void SetIconElement(AZ::EntityId iconElement) = 0;
|
||||
|
||||
//! Expand the dropdown
|
||||
virtual void Expand() = 0;
|
||||
|
||||
//! Collapse the dropdown
|
||||
virtual void Collapse() = 0;
|
||||
|
||||
//! Get the name of the action that is sent when the dropdown is expanded
|
||||
virtual const LyShine::ActionName& GetExpandedActionName() = 0;
|
||||
|
||||
//! Set the name of the action that is sent when the dropdown is expanded
|
||||
virtual void SetExpandedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the name of the action that is sent when the dropdown is collapsed
|
||||
virtual const LyShine::ActionName& GetCollapsedActionName() = 0;
|
||||
|
||||
//! Set the name of the action that is sent when the dropdown is collapsed
|
||||
virtual void SetCollapsedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the name of the action that is sent when the dropdown value is changed
|
||||
virtual const LyShine::ActionName& GetOptionSelectedActionName() = 0;
|
||||
|
||||
//! Set the name of the action that is sent when the dropdown value is changed
|
||||
virtual void SetOptionSelectedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropdownInterface> UiDropdownBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDropdownNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropdownNotifications() {}
|
||||
|
||||
//! Notify listeners that the dropdown was expanded
|
||||
virtual void OnDropdownExpanded() {}
|
||||
|
||||
//! Notify listeners that the dropdown was collapsed
|
||||
virtual void OnDropdownCollapsed() {}
|
||||
|
||||
//! Notify listeners that an option was selected
|
||||
virtual void OnDropdownValueChanged([[maybe_unused]] AZ::EntityId option) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropdownNotifications> UiDropdownNotificationBus;
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! The UiDropdownOptionComponent is a component that is designed to work in conjunction with the
|
||||
//! UiDropdownComponent. It represents any option of that dropdown that the user should be able to
|
||||
//! select to update the value of the dropdown.
|
||||
class UiDropdownOptionInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropdownOptionInterface() {}
|
||||
|
||||
//! Get the owning dropdown of this option
|
||||
virtual AZ::EntityId GetOwningDropdown() = 0;
|
||||
|
||||
//! Set the owning dropdown of this option
|
||||
virtual void SetOwningDropdown(AZ::EntityId owningDropdown) = 0;
|
||||
|
||||
//! Get the text element of this option
|
||||
virtual AZ::EntityId GetTextElement() = 0;
|
||||
|
||||
//! Set the text element of this option
|
||||
virtual void SetTextElement(AZ::EntityId textElement) = 0;
|
||||
|
||||
//! Get the icon element of this option
|
||||
virtual AZ::EntityId GetIconElement() = 0;
|
||||
|
||||
//! Set the icon element of this option
|
||||
virtual void SetIconElement(AZ::EntityId iconElement) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropdownOptionInterface> UiDropdownOptionBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiDropdownOptionNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDropdownOptionNotifications() {}
|
||||
|
||||
//! Notify listeners that the dropdown option was selected
|
||||
virtual void OnDropdownOptionSelected() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDropdownOptionNotifications> UiDropdownOptionNotificationBus;
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a dynamic layout component needs to implement. A dynamic layout component
|
||||
//! clones a prototype element to achieve the desired number of children. The parent is resized
|
||||
//! accordingly
|
||||
class UiDynamicLayoutInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDynamicLayoutInterface() {}
|
||||
|
||||
//! Clone a prototype element or remove cloned elements to end up with the specified number of children
|
||||
virtual void SetNumChildElements(int numChildren) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDynamicLayoutInterface> UiDynamicLayoutBus;
|
||||
@@ -1,233 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a dynamic scrollbox component needs to implement. A dynamic scrollbox
|
||||
//! component sets up scrollbox content as a horizontal or vertical list of elements that are
|
||||
//! cloned from prototype entities. Only the minimum number of entities are created for efficient
|
||||
//! scrolling
|
||||
class UiDynamicScrollBoxInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDynamicScrollBoxInterface() {}
|
||||
|
||||
//! Refresh the content. Should be called when list size or element content has changed.
|
||||
//! This will reset any cached information such as element sizes, so it is recommended
|
||||
//! to use AddElementsToEnd and RemoveElementsFromFront if possible when elements vary
|
||||
//! in size. AddElementsToEnd and RemoveElementsFromFront will also ensure that the
|
||||
//! scroll offset is adjusted to keep the visible elements in place
|
||||
virtual void RefreshContent() = 0;
|
||||
|
||||
//! Add elements to the end of the list.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual void AddElementsToEnd(int numElementsToAdd, bool scrollToEndIfWasAtEnd) = 0;
|
||||
|
||||
//! Remove elements from the front of the list.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual void RemoveElementsFromFront(int numElementsToRemove) = 0;
|
||||
|
||||
//! Scroll to the end of the list
|
||||
virtual void ScrollToEnd() = 0;
|
||||
|
||||
//! Get the element index of the specified child element. Returns -1 if not found.
|
||||
//! If the list is divided into sections, the index is local to the section
|
||||
virtual int GetElementIndexOfChild(AZ::EntityId childElement) = 0;
|
||||
|
||||
//! Get the section index of the specified child element. Returns -1 if not found.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual int GetSectionIndexOfChild(AZ::EntityId childElement) = 0;
|
||||
|
||||
//! Get the child element at the specified element index.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual AZ::EntityId GetChildAtElementIndex(int index) = 0;
|
||||
|
||||
//! Get the child element at the specified section index and element index.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual AZ::EntityId GetChildAtSectionAndElementIndex(int sectionIndex, int index) = 0;
|
||||
|
||||
//! Get whether the list should automatically prepare and refresh its content post activation
|
||||
virtual bool GetAutoRefreshOnPostActivate() = 0;
|
||||
|
||||
//! Set whether the list should automatically prepare and refresh its content post activation
|
||||
virtual void SetAutoRefreshOnPostActivate(bool autoRefresh) = 0;
|
||||
|
||||
//! Get the prototype entity used for the elements
|
||||
virtual AZ::EntityId GetPrototypeElement() = 0;
|
||||
|
||||
//! Set the prototype entity used for the elements
|
||||
virtual void SetPrototypeElement(AZ::EntityId prototypeElement) = 0;
|
||||
|
||||
//! Get whether the elements vary in size
|
||||
virtual bool GetElementsVaryInSize() = 0;
|
||||
|
||||
//! Set whether the elements vary in size
|
||||
virtual void SetElementsVaryInSize(bool varyInSize) = 0;
|
||||
|
||||
//! Get whether to auto calculate the elements when they vary in size
|
||||
virtual bool GetAutoCalculateVariableElementSize() = 0;
|
||||
|
||||
//! Set whether to auto calculate the elements when they vary in size
|
||||
virtual void SetAutoCalculateVariableElementSize(bool autoCalculateSize) = 0;
|
||||
|
||||
//! Get the estimated size for the variable elements. If set to 0, then element sizes
|
||||
//! are calculated up front rather than when becoming visible
|
||||
virtual float GetEstimatedVariableElementSize() = 0;
|
||||
|
||||
//! Set the estimated size for the variable elements. If set to 0, then element sizes
|
||||
//! are calculated up front rather than when becoming visible
|
||||
virtual void SetEstimatedVariableElementSize(float estimatedSize) = 0;
|
||||
|
||||
//! Get whether the list is divided into sections with headers
|
||||
virtual bool GetSectionsEnabled() = 0;
|
||||
|
||||
//! Set whether the list is divided into sections with headers
|
||||
virtual void SetSectionsEnabled(bool enabled) = 0;
|
||||
|
||||
//! Get the prototype entity used for the headers
|
||||
virtual AZ::EntityId GetPrototypeHeader() = 0;
|
||||
|
||||
//! Set the prototype entity used for the headers
|
||||
virtual void SetPrototypeHeader(AZ::EntityId prototypeHeader) = 0;
|
||||
|
||||
//! Get whether headers stick to the beginning of the visible list area
|
||||
virtual bool GetHeadersSticky() = 0;
|
||||
|
||||
//! Set whether headers stick to the beginning of the visible list area
|
||||
virtual void SetHeadersSticky(bool stickyHeaders) = 0;
|
||||
|
||||
//! Get whether the headers vary in size
|
||||
virtual bool GetHeadersVaryInSize() = 0;
|
||||
|
||||
//! Set whether the headers vary in size
|
||||
virtual void SetHeadersVaryInSize(bool varyInSize) = 0;
|
||||
|
||||
//! Get whether to auto calculate the headers when they vary in size
|
||||
virtual bool GetAutoCalculateVariableHeaderSize() = 0;
|
||||
|
||||
//! Set whether to auto calculate the headers when they vary in size
|
||||
virtual void SetAutoCalculateVariableHeaderSize(bool autoCalculateSize) = 0;
|
||||
|
||||
//! Get the estimated size for the variable headers. If set to 0, then header sizes
|
||||
//! are calculated up front rather than when becoming visible
|
||||
virtual float GetEstimatedVariableHeaderSize() = 0;
|
||||
|
||||
//! Set the estimated size for the variable headers. If set to 0, then header sizes
|
||||
//! are calculated up front rather than when becoming visible
|
||||
virtual void SetEstimatedVariableHeaderSize(float estimatedSize) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDynamicScrollBoxInterface> UiDynamicScrollBoxBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that provides data needed to display a list of elements
|
||||
class UiDynamicScrollBoxDataInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDynamicScrollBoxDataInterface() {}
|
||||
|
||||
//! Returns the number of elements in the list.
|
||||
//! Called when the list is being constructed (in the component's InGamePostActivate or when RefreshContent is being called explicitely).
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual int GetNumElements() { return 0; }
|
||||
|
||||
//! Returns the width of an element at the specified index.
|
||||
//! Called when a horizontal list contains elements of varying size, and the element's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual float GetElementWidth([[maybe_unused]] int index) { return 0.0f; }
|
||||
|
||||
//! Returns the height of an element at the specified index.
|
||||
//! Called when a vertical list contains elements of varying size, and the element's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual float GetElementHeight([[maybe_unused]] int index) { return 0.0f; }
|
||||
|
||||
//! Returns the number of sections in the list.
|
||||
//! Called when the list is being constructed (in the component's InGamePostActivate or when RefreshContent is being called explicitely).
|
||||
//! Used with lists that are divided into sections
|
||||
virtual int GetNumSections() { return 0; }
|
||||
|
||||
//! Returns the number of elements in the specified section.
|
||||
//! Called when the list is being constructed (in the component's InGamePostActivate or when RefreshContent is being called explicitely).
|
||||
//! Used with lists that are divided into sections
|
||||
virtual int GetNumElementsInSection([[maybe_unused]] int sectionIndex) { return 0; }
|
||||
|
||||
//! Returns the width of an element at the specified section.
|
||||
//! Called when a horizontal list contains elements of varying size, and the element's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual float GetElementInSectionWidth([[maybe_unused]] int sectionIndex, [[maybe_unused]] int elementindex) { return 0.0f; }
|
||||
|
||||
//! Returns the height of an element at the specified section.
|
||||
//! Called when a vertical list contains elements of varying size, and the element's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual float GetElementInSectionHeight([[maybe_unused]] int sectionIndex, [[maybe_unused]] int elementindex) { return 0.0f; }
|
||||
|
||||
//! Returns the width of a header at the specified section.
|
||||
//! Called when a horizontal list contains headers of varying size, and the header's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual float GetSectionHeaderWidth([[maybe_unused]] int sectionIndex) { return 0.0f; }
|
||||
|
||||
//! Returns the height of a header at the specified section.
|
||||
//! Called when a vertical list contains elements of varying size, and the header's "auto calculate size" option is disabled.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual float GetSectionHeaderHeight([[maybe_unused]] int sectionIndex) { return 0.0f; }
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDynamicScrollBoxDataInterface> UiDynamicScrollBoxDataBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to receive notifications of element state
|
||||
//! changes, such as when an element is about to scroll into view
|
||||
class UiDynamicScrollBoxElementNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiDynamicScrollBoxElementNotifications(){}
|
||||
|
||||
//! Called when an element is about to become visible. Used to populate the element with data for display.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual void OnElementBecomingVisible([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int index) {}
|
||||
|
||||
//! Called when elements have variable sizes and are set to auto calculate.
|
||||
//! Used with lists that are not divided into sections
|
||||
virtual void OnPrepareElementForSizeCalculation([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int index) {}
|
||||
|
||||
//! Called when an element in a section is about to become visible. Used to populate the element with data for display
|
||||
//! Used with lists that are divided into sections
|
||||
virtual void OnElementInSectionBecomingVisible([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int sectionIndex, [[maybe_unused]] int index) {}
|
||||
|
||||
//! Called when elements in sections have variable sizes and are set to auto calculate
|
||||
//! Used with lists that are divided into sections
|
||||
virtual void OnPrepareElementInSectionForSizeCalculation([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int sectionIndex, [[maybe_unused]] int index) {}
|
||||
|
||||
//! Called when a header is about to become visible. Used to populate the header with data for display.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual void OnSectionHeaderBecomingVisible([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int sectionIndex) {}
|
||||
|
||||
//! Called when headers have variable sizes and are set to auto calculate.
|
||||
//! Used with lists that are divided into sections
|
||||
virtual void OnPrepareSectionHeaderForSizeCalculation([[maybe_unused]] AZ::EntityId entityId, [[maybe_unused]] int sectionIndex) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiDynamicScrollBoxElementNotifications> UiDynamicScrollBoxElementNotificationBus;
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiEditorInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorInterface() {}
|
||||
|
||||
//! Test if this entity should be visible in the Ui Canvas Editor
|
||||
virtual bool GetIsVisible() = 0;
|
||||
|
||||
//! Set whether this entity should be visible in the Ui Canvas Editor
|
||||
virtual void SetIsVisible(bool isVisible) = 0;
|
||||
|
||||
//! Test if this entity is selectable in the UI Canvas Editor
|
||||
virtual bool GetIsSelectable() = 0;
|
||||
|
||||
//! Set whether this entity is selectable in the UI Canvas Editor
|
||||
virtual void SetIsSelectable(bool isSelectable) = 0;
|
||||
|
||||
//! Test if this entity is currently selected in the UI Canvas Editor
|
||||
virtual bool GetIsSelected() = 0;
|
||||
|
||||
//! Set whether this entity is currently selected in the UI Canvas Editor
|
||||
virtual void SetIsSelected(bool isSelected) = 0;
|
||||
|
||||
//! Test if this entity is currently expanded in the UI Canvas Editor
|
||||
virtual bool GetIsExpanded() = 0;
|
||||
|
||||
//! Set whether this entity is currently expanded in the UI Canvas Editor
|
||||
virtual void SetIsExpanded(bool isExpanded) = 0;
|
||||
|
||||
//! Test if all the parents of this UI element are visible in the editor
|
||||
virtual bool AreAllAncestorsVisible() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorInterface> UiEditorBus;
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiEditorCanvasInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorCanvasInterface() {}
|
||||
|
||||
//! Get the snap state.
|
||||
virtual bool GetIsSnapEnabled() = 0;
|
||||
|
||||
//! Set the snap state.
|
||||
virtual void SetIsSnapEnabled(bool enabled) = 0;
|
||||
|
||||
//! Get the translation distance to snap to
|
||||
virtual float GetSnapDistance() = 0;
|
||||
|
||||
//! Set the translation distance to snap to
|
||||
virtual void SetSnapDistance(float distance) = 0;
|
||||
|
||||
//! Get the degrees of rotation to snap to
|
||||
virtual float GetSnapRotationDegrees() = 0;
|
||||
|
||||
//! Set the degrees of rotation to snap to
|
||||
virtual void SetSnapRotationDegrees(float degrees) = 0;
|
||||
|
||||
//! Get the positions of the horizontal guide lines (along y-axis in canvas pixels)
|
||||
virtual AZStd::vector<float> GetHorizontalGuidePositions() = 0;
|
||||
|
||||
//! Add a horizontal guide line
|
||||
virtual void AddHorizontalGuide(float position) = 0;
|
||||
|
||||
//! Remove the horizontal guide line at the given index
|
||||
virtual void RemoveHorizontalGuide(int index) = 0;
|
||||
|
||||
//! Set the position of the horizontal guide line at the given index
|
||||
virtual void SetHorizontalGuidePosition(int index, float position) = 0;
|
||||
|
||||
//! Get the positions of the vertical guide lines (along x-axis in canvas pixels)
|
||||
virtual AZStd::vector<float> GetVerticalGuidePositions() = 0;
|
||||
|
||||
//! Add a vertical guide line
|
||||
virtual void AddVerticalGuide(float position) = 0;
|
||||
|
||||
//! Remove the vertical guide line at the given index
|
||||
virtual void RemoveVerticalGuide(int index) = 0;
|
||||
|
||||
//! Set the position of the vertical guide line at the given index
|
||||
virtual void SetVerticalGuidePosition(int index, float position) = 0;
|
||||
|
||||
//! Remove all of the guides
|
||||
virtual void RemoveAllGuides() = 0;
|
||||
|
||||
//! Get the color to draw the guide lines on this canvas
|
||||
virtual AZ::Color GetGuideColor() = 0;
|
||||
|
||||
//! Set the color to draw the guide lines on this canvas
|
||||
virtual void SetGuideColor(const AZ::Color& color) = 0;
|
||||
|
||||
//! Get whether the guides on this canvas are locked
|
||||
virtual bool GetGuidesAreLocked() = 0;
|
||||
|
||||
//! Set whether the guides on this canvas are locked
|
||||
virtual void SetGuidesAreLocked(bool areLocked) = 0;
|
||||
|
||||
//! Check the canvas for any orphaned elements. These are elements not referenced as a child by the canvas or any of its descendant elements.
|
||||
virtual bool CheckForOrphanedElements() = 0;
|
||||
|
||||
//! Recover any orphaned elements in the canvas by placing them under a special top-level element.
|
||||
virtual void RecoverOrphanedElements() = 0;
|
||||
|
||||
//! Remove any orphaned elements in the canvas.
|
||||
virtual void RemoveOrphanedElements() = 0;
|
||||
|
||||
//! Update the canvas from the UI Editor
|
||||
//! \param deltaTime the amount of time in seconds since the last call to this function
|
||||
//! \param isInGame, true if canvas being updated in preview mode, false if being updated in edit mode
|
||||
virtual void UpdateCanvasInEditorViewport(float deltaTime, bool isInGame) = 0;
|
||||
|
||||
//! Render the canvas in the UI Editor
|
||||
//! \param isInGame, true if canvas being rendered in preview mode, false if being rendered in edit mode
|
||||
//! \param viewportSize, this is the size of the viewport that the canvas is being rendered to
|
||||
virtual void RenderCanvasInEditorViewport(bool isInGame, AZ::Vector2 viewportSize) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorCanvasInterface> UiEditorCanvasBus;
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiEditorChangeNotificationInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorChangeNotificationInterface() {}
|
||||
|
||||
//! Called when the transform properties in the UI editor need to be refreshed
|
||||
virtual void OnEditorTransformPropertiesNeedRefresh() = 0;
|
||||
|
||||
//! Forces a refresh of the entire properties tree in the UI Editor.
|
||||
virtual void OnEditorPropertiesRefreshEntireTree() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorChangeNotificationInterface> UiEditorChangeNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Notify components who store directories as properties when directory contents change.
|
||||
class UiEditorRefreshDirectoryNotificationInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiEditorRefreshDirectoryNotificationInterface() {}
|
||||
|
||||
//! Notify directory properties that they should refresh their contents
|
||||
virtual void OnRefreshDirectory() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiEditorRefreshDirectoryNotificationInterface> UiEditorRefreshDirectoryNotificationBus;
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
namespace LyShine
|
||||
{
|
||||
class IRenderGraph;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiElementInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
//! Deleting an element will remove it from its parent and delete its child elements and components
|
||||
virtual ~UiElementInterface() {}
|
||||
|
||||
//! Render the element and its child elements and components, this is done by adding primitives to the render graph
|
||||
//! \param renderGraph, the render graph being added to
|
||||
//! \param isInGame, true if element being rendered in game (or preview), false if being render in edit mode
|
||||
virtual void RenderElement(LyShine::IRenderGraph* renderGraph, bool isInGame) = 0;
|
||||
|
||||
//! Retrieves the identifier of this element.
|
||||
virtual LyShine::ElementId GetElementId() = 0;
|
||||
|
||||
//! Get the name of this element
|
||||
virtual LyShine::NameType GetName() = 0;
|
||||
|
||||
//! Get the canvas that contains this element (returns AZ::InvalidEntityId if element has no canvas)
|
||||
virtual AZ::EntityId GetCanvasEntityId() = 0;
|
||||
|
||||
//! Get the parent element of this element (returns nullptr if element has no parent)
|
||||
virtual AZ::Entity* GetParent() = 0;
|
||||
|
||||
//! Get the parent entity Id of this element (returns invalid Id if element has no parent)
|
||||
virtual AZ::EntityId GetParentEntityId() = 0;
|
||||
|
||||
//! Get the number child elements of this element
|
||||
virtual int GetNumChildElements() = 0;
|
||||
|
||||
//! Get the specified child element, index must be less than GetNumChildElements()
|
||||
virtual AZ::Entity* GetChildElement(int index) = 0;
|
||||
|
||||
//! Get the specified child entity Id, index must be less than GetNumChildElements()
|
||||
virtual AZ::EntityId GetChildEntityId(int index) = 0;
|
||||
|
||||
//! Get the specified child's UiElementInterface, index must be less than GetNumChildElements()
|
||||
//! and the element must be fully initialized
|
||||
virtual UiElementInterface* GetChildElementInterface(int index) = 0;
|
||||
|
||||
//! Get the index of the specified child element
|
||||
virtual int GetIndexOfChild(const AZ::Entity* child) = 0;
|
||||
|
||||
//! Get the index of the specified child element
|
||||
virtual int GetIndexOfChildByEntityId(AZ::EntityId childId) = 0;
|
||||
|
||||
//! Get the child elements of this element
|
||||
virtual LyShine::EntityArray GetChildElements() = 0;
|
||||
|
||||
//! Get the child entity Ids of this element
|
||||
virtual AZStd::vector<AZ::EntityId> GetChildEntityIds() = 0;
|
||||
|
||||
//! Create a new element that is a child of this element, this element (the parent) has ownership of the child
|
||||
//! The new entity will have a UiElementComponent added but will not yet be initialized or activated
|
||||
virtual AZ::Entity* CreateChildElement(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Destroy this element
|
||||
virtual void DestroyElement() = 0;
|
||||
|
||||
//! Queue up element for destruction at end of frame
|
||||
virtual void DestroyElementOnFrameEnd() = 0;
|
||||
|
||||
//! Re-parent this element to move it in the hierarchy
|
||||
//! \param newParent New parent element. If null then the canvas is the parent
|
||||
//! \param nextElement Element to insert this element before. If null element is put at end of child list
|
||||
virtual void Reparent(AZ::Entity* newParent, AZ::Entity* insertBefore = nullptr) = 0;
|
||||
|
||||
//! Re-parent this element to move it in the hierarchy
|
||||
//! \param newParent New parent element. If InvalidEntityId then the canvas is the parent
|
||||
//! \param nextElement Element to insert this element before. If InvalidEntityId then element is put at end of child list
|
||||
virtual void ReparentByEntityId(AZ::EntityId newParent, AZ::EntityId insertBefore) = 0;
|
||||
|
||||
//! Add this element as a child of the specified parent
|
||||
//! \param newParent New parent element. If null then the canvas is the parent
|
||||
//! \param index Child index where element is inserted. If -1 element is put at end of child list
|
||||
virtual void AddToParentAtIndex(AZ::Entity* newParent, int index = -1) = 0;
|
||||
|
||||
//! Remove this element from its parent
|
||||
virtual void RemoveFromParent() = 0;
|
||||
|
||||
//! Get the front-most child element whose bounds include the given point in canvas space
|
||||
//! \return nullptr if no match
|
||||
virtual AZ::Entity* FindFrontmostChildContainingPoint(AZ::Vector2 point, bool isInGame) = 0;
|
||||
|
||||
//! Get all the children whose bounds intersect with the given rect in canvas space
|
||||
//! \return Empty EntityArray if no match
|
||||
virtual LyShine::EntityArray FindAllChildrenIntersectingRect(const AZ::Vector2& bound0, const AZ::Vector2& bound1, bool isInGame) = 0;
|
||||
|
||||
//! Look for an entity with interactable component to handle an event at given point
|
||||
virtual AZ::EntityId FindInteractableToHandleEvent(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Look for a parent (ancestor) entity with interactable component to handle dragging starting at given point
|
||||
virtual AZ::EntityId FindParentInteractableSupportingDrag(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Return the first immediate child element with the given name or nullptr if no match
|
||||
virtual AZ::Entity* FindChildByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first descendant element with the given name or nullptr if no match
|
||||
virtual AZ::Entity* FindDescendantByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first immediate child entity Id with the given name or invalid Id if no match
|
||||
virtual AZ::EntityId FindChildEntityIdByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first descendant entity Id with the given name or invalid Id if no match
|
||||
virtual AZ::EntityId FindDescendantEntityIdByName(const LyShine::NameType& name) = 0;
|
||||
|
||||
//! Return the first immediate child element with the given id or nullptr if no match
|
||||
virtual AZ::Entity* FindChildByEntityId(AZ::EntityId id) = 0;
|
||||
|
||||
//! Return the descendant element with the given id or nullptr if no match
|
||||
virtual AZ::Entity* FindDescendantById(LyShine::ElementId id) = 0;
|
||||
|
||||
//! recursively find descendant elements matching a predicate
|
||||
//! \param result, any matching elements will be added to this array
|
||||
virtual void FindDescendantElements(AZStd::function<bool(const AZ::Entity*)> predicate, LyShine::EntityArray& result) = 0;
|
||||
|
||||
//! recursively visit descendant elements and call the given function on them
|
||||
//! The function is called first on the element and then on its children
|
||||
virtual void CallOnDescendantElements(AZStd::function<void(const AZ::EntityId)> callFunction) = 0;
|
||||
|
||||
//! Return whether a given element is an ancestor of this element
|
||||
virtual bool IsAncestor(AZ::EntityId id) = 0;
|
||||
|
||||
//! Enabled/disabled
|
||||
virtual bool IsEnabled() = 0;
|
||||
virtual void SetIsEnabled(bool isEnabled) = 0;
|
||||
virtual bool GetAreElementAndAncestorsEnabled() = 0;
|
||||
|
||||
//! This can be used to disable the render without disabling the update/interaction.
|
||||
//! This is used internally by components that temporarily disable rendering of other elements (though they preserve the existing value).
|
||||
virtual bool IsRenderEnabled() = 0;
|
||||
virtual void SetIsRenderEnabled(bool isRenderEnabled) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiElementInterface> UiElementBus;
|
||||
|
||||
// UI_ANIMATION_REVISIT This may be a temporary location
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiElementChangeNotification
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiElementChangeNotification() {}
|
||||
|
||||
//! Notify listeners that a property has change on this entity
|
||||
virtual void UiElementPropertyChanged() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiElementChangeNotification> UiElementChangeNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiElementNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiElementNotifications() {}
|
||||
|
||||
//! Notify listeners that the element is being destroyed
|
||||
virtual void OnUiElementBeingDestroyed() {}
|
||||
|
||||
//! Notify listeners that the element has been fixed up (canvas and parent for the element have been set)
|
||||
virtual void OnUiElementFixup(AZ::EntityId /*canvasEntityId*/, AZ::EntityId /*parentEntityId*/) {}
|
||||
|
||||
//! Notify listeners that the element has been enabled or disabled (the flag on this element was changed)
|
||||
virtual void OnUiElementEnabledChanged(bool /*isEnabled*/) {}
|
||||
|
||||
//! Notify listeners that the element has been enabled or disabled either directly or to a change to an ancestors enabled flag
|
||||
virtual void OnUiElementAndAncestorsEnabledChanged(bool /*areElementAndAncestorsEnabled*/) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiElementNotifications> UiElementNotificationBus;
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Serialization/ObjectStream.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace AZ
|
||||
{
|
||||
class Entity;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for making requests to the UI entity context.
|
||||
//! There is one UiEntityContext per UI canvas.
|
||||
class UiEntityContextRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiEntityContextRequests() {}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides. Accessed by EntityContextId
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
typedef AzFramework::EntityContextId BusIdType;
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Creates an entity in a UI context.
|
||||
//! \return a new entity
|
||||
virtual AZ::Entity* CreateUiEntity(const char* name) = 0;
|
||||
|
||||
//! Registers an existing entity with a UI context.
|
||||
virtual void AddUiEntity(AZ::Entity* entity) = 0;
|
||||
|
||||
//! Registers an existing set of entities with a UI context.
|
||||
virtual void AddUiEntities(const AzFramework::EntityList& entities) = 0;
|
||||
|
||||
//! Destroys an entity in a UI context.
|
||||
//! \return whether or not the entity was destroyed. A false return value signifies the entity did not belong to the UI context.
|
||||
virtual bool DestroyUiEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Clones a set of entities.
|
||||
//! \param sourceEntities - the source set of entities to clone
|
||||
//! \param resultEntities - the set of entities cloned from the source
|
||||
virtual bool CloneUiEntities(const AZStd::vector<AZ::EntityId>& sourceEntities, AzFramework::EntityList& resultEntities) = 0;
|
||||
|
||||
};
|
||||
|
||||
using UiEntityContextRequestBus = AZ::EBus<UiEntityContextRequests>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for receiving events/notifications from the UI entity context
|
||||
class UiEntityContextNotification
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiEntityContextNotification() {};
|
||||
|
||||
//! Fired when the context is being reset.
|
||||
virtual void OnContextReset() {}
|
||||
|
||||
//! Fired when a slice has been successfully instantiated.
|
||||
virtual void OnSliceInstantiated(const AZ::Data::AssetId& /*sliceAssetId*/, const AZ::SliceComponent::SliceInstanceAddress& /*sliceAddress*/, const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
|
||||
//! Fired when a slice has failed to instantiate.
|
||||
virtual void OnSliceInstantiationFailed(const AZ::Data::AssetId& /*sliceAssetId*/, const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
|
||||
//! Fired when the entity stream has been successfully loaded.
|
||||
virtual void OnEntityStreamLoadSuccess() {}
|
||||
|
||||
//! Fired when the entity stream load has failed
|
||||
virtual void OnEntityStreamLoadFailed() {}
|
||||
};
|
||||
|
||||
using UiEntityContextNotificationBus = AZ::EBus<UiEntityContextNotification>;
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiFaderInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiFaderInterface() {}
|
||||
|
||||
//! Get the fade value. This is a float between 0 and 1. 1 means no fade. 0 means complete fade to invisible.
|
||||
virtual float GetFadeValue() = 0;
|
||||
|
||||
//! Set the fade value
|
||||
virtual void SetFadeValue(float fade) = 0;
|
||||
|
||||
//! Trigger a fade animation.
|
||||
//! \param targetValue The value to end the fade at [0,1]
|
||||
//! \param speed Speed measured in full fade amount per second; 0 means instant
|
||||
//! \param listener The listener to notify when the fade is completed or interrupted
|
||||
virtual void Fade(float targetValue, float speed) = 0;
|
||||
|
||||
//! Get whether a fade animation is taking place
|
||||
virtual bool IsFading() = 0;
|
||||
|
||||
//! Get the flag that indicates whether the fader should use render to texture
|
||||
virtual bool GetUseRenderToTexture() = 0;
|
||||
|
||||
//! Set the flag that indicates whether the fader should use render to texture
|
||||
virtual void SetUseRenderToTexture(bool useRenderToTexture) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiFaderInterface> UiFaderBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement
|
||||
class UiFaderNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiFaderNotifications(){}
|
||||
|
||||
//! Called when the animation triggered by UiFaderInterface::Fade() is done.
|
||||
//! The listener is automatically removed from the fader component after this is called.
|
||||
virtual void OnFadeComplete() = 0;
|
||||
|
||||
//! Called when the animation triggered by UiFaderInterface::Fade() is interrupted.
|
||||
//! The listener is automatically removed from the fader component after this is called.
|
||||
virtual void OnFadeInterrupted() = 0;
|
||||
|
||||
//! Called when the fader component is destroyed
|
||||
virtual void OnFaderDestroyed() = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiFaderNotifications> UiFaderNotificationBus;
|
||||
@@ -1,172 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus that defines the interface for flipbook animations.
|
||||
//!
|
||||
//! A flipbook animation component exists on an entity that has an image component
|
||||
//! and interacts with the image bus to achieve its functionality (such as by
|
||||
//! manipulating sprite-sheet indices).
|
||||
class UiFlipbookAnimationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // Types
|
||||
|
||||
//! Defines the looping behavior when playing back a flipbook animation.
|
||||
enum class LoopType
|
||||
{
|
||||
None, //!< No looping behavior
|
||||
|
||||
Linear, //!< When end frame is reached, next frame will be the loop start frame
|
||||
|
||||
PingPong //!< When end frame is reached, next frame will be the previous frame,
|
||||
//!< continuing in reverse until the start frame is reached.
|
||||
};
|
||||
|
||||
//! Units of speed for framerate
|
||||
enum class FramerateUnits
|
||||
{
|
||||
FPS, //!< Framerate of animation
|
||||
|
||||
SecondsPerFrame, //!< Number of seconds to wait before playing next frame
|
||||
};
|
||||
|
||||
public:
|
||||
virtual ~UiFlipbookAnimationInterface() {}
|
||||
|
||||
//! Start the animation sequence, beginning at the start frame.
|
||||
//!
|
||||
//! If a LoopType other than None has been set, the animation won't stop
|
||||
//! unless explicitly done so (or the image is unloaded/destroyed).
|
||||
virtual void Start() = 0;
|
||||
|
||||
//! Stops animation playback.
|
||||
virtual void Stop() = 0;
|
||||
|
||||
//! \return True if the flipbook animation is currently playing, false otherwise.
|
||||
virtual bool IsPlaying() = 0;
|
||||
|
||||
//! \return The starting frame of the animation.
|
||||
virtual AZ::u32 GetStartFrame() = 0;
|
||||
|
||||
//! Sets the starting frame of the animation.
|
||||
virtual void SetStartFrame(AZ::u32 startFrame) = 0;
|
||||
|
||||
//! \return End frame of the animation.
|
||||
virtual AZ::u32 GetEndFrame() = 0;
|
||||
|
||||
//! Sets the ending frame of the animation.
|
||||
virtual void SetEndFrame(AZ::u32 endFrame) = 0;
|
||||
|
||||
//! \return The current frame of the animation that's being rendered.
|
||||
virtual AZ::u32 GetCurrentFrame() = 0;
|
||||
|
||||
//! Sets the current frame of the animation to render.
|
||||
//!
|
||||
//! If the animation is currently playing, this will effectively "skip"
|
||||
//! to the given frame.
|
||||
virtual void SetCurrentFrame(AZ::u32 currentFrame) = 0;
|
||||
|
||||
//! This frame is distinct from the start frame and allows a "lead in"
|
||||
//! seqence of frames to play leading up to the looping animation. The
|
||||
//! frames that occur prior to the loop start frame will only play once.
|
||||
//!
|
||||
//! \return The frame to start the loop from.
|
||||
virtual AZ::u32 GetLoopStartFrame() = 0;
|
||||
|
||||
//! Sets the starting frame for looping sequences.
|
||||
virtual void SetLoopStartFrame(AZ::u32 loopStartFrame) = 0;
|
||||
|
||||
//! \return The LoopType of the flipbook animation.
|
||||
virtual LoopType GetLoopType() = 0;
|
||||
|
||||
//! Sets the LoopType of the flipbook animation.
|
||||
virtual void SetLoopType(LoopType loopType) = 0;
|
||||
|
||||
//! Gets the speed used to determine when to transition to the next frame.
|
||||
//!
|
||||
//! Framerate is defined relative to unit of time, specified by FramerateUnits.
|
||||
//!
|
||||
//! See GetFramerateUnit, SetFramerateUnit.
|
||||
virtual float GetFramerate() = 0;
|
||||
|
||||
//! Sets the speed used to determine when to transition to the next frame.
|
||||
//!
|
||||
//! Framerate is defined relative to unit of time, specified by FramerateUnits.
|
||||
//!
|
||||
//! See GetFramerateUnit, SetFramerateUnit.
|
||||
virtual void SetFramerate(float framerate) = 0;
|
||||
|
||||
//! Gets the framerate unit.
|
||||
virtual FramerateUnits GetFramerateUnit() = 0;
|
||||
|
||||
//! Sets the framerate unit.
|
||||
virtual void SetFramerateUnit(FramerateUnits framerateUnit) = 0;
|
||||
|
||||
//! Gets the delay (in seconds) before playing the flipbook (applied only once during playback).
|
||||
virtual float GetStartDelay() = 0;
|
||||
|
||||
//! Sets the delay (in seconds) before playing the flipbook (applied only once during playback).
|
||||
virtual void SetStartDelay(float startDelay) = 0;
|
||||
|
||||
//! Gets the delay (in seconds) before playing the loop sequence.
|
||||
virtual float GetLoopDelay() = 0;
|
||||
|
||||
//! Sets the delay (in seconds) before playing the loop sequence.
|
||||
virtual void SetLoopDelay(float loopDelay) = 0;
|
||||
|
||||
//! Gets the delay (in seconds) before playing the reverse loop sequence (PingPong loop types only).
|
||||
virtual float GetReverseDelay() = 0;
|
||||
|
||||
//! Sets the delay (in seconds) before playing the reverse loop sequence (PingPong loop types only).
|
||||
virtual void SetReverseDelay(float reverseDelay) = 0;
|
||||
|
||||
//! Returns true if the animation will begin playing when the component activates, false otherwise.
|
||||
virtual bool GetIsAutoPlay() = 0;
|
||||
|
||||
//! Sets whether the animation will automatically begin playing.
|
||||
//!
|
||||
//! This flag is ignored after the component has activated.
|
||||
virtual void SetIsAutoPlay(bool isAutoPlay) = 0;
|
||||
};
|
||||
|
||||
using UiFlipbookAnimationBus = AZ::EBus<UiFlipbookAnimationInterface>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Allows listeners to be aware of events, like loop completion, occurring.
|
||||
class UiFlipbookAnimationNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiFlipbookAnimationNotifications() {}
|
||||
|
||||
//! Notify listeners when the animation starts
|
||||
virtual void OnAnimationStarted() {}
|
||||
|
||||
//! Notify listeners when the animation stops
|
||||
virtual void OnAnimationStopped() {}
|
||||
|
||||
//! Notify listeners when the current loop sequence has completed
|
||||
//!
|
||||
//! This will only trigger for LoopType sequences other than None.
|
||||
//!
|
||||
//! For Linear LoopType, this will trigger on the last frame of the last
|
||||
//! frame of the loop.
|
||||
//!
|
||||
//! For PingPong LoopType, this will trigger on the last frame of the
|
||||
//! loop sequence before reversing the loop direction.
|
||||
virtual void OnLoopSequenceCompleted() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiFlipbookAnimationNotifications> UiFlipbookAnimationNotificationsBus;
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Serialization/ObjectStream.h>
|
||||
#include <AzCore/Serialization/IdUtils.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
|
||||
// Forward declarations
|
||||
namespace AZ
|
||||
{
|
||||
class Entity;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for making requests to the UI game entity context.
|
||||
class UiGameEntityContextRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiGameEntityContextRequests() {}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides. Accessed by EntityContextId
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
typedef AzFramework::EntityContextId BusIdType;
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Instantiates a dynamic slice asynchronously.
|
||||
//! \return a ticket identifying the spawn request.
|
||||
//! Callers can immediately subscribe to the SliceInstantiationResultBus for this ticket
|
||||
//! to receive result for this specific request.
|
||||
virtual AzFramework::SliceInstantiationTicket InstantiateDynamicSlice(
|
||||
const AZ::Data::Asset<AZ::Data::AssetData>& /*sliceAsset*/,
|
||||
const AZ::Vector2& /*position*/,
|
||||
bool /*isViewportPosition*/,
|
||||
AZ::Entity* /*parent*/,
|
||||
const AZ::IdUtils::Remapper<AZ::EntityId>::IdMapper& /*customIdMapper*/)
|
||||
{ return AzFramework::SliceInstantiationTicket(); }
|
||||
};
|
||||
|
||||
using UiGameEntityContextBus = AZ::EBus<UiGameEntityContextRequests>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for receiving notifications from the UI game entity context component.
|
||||
class UiGameEntityContextNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiGameEntityContextNotifications() = default;
|
||||
|
||||
/// Fired when a slice has been successfully instantiated.
|
||||
virtual void OnSliceInstantiated(const AZ::Data::AssetId& /*sliceAssetId*/,
|
||||
const AZ::SliceComponent::SliceInstanceAddress& /*instance*/,
|
||||
const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
|
||||
/// Fired when a slice asset could not be instantiated.
|
||||
virtual void OnSliceInstantiationFailed(const AZ::Data::AssetId& /*sliceAssetId*/,
|
||||
const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
};
|
||||
|
||||
using UiGameEntityContextNotificationBus = AZ::EBus<UiGameEntityContextNotifications>;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for receiving notifications from the UI game entity context component. This bus is used
|
||||
//! by the UiSpawnerComponent that depends on the UiGameEntityContext fixing entities up before
|
||||
//! it sends out notifications to listeners on the UiSpawnerNotificationBus
|
||||
class UiGameEntityContextSliceInstantiationResults
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~UiGameEntityContextSliceInstantiationResults() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides. Addressed by SliceInstantiationTicket
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
typedef AzFramework::SliceInstantiationTicket BusIdType;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Signals that a slice was successfully instantiated prior to entity registration.
|
||||
virtual void OnEntityContextSlicePreInstantiate(const AZ::Data::AssetId& /*sliceAssetId*/, const AZ::SliceComponent::SliceInstanceAddress& /*sliceAddress*/) {}
|
||||
|
||||
//! Signals that a slice was successfully instantiated after entity registration.
|
||||
virtual void OnEntityContextSliceInstantiated(const AZ::Data::AssetId& /*sliceAssetId*/, const AZ::SliceComponent::SliceInstanceAddress& /*sliceAddress*/) {}
|
||||
|
||||
//! Signals that a slice could not be instantiated.
|
||||
virtual void OnEntityContextSliceInstantiationFailed(const AZ::Data::AssetId& /*sliceAssetId*/) {}
|
||||
};
|
||||
|
||||
using UiGameEntityContextSliceInstantiationResultsBus = AZ::EBus<UiGameEntityContextSliceInstantiationResults>;
|
||||
@@ -1,168 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiImageInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
enum class ImageType : int32_t
|
||||
{
|
||||
Stretched, //!< the texture is stretched to fit the rect without maintaining aspect ratio
|
||||
Sliced, //!< the texture is sliced such that center stretches and the edges do not
|
||||
Fixed, //!< the texture is not stretched at all
|
||||
Tiled, //!< the texture is tiled (repeated)
|
||||
StretchedToFit, //!< the texture is scaled to fit the rect while maintaining aspect ratio
|
||||
StretchedToFill //!< the texture is scaled to fill the rect while maintaining aspect ratio
|
||||
};
|
||||
|
||||
enum class SpriteType : int32_t
|
||||
{
|
||||
SpriteAsset,
|
||||
RenderTarget,
|
||||
};
|
||||
|
||||
enum class FillType : int32_t
|
||||
{
|
||||
None, //!< the image is displayed fully filled
|
||||
Linear, //!< the image is filled linearly from one edge to the opposing edge
|
||||
Radial, //!< the image is filled radially around the center
|
||||
RadialCorner, //!< the image is filled radially around a corner
|
||||
RadialEdge, //!< the image is filled radially around the midpoint of an edge
|
||||
};
|
||||
|
||||
enum class FillCornerOrigin : int32_t
|
||||
{
|
||||
TopLeft,
|
||||
TopRight,
|
||||
BottomRight,
|
||||
BottomLeft,
|
||||
};
|
||||
|
||||
enum class FillEdgeOrigin : int32_t
|
||||
{
|
||||
Left,
|
||||
Top,
|
||||
Right,
|
||||
Bottom,
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiImageInterface() {}
|
||||
|
||||
//! Gets the image color tint
|
||||
virtual AZ::Color GetColor() = 0;
|
||||
|
||||
//! Sets the image color tint
|
||||
virtual void SetColor(const AZ::Color& color) = 0;
|
||||
|
||||
//! Gets the image color alpha
|
||||
virtual float GetAlpha() = 0;
|
||||
|
||||
//! Sets the image color alpha
|
||||
virtual void SetAlpha(float color) = 0;
|
||||
|
||||
//! Gets the sprite for this element
|
||||
virtual ISprite* GetSprite() = 0;
|
||||
|
||||
//! Sets the sprite for this element
|
||||
virtual void SetSprite(ISprite* sprite) = 0;
|
||||
|
||||
//! Gets the source location of the image to be displayed by the element
|
||||
virtual AZStd::string GetSpritePathname() = 0;
|
||||
|
||||
//! Sets the source location of the image to be displayed by the element
|
||||
virtual void SetSpritePathname(AZStd::string spritePath) = 0;
|
||||
|
||||
//! Sets the source location of the image to be displayed by the element only
|
||||
//! if the sprite asset exists. Otherwise, the current sprite remains unchanged.
|
||||
//! Returns whether the sprite changed
|
||||
virtual bool SetSpritePathnameIfExists(AZStd::string spritePath) = 0;
|
||||
|
||||
//! Gets the name of the render target
|
||||
virtual AZStd::string GetRenderTargetName() = 0;
|
||||
|
||||
//! Sets the name of the render target
|
||||
virtual void SetRenderTargetName(AZStd::string renderTargetName) = 0;
|
||||
|
||||
//! Gets whether the render target is in sRGB color space
|
||||
virtual bool GetIsRenderTargetSRGB() = 0;
|
||||
|
||||
//! Sets whether the render target is in sRGB color space
|
||||
virtual void SetIsRenderTargetSRGB(bool isSRGB) = 0;
|
||||
|
||||
//! Gets the type of the sprite
|
||||
virtual SpriteType GetSpriteType() = 0;
|
||||
|
||||
//! Sets the type of the sprite
|
||||
virtual void SetSpriteType(SpriteType spriteType) = 0;
|
||||
|
||||
//! Gets the type of the image
|
||||
virtual ImageType GetImageType() = 0;
|
||||
|
||||
//! Sets the type of the image
|
||||
virtual void SetImageType(ImageType imageType) = 0;
|
||||
|
||||
//! Gets the fill type for the image
|
||||
virtual FillType GetFillType() = 0;
|
||||
|
||||
//! Sets the fill type for the image
|
||||
virtual void SetFillType(FillType fillType) = 0;
|
||||
|
||||
//! Gets the fill amount for the image in the range [0,1]
|
||||
virtual float GetFillAmount() = 0;
|
||||
|
||||
//! Sets the fill amount for the image in the range [0,1]
|
||||
virtual void SetFillAmount(float fillAmount) = 0;
|
||||
|
||||
//! Gets the start angle for radial fill, measured clockwise in degrees from straight up
|
||||
virtual float GetRadialFillStartAngle() = 0;
|
||||
|
||||
//! Sets the start angle for radial fill, measured clockwise in degrees from straight up
|
||||
virtual void SetRadialFillStartAngle(float radialFillStartAngle) = 0;
|
||||
|
||||
//! Gets the corner fill origin
|
||||
virtual FillCornerOrigin GetCornerFillOrigin() = 0;
|
||||
|
||||
//! Sets the corner fill origin
|
||||
virtual void SetCornerFillOrigin(FillCornerOrigin cornerOrigin) = 0;
|
||||
|
||||
//! Gets the edge fill origin
|
||||
virtual FillEdgeOrigin GetEdgeFillOrigin() = 0;
|
||||
|
||||
//! Sets the edge fill origin
|
||||
virtual void SetEdgeFillOrigin(FillEdgeOrigin edgeOrigin) = 0;
|
||||
|
||||
//! Gets whether the image is filled clockwise
|
||||
virtual bool GetFillClockwise() = 0;
|
||||
|
||||
//! Sets whether the image is filled clockwise
|
||||
virtual void SetFillClockwise(bool fillClockwise) = 0;
|
||||
|
||||
//! Gets whether the center of a sliced image is filled
|
||||
virtual bool GetFillCenter() = 0;
|
||||
|
||||
//! Sets whether the center of a sliced image is filled
|
||||
virtual void SetFillCenter(bool fillCenter) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiImageInterface> UiImageBus;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiImageSequenceInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
enum class ImageType : int32_t
|
||||
{
|
||||
Stretched, //!< the texture is stretched to fit the rect without maintaining aspect ratio
|
||||
Fixed, //!< the texture is not stretched at all
|
||||
StretchedToFit, //!< the texture is scaled to fit the rect while maintaining aspect ratio
|
||||
StretchedToFill //!< the texture is scaled to fill the rect while maintaining aspect ratio
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiImageSequenceInterface() {}
|
||||
|
||||
//! Gets the type of the image
|
||||
virtual ImageType GetImageType() = 0;
|
||||
|
||||
//! Sets the type of the image
|
||||
virtual void SetImageType(ImageType imageType) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiImageSequenceInterface> UiImageSequenceBus;
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Defines an interface for working with indexable image types, such as sprite-sheets or image sequences.
|
||||
class UiIndexableImageInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiIndexableImageInterface() {}
|
||||
|
||||
//! Sets the index of the image to display
|
||||
virtual void SetImageIndex(AZ::u32 index) = 0;
|
||||
|
||||
//! Gets the index of the image to display
|
||||
virtual const AZ::u32 GetImageIndex() = 0;
|
||||
|
||||
//! Gets the number of indices for this image.
|
||||
virtual const AZ::u32 GetImageIndexCount() = 0;
|
||||
|
||||
//! Given an index, return its alias (if defined)
|
||||
virtual AZStd::string GetImageIndexAlias(AZ::u32 index) = 0;
|
||||
|
||||
//! Given an index, set an alias for it
|
||||
virtual void SetImageIndexAlias(AZ::u32 index, const AZStd::string& alias) = 0;
|
||||
|
||||
//! Given an alias, return the index that corresponds to it
|
||||
virtual AZ::u32 GetImageIndexFromAlias(const AZStd::string& alias) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiIndexableImageInterface> UiIndexableImageBus;
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiInitializationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInitializationInterface() {}
|
||||
|
||||
//! Initialize the component after it has been created as part of a set of entities.
|
||||
//! I.e. After a group of entities has been created and activated from a load or clone operation
|
||||
//! in the game (not in the UI Editor) this is called on each created element.
|
||||
//! This allows the component to perform operations that rely on related entities being
|
||||
//! activated.
|
||||
virtual void InGamePostActivate() = 0;
|
||||
|
||||
public: // static member functions
|
||||
|
||||
static const char* GetUniqueName() { return "UiInitializationInterface"; }
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Multiple components on an entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInitializationInterface> UiInitializationBus;
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This bus allows the get/set of properties for a group of actions that many interactable components
|
||||
// implement.
|
||||
// It is separate from UiInteractableBus because UiInteractableBus is part of a core system for how
|
||||
// the UI canvas communincates with any UI element that wants user input. Sometimes UI components
|
||||
// want input because they are part of a 2D puzzle for example but they do not always want to have
|
||||
// to support the standard action changes.
|
||||
class UiInteractableActionsInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
typedef AZStd::function<void(AZ::EntityId)> OnActionCallback;
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableActionsInterface() {}
|
||||
|
||||
//! Get the hover start action name
|
||||
virtual const LyShine::ActionName& GetHoverStartActionName() = 0;
|
||||
|
||||
//! Set the hover start action name
|
||||
virtual void SetHoverStartActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the hover end action name
|
||||
virtual const LyShine::ActionName& GetHoverEndActionName() = 0;
|
||||
|
||||
//! Set the hover end action name
|
||||
virtual void SetHoverEndActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the pressed action name
|
||||
virtual const LyShine::ActionName& GetPressedActionName() = 0;
|
||||
|
||||
//! Set the pressed action name
|
||||
virtual void SetPressedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the released action name
|
||||
virtual const LyShine::ActionName& GetReleasedActionName() = 0;
|
||||
|
||||
//! Set the released action name
|
||||
virtual void SetReleasedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the hover start callback
|
||||
virtual OnActionCallback GetHoverStartActionCallback() = 0;
|
||||
|
||||
//! Set the hover start callback
|
||||
virtual void SetHoverStartActionCallback(OnActionCallback onActionCallback) = 0;
|
||||
|
||||
//! Get the hover end callback
|
||||
virtual OnActionCallback GetHoverEndActionCallback() = 0;
|
||||
|
||||
//! Set the hover end callback
|
||||
virtual void SetHoverEndActionCallback(OnActionCallback onActionCallback) = 0;
|
||||
|
||||
//! Get the pressed callback
|
||||
virtual OnActionCallback GetPressedActionCallback() = 0;
|
||||
|
||||
//! Set the pressed callback
|
||||
virtual void SetPressedActionCallback(OnActionCallback onActionCallback) = 0;
|
||||
|
||||
//! Get the release callback
|
||||
virtual OnActionCallback GetReleasedActionCallback() = 0;
|
||||
|
||||
//! Set the release callback
|
||||
virtual void SetReleasedActionCallback(OnActionCallback onActionCallback) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableActionsInterface> UiInteractableActionsBus;
|
||||
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzFramework/Input/Channels/InputChannelDigitalWithSharedModifierKeyStates.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiInteractableInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableInterface() {}
|
||||
|
||||
//! Check whether this component can handle the event at the given location
|
||||
virtual bool CanHandleEvent(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Called on an interactable component when a pressed event is received over it
|
||||
//! \param point, the point at which the event occurred (viewport space)
|
||||
//! \param shouldStayActive, output - true if the interactable wants to become the active element for the canvas
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandlePressed(AZ::Vector2 point, bool& shouldStayActive) = 0;
|
||||
|
||||
//! Called on the currently pressed interactable component when a release event is received
|
||||
//! \param point, the point at which the event occurred (viewport space)
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleReleased(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Called on an interactable component when a multi-touch pressed event is received over it
|
||||
//! \param point, the point at which the event occurred (viewport space)
|
||||
//! \param multiTouchIndex, the index of the multi-touch (the 'primary' touch with index 0 is sent to HandlePressed)
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleMultiTouchPressed(AZ::Vector2 point, int multiTouchIndex) = 0;
|
||||
|
||||
//! Called on the currently pressed interactable component when a multi-touch release event is received
|
||||
//! \param point, the point at which the event occurred (viewport space)
|
||||
//! \param multiTouchIndex, the index of the multi-touch (the 'primary' touch with index 0 is sent to HandlePressed)
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleMultiTouchReleased(AZ::Vector2 point, int multiTouchIndex) = 0;
|
||||
|
||||
//! Called on an interactable component when an enter pressed event is received
|
||||
//! \param shouldStayActive, output - true if the interactable wants to become the active element for the canvas
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleEnterPressed([[maybe_unused]] bool& shouldStayActive) { return false; }
|
||||
|
||||
//! Called on the currently pressed interactable component when an enter released event is received
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleEnterReleased() { return false; }
|
||||
|
||||
//! Called when the interactable was navigated to via gamepad/keyboard, and auto activation is enabled on the interactable
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleAutoActivation() { return false; }
|
||||
|
||||
//! Called on the currently active interactable component when text input is received
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleTextInput([[maybe_unused]] const AZStd::string& textUTF8) { return false; };
|
||||
|
||||
//! Called on the currently active interactable component when input is received
|
||||
//! \return true if the interactable handled the event
|
||||
virtual bool HandleKeyInputBegan([[maybe_unused]] const AzFramework::InputChannel::Snapshot& inputSnapshot, [[maybe_unused]] AzFramework::ModifierKeyMask activeModifierKeys) { return false; }
|
||||
|
||||
//! Called on the currently active interactable component when a mouse/touch position event is received
|
||||
//! \param point, the current mouse/touch position (viewport space)
|
||||
virtual void InputPositionUpdate([[maybe_unused]] AZ::Vector2 point) {};
|
||||
|
||||
//! Called on the currently pressed interactable component when a multi-touch position event is received
|
||||
//! \param point, the current mouse/touch position (viewport space)
|
||||
//! \param multiTouchIndex, the index of the multi-touch (the 'primary' touch with index 0 is sent to HandlePressed)
|
||||
virtual void MultiTouchPositionUpdate([[maybe_unused]] AZ::Vector2 point, [[maybe_unused]] int multiTouchIndex) {};
|
||||
|
||||
//! Returns true if this interactable supports taking active status when a drag is started on a child
|
||||
//! interactble AND the given drag startPoint would be a valid drag start point
|
||||
//! \param point, the start point of the drag (which would be on a child interactable) (viewport space)
|
||||
virtual bool DoesSupportDragHandOff([[maybe_unused]] AZ::Vector2 startPoint) { return false; }
|
||||
|
||||
//! Called on a parent of the currently active interactable element to allow interactables that
|
||||
//! contain other interactables to support drags that start on the child.
|
||||
//! If this return true the hand-off occured and the caller will no longer be considered the
|
||||
//! active interactable by the canvas.
|
||||
//! \param currentActiveInteractable, the child element that is the currently active interactable
|
||||
//! \param startPoint, the start point of the potential drag (viewport space)
|
||||
//! \param currentPoint, the current points of the potential drag (viewport space)
|
||||
virtual bool OfferDragHandOff([[maybe_unused]] AZ::EntityId currentActiveInteractable, [[maybe_unused]] AZ::Vector2 startPoint, [[maybe_unused]] AZ::Vector2 currentPoint, [[maybe_unused]] float dragThreshold) { return false; };
|
||||
|
||||
//! Called on the currently active interactable component when the active interactable changes
|
||||
virtual void LostActiveStatus() {};
|
||||
|
||||
//! Called when mouse/touch enters the bounds of this interactable
|
||||
virtual void HandleHoverStart() = 0;
|
||||
|
||||
//! Called on the currently hovered interactable component when mouse/touch moves outside of bounds
|
||||
virtual void HandleHoverEnd() = 0;
|
||||
|
||||
//! Called when a descendant of the interactable becomes the hover interactable by being navigated to
|
||||
virtual void HandleDescendantReceivedHoverByNavigation([[maybe_unused]] AZ::EntityId descendantEntityId) {};
|
||||
|
||||
//! Called when the interactable becomes the hover interactable by being navigated to from one of its descendants
|
||||
virtual void HandleReceivedHoverByNavigatingFromDescendant([[maybe_unused]] AZ::EntityId descendantEntityId) {};
|
||||
|
||||
//! Query whether the interactable is currently pressed
|
||||
virtual bool IsPressed() { return false; }
|
||||
|
||||
//! Enable/disable event handling
|
||||
virtual bool IsHandlingEvents() { return true; }
|
||||
virtual void SetIsHandlingEvents([[maybe_unused]] bool isHandlingEvents) {}
|
||||
|
||||
//! Enable/disable multi-touch event handling
|
||||
virtual bool IsHandlingMultiTouchEvents() { return true; }
|
||||
virtual void SetIsHandlingMultiTouchEvents([[maybe_unused]] bool isHandlingMultiTouchEvents) {}
|
||||
|
||||
//! Get/set whether the interactable automatically becomes active when navigated to via gamepad/keyboard
|
||||
virtual bool GetIsAutoActivationEnabled() = 0;
|
||||
virtual void SetIsAutoActivationEnabled(bool isEnabled) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableInterface> UiInteractableBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiInteractableActiveNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableActiveNotifications() {}
|
||||
|
||||
//! Notify listener that this interactable is no longer active
|
||||
virtual void ActiveCancelled() {}
|
||||
|
||||
//! Notify listener that this interactable has given up active status to a new interactable
|
||||
virtual void ActiveChanged([[maybe_unused]] AZ::EntityId m_newActiveInteractable, [[maybe_unused]] bool shouldStayActive) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableActiveNotifications> UiInteractableActiveNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement in order to get notifications when actions are
|
||||
//! triggered
|
||||
class UiInteractableNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableNotifications(){}
|
||||
|
||||
//! Called on hover start
|
||||
virtual void OnHoverStart() {};
|
||||
|
||||
//! Called on hover end
|
||||
virtual void OnHoverEnd() {};
|
||||
|
||||
//! Called on pressed
|
||||
virtual void OnPressed() {};
|
||||
|
||||
//! Called on released
|
||||
virtual void OnReleased() {};
|
||||
|
||||
//! Called on receiving hover by being navigated to from a descendant
|
||||
virtual void OnReceivedHoverByNavigatingFromDescendant([[maybe_unused]] AZ::EntityId descendantEntityId) {};
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableNotifications> UiInteractableNotificationBus;
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This bus allows the get/set of properties for a group of states that many interactable components
|
||||
// implement.
|
||||
// It is separate from UiInteractableBus because UiInteractableBus is part of a core system for how
|
||||
// the UI canvas communincates with any UI element that wants user input. Sometimes UI components
|
||||
// want input because they are part of a 2D puzzle for example but they do not always want to have
|
||||
// to support the standard state changes.
|
||||
class UiInteractableStatesInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! The different visual states that an interactable can be in. An enum class is avoided so that
|
||||
//! derived components of UiInteractableComponent can extend with additional states.
|
||||
using State = int;
|
||||
enum
|
||||
{
|
||||
StateNormal = 0,
|
||||
StateHover,
|
||||
StatePressed,
|
||||
StateDisabled,
|
||||
NumStates
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractableStatesInterface() {}
|
||||
|
||||
//! Set the color to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has a color action for this state/target combination then replaces it
|
||||
virtual void SetStateColor(State state, AZ::EntityId target, const AZ::Color& color) = 0;
|
||||
|
||||
//! Get the color to be used for the given target when the interactable is in the given state
|
||||
//! \return the color to be used for the given target when the interactable is in the given state
|
||||
virtual AZ::Color GetStateColor(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get whether the interactable has a color action for this state/target combination
|
||||
//! \return true if the interactable has a color action for this state/target combination
|
||||
virtual bool HasStateColor(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Set the alpha to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has an alpha action for this state/target combination then replaces it
|
||||
virtual void SetStateAlpha(State state, AZ::EntityId target, float alpha) = 0;
|
||||
|
||||
//! Get the alpha to be used for the given target when the interactable is in the given state
|
||||
//! \return the alpha to be used for the given target when the interactable is in the given state
|
||||
virtual float GetStateAlpha(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get whether the interactable has an alpha action for this state/target combination
|
||||
//! \return true if the interactable has an alpha action for this state/target combination
|
||||
virtual bool HasStateAlpha(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Set the sprite to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has a sprite action for this state/target combination then replaces it
|
||||
virtual void SetStateSprite(State state, AZ::EntityId target, ISprite* sprite) = 0;
|
||||
|
||||
//! Get the sprite to be used for the given target when the interactable is in the given state
|
||||
//! \return the sprite to be used for the given target when the interactable is in the given state
|
||||
virtual ISprite* GetStateSprite(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Set the sprite path to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has a sprite action for this state/target combination then replaces it
|
||||
virtual void SetStateSpritePathname(State state, AZ::EntityId target, const AZStd::string& spritePath) = 0;
|
||||
|
||||
//! Get the sprite path to be used for the given target when the interactable is in the given state
|
||||
//! \return the sprite path to be used for the given target when the interactable is in the given state
|
||||
virtual AZStd::string GetStateSpritePathname(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get whether the interactable has a sprite action for this state/target combination
|
||||
//! \return true if the interactable has a sprite action for this state/target combination
|
||||
virtual bool HasStateSprite(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Set the font to be used for the given target when the interactable is in the given state
|
||||
//! If the interactable already has a font action for this state/target combination then replaces it
|
||||
virtual void SetStateFont(State state, AZ::EntityId target, const AZStd::string& fontPathname, unsigned int fontEffectIndex) = 0;
|
||||
|
||||
//! Get the font path to be used for the given target when the interactable is in the given state
|
||||
//! \return the font path to be used for the given target when the interactable is in the given state
|
||||
virtual AZStd::string GetStateFontPathname(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get the font effect to be used for the given target when the interactable is in the given state
|
||||
//! \return the font effect to be used for the given target when the interactable is in the given state
|
||||
virtual unsigned int GetStateFontEffectIndex(State state, AZ::EntityId target) = 0;
|
||||
|
||||
//! Get whether the interactable has a font action for this state/target combination
|
||||
//! \return true if the interactable has a font action for this state/target combination
|
||||
virtual bool HasStateFont(State state, AZ::EntityId target) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractableStatesInterface> UiInteractableStatesBus;
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiInteractionMaskInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiInteractionMaskInterface() {}
|
||||
|
||||
//! Check whether this element is masking the given point
|
||||
virtual bool IsPointMasked(AZ::Vector2 point) = 0;
|
||||
|
||||
public: // static member functions
|
||||
|
||||
static const char* GetUniqueName() { return "UIInteractionMaskInterface"; }
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiInteractionMaskInterface> UiInteractionMaskBus;
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/Bus/UiTransformBus.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Horizontal order used by layout components
|
||||
enum class HorizontalOrder
|
||||
{
|
||||
LeftToRight,
|
||||
RightToLeft
|
||||
};
|
||||
|
||||
//! Vertical order used by layout components
|
||||
enum class VerticalOrder
|
||||
{
|
||||
TopToBottom,
|
||||
BottomToTop
|
||||
};
|
||||
|
||||
//! Padding (in pixels) inside the edges of an element
|
||||
struct Padding
|
||||
{
|
||||
AZ_TYPE_INFO(Padding, "{DE5C18B0-4214-4A37-B590-8D45CC450A96}")
|
||||
|
||||
Padding()
|
||||
: m_left(0)
|
||||
, m_top(0)
|
||||
, m_right(0)
|
||||
, m_bottom(0) {}
|
||||
|
||||
int m_left;
|
||||
int m_right;
|
||||
int m_top;
|
||||
int m_bottom;
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutInterface() {}
|
||||
|
||||
//! Get whether this layout component uses layout cells to calculate its layout
|
||||
virtual bool IsUsingLayoutCellsToCalculateLayout() = 0;
|
||||
|
||||
//! Get whether this layout component should bypass the default layout cell values calculated by its children
|
||||
virtual bool GetIgnoreDefaultLayoutCells() = 0;
|
||||
|
||||
//! Set whether this layout component should bypass the default layout cell values calculated by its children
|
||||
virtual void SetIgnoreDefaultLayoutCells(bool ignoreDefaultLayoutCells) = 0;
|
||||
|
||||
//! Get the horizontal child alignment
|
||||
virtual IDraw2d::HAlign GetHorizontalChildAlignment() = 0;
|
||||
|
||||
//! Set the horizontal child alignment
|
||||
virtual void SetHorizontalChildAlignment(IDraw2d::HAlign alignment) = 0;
|
||||
|
||||
//! Get the vertical child alignment
|
||||
virtual IDraw2d::VAlign GetVerticalChildAlignment() = 0;
|
||||
|
||||
//! Set the vertical child alignment
|
||||
virtual void SetVerticalChildAlignment(IDraw2d::VAlign alignment) = 0;
|
||||
|
||||
//! Find out whether this layout component is currently overriding the transform of the specified element.
|
||||
virtual bool IsControllingChild(AZ::EntityId childId) = 0;
|
||||
|
||||
//! Get the size the element needs to be to fit a specified number of child elements of a certain size
|
||||
virtual AZ::Vector2 GetSizeToFitChildElements(const AZ::Vector2& childElementSize, int numChildElements) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutInterface> UiLayoutBus;
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiLayoutCellBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutCellInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutCellInterface() {}
|
||||
|
||||
//! Get the overridden min width. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetMinWidth() = 0;
|
||||
|
||||
//! Set the overridden min width. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetMinWidth(float width) = 0;
|
||||
|
||||
//! Get the overridden min height. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetMinHeight() = 0;
|
||||
|
||||
//! Set the overridden min height. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetMinHeight(float height) = 0;
|
||||
|
||||
//! Get the overridden target width. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetTargetWidth() = 0;
|
||||
|
||||
//! Set the overridden target width. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetTargetWidth(float width) = 0;
|
||||
|
||||
//! Get the overridden target height. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetTargetHeight() = 0;
|
||||
|
||||
//! Set the overridden target height. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetTargetHeight(float height) = 0;
|
||||
|
||||
//! Get the overridden max width. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetMaxWidth() = 0;
|
||||
|
||||
//! Set the overridden max width. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetMaxWidth(float width) = 0;
|
||||
|
||||
//! Get the overridden max height. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetMaxHeight() = 0;
|
||||
|
||||
//! Set the overridden max height. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetMaxHeight(float height) = 0;
|
||||
|
||||
//! Get the overridden extra width ratio. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetExtraWidthRatio() = 0;
|
||||
|
||||
//! Set the overridden extra width ratio. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetExtraWidthRatio(float width) = 0;
|
||||
|
||||
//! Get the overridden extra height ratio. LyShine::UiLayoutCellUnspecifiedSize means it has not been overridden
|
||||
virtual float GetExtraHeightRatio() = 0;
|
||||
|
||||
//! Set the overridden extra height ratio. LyShine::UiLayoutCellUnspecifiedSize means don't override
|
||||
virtual void SetExtraHeightRatio(float height) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutCellInterface> UiLayoutCellBus;
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiLayoutCellBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutCellDefaultInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutCellDefaultInterface() {}
|
||||
|
||||
//! Get the minimum width
|
||||
virtual float GetMinWidth() = 0;
|
||||
|
||||
//! Get the minimum height
|
||||
virtual float GetMinHeight() = 0;
|
||||
|
||||
//! Get the target width
|
||||
//! \param maxWidth A width that the element will not surpass. LyShine::UiLayoutCellUnspecifiedSize means no max
|
||||
virtual float GetTargetWidth(float maxWidth) = 0;
|
||||
|
||||
//! Get the target height
|
||||
//! \param maxHeight A height that the element will not surpass. LyShine::UiLayoutCellUnspecifiedSize means no max
|
||||
virtual float GetTargetHeight(float maxHeight) = 0;
|
||||
|
||||
//! Get the extra width ratio
|
||||
virtual float GetExtraWidthRatio() = 0;
|
||||
|
||||
//! Get the extra height ratio
|
||||
virtual float GetExtraHeightRatio() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Multiple components on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutCellDefaultInterface> UiLayoutCellDefaultBus;
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/Bus/UiLayoutBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutColumnInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutColumnInterface() {}
|
||||
|
||||
//! Get the padding (in pixels) inside the edges of the element
|
||||
virtual UiLayoutInterface::Padding GetPadding() = 0;
|
||||
|
||||
//! Set the padding (in pixels) inside the edges of the element
|
||||
virtual void SetPadding(UiLayoutInterface::Padding padding) = 0;
|
||||
|
||||
//! Get the spacing (in pixels) between child elements
|
||||
virtual float GetSpacing() = 0;
|
||||
|
||||
//! Set the spacing (in pixels) between child elements
|
||||
virtual void SetSpacing(float spacing) = 0;
|
||||
|
||||
//! Get the vertical order for this layout
|
||||
virtual UiLayoutInterface::VerticalOrder GetOrder() = 0;
|
||||
|
||||
//! Set the vertical order for this layout
|
||||
virtual void SetOrder(UiLayoutInterface::VerticalOrder order) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutColumnInterface> UiLayoutColumnBus;
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! This interface can to be implemented by any component that wants to modify transform properties
|
||||
//! of elements are runtime using the Layout system. The methods in this interface will be called
|
||||
//! by the LayoutManager whenever the element is told to recompute its layout. Because an element
|
||||
//! might have multiple components that implement this interface, the handlers will be sorted by
|
||||
//! priority (lower priority number gets called earlier).
|
||||
class UiLayoutControllerInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutControllerInterface() {}
|
||||
|
||||
//! Set elements' width transform properties
|
||||
virtual void ApplyLayoutWidth() = 0;
|
||||
|
||||
//! Set elements' height transform properties
|
||||
virtual void ApplyLayoutHeight() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Events are ordered, each handler may set its priority
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::MultipleAndOrdered;
|
||||
|
||||
//! Priority will be used for ordering, lower priority number means it gets called earlier
|
||||
struct BusHandlerOrderCompare
|
||||
{
|
||||
AZ_FORCE_INLINE bool operator()(const UiLayoutControllerInterface* left, const UiLayoutControllerInterface* right) const { return left->GetPriority() < right->GetPriority(); }
|
||||
};
|
||||
|
||||
protected: // member data
|
||||
|
||||
static const unsigned int k_defaultPriority = 100; // Default is 100, make it lower to get called earlier, higher to get called later
|
||||
virtual unsigned int GetPriority() const { return k_defaultPriority; }
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutControllerInterface> UiLayoutControllerBus;
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! This component resizes its element to fit its content. It uses cell sizing information given to
|
||||
//! it by other Layout components, Text component, or Image component (fixed type).
|
||||
class UiLayoutFitterInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Fit type indicating enabled fits
|
||||
enum class FitType
|
||||
{
|
||||
None,
|
||||
HorizontalOnly,
|
||||
VerticalOnly,
|
||||
HorizontalAndVertical
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutFitterInterface() {}
|
||||
|
||||
//! Get whether to resize the element horizontally
|
||||
virtual bool GetHorizontalFit() = 0;
|
||||
|
||||
//! Set whether to resize the element horizontally
|
||||
virtual void SetHorizontalFit(bool horizontalFit) = 0;
|
||||
|
||||
//! Get whether to resize the element vertically
|
||||
virtual bool GetVerticalFit() = 0;
|
||||
|
||||
//! Set whether to resize the element vertically
|
||||
virtual void SetVerticalFit(bool verticalFit) = 0;
|
||||
|
||||
//! Get the fit type
|
||||
virtual FitType GetFitType() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutFitterInterface> UiLayoutFitterBus;
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/Bus/UiLayoutBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutGridInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Used to determine which direction to start the layout with
|
||||
enum class StartingDirection
|
||||
{
|
||||
HorizontalOrder,
|
||||
VerticalOrder
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutGridInterface() {}
|
||||
|
||||
//! Get the padding (in pixels) inside the edges of the element
|
||||
virtual UiLayoutInterface::Padding GetPadding() = 0;
|
||||
|
||||
//! Set the padding (in pixels) inside the edges of the element
|
||||
virtual void SetPadding(UiLayoutInterface::Padding padding) = 0;
|
||||
|
||||
//! Get the spacing (in pixels) between child elements
|
||||
virtual AZ::Vector2 GetSpacing() = 0;
|
||||
|
||||
//! Set the spacing (in pixels) between child elements
|
||||
virtual void SetSpacing(AZ::Vector2 spacing) = 0;
|
||||
|
||||
//! Get the size (in pixels) of a child element in this layout
|
||||
virtual AZ::Vector2 GetCellSize() = 0;
|
||||
|
||||
//! Set the size (in pixels) of a child element in this layout
|
||||
virtual void SetCellSize(AZ::Vector2 size) = 0;
|
||||
|
||||
//! Get the horizontal order for this layout
|
||||
virtual UiLayoutInterface::HorizontalOrder GetHorizontalOrder() = 0;
|
||||
|
||||
//! Set the horizontal order for this layout
|
||||
virtual void SetHorizontalOrder(UiLayoutInterface::HorizontalOrder order) = 0;
|
||||
|
||||
//! Get the vertical order for this layout
|
||||
virtual UiLayoutInterface::VerticalOrder GetVerticalOrder() = 0;
|
||||
|
||||
//! Set the vertical order for this layout
|
||||
virtual void SetVerticalOrder(UiLayoutInterface::VerticalOrder order) = 0;
|
||||
|
||||
//! Get the starting direction for this layout
|
||||
virtual StartingDirection GetStartingDirection() = 0;
|
||||
|
||||
//! Set the starting direction for this layout
|
||||
virtual void SetStartingDirection(StartingDirection direction) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutGridInterface> UiLayoutGridBus;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutManagerInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutManagerInterface() {}
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Mark an element to recompute its layout. This is called when something that affects the layout
|
||||
//! has been modified. (ex. layout element size changed, layout element property changed, layout
|
||||
//! element child count changed.)
|
||||
virtual void MarkToRecomputeLayout(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Mark the specified element's parent to recompute its layout. The parent uses its child's layout
|
||||
//! cell values to calculate its layout, so this is called when something that affects the
|
||||
//! child's layout cell values has been modified. (ex. child's layout cell property changed.)
|
||||
//! Since a child's layout cell values may affect its parent's layout cell values, the top level parent
|
||||
//! is marked
|
||||
virtual void MarkToRecomputeLayoutsAffectedByLayoutCellChange(AZ::EntityId entityId, bool isDefaultLayoutCell) = 0;
|
||||
|
||||
//! Unmark all elements from needing to recompute their layouts
|
||||
virtual void UnmarkAllLayouts() = 0;
|
||||
|
||||
//! Recompute layouts of marked elements and clear the marked layout list
|
||||
virtual void RecomputeMarkedLayouts() = 0;
|
||||
|
||||
//! Compute the layout for the specified element and its descendants
|
||||
virtual void ComputeLayoutForElementAndDescendants(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutManagerInterface> UiLayoutManagerBus;
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/Bus/UiLayoutBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiLayoutRowInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiLayoutRowInterface() {}
|
||||
|
||||
//! Get the padding (in pixels) inside the edges of the element
|
||||
virtual UiLayoutInterface::Padding GetPadding() = 0;
|
||||
|
||||
//! Set the padding (in pixels) inside the edges of the element
|
||||
virtual void SetPadding(UiLayoutInterface::Padding padding) = 0;
|
||||
|
||||
//! Get the spacing (in pixels) between child elements
|
||||
virtual float GetSpacing() = 0;
|
||||
|
||||
//! Set the spacing (in pixels) between child elements
|
||||
virtual void SetSpacing(float spacing) = 0;
|
||||
|
||||
//! Get the horizontal order for this layout
|
||||
virtual UiLayoutInterface::HorizontalOrder GetOrder() = 0;
|
||||
|
||||
//! Set the horizontal order for this layout
|
||||
virtual void SetOrder(UiLayoutInterface::HorizontalOrder order) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiLayoutRowInterface> UiLayoutRowBus;
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! A markup button allows for button-like behavior on markup text.
|
||||
//!
|
||||
//! The markup itself is contained within a text component. The markup button
|
||||
//! handles interaction with the text, and can also apply styling (such as
|
||||
//! coloring for button/clickable text).
|
||||
//!
|
||||
//! Markup button behavior is only intended for mouse interactions.
|
||||
class UiMarkupButtonInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiMarkupButtonInterface() {}
|
||||
|
||||
//! Get the link color
|
||||
virtual AZ::Color GetLinkColor() = 0;
|
||||
|
||||
//! Set the link color
|
||||
virtual void SetLinkColor(const AZ::Color& linkColor) = 0;
|
||||
|
||||
//! Get the link hover color
|
||||
virtual AZ::Color GetLinkHoverColor() = 0;
|
||||
|
||||
//! Set the link hover color
|
||||
virtual void SetLinkHoverColor(const AZ::Color& linkHoverColor) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiMarkupButtonInterface> UiMarkupButtonBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiMarkupButtonNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiMarkupButtonNotifications() {}
|
||||
|
||||
virtual void OnHoverStart(int id, const AZStd::string& action, const AZStd::string& data) = 0;
|
||||
virtual void OnHoverEnd(int id, const AZStd::string& action, const AZStd::string& data) = 0;
|
||||
virtual void OnPressed(int id, const AZStd::string& action, const AZStd::string& data) = 0;
|
||||
virtual void OnReleased(int id, const AZStd::string& action, const AZStd::string& data) = 0;
|
||||
virtual void OnClick(int id, const AZStd::string& action, const AZStd::string& data) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiMarkupButtonNotifications> UiMarkupButtonNotificationsBus;
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiMaskInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiMaskInterface() {}
|
||||
|
||||
//! Get whether masking is enabled
|
||||
virtual bool GetIsMaskingEnabled() = 0;
|
||||
|
||||
//! Set whether masking is enabled
|
||||
virtual void SetIsMaskingEnabled(bool enableMasking) = 0;
|
||||
|
||||
//! Get whether interaction masking is enabled
|
||||
virtual bool GetIsInteractionMaskingEnabled() = 0;
|
||||
|
||||
//! Set whether interaction masking is enabled
|
||||
virtual void SetIsInteractionMaskingEnabled(bool enableInteractionMasking) = 0;
|
||||
|
||||
//! Get whether mask visual is drawn to color buffer behind child elements
|
||||
virtual bool GetDrawBehind() = 0;
|
||||
|
||||
//! Set whether mask visual is drawn to color buffer behind child elements
|
||||
virtual void SetDrawBehind(bool drawMaskVisualBehindChildren) = 0;
|
||||
|
||||
//! Get whether mask visual is drawn to color buffer in front of child elements
|
||||
virtual bool GetDrawInFront() = 0;
|
||||
|
||||
//! Set whether mask visual is drawn to color buffer in front of child elements
|
||||
virtual void SetDrawInFront(bool drawMaskVisualInFrontOfChildren) = 0;
|
||||
|
||||
//! Get whether to use alpha test when drawing mask visual to stencil
|
||||
virtual bool GetUseAlphaTest() = 0;
|
||||
|
||||
//! Set whether to use alpha test when drawing mask visual to stencil
|
||||
virtual void SetUseAlphaTest(bool useAlphaTest) = 0;
|
||||
|
||||
//! Get the flag that indicates whether the mask should use render to texture
|
||||
virtual bool GetUseRenderToTexture() = 0;
|
||||
|
||||
//! Set the flag that indicates whether the mask should use render to texture
|
||||
virtual void SetUseRenderToTexture(bool useRenderToTexture) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiMaskInterface> UiMaskBus;
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiNavigationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
enum class NavigationMode
|
||||
{
|
||||
Automatic,
|
||||
Custom,
|
||||
None
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiNavigationInterface() {}
|
||||
|
||||
//! Get the navigation mode
|
||||
virtual NavigationMode GetNavigationMode() = 0;
|
||||
|
||||
//! Set the navigation mode
|
||||
virtual void SetNavigationMode(NavigationMode navigationMode) = 0;
|
||||
|
||||
//! Get the entity to receive focus when up is pressed
|
||||
virtual AZ::EntityId GetOnUpEntity() = 0;
|
||||
|
||||
//! Set the entity to receive focus when up is pressed
|
||||
virtual void SetOnUpEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the entity to receive focus when down is pressed
|
||||
virtual AZ::EntityId GetOnDownEntity() = 0;
|
||||
|
||||
//! Set the entity to receive focus when down is pressed
|
||||
virtual void SetOnDownEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the entity to receive focus when left is pressed
|
||||
virtual AZ::EntityId GetOnLeftEntity() = 0;
|
||||
|
||||
//! Set the entity to receive focus when left is pressed
|
||||
virtual void SetOnLeftEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the entity to receive focus when right is pressed
|
||||
virtual AZ::EntityId GetOnRightEntity() = 0;
|
||||
|
||||
//! Set the entity to receive focus when right is pressed
|
||||
virtual void SetOnRightEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiNavigationInterface> UiNavigationBus;
|
||||
|
||||
|
||||
|
||||
@@ -1,393 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for making requests to the UiParticleEmitterComponent
|
||||
class UiParticleEmitterInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
enum class EmitShape
|
||||
{
|
||||
Point, //!< particles are emitted from the emitter position along the given angle
|
||||
Circle, //!< particles are emitted from a circle whose radius is the minimum of the element width and height
|
||||
Quad //!< particles are emitted from the quad with the same size as the element width and height
|
||||
};
|
||||
|
||||
enum class ParticleCoordinateType
|
||||
{
|
||||
Cartesian, //!< particles move using X,Y co-ordinates
|
||||
Polar //!< particles move using X: radial speed, Y: angular speed
|
||||
};
|
||||
|
||||
enum class ParticleInitialDirectionType
|
||||
{
|
||||
RelativeToEmitAngle, //!< particle initial direction is based on the emit angle
|
||||
RelativeToEmitterCenter //!< particle initial direction is directed away from the emitter shape center
|
||||
};
|
||||
|
||||
enum class ParticleKeyframeTangentType
|
||||
{
|
||||
EaseIn, //!< A zero/flat tangent, a keyframe with ease in + ease out would act like an x^3 curve at the origin
|
||||
EaseOut, //!< A zero/flat tangent, a keyframe with ease in + ease out would act like an x^3 curve at the origin
|
||||
Linear, //!< The curve moves linearly from this keyframe towards the next/previous keyframe
|
||||
Step //!< The curve jumps from the current keyframe value to the next/previous keyframe value
|
||||
};
|
||||
|
||||
struct ParticleFloatKeyframe
|
||||
{
|
||||
AZ_TYPE_INFO(ParticleFloatKeyframe, "{85DF04FE-F614-47C1-B88A-A9F7D4826F6F}");
|
||||
|
||||
float time = 0.0f;
|
||||
float multiplier = 1.0f;
|
||||
ParticleKeyframeTangentType inTangent = ParticleKeyframeTangentType::EaseIn;
|
||||
ParticleKeyframeTangentType outTangent = ParticleKeyframeTangentType::EaseOut;
|
||||
};
|
||||
|
||||
struct ParticleColorKeyframe
|
||||
{
|
||||
AZ_TYPE_INFO(ParticleColorKeyframe, "{22B0CBC0-21A5-44E3-90C5-9BFEF6E4E3C5}");
|
||||
|
||||
float time = 0.0f;
|
||||
AZ::Color color = AZ::Color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
ParticleKeyframeTangentType inTangent = ParticleKeyframeTangentType::EaseIn;
|
||||
ParticleKeyframeTangentType outTangent = ParticleKeyframeTangentType::EaseOut;
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiParticleEmitterInterface() {}
|
||||
|
||||
//! Gets whether the emitter is emitting particles
|
||||
virtual bool GetIsEmitting() = 0;
|
||||
|
||||
//! Sets whether the emitter is emitting particles
|
||||
virtual void SetIsEmitting(bool emitParticles) = 0;
|
||||
|
||||
//! Gets whether the emitter uses a fixed random seed
|
||||
virtual bool GetIsRandomSeedFixed() = 0;
|
||||
|
||||
//! Sets whether the emitter uses a fixed random seed
|
||||
virtual void SetIsRandomSeedFixed(bool randomSeedFixed) = 0;
|
||||
|
||||
//! Gets the emitter random seed
|
||||
virtual int GetRandomSeed() = 0;
|
||||
|
||||
//! Sets the emitter random seed
|
||||
virtual void SetRandomSeed(int randomSeed) = 0;
|
||||
|
||||
//! Gets whether the particles move relative to the emitter position
|
||||
virtual bool GetIsParticlePositionRelativeToEmitter() = 0;
|
||||
|
||||
//! Sets whether the particles move relative to the emitter position
|
||||
virtual void SetIsParticlePositionRelativeToEmitter(bool relativeToEmitter) = 0;
|
||||
|
||||
//! Gets the amount of particles emitted per second
|
||||
virtual float GetParticleEmitRate() = 0;
|
||||
|
||||
//! Sets the amount of particles emitted per second
|
||||
virtual void SetParticleEmitRate(float particleEmitRate) = 0;
|
||||
|
||||
//! Gets whether the emitter starts emitting on activate
|
||||
virtual bool GetIsEmitOnActivate() = 0;
|
||||
|
||||
//! Sets whether the emitter starts emitting on activate
|
||||
virtual void SetIsEmitOnActivate(bool emitOnActivate) = 0;
|
||||
|
||||
//! Gets whether the average particle count is reached as soon as the emitter starts emitting
|
||||
virtual bool GetIsHitParticleCountOnActivate() = 0;
|
||||
|
||||
//! Sets whether the average particle count is reached as soon as the emitter starts emitting
|
||||
virtual void SetIsHitParticleCountOnActivate(bool hitParticleCountOnActivate) = 0;
|
||||
|
||||
//! Gets whether the emitter lifetime is infinite
|
||||
virtual bool GetIsEmitterLifetimeInfinite() = 0;
|
||||
|
||||
//! Sets whether the emitter lifetime is infinite
|
||||
virtual void SetIsEmitterLifetimeInfinite(bool emitterLifetimeInfinite) = 0;
|
||||
|
||||
//! Gets the lifetime of the emitter (in seconds)
|
||||
virtual float GetEmitterLifetime() = 0;
|
||||
|
||||
//! Sets the lifetime of the emitter (in seconds)
|
||||
virtual void SetEmitterLifetime(float emitterLifetime) = 0;
|
||||
|
||||
//! Gets whether there is a cap on the amount of active particles
|
||||
virtual bool GetIsParticleCountLimited() = 0;
|
||||
|
||||
//! Sets whether there is a cap on the amount of active particles
|
||||
virtual void SetIsParticleCountLimited(bool particleCountLimited) = 0;
|
||||
|
||||
//! Gets the maximum amount of active particles
|
||||
virtual AZ::u32 GetMaxParticles() = 0;
|
||||
|
||||
//! Sets the maximum amount of active particles
|
||||
virtual void SetMaxParticles(AZ::u32 maxParticles) = 0;
|
||||
|
||||
//! Gets the shape of the emitter
|
||||
virtual EmitShape GetEmitterShape() = 0;
|
||||
|
||||
//! Sets the shape of the emitter
|
||||
virtual void SetEmitterShape(EmitShape emitterShape) = 0;
|
||||
|
||||
//! Gets whether the particles are emitted on the edge of the emitter shape
|
||||
virtual bool GetIsEmitOnEdge() = 0;
|
||||
|
||||
//! Sets whether the particles are emitted on the edge of the emitter shape
|
||||
virtual void SetIsEmitOnEdge(bool emitOnEdge) = 0;
|
||||
|
||||
//! Gets the inside distance from the emitter shape edge that particles should emit from
|
||||
virtual float GetInsideEmitDistance() = 0;
|
||||
|
||||
//! Sets the inside distance from the emitter shape edge that particles should emit from
|
||||
virtual void SetInsideEmitDistance(float insideEmitDistance) = 0;
|
||||
|
||||
//! Gets the outside distance from the emitter shape edge that particles should emit from
|
||||
virtual float GetOutsideEmitDistance() = 0;
|
||||
|
||||
//! Sets the outside distance from the emitter shape edge that particles should emit from
|
||||
virtual void SetOutsideEmitDistance(float outsideEmitDistance) = 0;
|
||||
|
||||
//! Gets how the initial direction is calculated for Cartesian movement.
|
||||
virtual ParticleInitialDirectionType GetParticleInitialDirectionType() = 0;
|
||||
|
||||
//! Sets how the initial direction is calculated for Cartesian movement.
|
||||
virtual void SetParticleInitialDirectionType(ParticleInitialDirectionType initialDirectionType) = 0;
|
||||
|
||||
//! Gets the angle that particles are emitted from (in degrees clockwise measured from straight up)
|
||||
virtual float GetEmitAngle() = 0;
|
||||
|
||||
//! Sets the angle that particles are emitted from (in degrees clockwise measured from straight up)
|
||||
virtual void SetEmitAngle(float emitAngle) = 0;
|
||||
|
||||
//! Gets the variation in the angle that particles are emitted from (in degrees, with 10 degrees variation being +/- 10 degrees about the emit angle)
|
||||
virtual float GetEmitAngleVariation() = 0;
|
||||
|
||||
//! Sets the variation in the angle that particles are emitted from (in degrees, with 10 degrees variation being +/- 10 degrees about the emit angle)
|
||||
virtual void SetEmitAngleVariation(float emitAngleVariation) = 0;
|
||||
|
||||
//! Gets whether the particle lifetime is infinite
|
||||
virtual bool GetIsParticleLifetimeInfinite() = 0;
|
||||
|
||||
//! Sets whether the particle lifetime is infinite
|
||||
virtual void SetIsParticleLifetimeInfinite(bool infiniteLifetime) = 0;
|
||||
|
||||
//! Gets the particle life time (in seconds)
|
||||
virtual float GetParticleLifetime() = 0;
|
||||
|
||||
//! Sets the particle life time (in seconds)
|
||||
virtual void SetParticleLifetime(float lifetime) = 0;
|
||||
|
||||
//! Gets the particle life time variation (in seconds, 1 second variation being up to +/- 1 second about the lifetime)
|
||||
virtual float GetParticleLifetimeVariation() = 0;
|
||||
|
||||
//! Sets the particle life time variation (in seconds, 1 second variation being up to +/- 1 second about the lifetime)
|
||||
virtual void SetParticleLifetimeVariation(float lifetimeVariation) = 0;
|
||||
|
||||
//! Gets the sprite to be used by the particles
|
||||
virtual ISprite* GetSprite() = 0;
|
||||
|
||||
//! Sets the sprite to be used by the particles
|
||||
virtual void SetSprite(ISprite* sprite) = 0;
|
||||
|
||||
//! Gets the source location of the image to be displayed by the particles
|
||||
virtual AZStd::string GetSpritePathname() = 0;
|
||||
|
||||
//! Sets the source location of the image to be displayed by the particles
|
||||
virtual void SetSpritePathname(AZStd::string spritePath) = 0;
|
||||
|
||||
//! Gets whether the sprite-sheet cell index changes over time
|
||||
virtual bool GetIsSpriteSheetAnimated() = 0;
|
||||
|
||||
//! Sets whether the sprite-sheet cell index changes over time
|
||||
virtual void SetIsSpriteSheetAnimated(bool isSpriteSheetAnimated) = 0;
|
||||
|
||||
//! Gets whether the sprite-sheet cell animation is looped
|
||||
virtual bool GetIsSpriteSheetAnimationLooped() = 0;
|
||||
|
||||
//! Sets whether the sprite-sheet cell animation is looped
|
||||
virtual void SetIsSpriteSheetAnimationLooped(bool isSpriteSheetAnimationLooped) = 0;
|
||||
|
||||
//! Gets whether the sprite-sheet cell (starting) index is random
|
||||
virtual bool GetIsSpriteSheetIndexRandom() = 0;
|
||||
|
||||
//! Sets whether the sprite-sheet cell (starting) index is random
|
||||
virtual void SetIsSpriteSheetIndexRandom(bool isSpriteSheetIndexRandom) = 0;
|
||||
|
||||
//! Gets the sprite-sheet cell (starting) index
|
||||
virtual int GetSpriteSheetCellIndex() = 0;
|
||||
|
||||
//! Sets the sprite-sheet cell (starting) index
|
||||
virtual void SetSpriteSheetCellIndex(int spriteSheetIndex) = 0;
|
||||
|
||||
//! Gets the sprite-sheet cell end index
|
||||
virtual int GetSpriteSheetCellEndIndex() = 0;
|
||||
|
||||
//! Sets the sprite-sheet cell end index
|
||||
virtual void SetSpriteSheetCellEndIndex(int spriteSheetEndIndex) = 0;
|
||||
|
||||
//! Gets the sprite-sheet cell frame delay (in seconds)
|
||||
virtual float GetSpriteSheetFrameDelay() = 0;
|
||||
|
||||
//! Sets the sprite-sheet cell frame delay (in seconds)
|
||||
virtual void SetSpriteSheetFrameDelay(float spriteSheetFrameDelay) = 0;
|
||||
|
||||
//! Gets whether the aspect ratio of the particles is locked
|
||||
virtual bool GetIsParticleAspectRatioLocked() = 0;
|
||||
|
||||
//! Sets whether the aspect ratio of the particles is locked
|
||||
virtual void SetIsParticleAspectRatioLocked(bool aspectRatioLocked) = 0;
|
||||
|
||||
//! Gets the particle pivot (where 0,0 is the top left of the particle and 1,1 is the bottom right of the particle)
|
||||
virtual AZ::Vector2 GetParticlePivot() = 0;
|
||||
|
||||
//! Sets the particle pivot (where 0,0 is the top left of the particle and 1,1 is the bottom right of the particle)
|
||||
virtual void SetParticlePivot(AZ::Vector2 particlePivot) = 0;
|
||||
|
||||
//! Gets the particle size
|
||||
virtual AZ::Vector2 GetParticleSize() = 0;
|
||||
|
||||
//! Sets the particle size
|
||||
virtual void SetParticleSize(AZ::Vector2 particleSize) = 0;
|
||||
|
||||
//! Gets the particle width
|
||||
virtual float GetParticleWidth() = 0;
|
||||
|
||||
//! Sets the particle width
|
||||
virtual void SetParticleWidth(float width) = 0;
|
||||
|
||||
//! Gets the particle width variation (a variation of 1 being up to 1 either side of the given width)
|
||||
virtual float GetParticleWidthVariation() = 0;
|
||||
|
||||
//! Sets the particle width variation (a variation of 1 being up to 1 either side of the given width)
|
||||
virtual void SetParticleWidthVariation(float widthVariation) = 0;
|
||||
|
||||
//! Gets the particle height
|
||||
virtual float GetParticleHeight() = 0;
|
||||
|
||||
//! Sets the particle height
|
||||
virtual void SetParticleHeight(float height) = 0;
|
||||
|
||||
//! Gets the particle height variation (a variation of 5 being up to 5 either side of the given height)
|
||||
virtual float GetParticleHeightVariation() = 0;
|
||||
|
||||
//! Sets the particle height variation (a variation of 5 being up to 5 either side of the given height)
|
||||
virtual void SetParticleHeightVariation(float heightVariation) = 0;
|
||||
|
||||
//! Gets the particle movement co-ordinate type
|
||||
virtual ParticleCoordinateType GetParticleMovementCoordinateType() = 0;
|
||||
|
||||
//! Sets the particle movement co-ordinate type
|
||||
virtual void SetParticleMovementCoordinateType(ParticleCoordinateType particleMovementCoordinateType) = 0;
|
||||
|
||||
//! Gets the particle acceleration co-ordinate type
|
||||
virtual ParticleCoordinateType GetParticleAccelerationCoordinateType() = 0;
|
||||
|
||||
//! Sets the particle acceleration co-ordinate type
|
||||
virtual void SetParticleAccelerationCoordinateType(ParticleCoordinateType particleAccelerationCoordinateType) = 0;
|
||||
|
||||
//! Gets the particle initial velocity for Polar movement
|
||||
virtual AZ::Vector2 GetParticleInitialVelocity() = 0;
|
||||
|
||||
//! Sets the particle initial velocity for Polar movement
|
||||
virtual void SetParticleInitialVelocity(AZ::Vector2 initialVelocity) = 0;
|
||||
|
||||
//! Gets the particle initial velocity variation for Polar movement (a variation of (1,2) being up to (1,2) either side of the initial velocity)
|
||||
virtual AZ::Vector2 GetParticleInitialVelocityVariation() = 0;
|
||||
|
||||
//! Sets the particle initial velocity variation for Polar movement (a variation of (1,2) being up to (1,2) either side of the initial velocity)
|
||||
virtual void SetParticleInitialVelocityVariation(AZ::Vector2 initialVelocityVariation) = 0;
|
||||
|
||||
//! Gets the particle speed for particles with a random initial direction for Cartesian movement
|
||||
virtual float GetParticleSpeed() = 0;
|
||||
|
||||
//! Sets the particle speed for particles with a random initial direction for Cartesian movement
|
||||
virtual void SetParticleSpeed(float speed) = 0;
|
||||
|
||||
//! Gets the particle speed variation for particles with a random initial direction for Cartesian movement (a variation of 1 being up to 1 either side of the given speed)
|
||||
virtual float GetParticleSpeedVariation() = 0;
|
||||
|
||||
//! Sets the particle speed variation for particles with a random initial direction for Cartesian movement (a variation of 1 being up to 1 either side of the given speed)
|
||||
virtual void SetParticleSpeedVariation(float speedVariation) = 0;
|
||||
|
||||
//! Gets the particle acceleration
|
||||
virtual AZ::Vector2 GetParticleAcceleration() = 0;
|
||||
|
||||
//! Sets the particle acceleration
|
||||
virtual void SetParticleAcceleration(AZ::Vector2 acceleration) = 0;
|
||||
|
||||
//! Gets whether the particle rotation is based on the current velocity
|
||||
virtual bool GetIsParticleRotationFromVelocity() = 0;
|
||||
|
||||
//! Sets whether the particle rotation is based on the current velocity
|
||||
virtual void SetIsParticleRotationFromVelocity(bool rotationFromVelocity) = 0;
|
||||
|
||||
//! Gets whether the particle initial rotation is based on the initial velocity
|
||||
virtual bool GetIsParticleInitialRotationFromInitialVelocity() = 0;
|
||||
|
||||
//! Sets whether the particle initial rotation is based on the initial velocity
|
||||
virtual void SetIsParticleInitialRotationFromInitialVelocity(bool rotationFromVelocity) = 0;
|
||||
|
||||
//! Gets the particle initial rotation (in degrees)
|
||||
virtual float GetParticleInitialRotation() = 0;
|
||||
|
||||
//! Sets the particle initial rotation (in degrees)
|
||||
virtual void SetParticleInitialRotation(float initialRotation) = 0;
|
||||
|
||||
//! Gets the particle initial rotation variation (in degrees, a variation of 10 being up to 10 degrees either side of the initial rotation)
|
||||
virtual float GetParticleInitialRotationVariation() = 0;
|
||||
|
||||
//! Sets the particle initial rotation variation (in degrees, a variation of 10 being up to 10 degrees either side of the initial rotation)
|
||||
virtual void SetParticleInitialRotationVariation(float initialRotationVariation) = 0;
|
||||
|
||||
//! Gets the particle rotation speed (in degrees per second)
|
||||
virtual float GetParticleRotationSpeed() = 0;
|
||||
|
||||
//! Sets the particle rotation speed (in degrees per second)
|
||||
virtual void SetParticleRotationSpeed(float rotationSpeed) = 0;
|
||||
|
||||
//! Gets the particle rotation speed variation (in degrees, a variation of 5 being up to 5 either side of the rotation speed)
|
||||
virtual float GetParticleRotationSpeedVariation() = 0;
|
||||
|
||||
//! Sets the particle rotation speed variation (in degrees, a variation of 5 being up to 5 either side of the rotation speed)
|
||||
virtual void SetParticleRotationSpeedVariation(float rotationSpeedVariation) = 0;
|
||||
|
||||
//! Gets the particle color tint
|
||||
virtual AZ::Color GetParticleColor() = 0;
|
||||
|
||||
//! Sets the particle color tint
|
||||
virtual void SetParticleColor(AZ::Color color) = 0;
|
||||
|
||||
//! Gets the particle color brightness variation (from 0-1, 0 being no variation, 1 being random variation from the original color down to black)
|
||||
virtual float GetParticleColorBrightnessVariation() = 0;
|
||||
|
||||
//! Sets the particle color brightness variation (from 0-1, 0 being no variation, 1 being random variation from the original color down to black)
|
||||
virtual void SetParticleColorBrightnessVariation(float brightnessVariation) = 0;
|
||||
|
||||
//! Gets the particle color tint variation
|
||||
virtual float GetParticleColorTintVariation() = 0;
|
||||
|
||||
//! Sets the particle color tint variation
|
||||
virtual void SetParticleColorTintVariation(float tintVariation) = 0;
|
||||
|
||||
//! Gets the particle alpha
|
||||
virtual float GetParticleAlpha() = 0;
|
||||
|
||||
//! Sets the particle alpha
|
||||
virtual void SetParticleAlpha(float alpha) = 0;
|
||||
};
|
||||
|
||||
using UiParticleEmitterBus = AZ::EBus<UiParticleEmitterInterface>;
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a radio button component needs to implement. A radio button component
|
||||
//! provides functionality for a button that can be turned on or off and is dependent on the other
|
||||
//! radio buttons in the same radio button group. This interface is designed to be used in
|
||||
//! conjunction with the UiRadioButtonGroupInterface, which describes the group for radio buttons.
|
||||
class UiRadioButtonInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiRadioButtonInterface() {}
|
||||
|
||||
//! Query the state of the radio button
|
||||
//! \return The current state for the radio button.
|
||||
virtual bool GetState() = 0;
|
||||
|
||||
//! Get the radio button group
|
||||
virtual AZ::EntityId GetGroup() = 0;
|
||||
|
||||
//! Get the optional checked (ON) entity
|
||||
virtual AZ::EntityId GetCheckedEntity() = 0;
|
||||
|
||||
//! Set the optional checked (ON) entity
|
||||
virtual void SetCheckedEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional unchecked (OFF) entity
|
||||
virtual AZ::EntityId GetUncheckedEntity() = 0;
|
||||
|
||||
//! Set the optional unchecked (OFF) entity
|
||||
virtual void SetUncheckedEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the action triggered when turned on
|
||||
virtual const LyShine::ActionName& GetTurnOnActionName() = 0;
|
||||
|
||||
//! Set the action triggered when turned on
|
||||
virtual void SetTurnOnActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the action triggered when turned off
|
||||
virtual const LyShine::ActionName& GetTurnOffActionName() = 0;
|
||||
|
||||
//! Set the action triggered when turned off
|
||||
virtual void SetTurnOffActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the action triggered when changed
|
||||
virtual const LyShine::ActionName& GetChangedActionName() = 0;
|
||||
|
||||
//! Set the action triggered when changed
|
||||
virtual void SetChangedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiRadioButtonInterface> UiRadioButtonBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiRadioButtonNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiRadioButtonNotifications() {}
|
||||
|
||||
//! Notify listeners that the radio button state has changed
|
||||
virtual void OnRadioButtonStateChange([[maybe_unused]] bool checked) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiRadioButtonNotifications> UiRadioButtonNotificationBus;
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a radio button component needs to implement. This interface allows the
|
||||
//! radio button group to communicate with the radio button itself
|
||||
class UiRadioButtonCommunicationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiRadioButtonCommunicationInterface() {}
|
||||
|
||||
//! Used by the group to set the state of the radio button
|
||||
//! \param The new desired state of the radio button.
|
||||
//! \param Whether the button should inform listeners that it was changed.
|
||||
virtual void SetState(bool isOn, bool sendNotifications) = 0;
|
||||
|
||||
//! Set the radio button group
|
||||
virtual void SetGroup(AZ::EntityId group) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on an entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiRadioButtonCommunicationInterface> UiRadioButtonCommunicationBus;
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a radio button group component needs to implement. A radio button group
|
||||
//! component provides functionality to manage a group of radio buttons. A group of radio buttons
|
||||
//! allows users to choose one of a predefined set of mutually exclusive options. No more than one
|
||||
//! item may be selected.
|
||||
class UiRadioButtonGroupInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiRadioButtonGroupInterface() {}
|
||||
|
||||
//! Query the state of the radio button group
|
||||
//! \return The currently checked radio button.
|
||||
virtual AZ::EntityId GetCheckedRadioButton() = 0;
|
||||
|
||||
//! Set a radio button to a desired state
|
||||
virtual void SetState(AZ::EntityId radioButton, bool isOn) = 0;
|
||||
|
||||
//! Get the allow uncheck flag
|
||||
virtual bool GetAllowUncheck() = 0;
|
||||
|
||||
//! Set the allow uncheck flag
|
||||
virtual void SetAllowUncheck(bool allowUncheck) = 0;
|
||||
|
||||
//! Add a new radio button to the group
|
||||
virtual void AddRadioButton(AZ::EntityId radioButton) = 0;
|
||||
|
||||
//! Remove a radio button from the group
|
||||
virtual void RemoveRadioButton(AZ::EntityId radioButton) = 0;
|
||||
|
||||
//! Query whether a radio button is in the group or not
|
||||
virtual bool ContainsRadioButton(AZ::EntityId radioButton) = 0;
|
||||
|
||||
//! Get the action triggered when changed
|
||||
virtual const LyShine::ActionName& GetChangedActionName() = 0;
|
||||
|
||||
//! Set the action triggered when changed
|
||||
virtual void SetChangedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiRadioButtonGroupInterface> UiRadioButtonGroupBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiRadioButtonGroupNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiRadioButtonGroupNotifications() {}
|
||||
|
||||
//! Notify listeners that the radio button group state has changed
|
||||
virtual void OnRadioButtonGroupStateChange([[maybe_unused]] AZ::EntityId checkedRadioButton) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiRadioButtonGroupNotifications> UiRadioButtonGroupNotificationBus;
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a radio button group component needs to implement. This interface allows
|
||||
//! a radio button to communicate with the radio button group itself
|
||||
class UiRadioButtonGroupCommunicationInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiRadioButtonGroupCommunicationInterface() {}
|
||||
|
||||
//! Registers a radio button within a group
|
||||
//! \param The radio button to add
|
||||
//! \return Whether the radio button was successfully added to the group or not
|
||||
virtual bool RegisterRadioButton(AZ::EntityId radioButton) = 0;
|
||||
|
||||
//! Unregisters a radio button within a group
|
||||
//! \param The radio button to remove
|
||||
virtual void UnregisterRadioButton(AZ::EntityId radioButton) = 0;
|
||||
|
||||
//! Called when a radio button wants to change state due to user action (i.e. by clicking it)
|
||||
//! \param The radio button to change the state of
|
||||
//! \param The new radio button state
|
||||
virtual void RequestRadioButtonStateChange(AZ::EntityId radioButton, bool newState) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on an entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiRadioButtonGroupCommunicationInterface> UiRadioButtonGroupCommunicationBus;
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
namespace LyShine
|
||||
{
|
||||
class IRenderGraph;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiRenderInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiRenderInterface() {}
|
||||
|
||||
//! Render the component into the render graph
|
||||
virtual void Render(LyShine::IRenderGraph* renderGraph) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Multiple components on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiRenderInterface> UiRenderBus;
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
namespace LyShine
|
||||
{
|
||||
class IRenderGraph;
|
||||
}
|
||||
|
||||
class UiElementInterface;
|
||||
class UiRenderInterface;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! The UiRenderControlBus is used for controlling the rendering of elements that affect the rendering
|
||||
//! of their children.
|
||||
//! An example use is a mask component that needs to setup stencil write before rendering its
|
||||
//! components to increment the stencil buffer, switch to stencil test before rendering the child
|
||||
//! elements and then do a second pass to decrement the stencil buffer.
|
||||
//! The interface is designed to be flexible and could also be used for setting up scissoring or
|
||||
//! rendering to a texture.
|
||||
class UiRenderControlInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiRenderControlInterface() {}
|
||||
|
||||
//! This renders this element plus its children. It allows the RenderControl element to control
|
||||
//! the order in which the element's component and children are rendered and to change state
|
||||
//! at any point while rendering them.
|
||||
//! \param renderGraph, the render graph being added to
|
||||
//! \param elementInterface, pointer to the element interface for this element (for performance)
|
||||
//! \param renderInterface, pointer to the render interface for this element (for performance)
|
||||
//! \param numChildren, the number of child elements of this element
|
||||
//! \param isInGame, true if element being rendered in game (or preview), false if being render in edit mode
|
||||
virtual void Render(
|
||||
LyShine::IRenderGraph* renderGraph,
|
||||
UiElementInterface* elementInterface,
|
||||
UiRenderInterface* renderInterface,
|
||||
int numChildren,
|
||||
bool isInGame) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiRenderControlInterface> UiRenderControlBus;
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiScrollBarInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiScrollBarInterface() {}
|
||||
|
||||
//! Get the size of the handle relative to the scrollbar (0 - 1)
|
||||
virtual float GetHandleSize() = 0;
|
||||
|
||||
//! Set the size of the handle relative to the scrollbar (0 - 1)
|
||||
virtual void SetHandleSize(float size) = 0;
|
||||
|
||||
//! Get the minimum size of the handle in pixels
|
||||
virtual float GetMinHandlePixelSize() = 0;
|
||||
|
||||
//! Set the minimum size of the handle in pixels
|
||||
virtual void SetMinHandlePixelSize(float size) = 0;
|
||||
|
||||
//! Get the handle entity
|
||||
virtual AZ::EntityId GetHandleEntity() = 0;
|
||||
|
||||
//! Set the handle entity
|
||||
virtual void SetHandleEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get auto fade
|
||||
virtual bool IsAutoFadeEnabled() = 0;
|
||||
|
||||
//! Set auto fade
|
||||
virtual void SetAutoFadeEnabled(bool isAutoFadeEnabled) = 0;
|
||||
|
||||
//! Get the delay in seconds before the scrollbar will fade if unused
|
||||
virtual float GetAutoFadeDelay() = 0;
|
||||
|
||||
//! Set the fade delay in seconds
|
||||
virtual void SetAutoFadeDelay(float delay) = 0;
|
||||
|
||||
//! Get the speed in seconds that it will take for the scrollbar to fade to transparent
|
||||
virtual float GetAutoFadeSpeed() = 0;
|
||||
|
||||
//! Set the fade speed in seconds
|
||||
virtual void SetAutoFadeSpeed(float speed) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiScrollBarInterface> UiScrollBarBus;
|
||||
@@ -1,184 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
#include <functional>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiScrollBoxInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Callback for when box is scrolled
|
||||
typedef AZStd::function<void(AZ::EntityId sendingEntityId, AZ::Vector2 newScrollOffset)> ScrollOffsetChangeCallback;
|
||||
|
||||
enum class SnapMode
|
||||
{
|
||||
None,
|
||||
Children,
|
||||
Grid
|
||||
};
|
||||
|
||||
enum class ScrollBarVisibility
|
||||
{
|
||||
AlwaysShow,
|
||||
AutoHide,
|
||||
AutoHideAndResizeViewport
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiScrollBoxInterface() {}
|
||||
|
||||
//! Query the current scroll offset of the scroll box
|
||||
//! \return The current scroll offset for the scroll box.
|
||||
//!
|
||||
//! The scroll offset is the offset from the content element's anchor point to
|
||||
//! the content element's pivot.
|
||||
//! If the content element's anchor points are split it is the offset from
|
||||
//! their center to the pivot.
|
||||
//! So if the mouse is dragged left, the content moves to the left, so the offset
|
||||
//! X has the X drag amount subtracted from it.
|
||||
//! Using the offset from the anchor to the pivot allows the offset to be center
|
||||
//! to center or top-left to top-left, or any combination of the possible
|
||||
//! anchor and pivot positions
|
||||
virtual AZ::Vector2 GetScrollOffset() = 0;
|
||||
|
||||
//! Set the scroll offset of the scroll box
|
||||
//! \param isOn The new desired scroll offset of the scroll box.
|
||||
virtual void SetScrollOffset(AZ::Vector2 scrollOffset) = 0;
|
||||
|
||||
//! Get the scroll value from 0 - 1
|
||||
virtual AZ::Vector2 GetNormalizedScrollValue() = 0;
|
||||
|
||||
//! Change content size and scroll offset, and handle the changes
|
||||
virtual void ChangeContentSizeAndScrollOffset(AZ::Vector2 contentSize, AZ::Vector2 scrollOffset) = 0;
|
||||
|
||||
//! Get whether there is content to scroll horizontally
|
||||
virtual bool HasHorizontalContentToScroll() = 0;
|
||||
|
||||
//! Get whether there is content to scroll vertically
|
||||
virtual bool HasVerticalContentToScroll() = 0;
|
||||
|
||||
//! Get whether horizontal scrolling interaction is enabled
|
||||
virtual bool GetIsHorizontalScrollingEnabled() = 0;
|
||||
|
||||
//! Set whether horizontal scrolling interaction is enabled
|
||||
virtual void SetIsHorizontalScrollingEnabled(bool isEnabled) = 0;
|
||||
|
||||
//! Get whether vertical scrolling interaction is enabled
|
||||
virtual bool GetIsVerticalScrollingEnabled() = 0;
|
||||
|
||||
//! Set whether vertical scrolling interaction is enabled
|
||||
virtual void SetIsVerticalScrollingEnabled(bool isEnabled) = 0;
|
||||
|
||||
//! Get whether scrolling interaction is constrained to the content area
|
||||
virtual bool GetIsScrollingConstrained() = 0;
|
||||
|
||||
//! Set whether vertical scrolling interaction is constrained to the content area
|
||||
virtual void SetIsScrollingConstrained(bool isConstrained) = 0;
|
||||
|
||||
//! Get snap mode
|
||||
virtual SnapMode GetSnapMode() = 0;
|
||||
|
||||
//! Set snap mode
|
||||
virtual void SetSnapMode(SnapMode snapMode) = 0;
|
||||
|
||||
//! Get snap grid
|
||||
virtual AZ::Vector2 GetSnapGrid() = 0;
|
||||
|
||||
//! Set snap grid
|
||||
virtual void SetSnapGrid(AZ::Vector2 snapGrid) = 0;
|
||||
|
||||
//! Get horizontal scrollbar visibility behavior
|
||||
virtual ScrollBarVisibility GetHorizontalScrollBarVisibility() = 0;
|
||||
|
||||
//! Set horizontal scrollbar visibility behavior
|
||||
virtual void SetHorizontalScrollBarVisibility(ScrollBarVisibility visibility) = 0;
|
||||
|
||||
//! Get vertical scrollbar visibility behavior
|
||||
virtual ScrollBarVisibility GetVerticalScrollBarVisibility() = 0;
|
||||
|
||||
//! Set vertical scrollbar visibility behavior
|
||||
virtual void SetVerticalScrollBarVisibility(ScrollBarVisibility visibility) = 0;
|
||||
|
||||
//! Get the callback invoked while the scroll offset is changing
|
||||
virtual ScrollOffsetChangeCallback GetScrollOffsetChangingCallback() = 0;
|
||||
|
||||
//! Set the callback invoked while the scroll offset is changing
|
||||
virtual void SetScrollOffsetChangingCallback(ScrollOffsetChangeCallback onChange) = 0;
|
||||
|
||||
//! Get the action triggered while the scroll offset is changing
|
||||
virtual const LyShine::ActionName& GetScrollOffsetChangingActionName() = 0;
|
||||
|
||||
//! Set the action triggered while the scroll offset is changing
|
||||
virtual void SetScrollOffsetChangingActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the callback invoked when the scroll offset is done changing
|
||||
virtual ScrollOffsetChangeCallback GetScrollOffsetChangedCallback() = 0;
|
||||
|
||||
//! Set the callback invoked when the scroll offset is done changing
|
||||
virtual void SetScrollOffsetChangedCallback(ScrollOffsetChangeCallback onChange) = 0;
|
||||
|
||||
//! Get the action triggered when the scroll offset is done changing
|
||||
virtual const LyShine::ActionName& GetScrollOffsetChangedActionName() = 0;
|
||||
|
||||
//! Set the action triggered when the scroll offset is done changing
|
||||
virtual void SetScrollOffsetChangedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Set the optional content entity, if none is specified then nothing gets scrolled
|
||||
virtual void SetContentEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional content entity
|
||||
virtual AZ::EntityId GetContentEntity() = 0;
|
||||
|
||||
//! Set the optional horizontal scrollbar entity
|
||||
virtual void SetHorizontalScrollBarEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional horizontal scrollbar entity
|
||||
virtual AZ::EntityId GetHorizontalScrollBarEntity() = 0;
|
||||
|
||||
//! Set the optional vertical scrollbar entity
|
||||
virtual void SetVerticalScrollBarEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional vertical scrollbar entity
|
||||
virtual AZ::EntityId GetVerticalScrollBarEntity() = 0;
|
||||
|
||||
//! Find the child of the content element that is closest to the content anchors
|
||||
//! at the current scroll offset. i.e. what is the currently "selected" child
|
||||
virtual AZ::EntityId FindClosestContentChildElement() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiScrollBoxInterface> UiScrollBoxBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement to receive scroll box change notifications
|
||||
class UiScrollBoxNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiScrollBoxNotifications(){}
|
||||
|
||||
//! Called when the scroll offset is changing
|
||||
virtual void OnScrollOffsetChanging(AZ::Vector2 newScrollOffset) = 0;
|
||||
|
||||
//! Called when the scroll offset is done changing
|
||||
virtual void OnScrollOffsetChanged(AZ::Vector2 newScrollOffset) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiScrollBoxNotifications> UiScrollBoxNotificationBus;
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a scrollable component needs to implement. A scrollable component is one
|
||||
//! that provides functionality to scroll its content
|
||||
//! (e.g. UiScrollBoxComponent)
|
||||
class UiScrollableInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiScrollableInterface() {}
|
||||
|
||||
//! Get the ratio between the scrollable content size and the size of its parent
|
||||
virtual bool GetScrollableParentToContentRatio(AZ::Vector2& ratioOut) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiScrollableInterface> UiScrollableBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement in order to get notifications when values of the
|
||||
//! scrollable change
|
||||
class UiScrollableNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiScrollableNotifications(){}
|
||||
|
||||
//! Called when the scroll value (0 - 1) is changing
|
||||
virtual void OnScrollableValueChanging(AZ::Vector2 value) = 0;
|
||||
|
||||
//! Called when the scroll value (0 - 1) has been changed
|
||||
virtual void OnScrollableValueChanged(AZ::Vector2 value) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiScrollableNotifications> UiScrollableNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that scrollers need to implement in order to get notifications of changes
|
||||
//! created by the scrollable
|
||||
class UiScrollableToScrollerNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiScrollableToScrollerNotifications(){}
|
||||
|
||||
//! Called when the scrollable is changing the scroll value (0 - 1)
|
||||
virtual void OnValueChangingByScrollable(AZ::Vector2 value) = 0;
|
||||
|
||||
//! Called when the scrollable is done changing the scroll value (0 - 1)
|
||||
virtual void OnValueChangedByScrollable(AZ::Vector2 value) = 0;
|
||||
|
||||
//! Called when the content size or content parent size has been changed
|
||||
virtual void OnScrollableParentToContentRatioChanged(AZ::Vector2 parentToContentRatio) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiScrollableToScrollerNotifications> UiScrollableToScrollerNotificationBus;
|
||||
@@ -1,121 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a scroller component needs to implement. A scroller component provides
|
||||
//! functionality to control the scrolling of scrollable content
|
||||
//! (e.g. UiScrollBarComponent)
|
||||
class UiScrollerInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! params: sending entity id, newValue, newPosition
|
||||
typedef AZStd::function<void(AZ::EntityId, float)> ValueChangeCallback;
|
||||
|
||||
//! Scroller orientation
|
||||
enum class Orientation
|
||||
{
|
||||
Horizontal,
|
||||
Vertical
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiScrollerInterface() {}
|
||||
|
||||
//! Get the current value for the scrollbar (0 - 1)
|
||||
virtual float GetValue() = 0;
|
||||
|
||||
//! Set the value of the scrollbar (0 - 1)
|
||||
virtual void SetValue(float value) = 0;
|
||||
|
||||
//! Get the orientation of the scroller
|
||||
virtual Orientation GetOrientation() = 0;
|
||||
|
||||
//! Set the orientation of the scroller
|
||||
virtual void SetOrientation(Orientation orientation) = 0;
|
||||
|
||||
//! Get the scrollable entity
|
||||
virtual AZ::EntityId GetScrollableEntity() = 0;
|
||||
|
||||
//! Set the scrollable entity
|
||||
virtual void SetScrollableEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the callback invoked while the value is changing
|
||||
virtual ValueChangeCallback GetValueChangingCallback() = 0;
|
||||
|
||||
//! Set the callback invoked while the value is changing
|
||||
virtual void SetValueChangingCallback(ValueChangeCallback onChange) = 0;
|
||||
|
||||
//! Get the callback invoked when the value is done changing
|
||||
virtual ValueChangeCallback GetValueChangedCallback() = 0;
|
||||
|
||||
//! Set the callback invoked when the value is done changing
|
||||
virtual void SetValueChangedCallback(ValueChangeCallback onChange) = 0;
|
||||
|
||||
//! Get the action triggered while the value is changing
|
||||
virtual const LyShine::ActionName& GetValueChangingActionName() = 0;
|
||||
|
||||
//! Set the action triggered while the value is changing
|
||||
virtual void SetValueChangingActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the action triggered when the value is done changing
|
||||
virtual const LyShine::ActionName& GetValueChangedActionName() = 0;
|
||||
|
||||
//! Set the action triggered when the value is done changing
|
||||
virtual void SetValueChangedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiScrollerInterface> UiScrollerBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement in order to get notifications when values of the
|
||||
//! scroller change
|
||||
class UiScrollerNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiScrollerNotifications(){}
|
||||
|
||||
//! Called when the scroller value (0 - 1) is changing
|
||||
virtual void OnScrollerValueChanging(float value) = 0;
|
||||
|
||||
//! Called when the scroller value (0 - 1) has been changed
|
||||
virtual void OnScrollerValueChanged(float value) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiScrollerNotifications> UiScrollerNotificationBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that scrollables need to implement in order to get notifications when the scroller
|
||||
//! changes the value
|
||||
class UiScrollerToScrollableNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiScrollerToScrollableNotifications(){}
|
||||
|
||||
//! Called when the scroller is changing the scroll value (0 - 1)
|
||||
virtual void OnValueChangingByScroller(float value) = 0;
|
||||
|
||||
//! Called when the scroller is done changing the scroll value (0 - 1)
|
||||
virtual void OnValueChangedByScroller(float value) = 0;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiScrollerToScrollableNotifications> UiScrollerToScrollableNotificationBus;
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiSliderInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! params: sending entity id, newValue, newPosition
|
||||
typedef AZStd::function<void(AZ::EntityId, float)> ValueChangeCallback;
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiSliderInterface() {}
|
||||
|
||||
//! Query the value of the slider
|
||||
//! \return The current value for the slider.
|
||||
virtual float GetValue() = 0;
|
||||
|
||||
//! Manually override the value of the slider
|
||||
//! \param isOn The new desired value of the slider.
|
||||
virtual void SetValue(float value) = 0;
|
||||
|
||||
virtual float GetMinValue() = 0;
|
||||
virtual void SetMinValue(float value) = 0;
|
||||
virtual float GetMaxValue() = 0;
|
||||
virtual void SetMaxValue(float value) = 0;
|
||||
virtual float GetStepValue() = 0;
|
||||
virtual void SetStepValue(float step) = 0;
|
||||
|
||||
//! Get the callback invoked while the value is changing
|
||||
virtual ValueChangeCallback GetValueChangingCallback() = 0;
|
||||
|
||||
//! Set the callback invoked while the value is changing
|
||||
virtual void SetValueChangingCallback(ValueChangeCallback onChange) = 0;
|
||||
|
||||
//! Get the action triggered while the value is changing
|
||||
virtual const LyShine::ActionName& GetValueChangingActionName() = 0;
|
||||
|
||||
//! Set the action triggered while the value is changing
|
||||
virtual void SetValueChangingActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the callback invoked when the value is done changing
|
||||
virtual ValueChangeCallback GetValueChangedCallback() = 0;
|
||||
|
||||
//! Set the callback invoked when the value is done changing
|
||||
virtual void SetValueChangedCallback(ValueChangeCallback onChange) = 0;
|
||||
|
||||
//! Get the action triggered when the value is done changing
|
||||
virtual const LyShine::ActionName& GetValueChangedActionName() = 0;
|
||||
|
||||
//! Set the action triggered when the value is done changing
|
||||
virtual void SetValueChangedActionName(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Set the optional track entity
|
||||
virtual void SetTrackEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional track entity
|
||||
virtual AZ::EntityId GetTrackEntity() = 0;
|
||||
|
||||
//! Set the optional fill entity
|
||||
virtual void SetFillEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional fill entity
|
||||
virtual AZ::EntityId GetFillEntity() = 0;
|
||||
|
||||
//! Set the optional manipulator entity
|
||||
virtual void SetManipulatorEntity(AZ::EntityId entityId) = 0;
|
||||
|
||||
//! Get the optional manipulator entity
|
||||
virtual AZ::EntityId GetManipulatorEntity() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiSliderInterface> UiSliderBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiSliderNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiSliderNotifications() {}
|
||||
|
||||
//! Notify listeners that the slider value is changing
|
||||
virtual void OnSliderValueChanging([[maybe_unused]] float value) {}
|
||||
|
||||
//! Notify listeners that the slider value is done changing
|
||||
virtual void OnSliderValueChanged([[maybe_unused]] float value) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiSliderNotifications> UiSliderNotificationBus;
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Slice/SliceInstantiationTicket.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for making requests to the UiSpawnerComponent
|
||||
class UiSpawnerInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiSpawnerInterface() {}
|
||||
|
||||
//! Spawn the selected slice at the entity's location
|
||||
virtual AzFramework::SliceInstantiationTicket Spawn() = 0;
|
||||
|
||||
//! Spawn the selected slice at the entity's location with the provided relative offset
|
||||
virtual AzFramework::SliceInstantiationTicket SpawnRelative(const AZ::Vector2& relative) = 0;
|
||||
|
||||
//! Spawn the selected slice at the specified viewport position
|
||||
virtual AzFramework::SliceInstantiationTicket SpawnViewport(const AZ::Vector2& pos) { (void)pos; return AzFramework::SliceInstantiationTicket(); };
|
||||
|
||||
//! Spawn the provided slice at the entity's location
|
||||
virtual AzFramework::SliceInstantiationTicket SpawnSlice(const AZ::Data::Asset<AZ::Data::AssetData>& slice) { (void)slice; return AzFramework::SliceInstantiationTicket(); };
|
||||
|
||||
//! Spawn the provided slice at the entity's location with the provided relative offset
|
||||
virtual AzFramework::SliceInstantiationTicket SpawnSliceRelative(const AZ::Data::Asset<AZ::Data::AssetData>& slice, const AZ::Vector2& relative) { (void)slice; (void)relative; return AzFramework::SliceInstantiationTicket(); };
|
||||
|
||||
//! Spawn the provided slice at the specified viewport position
|
||||
virtual AzFramework::SliceInstantiationTicket SpawnSliceViewport(const AZ::Data::Asset<AZ::Data::AssetData>& slice, const AZ::Vector2& pos) { (void)slice; (void)pos; return AzFramework::SliceInstantiationTicket(); };
|
||||
};
|
||||
|
||||
using UiSpawnerBus = AZ::EBus<UiSpawnerInterface>;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Bus for notifications dispatched by the UiSpawnerComponent
|
||||
//! Whenever one of the "Spawn" calls in UiSpawnerInterface is called then a listener connected
|
||||
//! on this bus with the spawner entity ID will either get:
|
||||
//! 1. This sequence of notifications:
|
||||
//! OnSpawnBegin
|
||||
//! N x OnEntitySpawned
|
||||
//! OnEntitiesSpawned
|
||||
//! OnTopLevelEntitiesSpawned
|
||||
//! OnSpawnEnd
|
||||
//! 2. In the case of a spawn error just this notification:
|
||||
//! OnSpawnFailed
|
||||
class UiSpawnerNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiSpawnerNotifications() {}
|
||||
|
||||
//! Notify that slice has been spawned, but entities have not yet been activated.
|
||||
//! OnEntitySpawned events are about to be dispatched.
|
||||
virtual void OnSpawnBegin(const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
|
||||
//! Notify that an entity has spawned, will be called once for each entity spawned in a slice.
|
||||
virtual void OnEntitySpawned(const AzFramework::SliceInstantiationTicket& /*ticket*/, const AZ::EntityId& /*spawnedEntity*/) {}
|
||||
|
||||
//! Single event notification for an entire slice spawn, providing a list of all resulting entity Ids.
|
||||
virtual void OnEntitiesSpawned(const AzFramework::SliceInstantiationTicket& /*ticket*/, const AZStd::vector<AZ::EntityId>& /*spawnedEntities*/) {}
|
||||
|
||||
//! Single event notification for an entire slice spawn, providing a list of all resulting top-level entity Ids.
|
||||
//! Top-level entities are ones that are not the child of any other entity in the slice
|
||||
virtual void OnTopLevelEntitiesSpawned(const AzFramework::SliceInstantiationTicket& /*ticket*/, const AZStd::vector<AZ::EntityId>& /*spawnedEntities*/) {}
|
||||
|
||||
//! Notify that a spawn has been completed. All spawn notifications for this ticket have been dispatched.
|
||||
virtual void OnSpawnEnd(const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
|
||||
//! Notify that slice has failed to be spawned.
|
||||
virtual void OnSpawnFailed(const AzFramework::SliceInstantiationTicket& /*ticket*/) {}
|
||||
};
|
||||
|
||||
using UiSpawnerNotificationBus = AZ::EBus<UiSpawnerNotifications>;
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
|
||||
class UiSystemInterface
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
// Public functions
|
||||
|
||||
//! Register a component type with the UI system.
|
||||
//! The order in which component types are registered is the order that they show up in
|
||||
//! the add component and in the properties pane.
|
||||
//! This will go away once there is a system that orders things the way we want based
|
||||
//! on the existing component registration.
|
||||
virtual void RegisterComponentTypeForMenuOrdering([[maybe_unused]] const AZ::Uuid& typeUuid) {}
|
||||
|
||||
//! Get the UI component types registered with the UI system
|
||||
//! This is a short-term solution until there is a way to get the registered components
|
||||
//! from the framework in an order that we want for the menus and the properties pane
|
||||
virtual const AZStd::vector<AZ::Uuid>* GetComponentTypesForMenuOrdering() = 0;
|
||||
|
||||
//! We use this for metrics to find out which components are part of the LyShine Gem
|
||||
virtual const AZStd::list<AZ::ComponentDescriptor*>* GetLyShineComponentDescriptors() = 0;
|
||||
};
|
||||
|
||||
using UiSystemBus = AZ::EBus<UiSystemInterface>;
|
||||
|
||||
@@ -1,292 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
#include <LyShine/Bus/UiTransformBus.h>
|
||||
#include <LyShine/IDraw2d.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiTextInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Callback type for retrieving displayed text.
|
||||
typedef AZStd::function<AZStd::string(const AZStd::string&)> DisplayedTextFunction;
|
||||
|
||||
//! Determines how text overflow should behave
|
||||
enum class OverflowMode
|
||||
{
|
||||
OverflowText, //!< text contents aren't impacted by element size (and vice versa)
|
||||
ClipText, //!< clips text contents to fit width of element
|
||||
Ellipsis //!< truncates displayed text to fit element and appends ellipsis to the text
|
||||
};
|
||||
|
||||
//! Provides values for determining whether text is wrapped or not
|
||||
enum class WrapTextSetting
|
||||
{
|
||||
NoWrap,
|
||||
Wrap
|
||||
};
|
||||
|
||||
//! Controls whether text should shrink (scale down) to prevent overflowing.
|
||||
//!
|
||||
//! The amount of scale applied to text can be limited by minimum shrink scale.
|
||||
enum class ShrinkToFit
|
||||
{
|
||||
None, //!< No shrinking is applied to text
|
||||
Uniform, //!< Shrink text uniformly along X/Y dimension (maintains aspect ratio)
|
||||
WidthOnly //!< Only scales text along X axis (width)
|
||||
};
|
||||
|
||||
//! Determines what processing should be performed on text before returning
|
||||
enum GetTextFlags
|
||||
{
|
||||
GetAsIs = 0,
|
||||
GetLocalized = 1 << 0
|
||||
};
|
||||
|
||||
//! Determines how text should be assigned
|
||||
enum SetTextFlags
|
||||
{
|
||||
SetAsIs = 0,
|
||||
SetEscapeMarkup = 1 << 0,
|
||||
SetLocalized = 1 << 1
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTextInterface() {}
|
||||
|
||||
//! Returns the unaltered contents of the string contained within the text component.
|
||||
//! \return Unaltered string contents of this text component
|
||||
virtual AZStd::string GetText() = 0;
|
||||
virtual void SetText(const AZStd::string& text) = 0;
|
||||
|
||||
virtual AZStd::string GetTextWithFlags(GetTextFlags flags = GetAsIs) = 0;
|
||||
virtual void SetTextWithFlags(const AZStd::string& text, SetTextFlags flags = SetAsIs) = 0;
|
||||
|
||||
virtual AZ::Color GetColor() = 0;
|
||||
virtual void SetColor(const AZ::Color& color) = 0;
|
||||
|
||||
//! Returns font object used by the displayed text.
|
||||
virtual LyShine::PathnameType GetFont() = 0;
|
||||
virtual void SetFont(const LyShine::PathnameType& fontPath) = 0;
|
||||
|
||||
virtual int GetFontEffect() = 0;
|
||||
virtual void SetFontEffect(int effectIndex) = 0;
|
||||
|
||||
virtual AZStd::string GetFontEffectName(int effectIndex) = 0;
|
||||
virtual void SetFontEffectByName(const AZStd::string& effectName) = 0;
|
||||
|
||||
virtual float GetFontSize() = 0;
|
||||
virtual void SetFontSize(float size) = 0;
|
||||
|
||||
virtual void GetTextAlignment(IDraw2d::HAlign& horizontalAlignment,
|
||||
IDraw2d::VAlign& verticalAlignment) = 0;
|
||||
virtual void SetTextAlignment(IDraw2d::HAlign horizontalAlignment,
|
||||
IDraw2d::VAlign verticalAlignment) = 0;
|
||||
|
||||
virtual IDraw2d::HAlign GetHorizontalTextAlignment() = 0;
|
||||
virtual void SetHorizontalTextAlignment(IDraw2d::HAlign alignment) = 0;
|
||||
virtual IDraw2d::VAlign GetVerticalTextAlignment() = 0;
|
||||
virtual void SetVerticalTextAlignment(IDraw2d::VAlign alignment) = 0;
|
||||
|
||||
virtual float GetCharacterSpacing() = 0;
|
||||
virtual void SetCharacterSpacing(float characterSpacing) = 0;
|
||||
virtual float GetLineSpacing() = 0;
|
||||
virtual void SetLineSpacing(float lineSpacing) = 0;
|
||||
|
||||
//! Given a point in viewport space, return the character index in the string
|
||||
//! \param point a point in viewport space
|
||||
//! \param mustBeInBoundingBox if true the given point be be contained in the bounding box of
|
||||
//! actual text characters (not the element). If false it can be anywhere (even outside the element)
|
||||
//! and is projected onto a text position (for drag select for example).
|
||||
//! \return -1 if second param is true and point is outside box
|
||||
//! 0 if to left of first char, 1 if between first and second char,
|
||||
//! length of string if to right of last char
|
||||
virtual int GetCharIndexFromPoint(AZ::Vector2 point, bool mustBeInBoundingBox) = 0;
|
||||
|
||||
//! Given a point in untransformed canvas space, return the character index in the string
|
||||
//! \param point a point in untransformed canvas space
|
||||
//! \param mustBeInBoundingBox if true the given point be be contained in the bounding box of
|
||||
//! actual text characters (not the element). If false it can be anywhere (even outside the element)
|
||||
//! and is projected onto a text position (for drag select for example).
|
||||
//! \return -1 if second param is true and point is outside box
|
||||
//! 0 if to left of first char, 1 if between first and second char,
|
||||
//! length of string if to right of last char
|
||||
virtual int GetCharIndexFromCanvasSpacePoint(AZ::Vector2 point, bool mustBeInBoundingBox) = 0;
|
||||
|
||||
//! Returns the XY coord of the rendered character position at a given index.
|
||||
//! Imagining a rect encompassing the character width and line height,
|
||||
//! the returned coordinate is the upper-left corner of the rect.
|
||||
//! \param index Index into displayed string.
|
||||
virtual AZ::Vector2 GetPointFromCharIndex(int index) = 0;
|
||||
|
||||
virtual AZ::Color GetSelectionColor() = 0;
|
||||
virtual void GetSelectionRange(int& startIndex, int& endIndex) = 0;
|
||||
|
||||
//! Set a range of the text string to be shown as selected
|
||||
//!
|
||||
//! If startIndex and endIndex are the same then a one pixel wide vertical bar is highlighted.
|
||||
//!
|
||||
//! The provided start and end indices are "character" indices into a UTF8 string. For
|
||||
//! example, an index of 1 could actually be mapped at buffer index 2 if the first character
|
||||
//! in the UTF8 string is a multi-byte character of size 2.
|
||||
//!
|
||||
//! \param startIndex 0 means starting at the left edge first character
|
||||
//! \param endIndex if equal to UTF8 text string length that means up to the right edge of the last char
|
||||
//! \param selectionColor the selection color (for box drawn behind text)
|
||||
virtual void SetSelectionRange(int startIndex, int endIndex, const AZ::Color& selectionColor) = 0;
|
||||
|
||||
//! Clear any text selection range that has been applied to this text
|
||||
virtual void ClearSelectionRange() = 0;
|
||||
|
||||
//! Get the width and height of the text
|
||||
virtual AZ::Vector2 GetTextSize() = 0;
|
||||
|
||||
//! Get the width of the text
|
||||
virtual float GetTextWidth() = 0;
|
||||
|
||||
//! Get the height of the text
|
||||
virtual float GetTextHeight() = 0;
|
||||
|
||||
//! Get the bounding box (in viewport space, so it can be rotated) of the given text range
|
||||
//! If startIndex and endIndex are the same then a rect is still returned that is one pixel wide
|
||||
//! \param startIndex 0 means starting at the first character
|
||||
//! \param endIndex if equal to text string length that means including the last char
|
||||
//! \param rectPoints Output parameter that gets populated with up to three RectPoints for multi-line text selection geometry.
|
||||
virtual void GetTextBoundingBox(int startIndex, int endIndex, UiTransformInterface::RectPointsArray& rectPoints) = 0;
|
||||
|
||||
//! Returns the function object used to manipulate a given string to condition it for rendering.
|
||||
//! The default displayed text function for a UiTextComponent is pass-through (the passed string
|
||||
//! is returned as-is).
|
||||
virtual DisplayedTextFunction GetDisplayedTextFunction() const = 0;
|
||||
|
||||
//! Allows setting a DisplayedTextFunction object to be called prior to rendering.
|
||||
//! The string contents of a UiTextComponent can be modified for rendering without
|
||||
//! changing the actual contents of the text component (GetText()). This functionality
|
||||
//! is useful in some situations, like password hiding, where the displayed text should
|
||||
//! be different from the stored text.
|
||||
virtual void SetDisplayedTextFunction(const DisplayedTextFunction& displayedTextFunction) = 0;
|
||||
|
||||
//! Gets the overflow behavior of this component
|
||||
virtual OverflowMode GetOverflowMode() = 0;
|
||||
|
||||
//! Sets the overflow setting of this component.
|
||||
virtual void SetOverflowMode(OverflowMode overflowMode) = 0;
|
||||
|
||||
//! Gets the text wrapping setting of this component
|
||||
virtual WrapTextSetting GetWrapText() = 0;
|
||||
|
||||
//! Sets the text wrapping setting of this component
|
||||
virtual void SetWrapText(WrapTextSetting wrapSetting) = 0;
|
||||
|
||||
//! Gets the "shrink-to-fit" value of this component
|
||||
virtual ShrinkToFit GetShrinkToFit() = 0;
|
||||
|
||||
//! Sets the "shrink-to-fit" value of this component
|
||||
virtual void SetShrinkToFit(ShrinkToFit shrinkToFit) = 0;
|
||||
|
||||
//! Typically triggered when input mechanism (keyboard vs. mouse) changes/alternates.
|
||||
virtual void ResetCursorLineHint() = 0;
|
||||
|
||||
//! Get whether markup is enabled. If true then the text string is parsed for XML markup.
|
||||
virtual bool GetIsMarkupEnabled() = 0;
|
||||
|
||||
//! Set whether markup is enabled. If true then the text string is parsed for XML markup.
|
||||
virtual void SetIsMarkupEnabled(bool isEnabled) = 0;
|
||||
|
||||
//! Gets the minimum shrink scale when using ShrinkToFit.
|
||||
virtual float GetMinimumShrinkScale() = 0;
|
||||
|
||||
//! Sets the minimum shrink scale when using ShrinkToFit.
|
||||
virtual void SetMinimumShrinkScale(float minShrinkScale) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTextInterface> UiTextBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface that describes "clickable" areas of text for a text component.
|
||||
//!
|
||||
//! Text components can contain anchor tags that allow user interaction with text.
|
||||
//! These anchor tags define clickable areas that can be stylized (via color) and
|
||||
//! provide information to listeners regarding the text.
|
||||
class UiClickableTextInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Defines an area of interaction for clickable text, along with metadata.
|
||||
struct ClickableTextRect
|
||||
{
|
||||
UiTransformInterface::Rect rect; //!< "Click area" for text.
|
||||
|
||||
AZStd::string action; //!< "action" string from markup.
|
||||
|
||||
AZStd::string data; //!< "data" string from markup.
|
||||
|
||||
int id; //!< Identifier that uniquely identifies clickable text from
|
||||
//!< a single anchor tag. The clickable text from markup can
|
||||
//!< be word-wrapped to subsequent lines, in which case the
|
||||
//!< identifier will identify all clickable text coming from
|
||||
//!< a single anchor tag. This allows word-wrapped clickable
|
||||
//!< text to be treated as a single clickable link,
|
||||
//!< especially useful for hover/color styling.
|
||||
};
|
||||
|
||||
using ClickableTextRects = AZStd::vector<ClickableTextRect>;
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiClickableTextInterface() {}
|
||||
|
||||
//! Populates given clickable text rects for a text component.
|
||||
virtual void GetClickableTextRects(UiClickableTextInterface::ClickableTextRects& clickableTextRects) = 0;
|
||||
|
||||
//! Sets the drawbatch color for clickable text, given by the ID.
|
||||
virtual void SetClickableTextColor(int id, const AZ::Color& color) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on an entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiClickableTextInterface> UiClickableTextBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiClickableTextNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const bool EnableEventQueue = true;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiClickableTextNotifications() {}
|
||||
|
||||
//! Notify listeners that the text has been prepared for render.
|
||||
virtual void OnClickableTextChanged() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiClickableTextNotifications> UiClickableTextNotificationsBus;
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiTextInputInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
typedef AZStd::function<void(AZ::EntityId, const AZStd::string&)> TextInputCallback;
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTextInputInterface() {}
|
||||
|
||||
//! Get the color to be used for the text background when it is selected
|
||||
virtual AZ::Color GetTextSelectionColor() = 0;
|
||||
|
||||
//! Set the color to be used for the text background when it is selected
|
||||
virtual void SetTextSelectionColor(const AZ::Color& color) = 0;
|
||||
|
||||
//! Get the color to be used for the text cursor
|
||||
virtual AZ::Color GetTextCursorColor() = 0;
|
||||
|
||||
//! Set the color to be used for the text cursor
|
||||
virtual void SetTextCursorColor(const AZ::Color& color) = 0;
|
||||
|
||||
//! Get the cursor blink interval
|
||||
virtual float GetCursorBlinkInterval() = 0;
|
||||
|
||||
//! Set the cursor blink interval, 0 means no blink
|
||||
virtual void SetCursorBlinkInterval(float interval) = 0;
|
||||
|
||||
//! Get the maximum number of character allowed in the edited string
|
||||
virtual int GetMaxStringLength() = 0;
|
||||
|
||||
//! Set the maximum number of character allowed in the edited string
|
||||
//! \param maxCharacters, a value of 0 means none allowed, -1 means no limit
|
||||
virtual void SetMaxStringLength(int maxCharacters) = 0;
|
||||
|
||||
//! Get the on-change callback (called when a character added/removed/changed)
|
||||
virtual TextInputCallback GetOnChangeCallback() = 0;
|
||||
|
||||
//! Set the on-change callback (called when a character added/removed/changed)
|
||||
virtual void SetOnChangeCallback(TextInputCallback callbackFunction) = 0;
|
||||
|
||||
//! Get the on-end-edit callback (called when edit of text is completed)
|
||||
virtual TextInputCallback GetOnEndEditCallback() = 0;
|
||||
|
||||
//! Set the on-end-edit callback (called when edit of text is completed)
|
||||
virtual void SetOnEndEditCallback(TextInputCallback callbackFunction) = 0;
|
||||
|
||||
//! Get the on-enter callback (called when Enter is pressed on keyboard)
|
||||
virtual TextInputCallback GetOnEnterCallback() = 0;
|
||||
|
||||
//! Set the on-enter callback (called when Enter is pressed on keyboard)
|
||||
virtual void SetOnEnterCallback(TextInputCallback callbackFunction) = 0;
|
||||
|
||||
//! Get the "change" action name, the action is sent to canvas listeners when text is changed
|
||||
virtual const LyShine::ActionName& GetChangeAction() = 0;
|
||||
|
||||
//! Set the "change" action name
|
||||
virtual void SetChangeAction(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the "end edit" action name, the action is sent to canvas listeners when the
|
||||
//! editing of the text is finished - i.e. when the text input component is no longer active
|
||||
virtual const LyShine::ActionName& GetEndEditAction() = 0;
|
||||
|
||||
//! Set the "end edit" action name
|
||||
virtual void SetEndEditAction(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the "enter" action name, the action is sent to canvas listeners when enter is pressed
|
||||
virtual const LyShine::ActionName& GetEnterAction() = 0;
|
||||
|
||||
//! Set the "enter" action name
|
||||
virtual void SetEnterAction(const LyShine::ActionName& actionName) = 0;
|
||||
|
||||
//! Get the entity id for the text element being edited by this component
|
||||
virtual AZ::EntityId GetTextEntity() = 0;
|
||||
|
||||
//! Set the entity id for the text element being edited by this component
|
||||
//! This must be a child of this entity
|
||||
virtual void SetTextEntity(AZ::EntityId textEntity) = 0;
|
||||
|
||||
//! Get the text string being edited by this component (from the text element)
|
||||
virtual AZStd::string GetText() = 0;
|
||||
|
||||
virtual void SetText(const AZStd::string& text) = 0;
|
||||
|
||||
//! Get the entity id for the placeholder text element for this component
|
||||
virtual AZ::EntityId GetPlaceHolderTextEntity() = 0;
|
||||
|
||||
//! Set the entity id for the placeholder text element for this component
|
||||
//! This must be a child of this entity
|
||||
virtual void SetPlaceHolderTextEntity(AZ::EntityId textEntity) = 0;
|
||||
|
||||
//! True if this text input is configured as a password field, false otherwise
|
||||
//!
|
||||
//! Password fields will render the displayed text with all of the characters
|
||||
//! of the input string replaced with a character.
|
||||
virtual bool GetIsPasswordField() = 0;
|
||||
|
||||
//! Allows this text input to be configured as a password field.
|
||||
virtual void SetIsPasswordField(bool passwordField) = 0;
|
||||
|
||||
//! Returns the UTF8 character to be used to display password fields
|
||||
//
|
||||
//! Note that having a replacement character configured doesn't determine
|
||||
//! whether this input is configured as a password field (see GetIsPasswordField).
|
||||
virtual uint32_t GetReplacementCharacter() = 0;
|
||||
|
||||
//! Sets the UTF8 character that should be used for displaying text in password fields.
|
||||
//
|
||||
//! Note that setting a replacement character doesn't determine whether this
|
||||
//! text input will be used as a password field (see GetIsPasswordField).
|
||||
virtual void SetReplacementCharacter(uint32_t replacementChar) = 0;
|
||||
|
||||
//! True if copy/cut/paste should be supported, false otherwise
|
||||
virtual bool GetIsClipboardEnabled() = 0;
|
||||
|
||||
//! Allows copy/cut/paste support for this text input
|
||||
virtual void SetIsClipboardEnabled(bool enableClipboard) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTextInputInterface> UiTextInputBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiTextInputNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTextInputNotifications() {}
|
||||
|
||||
//! Called when a character added/removed/change
|
||||
virtual void OnTextInputChange([[maybe_unused]] const AZStd::string& textString) {}
|
||||
|
||||
//! Called when edit of text is completed
|
||||
virtual void OnTextInputEndEdit([[maybe_unused]] const AZStd::string& textString) {}
|
||||
|
||||
//! Called when Enter is pressed on keyboard
|
||||
virtual void OnTextInputEnter([[maybe_unused]] const AZStd::string& textString) {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTextInputNotifications> UiTextInputNotificationBus;
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a tooltip component needs to implement. A tooltip component provides
|
||||
//! data that is assigned to a tooltip display element
|
||||
class UiTooltipInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTooltipInterface() {}
|
||||
|
||||
//! Get the tooltip text
|
||||
virtual AZStd::string GetText() = 0;
|
||||
|
||||
//! Set the tooltip text
|
||||
virtual void SetText(const AZStd::string& text) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTooltipInterface> UiTooltipBus;
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a tooltip component needs to implement. A tooltip component populates
|
||||
//! a tooltip display element with data
|
||||
class UiTooltipDataPopulatorInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTooltipDataPopulatorInterface() {}
|
||||
|
||||
//! Assign data to the specified tooltip display element
|
||||
virtual void PushDataToDisplayElement(AZ::EntityId displayEntityId) = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTooltipDataPopulatorInterface> UiTooltipDataPopulatorBus;
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that a tooltip display component needs to implement. A tooltip display
|
||||
//! component is responsible for displaying an element as a tooltip given sizing and positioning
|
||||
//! properties
|
||||
class UiTooltipDisplayInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
enum class AutoPositionMode
|
||||
{
|
||||
OffsetFromMouse,
|
||||
OffsetFromElement
|
||||
};
|
||||
|
||||
enum class TriggerMode
|
||||
{
|
||||
OnHover,
|
||||
OnPress,
|
||||
OnClick
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTooltipDisplayInterface() {}
|
||||
|
||||
//! Get the way the tooltip is triggered to display
|
||||
virtual TriggerMode GetTriggerMode() = 0;
|
||||
|
||||
//! Set the way the tooltip is triggered to display
|
||||
virtual void SetTriggerMode(TriggerMode triggerMode) = 0;
|
||||
|
||||
//! Get whether the tooltip display element will be auto positioned
|
||||
virtual bool GetAutoPosition() = 0;
|
||||
|
||||
//! Set whether the tooltip display element will be auto positioned
|
||||
virtual void SetAutoPosition(bool autoPosition) = 0;
|
||||
|
||||
//! Get auto position mode
|
||||
virtual AutoPositionMode GetAutoPositionMode() = 0;
|
||||
|
||||
//! Set auto position mode
|
||||
virtual void SetAutoPositionMode(AutoPositionMode autoPositionMode) = 0;
|
||||
|
||||
//! Get the offset from the tooltip display element's pivot to the mouse position
|
||||
virtual const AZ::Vector2& GetOffset() = 0;
|
||||
|
||||
//! Set the offset from the tooltip display element's pivot to the mouse position
|
||||
virtual void SetOffset(const AZ::Vector2& offset) = 0;
|
||||
|
||||
//! Get whether the tooltip display element should be resized so that the text element
|
||||
//! size matches the size of the string
|
||||
virtual bool GetAutoSize() = 0;
|
||||
|
||||
//! Set whether the tooltip display element should be resized so that the text element
|
||||
//! size matches the size of the string
|
||||
virtual void SetAutoSize(bool autoSize) = 0;
|
||||
|
||||
//! Get the entity id of the text element that is used for resizing
|
||||
virtual AZ::EntityId GetTextEntity() = 0;
|
||||
|
||||
//! Set the entity id of the text element that is used for resizing
|
||||
//! This must be a child of this entity
|
||||
virtual void SetTextEntity(AZ::EntityId textEntity) = 0;
|
||||
|
||||
//! Get the amount of time to wait before showing the tooltip display element after hover start
|
||||
virtual float GetDelayTime() = 0;
|
||||
|
||||
//! Set the amount of time to wait before showing the tooltip display element after hover start
|
||||
virtual void SetDelayTime(float delayTime) = 0;
|
||||
|
||||
//! Get the amount of time the tooltip display element is to remain visible
|
||||
virtual float GetDisplayTime() = 0;
|
||||
|
||||
//! Set the amount of time the tooltip display element is to remain visible
|
||||
virtual void SetDisplayTime(float displayTime) = 0;
|
||||
|
||||
//! Show the tooltip display element
|
||||
virtual void PrepareToShow(AZ::EntityId tooltipElement) = 0;
|
||||
|
||||
//! Hide the tooltip display element
|
||||
virtual void Hide() = 0;
|
||||
|
||||
//! Update the tooltip display element
|
||||
virtual void Update() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTooltipDisplayInterface> UiTooltipDisplayBus;
|
||||
|
||||
//! Interface class that listeners need to implement to be notified of tooltip display events
|
||||
class UiTooltipDisplayNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTooltipDisplayNotifications() {}
|
||||
|
||||
//! Called on tooltip display state changes
|
||||
virtual void OnShowing() {};
|
||||
virtual void OnShown() {};
|
||||
virtual void OnHiding() {};
|
||||
virtual void OnHidden() {};
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTooltipDisplayNotifications> UiTooltipDisplayNotificationBus;
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/Bus/UiTransformBus.h>
|
||||
#include <CryCommon/Cry_Color.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiTransform2dInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
// Anchors members are always in range 0-1, they are normalized positions within the parent elements bounds
|
||||
struct Anchors
|
||||
{
|
||||
AZ_TYPE_INFO(Anchors, "{65D4346C-FB16-4CB0-9BDC-1185B122C4A9}")
|
||||
|
||||
Anchors()
|
||||
: m_left(0.5f)
|
||||
, m_top(0.5f)
|
||||
, m_right(0.5f)
|
||||
, m_bottom(0.5f) {}
|
||||
|
||||
Anchors(float left, float top, float right, float bottom)
|
||||
: m_left(left)
|
||||
, m_top(top)
|
||||
, m_right(right)
|
||||
, m_bottom(bottom) {}
|
||||
|
||||
float m_left;
|
||||
float m_top;
|
||||
float m_right;
|
||||
float m_bottom;
|
||||
|
||||
void UnitClamp()
|
||||
{
|
||||
m_left = AZStd::clamp(m_left, 0.0f, 1.0f);
|
||||
m_top = AZStd::clamp(m_top, 0.0f, 1.0f);
|
||||
m_right = AZStd::clamp(m_right, 0.0f, 1.0f);
|
||||
m_bottom = AZStd::clamp(m_bottom, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
bool operator==(const Anchors& rhs) const
|
||||
{
|
||||
return (m_left == rhs.m_left &&
|
||||
m_right == rhs.m_right &&
|
||||
m_top == rhs.m_top &&
|
||||
m_bottom == rhs.m_bottom);
|
||||
}
|
||||
|
||||
bool operator!=(const Anchors& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
// Offsets are in pixels or physical units and are offsets from the anchors
|
||||
// The left offset is the offset from the left anchor to the left edge of this UiElement
|
||||
struct Offsets
|
||||
{
|
||||
AZ_TYPE_INFO(Offsets, "{F681BA9D-245C-4630-B20E-05DD752FAD57}")
|
||||
|
||||
Offsets()
|
||||
: m_left(-50)
|
||||
, m_top(-50)
|
||||
, m_right(50)
|
||||
, m_bottom(50) {}
|
||||
|
||||
Offsets(float left, float top, float right, float bottom)
|
||||
: m_left(left)
|
||||
, m_top(top)
|
||||
, m_right(right)
|
||||
, m_bottom(bottom) {}
|
||||
|
||||
float m_left;
|
||||
float m_top;
|
||||
float m_right;
|
||||
float m_bottom;
|
||||
|
||||
Offsets& operator+=(const UiTransformInterface::RectPoints& rhs)
|
||||
{
|
||||
m_left += rhs.TopLeft().GetX();
|
||||
m_right += rhs.BottomRight().GetX();
|
||||
m_top += rhs.TopLeft().GetY();
|
||||
m_bottom += rhs.BottomRight().GetY();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Offsets operator+(const UiTransformInterface::RectPoints& rhs) const
|
||||
{
|
||||
Offsets result(*this);
|
||||
|
||||
result.m_left += rhs.TopLeft().GetX();
|
||||
result.m_right += rhs.BottomRight().GetX();
|
||||
result.m_top += rhs.TopLeft().GetY();
|
||||
result.m_bottom += rhs.BottomRight().GetY();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Offsets& operator+=(const AZ::Vector2& rhs)
|
||||
{
|
||||
m_left += rhs.GetX();
|
||||
m_right += rhs.GetX();
|
||||
m_top += rhs.GetY();
|
||||
m_bottom += rhs.GetY();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Offsets operator+(const AZ::Vector2& rhs) const
|
||||
{
|
||||
Offsets result(*this);
|
||||
|
||||
result.m_left += rhs.GetX();
|
||||
result.m_right += rhs.GetX();
|
||||
result.m_top += rhs.GetY();
|
||||
result.m_bottom += rhs.GetY();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool operator==(const Offsets& rhs) const
|
||||
{
|
||||
return (m_left == rhs.m_left &&
|
||||
m_right == rhs.m_right &&
|
||||
m_top == rhs.m_top &&
|
||||
m_bottom == rhs.m_bottom);
|
||||
}
|
||||
|
||||
bool operator!=(const Offsets& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTransform2dInterface() {}
|
||||
|
||||
//! Get the anchors for the element
|
||||
virtual Anchors GetAnchors() = 0;
|
||||
|
||||
//! Set the anchors for the element
|
||||
//! \param adjustOffsets If true the offsets are adjusted to keep the rect in the same position
|
||||
//! \param allowPush Only has effect if the anchors are invalid. If true changing an anchor
|
||||
// to overlap its opposite anchor, will move the opposite anchor
|
||||
virtual void SetAnchors(Anchors anchors, bool adjustOffsets, bool allowPush) = 0;
|
||||
|
||||
//! Get the offsets for the element
|
||||
virtual Offsets GetOffsets() = 0;
|
||||
|
||||
//! Set the offsets for the element
|
||||
virtual void SetOffsets(Offsets offsets) = 0;
|
||||
|
||||
//! Set the pivot and adjust the offsets to stay in same place
|
||||
virtual void SetPivotAndAdjustOffsets(AZ::Vector2 pivot) = 0;
|
||||
|
||||
//! Modify left and right offsets relative the element's anchors
|
||||
virtual void SetLocalWidth(float width) = 0;
|
||||
|
||||
//! Get the height of the element based off it's offsets
|
||||
virtual float GetLocalWidth() = 0;
|
||||
|
||||
//! Modify top and bottom offsets relative the element's anchors
|
||||
virtual void SetLocalHeight(float height) = 0;
|
||||
|
||||
//! Get the height of the element based off it's offsets
|
||||
virtual float GetLocalHeight() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTransform2dInterface> UiTransform2dBus;
|
||||
@@ -1,550 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Matrix4x4.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The UiTransformInterface provides an abstract bus interface for UI components that define the
|
||||
// position and size of a UI element.
|
||||
class UiTransformInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Struct that stores the 4 points of a (transformed) rectangle and provides access either as an array or via access functions
|
||||
struct RectPoints
|
||||
{
|
||||
enum Corner // can be used as an index into RectPoints pt array but access via member functions preferred
|
||||
{
|
||||
Corner_TopLeft,
|
||||
Corner_TopRight,
|
||||
Corner_BottomRight,
|
||||
Corner_BottomLeft,
|
||||
|
||||
Corner_Count
|
||||
};
|
||||
|
||||
AZ::Vector2 pt[Corner_Count]; // in clockwise order: top left, top right, bottom right, bottom left
|
||||
|
||||
RectPoints();
|
||||
RectPoints(float left, float right, float top, float bottom);
|
||||
|
||||
AZ::Vector2& TopLeft();
|
||||
const AZ::Vector2& TopLeft() const;
|
||||
|
||||
AZ::Vector2& TopRight();
|
||||
const AZ::Vector2& TopRight() const;
|
||||
|
||||
AZ::Vector2& BottomRight();
|
||||
const AZ::Vector2& BottomRight() const;
|
||||
|
||||
AZ::Vector2& BottomLeft();
|
||||
const AZ::Vector2& BottomLeft() const;
|
||||
|
||||
AZ::Vector2 GetCenter() const;
|
||||
|
||||
AZ::Vector2 GetAxisAlignedSize() const;
|
||||
AZ::Vector2 GetAxisAlignedTopLeft() const;
|
||||
AZ::Vector2 GetAxisAlignedTopRight() const;
|
||||
AZ::Vector2 GetAxisAlignedBottomRight() const;
|
||||
AZ::Vector2 GetAxisAlignedBottomLeft() const;
|
||||
void SetAxisAligned(float left, float right, float top, float bottom);
|
||||
|
||||
RectPoints Transform(AZ::Matrix4x4& transform) const;
|
||||
RectPoints operator-(const RectPoints& rhs) const;
|
||||
};
|
||||
|
||||
using RectPointsArray = AZStd::vector < UiTransformInterface::RectPoints >;
|
||||
|
||||
//! Struct that stores the bounds of an axis-aligned rectangle
|
||||
struct Rect
|
||||
{
|
||||
float left;
|
||||
float right;
|
||||
float top;
|
||||
float bottom;
|
||||
|
||||
void Set(float l, float r, float t, float b);
|
||||
|
||||
float GetWidth() const;
|
||||
float GetHeight() const;
|
||||
|
||||
float GetCenterX();
|
||||
float GetCenterY();
|
||||
|
||||
AZ::Vector2 GetSize() const;
|
||||
AZ::Vector2 GetCenter();
|
||||
|
||||
void MoveBy(AZ::Vector2 offset);
|
||||
|
||||
RectPoints GetPoints();
|
||||
|
||||
bool operator==(const Rect& rhs) const;
|
||||
|
||||
bool operator!=(const Rect& rhs) const;
|
||||
};
|
||||
|
||||
//! Enum used as a parameter to SetRecomputeFlags
|
||||
enum class Recompute
|
||||
{
|
||||
RectOnly, //!< Only the rect (offsets or anchors for example) changed (this may affect transform if local scale or rotation)
|
||||
TransformOnly, //!< Only the transform changed (canvas and viewport transforms must be recomputed)
|
||||
ViewportTransformOnly, //!< Only the viewport transform changed (viewport transform must be recomputed)
|
||||
RectAndTransform //!< Both rect and transform changed (all cached data must be recomputed)
|
||||
};
|
||||
|
||||
//! Enum used as a parameter to SetScaleToDeviceMode
|
||||
//! The value determines how an element is scaled when the canvas reference size and actual size are different
|
||||
//! The comments below reference the canvas's "deviceScale". The deviceScale is target (actual) canvas size divided the reference canvas size
|
||||
enum class ScaleToDeviceMode
|
||||
{
|
||||
None, //!< Default, this element is not affected by device resolution changes
|
||||
UniformScaleToFit, //!< Apply a uniform scale which is the minimum of deviceScale.x and deviceScale.y
|
||||
UniformScaleToFill, //!< Apply a uniform scale which is the maximum of deviceScale.x and deviceScale.y
|
||||
UniformScaleToFitX, //!< Apply a uniform scale of deviceScale.x
|
||||
UniformScaleToFitY, //!< Apply a uniform scale of deviceScale.y
|
||||
NonUniformScale, //!< Apply a non-uniform scale which is simply deviceScale
|
||||
ScaleXOnly, //!< Scale the element only in the X dimension by deviceScale.x
|
||||
ScaleYOnly //!< Scale the element only in the Y dimension by deviceScale.y
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTransformInterface() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Methods to get and set the properties of the transform component
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Get the rotation about the Z axis
|
||||
virtual float GetZRotation() = 0;
|
||||
|
||||
//! Set the rotation about the Z axis
|
||||
virtual void SetZRotation(float rotation) = 0;
|
||||
|
||||
//! Get the scale
|
||||
virtual AZ::Vector2 GetScale() = 0;
|
||||
|
||||
//! Set the scale
|
||||
virtual void SetScale(AZ::Vector2 scale) = 0;
|
||||
|
||||
//! Get the scale X
|
||||
virtual float GetScaleX() = 0;
|
||||
|
||||
//! Set the scale X
|
||||
virtual void SetScaleX(float scale) = 0;
|
||||
|
||||
//! Get the scale Y
|
||||
virtual float GetScaleY() = 0;
|
||||
|
||||
//! Set the scale Y
|
||||
virtual void SetScaleY(float scale) = 0;
|
||||
|
||||
//! Get the pivot point for the element
|
||||
virtual AZ::Vector2 GetPivot() = 0;
|
||||
|
||||
//! Set the pivot point for the element
|
||||
virtual void SetPivot(AZ::Vector2 pivot) = 0;
|
||||
|
||||
//! Get the pivot point for the element
|
||||
virtual float GetPivotX() = 0;
|
||||
|
||||
//! Set the pivot point for the element
|
||||
virtual void SetPivotX(float pivot) = 0;
|
||||
|
||||
//! Get the pivot point for the element
|
||||
virtual float GetPivotY() = 0;
|
||||
|
||||
//! Set the pivot point for the element
|
||||
virtual void SetPivotY(float pivot) = 0;
|
||||
|
||||
//! Get how the element and all its children will be scaled to allow for the difference
|
||||
//! between the authored canvas size and the actual viewport size.
|
||||
virtual ScaleToDeviceMode GetScaleToDeviceMode() = 0;
|
||||
|
||||
//! Set how the element and all its children will be scaled to allow for the difference
|
||||
//! between the authored canvas size and the actual viewport size.
|
||||
virtual void SetScaleToDeviceMode(ScaleToDeviceMode scaleToDeviceMode) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Methods to get data in viewport space
|
||||
//
|
||||
// Viewport space is a 1-1 mapping to whatever viewport the UI canvas is being rendered to.
|
||||
// A position in viewport space is an offset in pixels from the top left of the viewport.
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Get the four points defining the rectangle of this element, in viewport space pixel coords
|
||||
virtual void GetViewportSpacePoints(RectPoints& points) = 0;
|
||||
|
||||
//! Get the pivot for this element in viewport space
|
||||
virtual AZ::Vector2 GetViewportSpacePivot() = 0;
|
||||
|
||||
//! Get the transform matrix to transform from canvas (noScaleRotate) space to viewport space
|
||||
virtual void GetTransformToViewport(AZ::Matrix4x4& mat) = 0;
|
||||
|
||||
//! Get the transform matrix to transform from viewport space to canvas (noScaleRotate) space
|
||||
virtual void GetTransformFromViewport(AZ::Matrix4x4& mat) = 0;
|
||||
|
||||
//! Apply the "to viewport" transform to the given points
|
||||
virtual void RotateAndScalePoints(RectPoints& points) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Methods to get data in canvas space
|
||||
//
|
||||
// Often canvas space and viewport space are the same thing. For example if a canvas is being
|
||||
// displayed full screen.
|
||||
// However, in other cases they are different. For example in the UI editor when Zoom and Pan allow
|
||||
// the canvas to be moved around in the viewport. In that case an offset of 1 does not mean 1 pixel
|
||||
// in the viewport. Canvas space is defined by the canvas size stored in the canvas.
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Get the four points defining the rectangle of this element, in canvas space coords
|
||||
virtual void GetCanvasSpacePoints(RectPoints& points) = 0;
|
||||
|
||||
//! Get the pivot for this element in canvas space
|
||||
virtual AZ::Vector2 GetCanvasSpacePivot() = 0;
|
||||
|
||||
//! Get the transform matrix to transform from canvasNoScaleRotate space to canvas space
|
||||
virtual void GetTransformToCanvasSpace(AZ::Matrix4x4& mat) = 0;
|
||||
|
||||
//! Get the transform matrix to transform from canvas space to canvasNoScaleRotate space
|
||||
virtual void GetTransformFromCanvasSpace(AZ::Matrix4x4& mat) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Methods to get data in unrotated and unscaled canvas space (CanvasNoScaleRotate space)
|
||||
//
|
||||
// CanvasNoScaleRotate space is like canvas space but without any of the rotation or scaling in
|
||||
// any of the elments applied. So if none of the elements in the canvas have scale or rotation
|
||||
// the two are the same.
|
||||
//
|
||||
// CanvasNoScaleRotate space is like local space for an element but it does include all of the
|
||||
// parent's anchor and offset calculations so it is not really local space.
|
||||
//
|
||||
// This is a useful space to do calculations in because all elements are axis aligned and their
|
||||
// rectangle can be represented by a Rect struct rather requiring a RectPoints struct.
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Get the axis-aligned rect for the element without accounting for rotation or scale
|
||||
virtual void GetCanvasSpaceRectNoScaleRotate(Rect& rect) = 0;
|
||||
|
||||
//! Get the rect points for the element without accounting for rotation or scale
|
||||
virtual void GetCanvasSpacePointsNoScaleRotate(RectPoints& points) = 0;
|
||||
|
||||
//! Get the size for the element without accounting for rotation or scale
|
||||
virtual AZ::Vector2 GetCanvasSpaceSizeNoScaleRotate() = 0;
|
||||
|
||||
//! Get the pivot for the element without accounting for rotation or scale
|
||||
virtual AZ::Vector2 GetCanvasSpacePivotNoScaleRotate() = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Methods to get data in/about local space
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Get the transform matrix to apply this element's rotation and scale about pivot
|
||||
virtual void GetLocalTransform(AZ::Matrix4x4& mat) = 0;
|
||||
|
||||
//! Get the transform matrix to apply the inverse of this element's rotation and scale about pivot
|
||||
virtual void GetLocalInverseTransform(AZ::Matrix4x4& mat) = 0;
|
||||
|
||||
//! Test whether this transform component has any scale or rotation
|
||||
virtual bool HasScaleOrRotation() = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Methods to get/set the element's position
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Get the position for this element in viewport space (same as GetViewportSpacePivot)
|
||||
virtual AZ::Vector2 GetViewportPosition() = 0;
|
||||
|
||||
//! Set the position for this element in viewport space
|
||||
virtual void SetViewportPosition(const AZ::Vector2& position) = 0;
|
||||
|
||||
//! Get the position for this element in canvas space (same as GetCanvasSpacePivot)
|
||||
virtual AZ::Vector2 GetCanvasPosition() = 0;
|
||||
|
||||
//! Set the position for this element in canvas space
|
||||
virtual void SetCanvasPosition(const AZ::Vector2& position) = 0;
|
||||
|
||||
//! Get the position for this element relative to the center of the element's anchors
|
||||
virtual AZ::Vector2 GetLocalPosition() = 0;
|
||||
|
||||
//! Set the position for this element relative to the center of the element's anchors
|
||||
virtual void SetLocalPosition(const AZ::Vector2& position) = 0;
|
||||
|
||||
//! Get the X position for this element relative to the center of the element's anchors
|
||||
virtual float GetLocalPositionX() = 0;
|
||||
|
||||
//! Set the X position for this element relative to the center of the element's anchors
|
||||
virtual void SetLocalPositionX(float position) = 0;
|
||||
|
||||
//! Get the Y position for this element relative to the center of the element's anchors
|
||||
virtual float GetLocalPositionY() = 0;
|
||||
|
||||
//! Set the Y position for this element relative to the center of the element's anchors
|
||||
virtual void SetLocalPositionY(float position) = 0;
|
||||
|
||||
//! Move this element in viewport space
|
||||
virtual void MoveViewportPositionBy(const AZ::Vector2& offset) = 0;
|
||||
|
||||
//! Move this element in canvas space
|
||||
virtual void MoveCanvasPositionBy(const AZ::Vector2& offset) = 0;
|
||||
|
||||
//! Move this element relative to the center of the element's anchors
|
||||
virtual void MoveLocalPositionBy(const AZ::Vector2& offset) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Query functions
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Test if the given point (in viewport space) is in the rectangle of this element
|
||||
virtual bool IsPointInRect(AZ::Vector2 point) = 0;
|
||||
|
||||
//! Test if the given rect (in viewport space) is in the rectangle of this element
|
||||
virtual bool BoundsAreOverlappingRect(const AZ::Vector2& bound0, const AZ::Vector2& bound1) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Optimization and caching
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Set the required dirty flags for the cached transforms and rect on this element and all its children
|
||||
virtual void SetRecomputeFlags(Recompute recompute) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Canvas space rect change
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Get whether the canvas space rect has changed since the last call to NotifyAndResetCanvasSpaceRectChange.
|
||||
//! May trigger a recompute of the rect if the recompute flag is dirty
|
||||
virtual bool HasCanvasSpaceRectChanged() = 0;
|
||||
|
||||
//! Get whether the canvas space size has changed since the last call to NotifyAndResetCanvasSpaceRectChange.
|
||||
//! May trigger a recompute of the rect if the recompute flag is dirty
|
||||
virtual bool HasCanvasSpaceSizeChanged() = 0;
|
||||
|
||||
//! Get whether the canvas space rect was changed due to initialization
|
||||
virtual bool HasCanvasSpaceRectChangedByInitialization() = 0;
|
||||
|
||||
//! Send notification of canvas space rect change and reset to unchanged
|
||||
virtual void NotifyAndResetCanvasSpaceRectChange() = 0;
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTransformInterface> UiTransformBus;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Interface class that listeners need to implement
|
||||
class UiTransformChangeNotification
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiTransformChangeNotification(){}
|
||||
|
||||
//! Called when an entity's transform (canvas space) has been modified
|
||||
virtual void OnCanvasSpaceRectChanged(AZ::EntityId entityId, const UiTransformInterface::Rect& oldRect, const UiTransformInterface::Rect& newRect) = 0;
|
||||
|
||||
//! Called when an entity's transform (viewport space) has been modified
|
||||
virtual void OnTransformToViewportChanged() {}
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiTransformChangeNotification> UiTransformChangeNotificationBus;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// RectPoints inline methods
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline UiTransformInterface::RectPoints::RectPoints()
|
||||
{
|
||||
}
|
||||
|
||||
inline UiTransformInterface::RectPoints::RectPoints(float left, float right, float top, float bottom)
|
||||
{
|
||||
SetAxisAligned(left, right, top, bottom);
|
||||
}
|
||||
|
||||
inline AZ::Vector2& UiTransformInterface::RectPoints::TopLeft()
|
||||
{
|
||||
return pt[Corner_TopLeft];
|
||||
}
|
||||
|
||||
inline const AZ::Vector2& UiTransformInterface::RectPoints::TopLeft() const
|
||||
{
|
||||
return pt[Corner_TopLeft];
|
||||
}
|
||||
|
||||
inline AZ::Vector2& UiTransformInterface::RectPoints::TopRight()
|
||||
{
|
||||
return pt[Corner_TopRight];
|
||||
}
|
||||
|
||||
inline const AZ::Vector2& UiTransformInterface::RectPoints::TopRight() const
|
||||
{
|
||||
return pt[Corner_TopRight];
|
||||
}
|
||||
|
||||
inline AZ::Vector2& UiTransformInterface::RectPoints::BottomRight()
|
||||
{
|
||||
return pt[Corner_BottomRight];
|
||||
}
|
||||
|
||||
inline const AZ::Vector2& UiTransformInterface::RectPoints::BottomRight() const
|
||||
{
|
||||
return pt[Corner_BottomRight];
|
||||
}
|
||||
|
||||
inline AZ::Vector2& UiTransformInterface::RectPoints::BottomLeft()
|
||||
{
|
||||
return pt[Corner_BottomLeft];
|
||||
}
|
||||
|
||||
inline const AZ::Vector2& UiTransformInterface::RectPoints::BottomLeft() const
|
||||
{
|
||||
return pt[Corner_BottomLeft];
|
||||
}
|
||||
|
||||
inline AZ::Vector2 UiTransformInterface::RectPoints::GetCenter() const
|
||||
{
|
||||
return ((GetAxisAlignedTopLeft() + GetAxisAlignedBottomRight()) * 0.5f);
|
||||
}
|
||||
|
||||
inline AZ::Vector2 UiTransformInterface::RectPoints::GetAxisAlignedSize() const
|
||||
{
|
||||
return AZ::Vector2(BottomRight().GetX() - TopLeft().GetX(), BottomRight().GetY() - TopLeft().GetY());
|
||||
}
|
||||
|
||||
inline AZ::Vector2 UiTransformInterface::RectPoints::GetAxisAlignedTopLeft() const
|
||||
{
|
||||
return AZ::Vector2(AZStd::min(AZStd::min(AZStd::min(TopLeft().GetX(), TopRight().GetX()), BottomRight().GetX()), BottomLeft().GetX()),
|
||||
AZStd::min(AZStd::min(AZStd::min(TopLeft().GetY(), TopRight().GetY()), BottomRight().GetY()), BottomLeft().GetY()));
|
||||
}
|
||||
|
||||
inline AZ::Vector2 UiTransformInterface::RectPoints::GetAxisAlignedTopRight() const
|
||||
{
|
||||
return AZ::Vector2(AZStd::max(AZStd::max(AZStd::max(TopLeft().GetX(), TopRight().GetX()), BottomRight().GetX()), BottomLeft().GetX()),
|
||||
AZStd::min(AZStd::min(AZStd::min(TopLeft().GetY(), TopRight().GetY()), BottomRight().GetY()), BottomLeft().GetY()));
|
||||
}
|
||||
|
||||
inline AZ::Vector2 UiTransformInterface::RectPoints::GetAxisAlignedBottomRight() const
|
||||
{
|
||||
return AZ::Vector2(AZStd::max(AZStd::max(AZStd::max(TopLeft().GetX(), TopRight().GetX()), BottomRight().GetX()), BottomLeft().GetX()),
|
||||
AZStd::max(AZStd::max(AZStd::max(TopLeft().GetY(), TopRight().GetY()), BottomRight().GetY()), BottomLeft().GetY()));
|
||||
}
|
||||
|
||||
inline AZ::Vector2 UiTransformInterface::RectPoints::GetAxisAlignedBottomLeft() const
|
||||
{
|
||||
return AZ::Vector2(AZStd::min(AZStd::min(AZStd::min(TopLeft().GetX(), TopRight().GetX()), BottomRight().GetX()), BottomLeft().GetX()),
|
||||
AZStd::max(AZStd::max(AZStd::max(TopLeft().GetY(), TopRight().GetY()), BottomRight().GetY()), BottomLeft().GetY()));
|
||||
}
|
||||
|
||||
inline void UiTransformInterface::RectPoints::SetAxisAligned(float left, float right, float top, float bottom)
|
||||
{
|
||||
pt[Corner_TopLeft] = AZ::Vector2(left, top);
|
||||
pt[Corner_TopRight] = AZ::Vector2(right, top);
|
||||
pt[Corner_BottomRight] = AZ::Vector2(right, bottom);
|
||||
pt[Corner_BottomLeft] = AZ::Vector2(left, bottom);
|
||||
}
|
||||
|
||||
inline UiTransformInterface::RectPoints UiTransformInterface::RectPoints::Transform(AZ::Matrix4x4& transform) const
|
||||
{
|
||||
RectPoints result;
|
||||
for (int i = 0; i < Corner_Count; ++i)
|
||||
{
|
||||
AZ::Vector3 point3(pt[i].GetX(), pt[i].GetY(), 0.0f);
|
||||
point3 = transform * point3;
|
||||
result.pt[i] = AZ::Vector2(point3.GetX(), point3.GetY());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
inline UiTransformInterface::RectPoints UiTransformInterface::RectPoints::operator-(const RectPoints& rhs) const
|
||||
{
|
||||
RectPoints result(*this);
|
||||
for (int i = 0; i < Corner_Count; ++i)
|
||||
{
|
||||
result.pt[i] -= rhs.pt[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Rect inline methods
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline void UiTransformInterface::Rect::Set(float l, float r, float t, float b)
|
||||
{
|
||||
left = l;
|
||||
right = r;
|
||||
top = t;
|
||||
bottom = b;
|
||||
}
|
||||
|
||||
inline float UiTransformInterface::Rect::GetWidth() const
|
||||
{
|
||||
return right - left;
|
||||
}
|
||||
|
||||
inline float UiTransformInterface::Rect::GetHeight() const
|
||||
{
|
||||
return bottom - top;
|
||||
}
|
||||
|
||||
inline float UiTransformInterface::Rect::GetCenterX()
|
||||
{
|
||||
return (left + right) * 0.5f;
|
||||
}
|
||||
|
||||
inline float UiTransformInterface::Rect::GetCenterY()
|
||||
{
|
||||
return (top + bottom) * 0.5f;
|
||||
}
|
||||
|
||||
inline AZ::Vector2 UiTransformInterface::Rect::GetSize() const
|
||||
{
|
||||
return AZ::Vector2(GetWidth(), GetHeight());
|
||||
}
|
||||
|
||||
inline AZ::Vector2 UiTransformInterface::Rect::GetCenter()
|
||||
{
|
||||
return AZ::Vector2(GetCenterX(), GetCenterY());
|
||||
}
|
||||
|
||||
inline void UiTransformInterface::Rect::MoveBy(AZ::Vector2 offset)
|
||||
{
|
||||
left += offset.GetX();
|
||||
right += offset.GetX();
|
||||
top += offset.GetY();
|
||||
bottom += offset.GetY();
|
||||
}
|
||||
|
||||
inline UiTransformInterface::RectPoints UiTransformInterface::Rect::GetPoints()
|
||||
{
|
||||
return UiTransformInterface::RectPoints(left, right, top, bottom);
|
||||
}
|
||||
|
||||
inline bool UiTransformInterface::Rect::operator==(const Rect& rhs) const
|
||||
{
|
||||
return left == rhs.left
|
||||
&& right == rhs.right
|
||||
&& top == rhs.top
|
||||
&& bottom == rhs.bottom;
|
||||
}
|
||||
|
||||
inline bool UiTransformInterface::Rect::operator!=(const Rect& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <LyShine/Bus/UiImageBus.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <IFont.h>
|
||||
|
||||
// Forward declarations
|
||||
class ISprite;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class UiVisualInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
virtual ~UiVisualInterface() {}
|
||||
|
||||
//! Reset the overrides, used when setting interactable states
|
||||
virtual void ResetOverrides() = 0;
|
||||
|
||||
//! Set the override color, used for interactable states
|
||||
virtual void SetOverrideColor(const AZ::Color& color) = 0;
|
||||
|
||||
//! Set the override alpha, used for interactable states
|
||||
virtual void SetOverrideAlpha(float alpha) = 0;
|
||||
|
||||
//! Set the override sprite, if this visual component uses a sprite this will override it
|
||||
//! \param sprite If null the sprite on the visual component will not be overridden
|
||||
//! \param cellIndex This value will be ignored if the given sprite isn't a sprite-sheet spritetype.
|
||||
virtual void SetOverrideSprite([[maybe_unused]] ISprite* sprite, [[maybe_unused]] AZ::u32 cellIndex) {};
|
||||
|
||||
//! Set the override font, if this visual component uses a font this will override it
|
||||
//! \param font If null the font on the visual component will not be overridden
|
||||
virtual void SetOverrideFont(FontFamilyPtr fontFamily) {};
|
||||
|
||||
//! Set the override font effect, if this visual component uses a font this will override it
|
||||
virtual void SetOverrideFontEffect([[maybe_unused]] unsigned int fontEffectIndex) {};
|
||||
|
||||
public: // static member data
|
||||
|
||||
//! Only one component on a entity can implement the events
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
};
|
||||
|
||||
typedef AZ::EBus<UiVisualInterface> UiVisualBus;
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
#include <AzFramework/Input/Channels/InputChannel.h>
|
||||
#include <Cry_Math.h>
|
||||
|
||||
struct ray_hit;
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
namespace RenderGeometry
|
||||
{
|
||||
struct RayResult;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UiCanvasOnMeshBus
|
||||
class UiCanvasOnMeshInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasOnMeshInterface() {}
|
||||
|
||||
|
||||
//! Convert the input ray collision into a canvas space position and pass the event and that position
|
||||
//! to the UI canvas to handle as a positional input event
|
||||
//! \return true if the event was handled
|
||||
virtual bool ProcessHitInputEvent(const AzFramework::InputChannel::Snapshot& inputSnapshot, const AzFramework::RenderGeometry::RayResult& rayResult) = 0;
|
||||
};
|
||||
|
||||
using UiCanvasOnMeshBus = AZ::EBus<UiCanvasOnMeshInterface>;
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Component/ComponentBus.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! UiCanvasRefBus
|
||||
//! Allows a reference to a UI Canvas entity (which is loaded from a .uicanvas asset file) to
|
||||
//! associated with a component entity in the level.
|
||||
//! This is used for convenience by flow graph nodes and also for supprting rendering UI
|
||||
//! canvases in the 3D world on a component entity.
|
||||
class UiCanvasRefInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasRefInterface() {}
|
||||
|
||||
//! Get the UI canvas associated with this entity
|
||||
virtual AZ::EntityId GetCanvas() = 0;
|
||||
};
|
||||
|
||||
using UiCanvasRefBus = AZ::EBus<UiCanvasRefInterface>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! UiCanvasRefNotificationBus
|
||||
//! Clients can connect to this bus to receive notifications of when the canvas reference
|
||||
//! in a UiCanvasRef changes to a different canvas
|
||||
class UiCanvasRefNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasRefNotifications() {}
|
||||
|
||||
//! Called when the canvas referenced by a canvas ref component changes
|
||||
//! This can happen through a load, unload or set
|
||||
virtual void OnCanvasRefChanged([[maybe_unused]] AZ::EntityId uiCanvasRefEntity, [[maybe_unused]] AZ::EntityId uiCanvasEntity) {}
|
||||
};
|
||||
|
||||
using UiCanvasRefNotificationBus = AZ::EBus<UiCanvasRefNotifications>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! UiCanvasAssetRefBus
|
||||
//! Allows loading and unloading of a UI canvas asset using a pathname stored in a component on
|
||||
//! an entity in the level.
|
||||
class UiCanvasAssetRefInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasAssetRefInterface() {}
|
||||
|
||||
//! Get the canvas pathname. This is the pathname of the canvas that this component
|
||||
//! will load (either on activate or when told to load by the LoadCanvas method)
|
||||
//! The Canvas pathname can be empty and the associated canvas can be set via SetCanvas
|
||||
virtual AZStd::string GetCanvasPathname() = 0;
|
||||
|
||||
//! Set the canvas pathname
|
||||
virtual void SetCanvasPathname(const AZStd::string& pathname) = 0;
|
||||
|
||||
//! Get the flag indicating whether this component will automatically load the canvas
|
||||
virtual bool GetIsAutoLoad() = 0;
|
||||
|
||||
//! Set the flag indicating whether this component will automatically load the canvas
|
||||
virtual void SetIsAutoLoad(bool isAutoLoad) = 0;
|
||||
|
||||
//! Get the flag indicating whether the canvas should be loaded in a disabled state
|
||||
virtual bool GetShouldLoadDisabled() = 0;
|
||||
|
||||
//! Set the flag indicating whether the canvas should be loaded in a disabled state
|
||||
virtual void SetShouldLoadDisabled(bool shouldLoadDisabled) = 0;
|
||||
|
||||
//! Load the UI canvas using the stored asset ref
|
||||
virtual AZ::EntityId LoadCanvas() = 0;
|
||||
|
||||
//! Unload the UI canvas using the stored asset ref (if it is owned by this component)
|
||||
virtual void UnloadCanvas() = 0;
|
||||
};
|
||||
|
||||
using UiCanvasAssetRefBus = AZ::EBus<UiCanvasAssetRefInterface>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! UiCanvasAssetRefNotificationBus
|
||||
//! Clients can connect to this bus to receive notifications of when a canvas is loaded into
|
||||
//! a canvas ref component on an entity
|
||||
class UiCanvasAssetRefNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasAssetRefNotifications() {}
|
||||
|
||||
//! Called when the canvas ref loads a UI canvas
|
||||
virtual void OnCanvasLoadedIntoEntity([[maybe_unused]] AZ::EntityId uiCanvasEntity) {}
|
||||
};
|
||||
|
||||
using UiCanvasAssetRefNotificationBus = AZ::EBus<UiCanvasAssetRefNotifications>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! UiCanvasProxyRefBus
|
||||
//! Allows an entity in a level to share a reference to a UI canvas that was loaded into another
|
||||
//! UiCanvasRef.
|
||||
//! This bus is only needed to allow two entities in the world to use the same instance of a
|
||||
//! UI canvas asset.
|
||||
class UiCanvasProxyRefInterface
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~UiCanvasProxyRefInterface() {}
|
||||
|
||||
//! Set the entity that is managing the UI canvas for this proxy
|
||||
//! This will cause the OnCanvasRefChanged event to be sent to any UiCanvasRefNotifications
|
||||
virtual void SetCanvasRefEntity(AZ::EntityId canvasAssetRefEntity) = 0;
|
||||
};
|
||||
|
||||
using UiCanvasProxyRefBus = AZ::EBus<UiCanvasProxyRefInterface>;
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Class for 2D drawing in screen space
|
||||
//
|
||||
//! The IDraw2d interface allows drawing images and text in 2D.
|
||||
//! Positions and sizes are specified in pixels in the current 2D viewport.
|
||||
//! The BeginDraw2d method should be called before calling the Draw methods to enter 2D mode
|
||||
//! and the EndDraw2d method should be called after calling the Draw methods to exit 2D mode.
|
||||
//! There is a helper class Draw2dHelper that encapsulates this in its constructor and destructor.
|
||||
class IDraw2d
|
||||
{
|
||||
public: // types
|
||||
|
||||
//! Horizontal alignment can be used for both text and image drawing
|
||||
enum class HAlign
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
Right,
|
||||
};
|
||||
|
||||
//! Vertical alignment can be used for both text and image drawing
|
||||
enum class VAlign
|
||||
{
|
||||
Top,
|
||||
Center,
|
||||
Bottom,
|
||||
};
|
||||
|
||||
//! Used for specifying how to round positions to an exact pixel position for pixel-perfect rendering
|
||||
enum class Rounding
|
||||
{
|
||||
None,
|
||||
Nearest,
|
||||
Down,
|
||||
Up
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
//! Limit imposed by FFont. This is the max number of characters including the null terminator.
|
||||
MAX_TEXT_STRING_LENGTH = 1024,
|
||||
};
|
||||
|
||||
public: // member functions
|
||||
|
||||
//! Implement virtual destructor just for safety.
|
||||
virtual ~IDraw2d() {}
|
||||
};
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Math/Vector2.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
class IDraw2d;
|
||||
class ISprite;
|
||||
struct IUiAnimationSystem;
|
||||
class UiEntityContext;
|
||||
|
||||
// The following ifdef block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the LYSHINE_EXPORTS
|
||||
// symbol defined in the StdAfx.h. this symbol should not be defined on any project
|
||||
// that uses this DLL. This way any other project whose source files include this file see
|
||||
// LYSHINE_API functions as being imported from a DLL, whereas this DLL sees symbols
|
||||
// defined with this macro as being exported.
|
||||
#ifdef LYSHINE_EXPORTS
|
||||
#define LYSHINE_API DLL_EXPORT
|
||||
#else
|
||||
#define LYSHINE_API DLL_IMPORT
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! The ILyShine interface provides access to the other interfaces provided by the UI module
|
||||
class ILyShine
|
||||
{
|
||||
public:
|
||||
virtual ~ILyShine(){}
|
||||
|
||||
//! Delete this object
|
||||
virtual void Release() = 0;
|
||||
|
||||
//! Gets the IDraw2d interface
|
||||
virtual IDraw2d* GetDraw2d() = 0;
|
||||
|
||||
//! Create an empty UI Canvas (in game)
|
||||
//
|
||||
//! The system keeps track of all the loaded canvases and unloads them on game exit.
|
||||
virtual AZ::EntityId CreateCanvas() = 0;
|
||||
|
||||
//! Load a UI Canvas from in-game
|
||||
virtual AZ::EntityId LoadCanvas(const AZStd::string& assetIdPathname) = 0;
|
||||
|
||||
//! Create an empty UI Canvas (for the UI editor)
|
||||
//
|
||||
//! The editor keeps track of the canvases it has open.
|
||||
virtual AZ::EntityId CreateCanvasInEditor(UiEntityContext* entityContext) = 0;
|
||||
|
||||
//! Load a UI Canvas from the UI editor
|
||||
virtual AZ::EntityId LoadCanvasInEditor(const AZStd::string& assetIdPathname, const AZStd::string& sourceAssetPathname, UiEntityContext* entityContext) = 0;
|
||||
|
||||
//! Reload a UI Canvas from xml. For use in the editor for the undo system only
|
||||
virtual AZ::EntityId ReloadCanvasFromXml(const AZStd::string& xmlString, UiEntityContext* entityContext) = 0;
|
||||
|
||||
//! Get a loaded canvas by CanvasId
|
||||
//! NOTE: this only searches canvases loaded in the game (not the editor)
|
||||
virtual AZ::EntityId FindCanvasById(LyShine::CanvasId id) = 0;
|
||||
|
||||
//! Get a loaded canvas by path name
|
||||
//! NOTE: this only searches canvases loaded in the game (not the editor)
|
||||
virtual AZ::EntityId FindLoadedCanvasByPathName(const AZStd::string& assetIdPathname) = 0;
|
||||
|
||||
//! Release a canvas from use either in-game or in editor, destroy UI Canvas if no longer used in either
|
||||
virtual void ReleaseCanvas(AZ::EntityId canvas, bool forEditor = false) = 0;
|
||||
|
||||
//! Queue a canvas for release on the next tick (used in game mode)
|
||||
virtual void ReleaseCanvasDeferred(AZ::EntityId canvas) = 0;
|
||||
|
||||
//! Load a sprite object.
|
||||
virtual ISprite* LoadSprite(const AZStd::string& pathname) = 0;
|
||||
|
||||
//! Create a sprite that references the specified render target
|
||||
virtual ISprite* CreateSprite(const AZStd::string& renderTargetName) = 0;
|
||||
|
||||
//! Check if a sprite's texture asset exists. The .sprite sidecar file is optional and is not checked
|
||||
virtual bool DoesSpriteTextureAssetExist(const AZStd::string& pathname) = 0;
|
||||
|
||||
//! Perform post-initialization (script system will be available)
|
||||
virtual void PostInit() = 0;
|
||||
|
||||
//! Set the current viewport size, this should be called before Update and Render are called
|
||||
virtual void SetViewportSize(AZ::Vector2 viewportSize) = 0;
|
||||
|
||||
//! Update UI elements
|
||||
//! \param deltaTimeInSeconds the amount of time in seconds since the last call to this function
|
||||
virtual void Update(float deltaTimeInSeconds) = 0;
|
||||
|
||||
//! Render 2D and UI elements that should be rendered at end of frame
|
||||
virtual void Render() = 0;
|
||||
|
||||
//! Execute events that were queued during a canvas update or input event handler
|
||||
virtual void ExecuteQueuedEvents() = 0;
|
||||
|
||||
//! Reset the system (this happens at end of running game in Editor for example)
|
||||
virtual void Reset() = 0;
|
||||
|
||||
//! Unload canvases that should be unloaded when a level is unloaded
|
||||
virtual void OnLevelUnload() = 0;
|
||||
|
||||
//! Called when a load screen is finished displaying (when a level load is complete).
|
||||
//! Used to mark all render graphs dirty in case the loaded canvases were already rendered before their textures
|
||||
//! were done loading. This happens when a load screen is being rendered during a level load. When other canvases
|
||||
//! associated with the level are loaded, they also get rendered by the UiLoadScreenComponent, but their texture
|
||||
//! loading is delayed until further down the level load process. Once a canvas is rendered, its render graph's
|
||||
//! dirty flag is cleared, so the render graph needs to be marked dirty again after the textures are loaded
|
||||
virtual void OnLoadScreenUnloaded() = 0;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
LYSHINE_API ILyShine* CreateLyShineInterface(ISystem* system);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* 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 <IRenderer.h>
|
||||
#include <ITexture.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class Color;
|
||||
class Vector2;
|
||||
}
|
||||
|
||||
namespace LyShine
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// UI visual components use this interface to add primitives to the render graph, which is how the
|
||||
// UI gets rendered.
|
||||
// There is one render graph per UI canvas. The render graph (like a display list) is rebuilt when
|
||||
// any visual change occurs on the canvas.
|
||||
class IRenderGraph
|
||||
{
|
||||
public:
|
||||
|
||||
//! Virtual destructor
|
||||
virtual ~IRenderGraph() {}
|
||||
|
||||
//---- Functions for creating and adding primitives to the render graph ----
|
||||
|
||||
//! Begin the setup of a mask render node, primitives added between this call and StartChildrenForMask define the mask
|
||||
virtual void BeginMask(bool isMaskingEnabled, bool useAlphaTest, bool drawBehind, bool drawInFront) = 0;
|
||||
|
||||
//! Start defining the children (masked primitives) of a mask
|
||||
virtual void StartChildrenForMask() = 0;
|
||||
|
||||
//! End the setup of a mask render node, this marks the end of adding child primitives
|
||||
virtual void EndMask() = 0;
|
||||
|
||||
//! Begin rendering to a texture
|
||||
virtual void BeginRenderToTexture(int renderTargetHandle, SDepthTexture* renderTargetDepthSurface,
|
||||
const AZ::Vector2& viewportTopLeft, const AZ::Vector2& viewportSize, const AZ::Color& clearColor) = 0;
|
||||
|
||||
//! End rendering to a texture
|
||||
virtual void EndRenderToTexture() = 0;
|
||||
|
||||
//! Get a dynamic quad primitive that can be added as an image primitive to the render graph
|
||||
//! The graph handles the allocation of this DynUiPrimitive and deletes it when the graph is reset
|
||||
//! This can be used if the UI component doesn't want to own the storage of the primitive. Used infrequently,
|
||||
//! e.g. for the selection rect on a text component.
|
||||
virtual DynUiPrimitive* GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) = 0;
|
||||
|
||||
//---- Functions for supporting masking (used during creation of the graph, not rendering ) ----
|
||||
|
||||
//! Get flag that indicates we are rendering into a mask. Used to avoid masks on child mask elements.
|
||||
virtual bool IsRenderingToMask() const = 0;
|
||||
|
||||
//! Set flag that we are rendering into a mask. Used to avoid masks on child mask elements.
|
||||
virtual void SetIsRenderingToMask(bool isRenderingToMask) = 0;
|
||||
|
||||
//---- Functions for supporting fading (used during creation of the graph, not rendering ) ----
|
||||
|
||||
//! Push an alpha fade, this is multiplied with any existing alpha fade from parents
|
||||
virtual void PushAlphaFade(float alphaFadeValue) = 0;
|
||||
|
||||
//! Push a new alpha fade value, this replaces any existing alpha fade
|
||||
virtual void PushOverrideAlphaFade(float alphaFadeValue) = 0;
|
||||
|
||||
//! Pop an alpha fade off the stack
|
||||
virtual void PopAlphaFade() = 0;
|
||||
|
||||
//! Get the current alpha fade value
|
||||
virtual float GetAlphaFade() const = 0;
|
||||
};
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* 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 <SerializeFwd.h>
|
||||
#include <smartptr.h>
|
||||
#include <LyShine/Bus/UiTransformBus.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! A sprite is a texture with extra information about how it behaves for 2D drawing
|
||||
//! Currently a sprite exists on disk as a side car file next to the texture file.
|
||||
class ISprite
|
||||
: public _i_reference_target<int>
|
||||
{
|
||||
public: // types
|
||||
|
||||
// The borders define the areas of the sprite that stretch
|
||||
// Border's members are always in range 0-1, they are normalized positions within the texture bounds
|
||||
struct Borders
|
||||
{
|
||||
Borders()
|
||||
: m_left(0.0f)
|
||||
, m_right(1.0f)
|
||||
, m_top(0.0f)
|
||||
, m_bottom(1.0f) {}
|
||||
|
||||
Borders(float left, float right, float top, float bottom)
|
||||
: m_left(left)
|
||||
, m_right(right)
|
||||
, m_top(top)
|
||||
, m_bottom(bottom) {}
|
||||
|
||||
float m_left;
|
||||
float m_right;
|
||||
float m_top;
|
||||
float m_bottom;
|
||||
};
|
||||
|
||||
//! \brief Defines the UV-extents of a particular "cell" in a sprite-sheet.
|
||||
//! 9-slice information for the cell is also stored.
|
||||
struct SpriteSheetCell
|
||||
{
|
||||
AZStd::string alias;
|
||||
UiTransformInterface::RectPoints uvCellCoords;
|
||||
Borders borders;
|
||||
};
|
||||
|
||||
using SpriteSheetCellContainer = AZStd::vector<SpriteSheetCell>;
|
||||
|
||||
public: // member functions
|
||||
|
||||
//! Deleting a sprite will release its texture
|
||||
virtual ~ISprite() {}
|
||||
|
||||
//! Get the pathname of this sprite
|
||||
virtual const AZStd::string& GetPathname() const = 0;
|
||||
|
||||
//! Get the pathname of the texture of this sprite
|
||||
virtual const AZStd::string& GetTexturePathname() const = 0;
|
||||
|
||||
//! Get the borders of this sprite
|
||||
virtual Borders GetBorders() const = 0;
|
||||
|
||||
//! Set the borders of this sprite
|
||||
virtual void SetBorders(Borders borders) = 0;
|
||||
|
||||
//! Set the borders of a given cell within the sprite-sheet.
|
||||
virtual void SetCellBorders(int cellIndex, Borders borders) = 0;
|
||||
|
||||
//! Serialize this object for save/load
|
||||
virtual void Serialize(TSerialize ser) = 0;
|
||||
|
||||
//! Save this sprite data to disk
|
||||
virtual bool SaveToXml(const AZStd::string& pathname) = 0;
|
||||
|
||||
//! Test if this sprite has any borders
|
||||
virtual bool AreBordersZeroWidth() const = 0;
|
||||
|
||||
//! Tests if the sprite-sheet cell has borders
|
||||
virtual bool AreCellBordersZeroWidth(int cellIndex) const = 0;
|
||||
|
||||
//! Get the dimensions of the sprite
|
||||
virtual AZ::Vector2 GetSize() = 0;
|
||||
|
||||
//! Gets the dimensions of a specific cell texture within a sprite-sheet
|
||||
virtual AZ::Vector2 GetCellSize(int cellIndex) = 0;
|
||||
|
||||
//! Gets cell info for each of the cells within the sprite-sheet.
|
||||
virtual const SpriteSheetCellContainer& GetSpriteSheetCells() const = 0;
|
||||
|
||||
//! Sets the sprite's sprite-sheet cells.
|
||||
virtual void SetSpriteSheetCells(const SpriteSheetCellContainer& cells) = 0;
|
||||
|
||||
//! Removes all sprite-sheet cell info for this sprite.
|
||||
virtual void ClearSpriteSheetCells() = 0;
|
||||
|
||||
//! Defines a new SpriteSheetCell for this sprite.
|
||||
virtual void AddSpriteSheetCell(const SpriteSheetCell& spriteSheetCell) = 0;
|
||||
|
||||
//! Gets the dimensions of a specific cell (in a sprite-sheet) in UV coords (UV range).
|
||||
virtual AZ::Vector2 GetCellUvSize(int cellIndex) const = 0;
|
||||
|
||||
//! Gets the UV coords associated for a given cell in a sprite-sheet.
|
||||
virtual UiTransformInterface::RectPoints GetCellUvCoords(int cellIndex) const = 0;
|
||||
|
||||
//! Gets the UV coords associated for a given cell in a sprite-sheet in a way that ignores texture atlases
|
||||
virtual UiTransformInterface::RectPoints GetSourceCellUvCoords(int cellIndex) const = 0;
|
||||
|
||||
//! Gets the sliced border info for a given cell within a sprite-sheet.
|
||||
//!
|
||||
//! The returned UV borders are in "cell space" relative to the given indexed spell. For example,
|
||||
//! a top-left border of (0.5, 0.5) would be the center of the given cell.
|
||||
virtual Borders GetCellUvBorders(int cellIndex) const = 0;
|
||||
|
||||
//! Gets the sliced border UV coordinates in texture space for a given cell within a sprite-sheet.
|
||||
//!
|
||||
//! The returned UV border coordinates are in texture space. For example, a top-left border of (0.5, 0.5)
|
||||
//! would be the center of the sprite-sheet.
|
||||
virtual Borders GetTextureSpaceCellUvBorders(int cellIndex) const = 0;
|
||||
|
||||
//! Gets the string alias associated with the given cell in a sprite-sheet.
|
||||
virtual const AZStd::string& GetCellAlias(int cellIndex) const = 0;
|
||||
|
||||
//! Sets the string alias associated with the given cell in a sprite-sheet.
|
||||
virtual void SetCellAlias(int cellIndex, const AZStd::string& cellAlias) = 0;
|
||||
|
||||
//! Returns the sprite-sheet cell index that corresponds to the given string alias.
|
||||
virtual int GetCellIndexFromAlias(const AZStd::string& cellAlias) const = 0;
|
||||
|
||||
//! Returns true if this sprite is configured as a sprite-sheet, false otherwise
|
||||
virtual bool IsSpriteSheet() const = 0;
|
||||
};
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* 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 <platform.h>
|
||||
#include <algorithm>
|
||||
#include <Cry_Math.h>
|
||||
#include <Cry_Color.h>
|
||||
#include <ISystem.h>
|
||||
#include <CryCommon/LegacyAllocator.h>
|
||||
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
// This is a workaround for AZCore including WinUser.h which defines DrawText to be DrawTextA
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Common types used across the LyShine UI system
|
||||
namespace LyShine
|
||||
{
|
||||
//! used for UI element names and canvas names, should be the same as the AZ::Entity name type
|
||||
typedef AZStd::string NameType;
|
||||
|
||||
//! Used for pathnames for UI canvas and prefab files
|
||||
typedef AZStd::string PathnameType;
|
||||
|
||||
//! USed for our 32-bit id's for canvases and elements. Only used so FlowGraph can reference these things
|
||||
//! These should go away once FlowGraph can used AZ::EntityIds
|
||||
typedef unsigned int CanvasId;
|
||||
typedef unsigned int ElementId;
|
||||
|
||||
//! Used for UI action names
|
||||
typedef AZStd::string ActionName;
|
||||
|
||||
//! Used for test strings in UI text elements
|
||||
typedef AZStd::string StringType; // not yet decided if we should use wchar_t or UTF8
|
||||
|
||||
//! Used for passing lists of entities
|
||||
typedef AZStd::vector<AZ::Entity*, AZ::StdLegacyAllocator> EntityArray;
|
||||
|
||||
enum class BlendMode
|
||||
{
|
||||
Normal, //!< interpolate from dest color to source color according to source alpha
|
||||
Add, //!< source color * source alpha is added to dest color (Linear Dodge)
|
||||
Screen, //!< as close as we can get to Photoshop Screen
|
||||
Darken, //!< like Photoshop darken
|
||||
Lighten, //!< like Photoshop lighten
|
||||
};
|
||||
|
||||
// used to map old EntityId's to new EntityId's when generating new ids for a paste or prefab
|
||||
typedef AZStd::unordered_map<AZ::EntityId, AZ::EntityId> EntityIdMap;
|
||||
};
|
||||
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
AZ_TYPE_INFO_SPECIALIZE(ColorF, "{63782551-A309-463B-A301-3A360800DF1E}");
|
||||
AZ_TYPE_INFO_SPECIALIZE(ColorB, "{6F0CC2C0-0CC6-4DBF-9297-B043F270E6A4}");
|
||||
AZ_TYPE_INFO_SPECIALIZE(Vec4, "{CAC9510C-8C00-41D4-BC4D-2C6A8136EB30}");
|
||||
} // namespace AZ
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Common types used across the LyShine UI system
|
||||
namespace LyShine
|
||||
{
|
||||
// Uuid strings for all component types define by LyShine.
|
||||
// This can be used to create components at runtime. E.g.:
|
||||
// entity->CreateComponent(LyShine::UiTransform2dComponentUuid);
|
||||
const char* const UiButtonComponentUuid = "{7329DFE8-0F3C-4629-B395-78B2CF646B96}";
|
||||
const char* const UiCanvasComponentUuid = "{50B8CF6C-B19A-4D86-AFE9-96EFB820D422}";
|
||||
const char* const UiCheckboxComponentUuid = "{68D62281-B360-4426-AACA-E8BDE8BFEB3A}";
|
||||
const char* const UiDraggableComponentUuid = "{C96B1EEF-033A-479B-829B-ED3555D0F33A}";
|
||||
const char* const UiDropTargetComponentUuid = "{E4B8ACE0-FCE7-42D8-9836-942F910168B4}";
|
||||
const char* const UiDropdownComponentUuid = "{BFC4D5A3-2F7C-4079-B19C-C2A06E93F343}";
|
||||
const char* const UiDropdownOptionComponentUuid = "{554E16E4-CBA1-4E57-B326-9731AA963BAA}";
|
||||
const char* const UiDynamicLayoutComponentUuid = "{690BEC14-3642-4247-BD96-FE414CCB7DE7}";
|
||||
const char* const UiDynamicScrollBoxComponentUuid = "{6982C200-4D32-43CC-A7F6-F54FA50FCFF5}";
|
||||
const char* const UiElementComponentUuid = "{4A97D63E-CE7A-45B6-AAE4-102DB4334688}";
|
||||
const char* const UiFaderComponentUuid = "{CD01FF77-2249-4ED8-BFFB-33A66A47E17C}";
|
||||
const char* const UiFlipbookAnimationComponentUuid ="{AACCFFA1-B694-4F8B-A289-391A56404E0C}";
|
||||
const char* const UiImageComponentUuid = "{BDBEFD23-DBB4-4726-A32D-4FEAC24E51F6}";
|
||||
const char* const UiImageSequenceComponentUuid = "{BFAC7909-3A56-4980-AF7C-261A99D6371B}";
|
||||
const char* const UiLayoutColumnComponentUuid = "{4BC2E786-360B-4426-8D9C-9B254C5EA21F}";
|
||||
const char* const UiLayoutCellComponentUuid = "{A0568E58-4382-47F8-8B88-77C64B99AC80}";
|
||||
const char* const UiLayoutFitterComponentUuid = "{96C55390-9D03-4C47-BB0D-17D3BD5219E3}";
|
||||
const char* const UiLayoutGridComponentUuid = "{ADDA3AE5-B9AB-44B7-A462-8B89B398A837}";
|
||||
const char* const UiLayoutRowComponentUuid = "{7B2820C4-7FC7-4F02-B777-6727EB4BAC13}";
|
||||
const char* const UiMarkupButtonComponentUuid = "{D7EB1706-75E8-4C94-A266-61913F42431B}";
|
||||
const char* const UiMaskComponentUuid = "{2279AA38-271D-4D4F-A472-E42B984088AC}";
|
||||
const char* const UiParticleEmitterComponentUuid = "{E8B1288C-CB49-4CAD-B366-AF1B40C47E74}";
|
||||
const char* const UiRadioButtonComponentUuid = "{773A0F4B-F9F9-4B82-9951-BBD73A737DE4}";
|
||||
const char* const UiRadioButtonGroupComponentUuid = "{F89D5EF2-37C4-4CA7-9AA2-23DC3867EC9D}";
|
||||
const char* const UiScrollBarComponentUuid = "{6B283F90-3519-47DA-A1DD-65A79CE119CF}";
|
||||
const char* const UiScrollBoxComponentUuid = "{2F539588-AEAB-4341-A6A6-AF645D129693}";
|
||||
const char* const UiSliderComponentUuid = "{2913D76B-36A0-45E0-A104-33C668EB612D}";
|
||||
const char* const UiTextComponentUuid = "{5B3FB2A7-5DC4-4033-A970-001CEC85B6C4}";
|
||||
const char* const UiTextInputComponentUuid = "{2CB3872B-D2B4-4DDB-B39A-97492310AE11}";
|
||||
const char* const UiTooltipComponentUuid = "{493EBF89-C299-4722-829D-4DFAB926795B}";
|
||||
const char* const UiTooltipDisplayComponentUuid = "{18CEE6A7-3CBC-4638-9F4D-87E8D53DDF1A}";
|
||||
const char* const UiTransform2dComponentUuid = "{2751A5A5-3291-4A4D-9FC0-9CB0EB8D1DE6}";
|
||||
|
||||
// The Uuid of the LyShine system component. Can be used from tools to activate this component.
|
||||
const char* const lyShineSystemComponentUuid = "{B0C78B8D-1E5B-47D7-95D0-EC69C0513804}";
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
#include <AzFramework/Asset/AssetCatalogBus.h>
|
||||
|
||||
#include <LyShine/Bus/UiEntityContextBus.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class SerializeContext;
|
||||
}
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
class EntityContext;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! The UI Entity Context stores the prefab asset for the root slice of a UI canvas
|
||||
//! So all of the UI element entities in a canvas are owned indirectly by the context and managed
|
||||
//! by the entity context.
|
||||
class UiEntityContext
|
||||
: public AzFramework::EntityContext
|
||||
, public UiEntityContextRequestBus::Handler
|
||||
{
|
||||
public: // member functions
|
||||
|
||||
//! Initialize the entity context and instantiate the root slice
|
||||
virtual void InitUiContext() = 0;
|
||||
|
||||
//! Destroy the Entity Context
|
||||
virtual void DestroyUiContext() = 0;
|
||||
|
||||
//! Saves the context's slice root to the specified buffer. If necessary
|
||||
//! entities undergo conversion for game: editor -> game components.
|
||||
//! \return true if successfully saved. Failure is only possible if serialization data is corrupt.
|
||||
virtual bool SaveToStreamForGame(AZ::IO::GenericStream& stream, AZ::DataStream::StreamType streamType) = 0;
|
||||
|
||||
//! Saves the given canvas entity to the specified buffer. If necessary
|
||||
//! the entity undergoes conversion for game: editor -> game components.
|
||||
//! \return true if successfully saved. Failure is only possible if serialization data is corrupt.
|
||||
//! This is needed because the canvas entity is not part of the root slice. It is here in the entity
|
||||
//! context because that allows us to get to the ToolsFramework functionality.
|
||||
virtual bool SaveCanvasEntityToStreamForGame(AZ::Entity* canvasEntity, AZ::IO::GenericStream& stream, AZ::DataStream::StreamType streamType) = 0;
|
||||
};
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Common types used across the LyShine UI layout cell system
|
||||
namespace LyShine
|
||||
{
|
||||
const float UiLayoutCellUnspecifiedSize = -1.0f;
|
||||
|
||||
inline bool IsUiLayoutCellSizeSpecified(float size)
|
||||
{
|
||||
return size >= 0.0f;
|
||||
}
|
||||
};
|
||||
@@ -1,523 +0,0 @@
|
||||
/*
|
||||
* 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 <AzCore/Math/Crc.h>
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Math/Sfmt.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
|
||||
#include <LyShine/UiAssetTypes.h>
|
||||
#include <LyShine/UiBase.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace LyShine
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to VersionConverter to convert an AZStd::string field to a simple asset reference
|
||||
// Inline to avoid DLL linkage issues
|
||||
template<typename T>
|
||||
inline bool ConvertSubElementFromAzStringToAssetRef(
|
||||
AZ::SerializeContext& context,
|
||||
AZ::SerializeContext::DataElementNode& classElement,
|
||||
const char* subElementName)
|
||||
{
|
||||
int index = classElement.FindElement(AZ_CRC(subElementName));
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& elementNode = classElement.GetSubElement(index);
|
||||
|
||||
AZStd::string oldData;
|
||||
|
||||
if (!elementNode.GetData(oldData))
|
||||
{
|
||||
// Error, old subElement was not a string or not valid
|
||||
AZ_Error("Serialization", false, "Cannot get string data for element %s.", subElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove old version.
|
||||
classElement.RemoveElement(index);
|
||||
|
||||
// Add a new element for the new data.
|
||||
int simpleAssetRefIndex = classElement.AddElement<AzFramework::SimpleAssetReference<T> >(context, subElementName);
|
||||
if (simpleAssetRefIndex == -1)
|
||||
{
|
||||
// Error adding the new sub element
|
||||
AZ_Error("Serialization", false, "AddElement failed for simpleAssetRefIndex %s", subElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// add a sub element for the SimpleAssetReferenceBase within the SimpleAssetReference
|
||||
AZ::SerializeContext::DataElementNode& simpleAssetRefNode = classElement.GetSubElement(simpleAssetRefIndex);
|
||||
int simpleAssetRefBaseIndex = simpleAssetRefNode.AddElement<AzFramework::SimpleAssetReferenceBase>(context, "BaseClass1");
|
||||
if (simpleAssetRefBaseIndex == -1)
|
||||
{
|
||||
// Error adding the new sub element
|
||||
AZ_Error("Serialization", false, "AddElement failed for converted element BaseClass1");
|
||||
return false;
|
||||
}
|
||||
|
||||
// add a sub element for the AssetPath within the SimpleAssetReference
|
||||
AZ::SerializeContext::DataElementNode& simpleAssetRefBaseNode = simpleAssetRefNode.GetSubElement(simpleAssetRefBaseIndex);
|
||||
int assetPathElementIndex = simpleAssetRefBaseNode.AddElement<AZStd::string>(context, "AssetPath");
|
||||
if (assetPathElementIndex == -1)
|
||||
{
|
||||
// Error adding the new sub element
|
||||
AZ_Error("Serialization", false, "AddElement failed for converted element AssetPath");
|
||||
return false;
|
||||
}
|
||||
|
||||
AZStd::string newData(oldData.c_str());
|
||||
simpleAssetRefBaseNode.GetSubElement(assetPathElementIndex).SetData(context, newData);
|
||||
}
|
||||
|
||||
// if the field did not exist then we do not report an error
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to VersionConverter to convert a char to a uint32_t
|
||||
// Inline to avoid DLL linkage issues
|
||||
inline bool ConvertSubElementFromCharToUInt32(
|
||||
AZ::SerializeContext& context,
|
||||
AZ::SerializeContext::DataElementNode& classElement,
|
||||
const char* subElementName)
|
||||
{
|
||||
int index = classElement.FindElement(AZ_CRC(subElementName));
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& elementNode = classElement.GetSubElement(index);
|
||||
|
||||
char oldData;
|
||||
|
||||
if (!elementNode.GetData(oldData))
|
||||
{
|
||||
// Error, old subElement was not a CryString
|
||||
AZ_Error("Serialization", false, "Element %s is not a char.", subElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove old version.
|
||||
classElement.RemoveElement(index);
|
||||
|
||||
// Add a new element for the new data.
|
||||
int newElementIndex = classElement.AddElement<uint32_t>(context, subElementName);
|
||||
if (newElementIndex == -1)
|
||||
{
|
||||
// Error adding the new sub element
|
||||
AZ_Error("Serialization", false, "AddElement failed for converted element %s", subElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t newData = oldData;
|
||||
classElement.GetSubElement(newElementIndex).SetData(context, newData);
|
||||
}
|
||||
|
||||
// if the field did not exist then we do not report an error
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to get the value for a named sub element
|
||||
template<typename T>
|
||||
inline bool GetSubElementValue(
|
||||
AZ::SerializeContext::DataElementNode& classElement,
|
||||
const char* elementName, T& value)
|
||||
{
|
||||
int index = classElement.FindElement(AZ_CRC(elementName));
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& elementNode = classElement.GetSubElement(index);
|
||||
if (!elementNode.GetData(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to make a ColorF out of an RGB color and an alpha
|
||||
inline ColorF MakeColorF(AZ::Vector3 color, float alpha)
|
||||
{
|
||||
return ColorF(color.GetX(), color.GetY(), color.GetZ(), alpha);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to make an AZ::Vector3 from the rgb elements of a ColorF
|
||||
inline AZ::Vector3 MakeColorVector3(ColorF color)
|
||||
{
|
||||
return AZ::Vector3(color.r, color.g, color.b);
|
||||
}
|
||||
|
||||
// Helper function to make an AZ::Color from a ColorF
|
||||
inline AZ::Color MakeColorAZColor(ColorF color)
|
||||
{
|
||||
return AZ::Color(color.r, color.g, color.b, color.a);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to VersionConverter to convert a ColorF field to a Vector3 color and a float
|
||||
// alpha.
|
||||
// Inline to avoid DLL linkage issues
|
||||
inline bool ConvertSubElementFromColorToColorPlusAlpha(
|
||||
AZ::SerializeContext& context,
|
||||
AZ::SerializeContext::DataElementNode& classElement,
|
||||
const char* colorElementName,
|
||||
const char* alphaElementName)
|
||||
{
|
||||
int index = classElement.FindElement(AZ_CRC(colorElementName));
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& elementNode = classElement.GetSubElement(index);
|
||||
|
||||
ColorF oldData;
|
||||
|
||||
if (!(GetSubElementValue(elementNode, "r", oldData.r) &&
|
||||
GetSubElementValue(elementNode, "g", oldData.g) &&
|
||||
GetSubElementValue(elementNode, "b", oldData.b) &&
|
||||
GetSubElementValue(elementNode, "a", oldData.a)))
|
||||
{
|
||||
// Error, old subElement was not a ColorF
|
||||
AZ_Error("Serialization", false, "Element %s is not a ColorF.", colorElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove old version.
|
||||
classElement.RemoveElement(index);
|
||||
|
||||
// Add new elements for the new data.
|
||||
|
||||
int newColorElementIndex = classElement.AddElement<AZ::Vector3>(context, colorElementName);
|
||||
if (newColorElementIndex == -1)
|
||||
{
|
||||
// Error adding the new sub element
|
||||
AZ_Error("Serialization", false, "AddElement failed for converted element %s", colorElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
int newAlphaElementIndex = classElement.AddElement<float>(context, alphaElementName);
|
||||
if (newAlphaElementIndex == -1)
|
||||
{
|
||||
// Error adding the new sub element
|
||||
AZ_Error("Serialization", false, "AddElement failed for converted element %s", alphaElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
AZ::Vector3 newColorData(oldData.r, oldData.g, oldData.b);
|
||||
classElement.GetSubElement(newColorElementIndex).SetData(context, newColorData);
|
||||
|
||||
float newAlphaData(oldData.a);
|
||||
classElement.GetSubElement(newAlphaElementIndex).SetData(context, newAlphaData);
|
||||
}
|
||||
|
||||
// if the field did not exist then we do not report an error
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to VersionConverter to convert a AZ::Vector3 field to a AZ::Color
|
||||
// Inline to avoid DLL linkage issues
|
||||
inline bool ConvertSubElementFromVector3ToAzColor(
|
||||
AZ::SerializeContext& context,
|
||||
AZ::SerializeContext::DataElementNode& classElement,
|
||||
const char* colorElementName)
|
||||
{
|
||||
int index = classElement.FindElement(AZ_CRC(colorElementName));
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& elementNode = classElement.GetSubElement(index);
|
||||
|
||||
AZ::Vector3 oldData;
|
||||
|
||||
if (!elementNode.GetData(oldData))
|
||||
{
|
||||
// Error, old subElement was not a Vector3 or not valid
|
||||
AZ_Error("Serialization", false, "Cannot get Vector3 data for element %s.", colorElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove old version.
|
||||
classElement.RemoveElement(index);
|
||||
|
||||
// Add new elements for the new data.
|
||||
|
||||
int newColorElementIndex = classElement.AddElement<AZ::Color>(context, colorElementName);
|
||||
if (newColorElementIndex == -1)
|
||||
{
|
||||
// Error adding the new sub element
|
||||
AZ_Error("Serialization", false, "AddElement failed for converted element %s", colorElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
AZ::Color newColorData = AZ::Color::CreateFromVector3(oldData);
|
||||
classElement.GetSubElement(newColorElementIndex).SetData(context, newColorData);
|
||||
}
|
||||
|
||||
// if the field did not exist then we do not report an error
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to VersionConverter to convert a ColorF field to a AZ::Color
|
||||
// Inline to avoid DLL linkage issues
|
||||
inline bool ConvertSubElementFromColorFToAzColor(
|
||||
AZ::SerializeContext& context,
|
||||
AZ::SerializeContext::DataElementNode& classElement,
|
||||
const char* colorElementName)
|
||||
{
|
||||
int index = classElement.FindElement(AZ_CRC(colorElementName));
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& elementNode = classElement.GetSubElement(index);
|
||||
|
||||
ColorF oldData;
|
||||
|
||||
if (!(GetSubElementValue(elementNode, "r", oldData.r) &&
|
||||
GetSubElementValue(elementNode, "g", oldData.g) &&
|
||||
GetSubElementValue(elementNode, "b", oldData.b) &&
|
||||
GetSubElementValue(elementNode, "a", oldData.a)))
|
||||
{
|
||||
// Error, old subElement was not a ColorF
|
||||
AZ_Error("Serialization", false, "Element %s is not a ColorF.", colorElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove old version.
|
||||
classElement.RemoveElement(index);
|
||||
|
||||
// Add new elements for the new data.
|
||||
|
||||
int newColorElementIndex = classElement.AddElement<AZ::Color>(context, colorElementName);
|
||||
if (newColorElementIndex == -1)
|
||||
{
|
||||
// Error adding the new sub element
|
||||
AZ_Error("Serialization", false, "AddElement failed for converted element %s", colorElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
classElement.GetSubElement(newColorElementIndex).SetData(context, MakeColorAZColor(oldData));
|
||||
}
|
||||
|
||||
// if the field did not exist then we do not report an error
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to VersionConverter to convert a Vec2 field to a AZ::Vector2.
|
||||
// Inline to avoid DLL linkage issues
|
||||
inline bool ConvertSubElementFromVec2ToVector2(
|
||||
AZ::SerializeContext& context,
|
||||
AZ::SerializeContext::DataElementNode& classElement,
|
||||
const char* vec2ElementName)
|
||||
{
|
||||
int index = classElement.FindElement(AZ_CRC(vec2ElementName));
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& elementNode = classElement.GetSubElement(index);
|
||||
|
||||
Vec2 oldData;
|
||||
|
||||
if (!(GetSubElementValue(elementNode, "x", oldData.x) &&
|
||||
GetSubElementValue(elementNode, "y", oldData.y)))
|
||||
{
|
||||
// Error, old subElement was not a Vec2
|
||||
AZ_Error("Serialization", false, "Element %s is not a Vec2.", vec2ElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove old version.
|
||||
classElement.RemoveElement(index);
|
||||
|
||||
// Add new elements for the new data.
|
||||
|
||||
int newVector2ElementIndex = classElement.AddElement<AZ::Vector2>(context, vec2ElementName);
|
||||
if (newVector2ElementIndex == -1)
|
||||
{
|
||||
// Error adding the new sub element
|
||||
AZ_Error("Serialization", false, "AddElement failed for converted element %s", vec2ElementName);
|
||||
return false;
|
||||
}
|
||||
|
||||
AZ::Vector2 newVector2Data(oldData.x, oldData.y);
|
||||
classElement.GetSubElement(newVector2ElementIndex).SetData(context, newVector2Data);
|
||||
}
|
||||
|
||||
// if the field did not exist then we do not report an error
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to VersionConverter to move a sub-element from one DataElementNode to another
|
||||
// DataElementNode and rename it
|
||||
inline bool MoveElement(
|
||||
[[maybe_unused]] AZ::SerializeContext& context,
|
||||
AZ::SerializeContext::DataElementNode& srcElement,
|
||||
AZ::SerializeContext::DataElementNode& dstElement,
|
||||
const char* srcSubElementName,
|
||||
const char* dstSubElementName)
|
||||
{
|
||||
// find the sub-element (the field we will move)
|
||||
int srcSubElementIndex = srcElement.FindElement(AZ_CRC(srcSubElementName));
|
||||
if (srcSubElementIndex != -1)
|
||||
{
|
||||
// add a copy of the sub-element into the base class
|
||||
AZ::SerializeContext::DataElementNode subElementNode = srcElement.GetSubElement(srcSubElementIndex);
|
||||
subElementNode.SetName(dstSubElementName);
|
||||
dstElement.AddElement(subElementNode);
|
||||
|
||||
// remove the sub-element from its original location
|
||||
srcElement.RemoveElement(srcSubElementIndex);
|
||||
}
|
||||
|
||||
// if the field did not exist then we do not report an error
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to VersionConverter to remove leading forward slashes from asset path
|
||||
inline bool RemoveLeadingForwardSlashesFromAssetPath(
|
||||
AZ::SerializeContext& context,
|
||||
AZ::SerializeContext::DataElementNode& classElement,
|
||||
const char* simpleAssetRefSubElementName)
|
||||
{
|
||||
int index = classElement.FindElement(AZ_CRC(simpleAssetRefSubElementName));
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& simpleAssetRefNode = classElement.GetSubElement(index);
|
||||
index = simpleAssetRefNode.FindElement(AZ_CRC("BaseClass1", 0xd4925735));
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& baseClassNode = simpleAssetRefNode.GetSubElement(index);
|
||||
index = baseClassNode.FindElement(AZ_CRC("AssetPath", 0x2c355179));
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& assetPathNode = baseClassNode.GetSubElement(index);
|
||||
AZStd::string assetPath;
|
||||
|
||||
if (!assetPathNode.GetData(assetPath))
|
||||
{
|
||||
AZ_Error("Serialization", false, "Element AssetPath is not a AZStd::string.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Count leading forward slashes
|
||||
int i = 0;
|
||||
while ((i < assetPath.length()) && (assetPath[i] == '/'))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
if (i > 0)
|
||||
{
|
||||
// Remove leading forward slashes
|
||||
assetPath.erase(0, i);
|
||||
|
||||
if (!assetPathNode.SetData(context, assetPath))
|
||||
{
|
||||
AZ_Error("Serialization", false, "Unable to set AssetPath data.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to find a component with the given UUID in an entity
|
||||
inline AZ::SerializeContext::DataElementNode* FindComponentNode(AZ::SerializeContext::DataElementNode& entityNode, const AZ::Uuid& uuid)
|
||||
{
|
||||
// get the component vector node
|
||||
int componentsIndex = entityNode.FindElement(AZ_CRC("Components", 0xee48f5fd));
|
||||
if (componentsIndex == -1)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
AZ::SerializeContext::DataElementNode& componentsNode = entityNode.GetSubElement(componentsIndex);
|
||||
|
||||
// search the components vector for the first component with the given ID
|
||||
int numComponents = componentsNode.GetNumSubElements();
|
||||
for (int compIndex = 0; compIndex < numComponents; ++compIndex)
|
||||
{
|
||||
AZ::SerializeContext::DataElementNode& componentNode = componentsNode.GetSubElement(compIndex);
|
||||
|
||||
if (componentNode.GetId() == uuid)
|
||||
{
|
||||
return &componentNode;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to create an EntityId node for a newly created entity node
|
||||
inline bool CreateEntityIdNode(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& entityNode)
|
||||
{
|
||||
// Generate a new EntityId and extract the raw u64
|
||||
AZ::EntityId newEntityId = AZ::Entity::MakeId();
|
||||
AZ::u64 rawId = static_cast<AZ::u64>(newEntityId);
|
||||
|
||||
// Create the EntityId node within this entity
|
||||
int entityIdIndex = entityNode.AddElement<AZ::EntityId>(context, "Id");
|
||||
if (entityIdIndex == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
AZ::SerializeContext::DataElementNode& elementIdNode = entityNode.GetSubElement(entityIdIndex);
|
||||
|
||||
// Create the sub node of the EntityID that actually stores the u64
|
||||
int u64Index = elementIdNode.AddElementWithData(context, "id", rawId);
|
||||
if (u64Index == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper function to create the AZ::Component base class for a newly created component
|
||||
inline bool CreateComponentBaseClassNode(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& componentNode)
|
||||
{
|
||||
// Generate a new component ID (using same technique that the AZ::Component uses)
|
||||
AZ::ComponentId compId = AZ::Sfmt::GetInstance().Rand64();
|
||||
|
||||
// Create the base class node within this component node
|
||||
int baseClassIndex = componentNode.AddElement<AZ::Component>(context, "BaseClass1");
|
||||
if (baseClassIndex == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
AZ::SerializeContext::DataElementNode& baseClassNode = componentNode.GetSubElement(baseClassIndex);
|
||||
|
||||
// Create the sub node of the component base class that stores the u64 component id
|
||||
int u64Index = baseClassNode.AddElementWithData(context, "Id", compId);
|
||||
if (u64Index == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,85 +100,8 @@ set(FILES
|
||||
platform_impl.cpp
|
||||
Win32specific.h
|
||||
Win64specific.h
|
||||
LyShine/IDraw2d.h
|
||||
LyShine/ILyShine.h
|
||||
LyShine/ISprite.h
|
||||
LyShine/IRenderGraph.h
|
||||
LyShine/UiAssetTypes.h
|
||||
LyShine/UiComponentTypes.h
|
||||
LyShine/UiBase.h
|
||||
LyShine/UiEntityContext.h
|
||||
LyShine/UiLayoutCellBase.h
|
||||
LyShine/UiSerializeHelpers.h
|
||||
LyShine/Animation/IUiAnimation.h
|
||||
LyShine/Bus/UiAnimateEntityBus.h
|
||||
LyShine/Bus/UiAnimationBus.h
|
||||
LyShine/Bus/UiButtonBus.h
|
||||
LyShine/Bus/UiCanvasBus.h
|
||||
LyShine/Bus/UiCanvasManagerBus.h
|
||||
LyShine/Bus/UiCanvasUpdateNotificationBus.h
|
||||
LyShine/Bus/UiCheckboxBus.h
|
||||
LyShine/Bus/UiCursorBus.h
|
||||
LyShine/Bus/UiDraggableBus.h
|
||||
LyShine/Bus/UiDropdownBus.h
|
||||
LyShine/Bus/UiDropdownOptionBus.h
|
||||
LyShine/Bus/UiDropTargetBus.h
|
||||
LyShine/Bus/UiDynamicLayoutBus.h
|
||||
LyShine/Bus/UiDynamicScrollBoxBus.h
|
||||
LyShine/Bus/UiEditorBus.h
|
||||
LyShine/Bus/UiEditorCanvasBus.h
|
||||
LyShine/Bus/UiEditorChangeNotificationBus.h
|
||||
LyShine/Bus/UiElementBus.h
|
||||
LyShine/Bus/UiEntityContextBus.h
|
||||
LyShine/Bus/UiFaderBus.h
|
||||
LyShine/Bus/UiFlipbookAnimationBus.h
|
||||
LyShine/Bus/UiGameEntityContextBus.h
|
||||
LyShine/Bus/UiImageBus.h
|
||||
LyShine/Bus/UiImageSequenceBus.h
|
||||
LyShine/Bus/UiIndexableImageBus.h
|
||||
LyShine/Bus/UiInitializationBus.h
|
||||
LyShine/Bus/UiInteractableActionsBus.h
|
||||
LyShine/Bus/UiInteractableBus.h
|
||||
LyShine/Bus/UiInteractableStatesBus.h
|
||||
LyShine/Bus/UiInteractionMaskBus.h
|
||||
LyShine/Bus/UiLayoutBus.h
|
||||
LyShine/Bus/UiLayoutCellBus.h
|
||||
LyShine/Bus/UiLayoutCellDefaultBus.h
|
||||
LyShine/Bus/UiLayoutColumnBus.h
|
||||
LyShine/Bus/UiLayoutControllerBus.h
|
||||
LyShine/Bus/UiLayoutFitterBus.h
|
||||
LyShine/Bus/UiLayoutGridBus.h
|
||||
LyShine/Bus/UiLayoutManagerBus.h
|
||||
LyShine/Bus/UiLayoutRowBus.h
|
||||
LyShine/Bus/UiMarkupButtonBus.h
|
||||
LyShine/Bus/UiMaskBus.h
|
||||
LyShine/Bus/UiNavigationBus.h
|
||||
LyShine/Bus/UiParticleEmitterBus.h
|
||||
LyShine/Bus/UiRadioButtonBus.h
|
||||
LyShine/Bus/UiRadioButtonCommunicationBus.h
|
||||
LyShine/Bus/UiRadioButtonGroupBus.h
|
||||
LyShine/Bus/UiRadioButtonGroupCommunicationBus.h
|
||||
LyShine/Bus/UiRenderBus.h
|
||||
LyShine/Bus/UiRenderControlBus.h
|
||||
LyShine/Bus/UiScrollableBus.h
|
||||
LyShine/Bus/UiScrollBarBus.h
|
||||
LyShine/Bus/UiScrollBoxBus.h
|
||||
LyShine/Bus/UiScrollerBus.h
|
||||
LyShine/Bus/UiSliderBus.h
|
||||
LyShine/Bus/UiSpawnerBus.h
|
||||
LyShine/Bus/UiSystemBus.h
|
||||
LyShine/Bus/UiTextBus.h
|
||||
LyShine/Bus/UiTextInputBus.h
|
||||
LyShine/Bus/UiTooltipBus.h
|
||||
LyShine/Bus/UiTooltipDataPopulatorBus.h
|
||||
LyShine/Bus/UiTooltipDisplayBus.h
|
||||
LyShine/Bus/UiTransform2dBus.h
|
||||
LyShine/Bus/UiTransformBus.h
|
||||
LyShine/Bus/UiVisualBus.h
|
||||
LyShine/Bus/Sprite/UiSpriteBus.h
|
||||
LyShine/Bus/World/UiCanvasOnMeshBus.h
|
||||
LyShine/Bus/World/UiCanvasRefBus.h
|
||||
LyShine/Bus/Tools/UiSystemToolsBus.h
|
||||
Maestro/Bus/EditorSequenceAgentComponentBus.h
|
||||
Maestro/Bus/EditorSequenceBus.h
|
||||
Maestro/Bus/EditorSequenceComponentBus.h
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <AzFramework/Spawnable/RootSpawnableInterface.h>
|
||||
|
||||
#include "MainThreadRenderRequestBus.h"
|
||||
#include <LyShine/ILyShine.h>
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
@@ -880,12 +879,6 @@ void CLevelSystem::UnloadLevel()
|
||||
// Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event).
|
||||
EBUS_EVENT(AZ::ScriptSystemRequestBus, GarbageCollect);
|
||||
|
||||
// Perform level unload procedures for the LyShine UI system
|
||||
if (gEnv && gEnv->pLyShine)
|
||||
{
|
||||
gEnv->pLyShine->OnLevelUnload();
|
||||
}
|
||||
|
||||
m_bLevelLoaded = false;
|
||||
|
||||
[[maybe_unused]] const AZ::TimeMs unloadTimeMs = AZ::GetRealElapsedTimeMs() - beginTimeMs;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <AzFramework/Input/Buses/Requests/InputChannelRequestBus.h>
|
||||
|
||||
#include "MainThreadRenderRequestBus.h"
|
||||
#include <LyShine/ILyShine.h>
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Settings/SettingsRegistryVisitorUtils.h>
|
||||
@@ -556,12 +555,6 @@ namespace LegacyLevelSystem
|
||||
// Normally the GC step is triggered at the end of this method (by the ESYSTEM_EVENT_LEVEL_POST_UNLOAD event).
|
||||
EBUS_EVENT(AZ::ScriptSystemRequestBus, GarbageCollect);
|
||||
|
||||
// Perform level unload procedures for the LyShine UI system
|
||||
if (gEnv && gEnv->pLyShine)
|
||||
{
|
||||
gEnv->pLyShine->OnLevelUnload();
|
||||
}
|
||||
|
||||
m_bLevelLoaded = false;
|
||||
|
||||
[[maybe_unused]] const AZ::TimeMs unloadTimeMs = AZ::GetRealElapsedTimeMs() - beginTimeMs;
|
||||
|
||||
@@ -117,7 +117,6 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
#include <ILog.h>
|
||||
#include <IAudioSystem.h>
|
||||
#include <IProcess.h>
|
||||
#include <LyShine/ILyShine.h>
|
||||
|
||||
#include <LoadScreenBus.h>
|
||||
|
||||
@@ -374,14 +373,7 @@ void CSystem::ShutDown()
|
||||
m_pSystemEventDispatcher->OnSystemEvent(ESYSTEM_EVENT_FULL_SHUTDOWN, 0, 0);
|
||||
}
|
||||
|
||||
if (gEnv && gEnv->pLyShine)
|
||||
{
|
||||
gEnv->pLyShine->Release();
|
||||
gEnv->pLyShine = nullptr;
|
||||
}
|
||||
|
||||
SAFE_RELEASE(m_env.pMovieSystem);
|
||||
SAFE_RELEASE(m_env.pLyShine);
|
||||
SAFE_RELEASE(m_env.pCryFont);
|
||||
if (m_env.pConsole)
|
||||
{
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
#include <AzFramework/Archive/ArchiveFileIO.h>
|
||||
|
||||
#include <LoadScreenBus.h>
|
||||
#include <LyShine/Bus/UiSystemBus.h>
|
||||
#include <AzFramework/Logging/MissingAssetLogger.h>
|
||||
#include <AzFramework/Platform/PlatformDefaults.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
@@ -77,7 +76,6 @@
|
||||
#include <IAudioSystem.h>
|
||||
#include <ICmdLine.h>
|
||||
#include <IProcess.h>
|
||||
#include <LyShine/ILyShine.h>
|
||||
|
||||
#include <AzFramework/Archive/Archive.h>
|
||||
#include "XConsole.h"
|
||||
@@ -1105,11 +1103,6 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
InlineInitializationProcessing("CSystem::Init Level System");
|
||||
|
||||
if (m_env.pLyShine)
|
||||
{
|
||||
m_env.pLyShine->PostInit();
|
||||
}
|
||||
|
||||
InlineInitializationProcessing("CSystem::Init InitLmbrAWS");
|
||||
|
||||
// Az to Cry console binding
|
||||
|
||||
Reference in New Issue
Block a user