Class UnrealHookClientBase<TDataType>
Base class for IUnrealToolkitHookClient that uses Bifrost as the underlying RPC connection.
Implements
Inherited Members
Namespace: Microsoft.XboxStudios.UnrealToolkit.Bifrost.HookClient
Assembly: UnrealToolkit.Bifrost.HookClient.dll
Syntax
public abstract class UnrealHookClientBase<TDataType> : IUnrealToolkitHookClient, IUnrealGameHooks, IUnrealPlayerHooks, IDisposable, IAsyncDisposable where TDataType : class
Type Parameters
Name | Description |
---|---|
TDataType | The type of the protocol packet. |
Remarks
Initializes a new instance of the UnrealHookClientBase<TDataType> class.
Constructors
View SourceUnrealHookClientBase(IClient<TDataType>)
Base class for IUnrealToolkitHookClient that uses Bifrost as the underlying RPC connection.
Declaration
protected UnrealHookClientBase(IClient<TDataType> client)
Parameters
Type | Name | Description |
---|---|---|
IClient<TDataType> | client | The client to use to connect to the game application. |
Remarks
Initializes a new instance of the UnrealHookClientBase<TDataType> class.
Properties
View SourceClient
Gets the client to use to connect to the game application.
Declaration
public IClient<TDataType> Client { get; }
Property Value
Type | Description |
---|---|
IClient<TDataType> |
Methods
View SourceConnectAsync(CancellationToken)
Connects the hook client if necessary.
Declaration
public Task ConnectAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Whether this client is disposing or not. |
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
Declaration
public ValueTask DisposeAsync()
Returns
Type | Description |
---|---|
ValueTask | A task that represents the asynchronous dispose operation. |
DisposeAsyncCore()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected virtual ValueTask DisposeAsyncCore()
Returns
Type | Description |
---|---|
ValueTask | A task. |
ExecuteCommandAsync(string, CancellationToken)
Executes a console command in the game client.
Declaration
public abstract Task<string> ExecuteCommandAsync(string command, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | command | Command to execute (includes arguments). |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task<string> | Output of the command (if any). |
GetActorPropertiesAsync(string?, string?, IEnumerable<string>, CancellationToken)
Retrieves property values for all actors matching the given query.
Declaration
public abstract Task<IEnumerable<(string ResultClass, string ResultName, KeyValuePair<string, object> Properties)>> GetActorPropertiesAsync(string? className, string? objectName, IEnumerable<string> properties, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | className | The class name of actors to look for. |
string | objectName | The name of actors to look for. |
IEnumerable<string> | properties | The properties to retrieve. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task<IEnumerable<(string ResultClass, string ResultName, KeyValuePair<string, object> Properties)>> | A Task that contains an enumeration of each matching actor and property value. |
GetAutoCompleteCommandsAsync(CancellationToken)
Gets the auto complete data from the console in game.
Declaration
public abstract Task<IEnumerable<(string Command, string Description)>> GetAutoCompleteCommandsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task<IEnumerable<(string Command, string Description)>> | List of console commands from the console auto complete. |
GetCurrentMapAsync(CancellationToken)
Get some data of the current map.
Declaration
public abstract Task<(string Name, string Url)> GetCurrentMapAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task<(string Name, string Url)> | Data of the current map. |
GetObjectPropertiesAsync(string?, string?, IEnumerable<string>, CancellationToken)
Retrieves property values for all objects matching the given query.
Declaration
public abstract Task<IEnumerable<(string ResultClass, string ResultName, KeyValuePair<string, object> Properties)>> GetObjectPropertiesAsync(string? className, string? objectName, IEnumerable<string> properties, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | className | The class name of objects to look for. |
string | objectName | The name of objects to look for. |
IEnumerable<string> | properties | The properties to retrieve. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task<IEnumerable<(string ResultClass, string ResultName, KeyValuePair<string, object> Properties)>> | A Task that contains an enumeration of each matching object and property value. |
GetPlayerLocationAsync(int, CancellationToken)
Get the location of the player in the specified index.
Declaration
public abstract Task<Vector3> GetPlayerLocationAsync(int index, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the player. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task<Vector3> | Location of the player. |
GetPlayerRotationAsync(int, CancellationToken)
Get the rotation of the player in the specified index.
Declaration
public abstract Task<Rotation3> GetPlayerRotationAsync(int index, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the player. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task<Rotation3> | Rotation of the player. |
GetScreenshotAsync(bool, CancellationToken)
Gets a screenshot which was previously captured via TakeScreenshotAsync(bool, CancellationToken).
Declaration
public abstract Task<(int Width, int Height, byte[] Image)> GetScreenshotAsync(bool keepData = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
bool | keepData | Whether or not to delete the captured data and free game memory. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task<(int Width, int Height, byte[] Image)> | The screenshot width, height, and data in RGB 3 bytes-per-pixel format. |
LoadMapAsync(string, CancellationToken)
Load the specified map.
Declaration
public abstract Task LoadMapAsync(string mapFilePath, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | mapFilePath | The path to the map. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
SetPlayerLocationAsync(int, Vector3, CancellationToken)
Set the location of the player in the specified index.
Declaration
public abstract Task SetPlayerLocationAsync(int index, Vector3 location, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the player. |
Vector3 | location | New location. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
SetPlayerRotationAsync(int, Rotation3, CancellationToken)
Set the rotation of the player in the specified index.
Declaration
public abstract Task SetPlayerRotationAsync(int index, Rotation3 rotation, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the player. |
Rotation3 | rotation | New rotation. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
TakeAndGetScreenshotAsync(bool, bool, CancellationToken)
Takes and retrieves a screenshot of the game client viewport.
Declaration
public abstract Task<(int Width, int Height, byte[] Image)> TakeAndGetScreenshotAsync(bool showUI = false, bool keepData = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
bool | showUI | Whether or not to show game UI and messages. This controls Unreal's UI and custom UI may not be affected. |
bool | keepData | Whether or not to delete the captured data and free game memory. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task<(int Width, int Height, byte[] Image)> | The screenshot width, height, and data in RGB 3 bytes-per-pixel format. |
TakeScreenshotAsync(bool, CancellationToken)
Takes a screenshot of the game client viewport.
Declaration
public abstract Task TakeScreenshotAsync(bool showUI = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
bool | showUI | Whether or not to show game UI and messages. This controls Unreal's UI and custom UI may not be affected. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task | A Task that completes when the screenshot has been taken. |
TeleportPlayerAsync(int, Vector3, Rotation3, bool, CancellationToken)
Teleport the player in the specified index to a certain location
and rotation in the current map.
SetPlayerLocationAndRotation
, this method
can check for clipping issues.
Declaration
public abstract Task TeleportPlayerAsync(int index, Vector3 location, Rotation3 rotation, bool enforceNotClipping, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the player to teleport. |
Vector3 | location | Location to teleport the player to. |
Rotation3 | rotation | Rotation to place the player in. |
bool | enforceNotClipping | Indicates if the teleport should be done no matter what. If set to true the engine will look for and adjust or fail due to clipping issues. If set to false, clipping issues may happen. |
CancellationToken | cancellationToken | A cancellation token for the operation. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |