#include "OperatingSystemDeviceActor.h"
|
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) |
|
An operating system device actor that user can place in world.
- Note
- This is where everything begins
◆ 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
-
OutError | A reference to a FGenericError object that will hold any error information if an error occurs during device creation. |
◆ 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.
◆ 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()
Retrieves the hardware by the specified tag.
- Parameters
-
TestTag | The gameplay tag used for filtering hardware. |
- Returns
- The instance of UOperatingSystemBaseHardware that matches the specified tag.
◆ 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
-
OutError | A reference to a FGenericError object that will hold any error encountered during device creation. |
- Returns
- True if the device creation was successful, false otherwise.
◆ 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
-
OnScreenTime | The 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.
◆ 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.
◆ 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
-
ChangedWidget | The 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. |
◆ OnLoadGame()
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
-
LoadData | The 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
-
OutError | A reference to a FGenericError object that can be used to return error messages if necessary. |
Reimplemented in AOperatingSystemPortableDeviceActor.
◆ OnSaveGame()
Saves the state of the operating system device in the provided save data.
- Parameters
-
SaveData | The 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.
◆ OnShowBlueScreen()
void AOperatingSystemDeviceActor::OnShowBlueScreen |
( |
const float & | OnScreenTime | ) |
|
Called when the blue screen should be shown on the operating system device.
- Parameters
-
OnScreenTime | The 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
◆ 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
-
OutError | A 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.
◆ SetAddWidgetsToScreen()
Sets the method for adding widgets to the screen.
Depending on the specified method, widgets may be added to the screen or not.
- Parameters
-
Method | The 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
-
ChangedWidget | The pointer to the user widget that has been changed. |
◆ 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
Target device class to create.
◆ DeviceTag
FGameplayTag AOperatingSystemDeviceActor::DeviceTag |
|
protected |
A unique tag to identify this device.
◆ LoadGameInstance
◆ MainComponent
TObjectPtr<USceneComponent> AOperatingSystemDeviceActor::MainComponent |
|
protected |
◆ MediaSoundComponent
TObjectPtr<UMediaSoundComponent> AOperatingSystemDeviceActor::MediaSoundComponent |
|
protected |
◆ MessengerClass
◆ 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:
{
}
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
The documentation for this class was generated from the following files: