Open 3D Engine LyShine Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
UiGameEntityContext Class Reference

#include <UiGameEntityContext.h>

Inherits UiEntityContext, UiGameEntityContextBus::Handler, and AzFramework::SliceInstantiationResultBus::MultiHandler.

Classes

struct  InstantiatingDynamicSlice
 

Public Member Functions

 UiGameEntityContext (AZ::EntityId canvasEntityId=AZ::EntityId())
 
bool HandleLoadedRootSliceEntity (AZ::Entity *rootEntity, bool remapIds, AZ::SliceComponent::EntityIdToEntityIdMap *idRemapTable=nullptr)
 
bool DestroyEntity (AZ::Entity *entity) override
 
void InitUiContext () override
 Initialize the entity context and instantiate the root slice.
 
void DestroyUiContext () override
 Destroy the Entity Context.
 
bool SaveToStreamForGame (AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType) override
 
bool SaveCanvasEntityToStreamForGame (AZ::Entity *canvasEntity, AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType) override
 
AZ::Entity * CreateUiEntity (const char *name) override
 
void AddUiEntity (AZ::Entity *entity) override
 
void AddUiEntities (const AzFramework::EntityList &entities) override
 
bool CloneUiEntities (const AZStd::vector< AZ::EntityId > &sourceEntities, AzFramework::EntityList &resultEntities) override
 
bool DestroyUiEntity (AZ::EntityId entityId) override
 
AzFramework::SliceInstantiationTicket InstantiateDynamicSlice (const AZ::Data::Asset< AZ::Data::AssetData > &sliceAsset, const AZ::Vector2 &position, bool isViewportPostion, AZ::Entity *parent, const AZ::IdUtils::Remapper< AZ::EntityId >::IdMapper &customIdMapper) override
 
void OnSlicePreInstantiate (const AZ::Data::AssetId &sliceAssetId, const AZ::SliceComponent::SliceInstanceAddress &instance) override
 
void OnSliceInstantiated (const AZ::Data::AssetId &sliceAssetId, const AZ::SliceComponent::SliceInstanceAddress &instance) override
 
void OnSliceInstantiationFailed (const AZ::Data::AssetId &sliceAssetId) override
 
void SetCanvasEntity (AZ::EntityId canvasEntityId)
 
virtual void InitUiContext ()=0
 Initialize the entity context and instantiate the root slice.
 
virtual void DestroyUiContext ()=0
 Destroy the Entity Context.
 
virtual bool SaveToStreamForGame (AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType)=0
 
virtual bool SaveCanvasEntityToStreamForGame (AZ::Entity *canvasEntity, AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType)=0
 

Protected Member Functions

void OnContextEntitiesAdded (const AzFramework::EntityList &entities) override
 
void InitializeEntities (const AzFramework::EntityList &entities)
 
bool ValidateEntitiesAreValidForContext (const AzFramework::EntityList &entities) override
 

Protected Attributes

AZStd::unordered_map< AzFramework::SliceInstantiationTicket, InstantiatingDynamicSlicem_instantiatingDynamicSlices
 
AZ::EntityId m_canvasEntityId
 

Detailed Description

The UiGameEntityContext is used for a canvas that is loaded in game as oppoed to being open for editing

Member Function Documentation

◆ DestroyUiContext()

void UiGameEntityContext::DestroyUiContext ( )
overridevirtual

Destroy the Entity Context.

Implements UiEntityContext.

◆ InitUiContext()

void UiGameEntityContext::InitUiContext ( )
overridevirtual

Initialize the entity context and instantiate the root slice.

Implements UiEntityContext.

◆ SaveCanvasEntityToStreamForGame()

bool UiGameEntityContext::SaveCanvasEntityToStreamForGame ( AZ::Entity *  canvasEntity,
AZ::IO::GenericStream &  stream,
AZ::DataStream::StreamType  streamType 
)
overridevirtual

Saves the given canvas entity to the specified buffer. If necessary the entity undergoes conversion for game: editor -> game components.

Returns
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.

Implements UiEntityContext.

◆ SaveToStreamForGame()

bool UiGameEntityContext::SaveToStreamForGame ( AZ::IO::GenericStream &  stream,
AZ::DataStream::StreamType  streamType 
)
overridevirtual

Saves the context's slice root to the specified buffer. If necessary entities undergo conversion for game: editor -> game components.

Returns
true if successfully saved. Failure is only possible if serialization data is corrupt.

Implements UiEntityContext.


The documentation for this class was generated from the following file: