Operating System Simulator Plugin  3.5.1
Unreal Engine plugin that simulates an Operating System Environment
Loading...
Searching...
No Matches
AOperatingSystemDeviceActor Class Reference

#include "OperatingSystemDeviceActor.h"

Inheritance diagram for AOperatingSystemDeviceActor:
[legend]
Collaboration diagram for AOperatingSystemDeviceActor:
[legend]

Public Member Functions

virtual void OnValidate (FGenericError &OutError)
 This method is called to validate the object's state.
 
OPERATINGSYSTEMSIMULATOR_API void CreateDevice (FGenericError &OutError)
 
void CurrentDeviceDestroyed ()
 Method to handle the destruction of the current device.
 
void RestartDevice ()
 
void WidgetChanged (UUserWidget *ChangedWidget)
 Handles the event when a widget is changed.
 
void OnShowBlueScreen (const float &OnScreenTime)
 
void StopMediaAudio () const
 
OPERATINGSYSTEMSIMULATOR_API UOperatingSystemBaseHardwareGetHardwareByTag (const FGameplayTag &TestTag) const
 
void SetAddWidgetsToScreen (const EOperatingSystemWidgetSet Method)
 
void ClearWidgetFromScreen () const
 
void RefreshWidget () const
 
OPERATINGSYSTEMSIMULATOR_API bool IsPortableDevice () const
 Determines whether the operating system device actor is a portable device.
 
void BeginDestroyMessenger ()
 
void FinishDestroyMessenger ()
 A method to finish the destruction of the operating system device actor.
 
virtual OPERATINGSYSTEMSIMULATOR_API void OnSaveGame (FOperatingSystemDeviceSaveLoad &SaveData)
 
virtual OPERATINGSYSTEMSIMULATOR_API void OnLoadGame (const FOperatingSystemDeviceSaveLoad &LoadData)
 Callback method called when loading a game.
 

Public Attributes

FOnDeviceCreated OnDeviceCreated
 
FOnOperatingSystemStarted OnOperatingSystemStarted
 

Protected Member Functions

virtual OPERATINGSYSTEMSIMULATOR_API void OnNewDeviceCreated (FGenericError &OutError)
 This method is called when a new device has been created. This method is intended to be overridden in subclasses of OperatingSystemDeviceActor to handle the event of a new device being created. It provides a way for the subclass to perform any necessary actions or processing related to the new device.
 
virtual bool IsPortableDeviceImpl () const
 Determines if the device is portable or not. By default, the method returns false.
 
bool K2_CreateDevice (FGenericError &OutError)
 
void K2_OnCurrentDeviceDestroyed ()
 
void K2_OnWidgetChanged (UUserWidget *ChangedWidget)
 Notifies the actor when the widget has changed.
 
void K2_OnBlueScreenShow (const float &OnScreenTime)
 

Protected Attributes

TObjectPtr< USceneComponent > MainComponent
 
TObjectPtr< UMediaSoundComponent > MediaSoundComponent
 
FGameplayTag DeviceTag
 
TSoftClassPtr< UOperatingSystemBaseDeviceDeviceClass
 
uint8 bCreateDeviceOnBeginPlay: 1
 
uint8 bAddWidgetsToScreen: 1
 
uint8 bExitWhenDeviceIsDestroyed: 1
 
uint8 bCanSaveGame: 1
 
TSoftClassPtr< UOperatingSystemSaveGameSaveGameClass
 
TSoftClassPtr< UOperatingSystemDeviceMessengerMessengerClass
 
TObjectPtr< UOperatingSystemSaveGameLoadGameInstance
 

Detailed Description

An operating system device actor that user can place in world.

Note
This is where everything begins

Member Function Documentation

◆ BeginDestroyMessenger()

void AOperatingSystemDeviceActor::BeginDestroyMessenger ( )

Begins the destruction process for the messenger associated with the operating system device actor.

This method is responsible for initiating the destruction process for the messenger. It calls the BeginDestroyMessenger method of the DeviceMessenger associated with the operating system device actor.

Note
This method should only be called when the operating system device actor is being destroyed.
See also
DeviceMessenger, AOperatingSystemDeviceActor

◆ ClearWidgetFromScreen()

