Organizes scenes described by FScenario in a meaningful way. More...
#include <G:/UE5/UEProjects/5.7/VisualUEx/Plugins/VisualU/Source/VisualU/Public/VisualController.h>
Public Member Functions | |
| UVisualController (const FObjectInitializer &ObjectInitializer=FObjectInitializer::Get()) | |
| virtual void | BeginDestroy () override |
| Brings controller to idle state before destruction. | |
| virtual void | PreSave (FObjectPreSaveContext SaveContext) override |
| Brings controller to idle state before serialization. | |
| virtual void | PostInitProperties () override |
| Setups initial values to make controller operational. | |
| virtual void | SerializeController (FArchive &Ar) |
| Serializes controller to the provided archive. | |
| virtual void | Serialize (FArchive &Ar) override |
| Serializes controller to the provided archive. | |
| bool | RequestNextScene () |
| Visualizes the next scene in the node. | |
| bool | RequestPreviousScene () |
| Visualizes the previous scene in the node. | |
| bool | RequestAdjacentScene (EVisualControllerDirection::Type Direction=EVisualControllerDirection::Forward) |
| Visualizes a scene adjacent to the current scene in specified direction. | |
| bool | RequestScene (const FScenario *Scene) |
| Visualize any exhausted scene. | |
| bool | RequestScenario (const FScenario &Scenario) |
| const FScenario * | GetSceneAt (int32 Index) |
| Gets scene from the node at given position. | |
| bool | RequestNode (const UDataTable *NewNode) |
| Sets provided node as active and visualizes the first scene in it. | |
| bool | RequestFastMove (EVisualControllerDirection::Type Direction=EVisualControllerDirection::Forward) |
| Tries to activate fast move mode. | |
| bool | RequestAutoMove (EVisualControllerDirection::Type Direction=EVisualControllerDirection::Forward) |
| Tries to activate auto move. | |
| void | CancelFastMove () |
| Ends fast move mode when it is active. | |
| void | CancelAutoMove () |
| Ends auto move mode when it is active. | |
| void | VisualizeToScreen (TSubclassOf< UVisualRenderer > RendererClass, int32 ZOrder=0) |
| Reconstruct renderer to a new class if necessary and add it to the player screen. | |
| void | VisualizeToComponent (TSubclassOf< UVisualRenderer > RendererClass, UWidgetComponent *Component) |
| Reconstructs renderer to a new class if necessary and add it to the widget component. | |
| void | RemoveFromScreen () const |
| Removes renderer visualized to screen. | |
| void | SetRendererVisibility (ESlateVisibility Visibility) |
| Sets renderer visibility. | |
| ESlateVisibility | GetRendererVisibility () const |
| void | SetNumScenesToLoad (int32 Num) |
| Setter for UVisualController::NumScenesToLoad. | |
| FORCEINLINE int32 | GetNumScenesToLoad () const |
| void | ShouldPlayTransitions (bool bShouldPlay) |
| Setter for UVisualController::bPlayTransitions. | |
| FORCEINLINE bool | PlaysTransitions () const |
| void | ShouldPlaySound (bool bShouldPlay) |
| Setter for UVisualController::bPlaySound. | |
| FORCEINLINE bool | PlaysSound () const |
| void | SetAutoMoveDelay (float Delay) |
| Setter for UVisualController::AutoMoveDelay. | |
| FORCEINLINE float | GetAutoMoveDelay () const |
| const FScenario * | GetCurrentScene () const |
| const FScenario & | GetCurrentScenario () const |
| bool | CanAdvanceScene () const |
| bool | CanRetractScene () const |
| bool | IsWithChoice () const |
| bool | IsSceneExhausted (const FScenario *Scene) const |
| Is provided scene exhausted. | |
| bool | IsScenarioExhausted (const FScenario &Scenario) const |
| bool | IsTransitioning () const |
| Is renderer has transition ongoing. | |
| bool | IsCurrentScenarioHead () const |
| FORCEINLINE EVisualControllerMode | GetMode () const |
| FORCEINLINE bool | IsFastMoving () const |
| FORCEINLINE bool | IsAutoMoving () const |
| FORCEINLINE bool | IsIdle () const |
| const FString | GetHeadDebugString () const |
| Development only. | |
| const FString | GetAsyncQueueDebugString () const |
| Development only. | |
| const FString | GetExhaustedScenesDebugString () const |
| Development only. | |
Public Attributes | |
| FOnSceneStart | OnSceneStart |
| Called when controller has switched to a different scenario. | |
| FOnSceneEnd | OnSceneEnd |
| Called when controller is about to switch to a different scenario. | |
| FOnFastMoveStart | OnFastMoveStart |
| Called when controller enters Fast Move mode. | |
| FOnFastMoveEnd | OnFastMoveEnd |
| Called when controller exits Fast Move mode. | |
| FOnAutoMoveStart | OnAutoMoveStart |
| Called when controller enters Auto Move mode. | |
| FOnAutoMoveEnd | OnAutoMoveEnd |
| Called when controller exits Auto Move mode. | |
Protected Member Functions | |
| TSharedPtr< FStreamableHandle > | LoadSceneAsync (const FScenario *Scene, FStreamableDelegate AfterLoadDelegate=nullptr) |
| Asynchronously loads assets of the scene into the memory. | |
| TSharedPtr< FStreamableHandle > | LoadScene (const FScenario *Scene, FStreamableDelegate AfterLoadDelegate=nullptr) |
| Synchronously loads assets of the scene into the memory. | |
| void | PrepareScenes (EVisualControllerDirection::Type Direction=EVisualControllerDirection::Forward) |
| Asynchronously loads assets of future scenes after controller moves. | |
| void | TryPlaySceneSound (TSoftObjectPtr< USoundBase > SceneSound) const |
| Plays the scene sound when available. | |
| void | CancelNextScene () |
| Releases the handle for the assets of the next scene. | |
| bool | TryPlayTransition (const FScenario *From, const FScenario *To) |
| Requests renderer to display transition animation. | |
| void | RollbackTo (const FScenario *Scene) |
| Switches controller to the previously seen scene. | |
| UVisualVersioningSubsystem * | TryGetVisualVersioningSubsystem () const |
| void | AssertNextSceneLoad (EVisualControllerDirection::Type Direction=EVisualControllerDirection::Forward) |
| Guarantees that the next requested scene assets will be loaded. | |
Private Attributes | |
| TObjectPtr< UVisualRenderer > | Renderer |
| Responsible for visualizing scenes as widgets. | |
| TSharedPtr< FStreamableHandle > | NextSceneHandle |
| Handle for assets of the scene that are loaded into the memory. | |
| TArray< FScenario * > | Node |
| Currently active data table with scenes. | |
| int32 | SceneIndex |
| Position of the current scene. | |
| TQueue< TSharedPtr< FStreamableHandle > > | SceneHandles |
| Handles for resources of the following scenes. | |
| TDeque< TWeakPtr< FStreamableHandle > > | DebugSceneHandles {} |
| Additional debug queue that gathers weak references to scenes that are meant to be loaded asynchronously. | |
| TSet< const UDataTable * > | NodeReferenceKeeper |
| Maintains references to all data tables that currently own scenes that are referenced by controller. | |
| TArray< FScenario * > | ExhaustedScenes |
| Last scenes of already processed nodes which could be made current again in the future. | |
| const FScenario * | Head |
| So far, the deepest scene in Visual Controller. | |
| TUniquePtr< UE::VisualU::Private::FFastMoveAsyncTask > | FastMoveTask |
| Task to be dispatched asynchronously to perform fast move. | |
| FTSTicker::FDelegateHandle | AutoMoveHandle |
| Handle to the ticker that performs auto move. | |
| int32 | ScenesToLoad |
| How many following scenes will be loaded asynchronously. | |
| bool | bPlayTransitions |
| Should controller attempt to play transitions between scenes. | |
| bool | bPlaySound |
| Will controller attempt to play scene sound. | |
| float | AutoMoveDelay |
| How long, in seconds, controller should wait before moving to the next scene in auto move mode. | |
| EVisualControllerMode | Mode |
| Current state of this controller. | |
Organizes scenes described by FScenario in a meaningful way.
Must be created within APlayerController. Requires UVisualUSettings::FirstDataTable to be set at compile/editor time.
|
protected |
Guarantees that the next requested scene assets will be loaded.
| Direction | determines what is the next scene e.g. controller going back to the beginning or forward towards the end of the node |
| bool UVisualController::CanAdvanceScene | ( | ) | const |
true when there is a scene in front of the current one | void UVisualController::CancelAutoMove | ( | ) |
Ends auto move mode when it is active.
controller becomes idle.
| void UVisualController::CancelFastMove | ( | ) |
Ends fast move mode when it is active.
controller becomes idle.
|
protected |
Releases the handle for the assets of the next scene.
| bool UVisualController::CanRetractScene | ( | ) | const |
true when there is a scene behind the current one | const FString UVisualController::GetAsyncQueueDebugString | ( | ) | const |
Development only.
|
inline |
| const FScenario & UVisualController::GetCurrentScenario | ( | ) | const |
| const FScenario * UVisualController::GetCurrentScene | ( | ) | const |
| const FString UVisualController::GetExhaustedScenesDebugString | ( | ) | const |
Development only.
| const FString UVisualController::GetHeadDebugString | ( | ) | const |
Development only.
|
inline |
|
inline |
| ESlateVisibility UVisualController::GetRendererVisibility | ( | ) | const |
| const FScenario * UVisualController::GetSceneAt | ( | int32 | Index | ) |
Gets scene from the node at given position.
| Index | position of the scene |
|
inline |
true when controller is in auto move mode| bool UVisualController::IsCurrentScenarioHead | ( | ) | const |
true when current scene is UVisualController::Head
|
inline |
true when controller is in fast move mode
|
inline |
true when controller is idle| bool UVisualController::IsScenarioExhausted | ( | const FScenario & | Scenario | ) | const |
| bool UVisualController::IsSceneExhausted | ( | const FScenario * | Scene | ) | const |
Is provided scene exhausted.
| Scene | scene to check for exhaustion |
| bool UVisualController::IsTransitioning | ( | ) | const |
Is renderer has transition ongoing.
true for active scene transition | bool UVisualController::IsWithChoice | ( | ) | const |
|
protected |
Synchronously loads assets of the scene into the memory.
| Scene | scenario that provides assets to load |
| AfterLoadDelegate | delegate to execute after assets are loaded |
|
protected |
Asynchronously loads assets of the scene into the memory.
| Scene | scenario that provides assets to stream in |
| AfterLoadDelegate | delegate to execute after assets are loaded |
|
inline |
|
inline |
|
protected |
Asynchronously loads assets of future scenes after controller moves.
Has no effect when UVisualController::NumScenesToLoad is less than zero.
| Direction | determines where future scenes are |
|
overridevirtual |
Brings controller to idle state before serialization.
| SaveContext | save parameters |
| void UVisualController::RemoveFromScreen | ( | ) | const |
Removes renderer visualized to screen.
Has no effect on widget component or not visualized renderer.
| bool UVisualController::RequestAdjacentScene | ( | EVisualControllerDirection::Type | Direction = EVisualControllerDirection::Forward | ) |
Visualizes a scene adjacent to the current scene in specified direction.
| Direction | describes position of the adjacent scene to request |
| bool UVisualController::RequestAutoMove | ( | EVisualControllerDirection::Type | Direction = EVisualControllerDirection::Forward | ) |
Tries to activate auto move.
In this mode, controller will request scenes at the pace of UVisualController::AutoMoveDelay. This mode will end when scene with EScenarioMetaFlags::Choice is encountered.
| Direction | decides whether to request next or previous scenes |
| bool UVisualController::RequestFastMove | ( | EVisualControllerDirection::Type | Direction = EVisualControllerDirection::Forward | ) |
Tries to activate fast move mode.
In this mode, controller will request scenes in the specified direction as fast as possible. This mode will end when UVisualController::Head is reached or scene with EScenarioMetaFlags::Choice is encountered.
| Direction | decides whether to request next or previous scenes |
| bool UVisualController::RequestNextScene | ( | ) |
Visualizes the next scene in the node.
| bool UVisualController::RequestNode | ( | const UDataTable * | NewNode | ) |
Sets provided node as active and visualizes the first scene in it.
Will trigger assertion when:
FScenario| NewNode | data table with at least one scene |
| bool UVisualController::RequestPreviousScene | ( | ) |
Visualizes the previous scene in the node.
Can also display last exhausted scene from previous node.
| bool UVisualController::RequestScenario | ( | const FScenario & | Scenario | ) |
| bool UVisualController::RequestScene | ( | const FScenario * | Scene | ) |
Visualize any exhausted scene.
Will fail for any other scene.
| Scene | exhausted scenario to visualize |
|
protected |
Switches controller to the previously seen scene.
| Scene | scene to be visualized by this controller |
|
overridevirtual |
Serializes controller to the provided archive.
Uses FVisualUCustomVersion.
| Ar | archive to serialize this controller |
|
virtual |
Serializes controller to the provided archive.
Uses FVisualUCustomVersion.
| Ar | archive to serialize this controller |
| void UVisualController::SetAutoMoveDelay | ( | float | Delay | ) |
Setter for UVisualController::AutoMoveDelay.
| Delay | new delay, in seconds, between scenes in auto move mode |
| void UVisualController::SetNumScenesToLoad | ( | int32 | Num | ) |
Setter for UVisualController::NumScenesToLoad.
| Num | Number of scenes to load. Triggers a warning when larger than ScenesToLoadLargeNum |
| void UVisualController::SetRendererVisibility | ( | ESlateVisibility | Visibility | ) |
Sets renderer visibility.
| Visibility | new renderer visibility |
| void UVisualController::ShouldPlaySound | ( | bool | bShouldPlay | ) |
Setter for UVisualController::bPlaySound.
Calling this during fast moving mode is discouraged because bPlaySound may change after fast moving mode is over.
| bShouldPlay | true to play sound when available |
| void UVisualController::ShouldPlayTransitions | ( | bool | bShouldPlay | ) |
Setter for UVisualController::bPlayTransitions.
Calling this during fast moving mode is discouraged because bPlayTransitions may change after fast moving mode is over.
| bShouldPlay | true to play transitions when available |
|
protected |
|
protected |
Plays the scene sound when available.
Will fail when scene sound is invalid or controller doesn't play sound.
| SceneSound | audio to play |
|
protected |
Requests renderer to display transition animation.
| From | Scene that will be displayed at the start and then blended as transition progresses. Usually the currently displayed scene. |
| To | Scene that will be visualized after transition ends |
| void UVisualController::VisualizeToComponent | ( | TSubclassOf< UVisualRenderer > | RendererClass, |
| UWidgetComponent * | Component ) |
Reconstructs renderer to a new class if necessary and add it to the widget component.
| RendererClass | Renderer class, has no effect when current and provided classes are the same. |
| Component | widget component that should display the renderer |
| void UVisualController::VisualizeToScreen | ( | TSubclassOf< UVisualRenderer > | RendererClass, |
| int32 | ZOrder = 0 ) |
Reconstruct renderer to a new class if necessary and add it to the player screen.
| RendererClass | Renderer class, has no effect when current and provided classes are the same. |
| ZOrder | renderer layer on the screen |
|
private |
How long, in seconds, controller should wait before moving to the next scene in auto move mode.
Must be larger than transition duration to not stop on transitions.
|
private |
Handle to the ticker that performs auto move.
|
private |
Will controller attempt to play scene sound.
Changes to this value during fast moving mode may be reverted when said mode is over.
|
private |
Should controller attempt to play transitions between scenes.
Changes to this value during fast moving mode may be reverted when said mode is over.
|
private |
Additional debug queue that gathers weak references to scenes that are meant to be loaded asynchronously.
|
private |
Last scenes of already processed nodes which could be made current again in the future.
In other words, when controller returns back to the exhausted scene, that scene is not exhausted anymore untill the controller advances forward again.
|
private |
Task to be dispatched asynchronously to perform fast move.
|
private |
So far, the deepest scene in Visual Controller.
It does not account for parallel branches. That means that when the new node is introduced, its first scene will become the head even if it has less scenes than parallel node (e.g. other choice option)
|
private |
Current state of this controller.
Controller can be fast moving, auto moving, or idle.
|
private |
Currently active data table with scenes.
| FOnAutoMoveStart UVisualController::OnAutoMoveStart |
Called when controller enters Auto Move mode.
| Direction | direction in which controller moves |
| FOnFastMoveStart UVisualController::OnFastMoveStart |
Called when controller enters Fast Move mode.
| Direction | direction in which controller moves |
| FOnSceneEnd UVisualController::OnSceneEnd |
Called when controller is about to switch to a different scenario.
| Scenario | active scenario before controller switches |
| FOnSceneStart UVisualController::OnSceneStart |
Called when controller has switched to a different scenario.
| Scenario | scenario to which controller has swiched to |
|
private |
Responsible for visualizing scenes as widgets.
|
private |
Handles for resources of the following scenes.
|
private |
How many following scenes will be loaded asynchronously.
Zero means no asynchronous loading.