Deserialize FUniqueNetIdRepl
This commit is contained in:
@@ -27,6 +27,10 @@ internal static class Program
|
||||
|
||||
Logger.Information("Starting Prospect.Server.Game");
|
||||
|
||||
// Prospect:
|
||||
// Map: /Game/Maps/MP/Station/Station_P
|
||||
// GameMode: /Script/Prospect/YGameMode_Station
|
||||
|
||||
var worldUrl = new FUrl
|
||||
{
|
||||
Map = "/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap"
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
namespace Prospect.Unreal.Net;
|
||||
using Prospect.Unreal.Core.Names;
|
||||
|
||||
namespace Prospect.Unreal.Net;
|
||||
|
||||
public class FUniqueNetId
|
||||
{
|
||||
public FUniqueNetId(string contents)
|
||||
public FUniqueNetId(FName type, string contents)
|
||||
{
|
||||
Type = type;
|
||||
Contents = contents;
|
||||
}
|
||||
|
||||
|
||||
public FName Type { get; }
|
||||
public string Contents { get; }
|
||||
|
||||
public bool IsValid()
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Prospect.Unreal.Net;
|
||||
public class FUniqueNetIdRepl
|
||||
{
|
||||
private static readonly ILogger Logger = Log.ForContext<FUniqueNetIdRepl>();
|
||||
private const int TypeHash_Other = 31;
|
||||
private const int TypeHashOther = 31;
|
||||
|
||||
public FUniqueNetId? UniqueNetId { get; private set; }
|
||||
|
||||
@@ -18,8 +18,7 @@ public class FUniqueNetIdRepl
|
||||
|
||||
public string ToDebugString()
|
||||
{
|
||||
// TODO: Add type
|
||||
return IsValid() ? $"{UniqueNetId!.Contents}" : "INVALID";
|
||||
return IsValid() ? $"${UniqueNetId!.Type}:{UniqueNetId!.Contents}" : "INVALID";
|
||||
}
|
||||
|
||||
public static void Write(FArchive ar, FUniqueNetIdRepl value)
|
||||
@@ -68,7 +67,7 @@ public class FUniqueNetIdRepl
|
||||
|
||||
var bValidTypeHash = typeHash != 0;
|
||||
|
||||
if (typeHash == TypeHash_Other)
|
||||
if (typeHash == TypeHashOther)
|
||||
{
|
||||
var typeString = ar.ReadString();
|
||||
var type = new FName(typeString);
|
||||
@@ -102,13 +101,16 @@ public class FUniqueNetIdRepl
|
||||
// TypeHash = UOnlineEngineInterface::Get()->GetReplicationHashForSubsystem(UOnlineEngineInterface::Get()->GetDefaultOnlineSubsystemName());
|
||||
}
|
||||
|
||||
FName type;
|
||||
|
||||
var bValidTypeHash = typeHash != 0;
|
||||
if (typeHash == TypeHash_Other)
|
||||
if (typeHash == TypeHashOther)
|
||||
{
|
||||
|
||||
type = new FName(ar.ReadString());
|
||||
}
|
||||
else
|
||||
{
|
||||
type = UnrealNames.FNames[UnrealNameKey.None];
|
||||
// TODO: Type = UOnlineEngineInterface::Get()->GetSubsystemFromReplicationHash(TypeHash);
|
||||
}
|
||||
|
||||
@@ -118,7 +120,7 @@ public class FUniqueNetIdRepl
|
||||
if (!ar.IsError())
|
||||
{
|
||||
// TODO: Check if type != none
|
||||
UniqueNetId = new FUniqueNetId(contents);
|
||||
UniqueNetId = new FUniqueNetId(type, contents);
|
||||
bOutSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Prospect.Unreal.Core;
|
||||
using Prospect.Unreal.Core;
|
||||
using Prospect.Unreal.Core.Names;
|
||||
using Prospect.Unreal.Exceptions;
|
||||
using Prospect.Unreal.Net;
|
||||
@@ -268,7 +268,7 @@ public abstract class UWorld : FNetworkNotify, IAsyncDisposable
|
||||
connection.SetPlayerOnlinePlatformName(new FName(onlinePlatformName));
|
||||
|
||||
// ask the game code if this player can join
|
||||
string errorMsg = null;
|
||||
string? errorMsg = null;
|
||||
|
||||
var gameMode = GetAuthGameMode();
|
||||
if (gameMode != null)
|
||||
|
||||
Reference in New Issue
Block a user