void AOperatingSystemDeviceActor::ClearWidgetFromScreen ( ) const

Clears the widget from the screen.

This method clears the currently displayed widget from the screen. It checks if the current device is valid. If valid, it calls the "ClearOnScreenWidget()" method of the current device to clear the widget from the screen.

◆ CreateDevice()

void AOperatingSystemDeviceActor::CreateDevice ( FGenericError & OutError)

Creates a new device.

This method creates a new device based on the specified class and instance. If the 'CurrentDevice' member variable is already set, an error will be returned and no device will be created. The 'DeviceClass' argument should not be null, otherwise an error will be returned. The 'DeviceTag' argument should have a valid tag, otherwise an error will be returned.

If the device creation is successful, the 'CurrentDevice' member variable will be set to the created device.

Parameters
OutErrorA reference to a FGenericError object that will hold any error information if an error occurs during device creation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CurrentDeviceDestroyed()

void AOperatingSystemDeviceActor::CurrentDeviceDestroyed ( )

Method to handle the destruction of the current device.

This method is called when the current device is being destroyed. It performs various cleanup operations and handles any necessary actions. If the current device is valid, it checks if there is a blueprint assigned to the "CurrentDeviceDestroyed" event and calls it if available. It then unbinds the "OnOperatingSystemStartedDelegate" event from the current device, marks it as garbage, and sets the current device to nullptr.

If the "bExitWhenDeviceIsDestroyed" flag is set to true, the method executes additional actions. In the editor mode, it retrieves the player controller and executes the "exit" console command, which will exit the game. Otherwise, it requests the exit of the application.

Here is the call graph for this function:

◆ FinishDestroyMessenger()

void AOperatingSystemDeviceActor::FinishDestroyMessenger ( )

A method to finish the destruction of the operating system device actor.

This method marks the device messenger as garbage and sets it to nullptr.

Note
This method should be called to properly destroy the operating system device actor.
Preconditions:
  • The device messenger must be initialized and assigned.
Postconditions:
  • The device messenger will be marked as garbage.
  • The device messenger will be set to nullptr.

◆ GetHardwareByTag()

UOperatingSystemBaseHardware * AOperatingSystemDeviceActor::GetHardwareByTag ( const FGameplayTag & TestTag) const

Retrieves the hardware by the specified tag.

Parameters
TestTagThe gameplay tag used for filtering hardware.
Returns
The instance of UOperatingSystemBaseHardware that matches the specified tag.
Here is the caller graph for this function:

◆ IsPortableDevice()

OPERATINGSYSTEMSIMULATOR_API bool AOperatingSystemDeviceActor::IsPortableDevice ( ) const
inline

Determines whether the operating system device actor is a portable device.

Returns
True if the operating system device actor is a portable device, false otherwise.

◆ IsPortableDeviceImpl()

virtual bool AOperatingSystemDeviceActor::IsPortableDeviceImpl ( ) const
inlineprotectedvirtual

Determines if the device is portable or not. By default, the method returns false.

Returns
True if the device is portable, false otherwise.

Reimplemented in AOperatingSystemPortableDeviceActor.

◆ K2_CreateDevice()

bool AOperatingSystemDeviceActor::K2_CreateDevice ( FGenericError & OutError)
protected

Creates a device in the operating system.

Note
The device creation is the first step in the process.
Parameters
OutErrorA reference to a FGenericError object that will hold any error encountered during device creation.
Returns
True if the device creation was successful, false otherwise.
Here is the call graph for this function:

◆ K2_OnBlueScreenShow()

void AOperatingSystemDeviceActor::K2_OnBlueScreenShow ( const float & OnScreenTime)
protected

Event that is triggered when the blue screen is shown on the operating system device actor.

Parameters
OnScreenTimeThe amount of time the blue screen will be displayed on the screen.
Note
This event can be implemented in Blueprint to perform additional logic when the blue screen is shown. The implementation should be placed in the blueprint graph associated with the operating system device actor. The OnScreenTime parameter specifies the duration the blue screen will remain visible on the screen.
Here is the caller graph for this function:

◆ K2_OnCurrentDeviceDestroyed()

void AOperatingSystemDeviceActor::K2_OnCurrentDeviceDestroyed ( )
protected

