Skip to content

Commit

Permalink
Expose seamless travel option property
Browse files Browse the repository at this point in the history
  • Loading branch information
nxrighthere committed May 13, 2021
1 parent d730cd5 commit 7341a97
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 2 deletions.
10 changes: 10 additions & 0 deletions API/GameModeBase-HandleSeamlessTravelPlayer(Controller).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[GameModeBase](./GameModeBase.md 'UnrealEngine.Framework.GameModeBase')
## GameModeBase.HandleSeamlessTravelPlayer(UnrealEngine.Framework.Controller) Method
Reinitializes a player remained through a seamless level transition
```csharp
public void HandleSeamlessTravelPlayer(UnrealEngine.Framework.Controller controller);
```
#### Parameters
<a name='UnrealEngine-Framework-GameModeBase-HandleSeamlessTravelPlayer(UnrealEngine-Framework-Controller)-controller'></a>
`controller` [Controller](./Controller.md 'UnrealEngine.Framework.Controller')

8 changes: 8 additions & 0 deletions API/GameModeBase-UseSeamlessTravel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[GameModeBase](./GameModeBase.md 'UnrealEngine.Framework.GameModeBase')
## GameModeBase.UseSeamlessTravel Property
Gets or sets whether the game perform seamless map travels which loads in the background and doesn't disconnect clients
```csharp
public bool UseSeamlessTravel { get; set; }
```
#### Property Value
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
3 changes: 3 additions & 0 deletions API/GameModeBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ Defines the game being played, instantiated only on the server
public class GameModeBase : UnrealEngine.Framework.Actor
```
Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') &#129106; [Actor](./Actor.md 'UnrealEngine.Framework.Actor') &#129106; GameModeBase
### Properties
- [UseSeamlessTravel](./GameModeBase-UseSeamlessTravel.md 'UnrealEngine.Framework.GameModeBase.UseSeamlessTravel')
### Methods
- [HandleSeamlessTravelPlayer(UnrealEngine.Framework.Controller)](./GameModeBase-HandleSeamlessTravelPlayer(Controller).md 'UnrealEngine.Framework.GameModeBase.HandleSeamlessTravelPlayer(UnrealEngine.Framework.Controller)')
- [SwapPlayerControllers(UnrealEngine.Framework.PlayerController, UnrealEngine.Framework.PlayerController)](./GameModeBase-SwapPlayerControllers(PlayerController_PlayerController).md 'UnrealEngine.Framework.GameModeBase.SwapPlayerControllers(UnrealEngine.Framework.PlayerController, UnrealEngine.Framework.PlayerController)')
6 changes: 5 additions & 1 deletion Source/Managed/Framework/Codegen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace UnrealEngine.Framework {
// Automatically generated

internal static class Shared {
internal const int checksum = 0x2CB;
internal const int checksum = 0x2CD;
internal static Dictionary<int, IntPtr> userFunctions = new();
private const string dynamicTypesAssemblyName = "UnrealEngine.DynamicTypes";
private static readonly ModuleBuilder moduleBuilder = AssemblyBuilder.DefineDynamicAssembly(new(dynamicTypesAssemblyName), AssemblyBuilderAccess.RunAndCollect).DefineDynamicModule(dynamicTypesAssemblyName);
Expand Down Expand Up @@ -334,6 +334,8 @@ internal static unsafe Dictionary<int, IntPtr> Load(IntPtr* events, IntPtr funct
int head = 0;
IntPtr* gameModeBaseFunctions = (IntPtr*)buffer[position++];

GameModeBase.getUseSeamlessTravel = (delegate* unmanaged[Cdecl]<IntPtr, Bool>)gameModeBaseFunctions[head++];
GameModeBase.setUseSeamlessTravel = (delegate* unmanaged[Cdecl]<IntPtr, Bool, void>)gameModeBaseFunctions[head++];
GameModeBase.swapPlayerControllers = (delegate* unmanaged[Cdecl]<IntPtr, IntPtr, IntPtr, void>)gameModeBaseFunctions[head++];
}

Expand Down Expand Up @@ -1588,6 +1590,8 @@ unsafe partial class Actor {
}

unsafe partial class GameModeBase {
internal static delegate* unmanaged[Cdecl]<IntPtr, Bool> getUseSeamlessTravel;
internal static delegate* unmanaged[Cdecl]<IntPtr, Bool, void> setUseSeamlessTravel;
internal static delegate* unmanaged[Cdecl]<IntPtr, IntPtr, IntPtr, void> swapPlayerControllers;
}

Expand Down
8 changes: 8 additions & 0 deletions Source/Managed/Framework/Framework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5465,6 +5465,14 @@ private protected GameModeBase() { }

internal GameModeBase(IntPtr pointer) => Pointer = pointer;

/// <summary>
/// Gets or sets whether the game perform seamless map travels which loads in the background and doesn't disconnect clients
/// </summary>
public bool UseSeamlessTravel {
get => getUseSeamlessTravel(Pointer);
set => setUseSeamlessTravel(Pointer, value);
}

/// <summary>
/// Swaps player controllers
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Source/Managed/Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnrealEngine.Framework;

namespace UnrealEngine.Tests {
public static class Main {
public class Main {
private static ISystem runningSystem;

public static void OnWorldPostBegin() {
Expand Down
2 changes: 2 additions & 0 deletions Source/Native/Source/UnrealCLR/Private/UnrealCLR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ void UnrealCLR::Module::StartupModule() {
int32 head = 0;
Shared::Functions[position++] = Shared::GameModeBaseFunctions;

Shared::GameModeBaseFunctions[head++] = (void*)&UnrealCLRFramework::GameModeBase::GetUseSeamlessTravel;
Shared::GameModeBaseFunctions[head++] = (void*)&UnrealCLRFramework::GameModeBase::SetUseSeamlessTravel;
Shared::GameModeBaseFunctions[head++] = (void*)&UnrealCLRFramework::GameModeBase::SwapPlayerControllers;

checksum += head;
Expand Down
8 changes: 8 additions & 0 deletions Source/Native/Source/UnrealCLR/Private/UnrealCLRFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1683,6 +1683,14 @@ namespace UnrealCLRFramework {
}

namespace GameModeBase {
bool GetUseSeamlessTravel(AGameModeBase* GameModeBase) {
return GameModeBase->bUseSeamlessTravel;
}

void SetUseSeamlessTravel(AGameModeBase* GameModeBase, bool Value) {
GameModeBase->bUseSeamlessTravel = Value;
}

void SwapPlayerControllers(AGameModeBase* GameModeBase, APlayerController* PlayerController, APlayerController* NewPlayerController) {
GameModeBase->SwapPlayerControllers(PlayerController, NewPlayerController);
}
Expand Down
2 changes: 2 additions & 0 deletions Source/Native/Source/UnrealCLR/Public/UnrealCLRFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,8 @@ namespace UnrealCLRFramework {
}

namespace GameModeBase {
static bool GetUseSeamlessTravel(AGameModeBase* GameModeBase);
static void SetUseSeamlessTravel(AGameModeBase* GameModeBase, bool Value);
static void SwapPlayerControllers(AGameModeBase* GameModeBase, APlayerController* PlayerController, APlayerController* NewPlayerController);
}

Expand Down

0 comments on commit 7341a97

Please sign in to comment.