Notifies the actor that the current device has been destroyed.

This event is blueprint implementable, allowing the user to define their own behavior when the current device is destroyed.

Note
This event will only be called when the current device associated with the actor is destroyed.
Here is the caller graph for this function:

◆ K2_OnWidgetChanged()

void AOperatingSystemDeviceActor::K2_OnWidgetChanged ( UUserWidget * ChangedWidget)
protected

Notifies the actor when the widget has changed.

This event is called when the user widget associated with the operating system device actor has been changed.

Parameters
ChangedWidgetThe new user widget that has been assigned to the operating system device actor. This parameter can be nullptr if the widget is being cleared. The ownership of the widget remains with the caller and it's the caller responsibility to properly manage the widget's lifetime.
Here is the caller graph for this function:

◆ OnLoadGame()

virtual OPERATINGSYSTEMSIMULATOR_API void AOperatingSystemDeviceActor::OnLoadGame ( const FOperatingSystemDeviceSaveLoad & LoadData)
inlinevirtual

Callback method called when loading a game.

This method is called when a game is being loaded. It is a virtual method that can be overridden by derived classes to provide custom logic for loading a game.

Parameters
LoadDataThe save/load data for the operating system device.
Note
This method should be overridden in derived classes to load additional state data.
See also
FOperatingSystemDeviceSaveLoad

Reimplemented in AOperatingSystemPortableDeviceActor.

◆ OnNewDeviceCreated()

virtual OPERATINGSYSTEMSIMULATOR_API void AOperatingSystemDeviceActor::OnNewDeviceCreated ( FGenericError & OutError)
inlineprotectedvirtual

This method is called when a new device has been created. This method is intended to be overridden in subclasses of OperatingSystemDeviceActor to handle the event of a new device being created. It provides a way for the subclass to perform any necessary actions or processing related to the new device.

Note
It is important to handle any errors that may occur during the processing of the new device creation. The OutError parameter can be used to return any error messages or information.
Parameters
OutErrorA reference to a FGenericError object that can be used to return error messages if necessary.

Reimplemented in AOperatingSystemPortableDeviceActor.

Here is the caller graph for this function:

◆ OnSaveGame()

virtual OPERATINGSYSTEMSIMULATOR_API void AOperatingSystemDeviceActor::OnSaveGame ( FOperatingSystemDeviceSaveLoad & SaveData)
inlinevirtual

Saves the state of the operating system device in the provided save data.

Parameters
SaveDataThe reference to the save data object where the state will be saved.
Note
This method should be overridden in derived classes to save additional state data.

Reimplemented in AOperatingSystemPortableDeviceActor.

Here is the caller graph for this function:

◆ OnShowBlueScreen()

void AOperatingSystemDeviceActor::OnShowBlueScreen ( const float & OnScreenTime)

Called when the blue screen should be shown on the operating system device.

Parameters
OnScreenTimeThe time in seconds the blue screen should be shown on the screen.
Note
This method is called when the operating system device actor is requested to show the blue screen. If the 'bHasBlueprintOnBlueScreenShow' flag is true, the K2_OnBlueScreenShow method in the blueprint will be called with the specified "OnScreenTime".
See also
K2_OnBlueScreenShow
Here is the call graph for this function:

◆ OnValidate()

virtual void AOperatingSystemDeviceActor::OnValidate ( FGenericError & OutError)
inlinevirtual

This method is called to validate the object's state.

This method should be implemented by derived classes to validate the state of the object. If any errors are found during the validation, they should be added to the provided OutError parameter.

Parameters
OutErrorA reference to a FGenericError object, which is used to store any errors found during validation.
Note
The derived class must provide an implementation for this method.

Reimplemented in AOperatingSystemPortableDeviceActor.

◆ RefreshWidget()

void AOperatingSystemDeviceActor::RefreshWidget ( ) const

Checks if the current device is valid and then calls the ReApplyWidget() method on the current device.

◆ RestartDevice()

void AOperatingSystemDeviceActor::RestartDevice ( )

Restarts the device.

This method restarts the operating system device. If the device has a blueprint on it that is destroyed, this method triggers the K2_OnCurrentDeviceDestroyed event.

If there is a current device, this method unbinds the OnOperatingSystemStartedDelegate and marks the current device as garbage. It then sets the CurrentDevice pointer to nullptr.

After that, it creates a timer delegate for the CreateDevice function and binds it to this actor. The delegate is then set to be executed after 1 second.

Note
This method assumes that the CurrentDevice pointer is already set to a valid device.
Here is the call graph for this function:

◆ SetAddWidgetsToScreen()

void AOperatingSystemDeviceActor::SetAddWidgetsToScreen ( const EOperatingSystemWidgetSet Method)

Sets the method for adding widgets to the screen.

Depending on the specified method, widgets may be added to the screen or not.

Parameters
MethodThe method for adding widgets to the screen.

◆ StopMediaAudio()

void AOperatingSystemDeviceActor::StopMediaAudio ( ) const

Stops the media audio playback.

This method stops the media audio playback by calling the Stop() function of the MediaSoundComponent.

Note
The MediaSoundComponent must be valid and initialized before calling this method.
See also
MediaSoundComponent

◆ WidgetChanged()

void AOperatingSystemDeviceActor::WidgetChanged ( UUserWidget * ChangedWidget)

Handles the event when a widget is changed.

This method is called when a user widget is changed in the operating system device actor.

Parameters
ChangedWidgetThe pointer to the user widget that has been changed.
Here is the call graph for this function:

Member Data Documentation

◆ bAddWidgetsToScreen

uint8 AOperatingSystemDeviceActor::bAddWidgetsToScreen
protected

If true, add widgets directly to viewport screen.

◆ bCanSaveGame

uint8 AOperatingSystemDeviceActor::bCanSaveGame
protected

Determines if this device support save game.

◆ bCreateDeviceOnBeginPlay

uint8 AOperatingSystemDeviceActor::bCreateDeviceOnBeginPlay
protected

If true, create the device on begin play. If false, you can manually call Create Device whenever you need.

◆ bExitWhenDeviceIsDestroyed

uint8 AOperatingSystemDeviceActor::bExitWhenDeviceIsDestroyed
protected

Set to exit game when the device is destroyed. Device is destroyed when the OS shuts down.

◆ DeviceClass

TSoftClassPtr<UOperatingSystemBaseDevice> AOperatingSystemDeviceActor::DeviceClass
protected

Target device class to create.

◆ DeviceTag

FGameplayTag AOperatingSystemDeviceActor::DeviceTag
protected

A unique tag to identify this device.

◆ LoadGameInstance

TObjectPtr<UOperatingSystemSaveGame> AOperatingSystemDeviceActor::LoadGameInstance
protected

◆ MainComponent

TObjectPtr<USceneComponent> AOperatingSystemDeviceActor::MainComponent
protected

◆ MediaSoundComponent

TObjectPtr<UMediaSoundComponent> AOperatingSystemDeviceActor::MediaSoundComponent
protected

◆ MessengerClass

TSoftClassPtr<UOperatingSystemDeviceMessenger> AOperatingSystemDeviceActor::MessengerClass
protected

Target messenger class.

◆ OnDeviceCreated

FOnDeviceCreated AOperatingSystemDeviceActor::OnDeviceCreated

Event raised when a new device is created.

This event is dispatched when a new device is created and associated with the operating system device actor. Subscribers can listen to this event to perform any necessary actions when a new device is created.

Example usage:

{
// Perform actions when a new device is created
}
// Subscribe to the OnDeviceCreated event
MyOperatingSystemDeviceActorInstance->OnDeviceCreated.AddDynamic(this, &AActorClass::OnNewDeviceCreated);
virtual OPERATINGSYSTEMSIMULATOR_API void OnNewDeviceCreated(FGenericError &OutError)
This method is called when a new device has been created. This method is intended to be overridden in...
Definition OperatingSystemDeviceActor.h:358

◆ OnOperatingSystemStarted

FOnOperatingSystemStarted AOperatingSystemDeviceActor::OnOperatingSystemStarted

An event that is raised when Operating System starts in this device.

◆ SaveGameClass

TSoftClassPtr<UOperatingSystemSaveGame> AOperatingSystemDeviceActor::SaveGameClass
protected

Target save game class.


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