More actor and UObject progress
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace Prospect.Unreal.Core.Math;
|
||||
|
||||
public class FQuat
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Prospect.Unreal.Core.Math;
|
||||
|
||||
public class FRotator
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Prospect.Unreal.Core.Math;
|
||||
|
||||
public ref struct FTransform
|
||||
{
|
||||
public FVector Location { get; set; }
|
||||
public FRotator Rotation { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Prospect.Unreal.Core.Math;
|
||||
|
||||
public class FVector
|
||||
{
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Prospect.Unreal.Core;
|
||||
namespace Prospect.Unreal.Core.Objects;
|
||||
|
||||
[Flags]
|
||||
public enum EObjectFlags
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Prospect.Unreal.Core.Objects;
|
||||
|
||||
/// <summary>
|
||||
/// Custom class to help with <code>T::StaticClass()</code> code.
|
||||
/// </summary>
|
||||
public class GUClassArray
|
||||
{
|
||||
public static UClass StaticClass<T>()
|
||||
{
|
||||
return StaticClass(typeof(T));
|
||||
}
|
||||
|
||||
public static UClass StaticClass(Type type)
|
||||
{
|
||||
// TODO: Implement
|
||||
return new UClass();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Prospect.Unreal.Core.Objects;
|
||||
|
||||
public static class GUObjectArray
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Prospect.Unreal.Core.Properties;
|
||||
|
||||
namespace Prospect.Unreal.Core.Objects;
|
||||
|
||||
public class UClass : UStruct
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Prospect.Unreal.Core.Objects;
|
||||
|
||||
public class UObject : UObjectBaseUtility
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Prospect.Unreal.Core.Names;
|
||||
|
||||
namespace Prospect.Unreal.Core.Objects;
|
||||
|
||||
public class UObjectBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Flags used to track and report various object states.
|
||||
/// </summary>
|
||||
private EObjectFlags _objectFlags;
|
||||
|
||||
/// <summary>
|
||||
/// Index into GObjectArray...very private.
|
||||
/// </summary>
|
||||
private int _internalIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Class the object belongs to.
|
||||
/// </summary>
|
||||
private UClass _classPrivate;
|
||||
|
||||
/// <summary>
|
||||
/// Name of this object.
|
||||
/// </summary>
|
||||
private FName _namePrivate;
|
||||
|
||||
/// <summary>
|
||||
/// Object this object resides in.
|
||||
/// </summary>
|
||||
private UObject? _outerPrivate;
|
||||
|
||||
public UObjectBase()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the unique ID of the object...these are reused so it is only unique while the object is alive.
|
||||
/// Useful as a tag.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint GetUniqueID()
|
||||
{
|
||||
return (uint)_internalIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the UClass that defines the fields of this object.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public UClass GetClass()
|
||||
{
|
||||
return _classPrivate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the UObject this object resides in.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public UObject? GetOuter()
|
||||
{
|
||||
return _outerPrivate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the logical name of this object.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public FName GetFName()
|
||||
{
|
||||
return _namePrivate;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected void SetFlagsTo(EObjectFlags newFlags)
|
||||
{
|
||||
_objectFlags = newFlags;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public EObjectFlags GetFlags()
|
||||
{
|
||||
return _objectFlags;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Prospect.Unreal.Core.Objects;
|
||||
|
||||
public class UObjectBaseUtility : UObjectBase
|
||||
{
|
||||
/*
|
||||
* Flags
|
||||
*/
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetFlags(EObjectFlags newFlags)
|
||||
{
|
||||
SetFlagsTo(GetFlags() | newFlags);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void ClearFlags(EObjectFlags newFlags)
|
||||
{
|
||||
SetFlagsTo(GetFlags() | ~newFlags);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool HasAnyFlags(EObjectFlags flagsToCheck)
|
||||
{
|
||||
return (GetFlags() & flagsToCheck) != 0;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool HasAllFlags(EObjectFlags flagsToCheck)
|
||||
{
|
||||
return (GetFlags() & flagsToCheck) == flagsToCheck;
|
||||
}
|
||||
|
||||
/*
|
||||
* Marks
|
||||
*/
|
||||
public bool IsUnreachable()
|
||||
{
|
||||
// TODO: GUObjectArray
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Outer & Package
|
||||
*/
|
||||
public UObject? GetTypedOuter(UClass target)
|
||||
{
|
||||
UObject? result = null;
|
||||
for (var nextOuter = GetOuter(); result == null && nextOuter != null; nextOuter = nextOuter.GetOuter())
|
||||
{
|
||||
if (nextOuter.IsA(target))
|
||||
{
|
||||
result = nextOuter;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public T? GetTypedOuter<T>() where T : UObject
|
||||
{
|
||||
return (T?)GetTypedOuter(GUClassArray.StaticClass<T>());
|
||||
}
|
||||
|
||||
/*
|
||||
* Class
|
||||
*/
|
||||
public bool IsChildOfWorkaround(UClass objClass, UClass testClass)
|
||||
{
|
||||
return objClass.IsChildOf(testClass);
|
||||
}
|
||||
|
||||
public bool IsA(UClass someBase)
|
||||
{
|
||||
var someBaseClass = someBase;
|
||||
var thisClass = GetClass();
|
||||
|
||||
return IsChildOfWorkaround(thisClass, someBaseClass);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Prospect.Unreal.Core.Objects;
|
||||
|
||||
namespace Prospect.Unreal.Core.Properties;
|
||||
|
||||
public class UField : UObject
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace Prospect.Unreal.Core.Properties;
|
||||
|
||||
public class UStruct : UField
|
||||
{
|
||||
private UStruct? _superStruct;
|
||||
|
||||
public bool IsChildOf(UStruct? someBase)
|
||||
{
|
||||
if (someBase == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var bOldResult = false;
|
||||
|
||||
for (var tempStruct = this; tempStruct != null; tempStruct = tempStruct.GetSuperStruct())
|
||||
{
|
||||
if (tempStruct == someBase)
|
||||
{
|
||||
bOldResult = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return bOldResult;
|
||||
}
|
||||
|
||||
public UStruct? GetSuperStruct()
|
||||
{
|
||||
return _superStruct;
|
||||
}
|
||||
|
||||
public virtual void SetSuperStruct(UStruct newSuperStruct)
|
||||
{
|
||||
_superStruct = newSuperStruct;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using Prospect.Unreal.Net.Actors;
|
||||
using Prospect.Unreal.Core.Objects;
|
||||
using Prospect.Unreal.Net.Actors;
|
||||
using Prospect.Unreal.Runtime;
|
||||
|
||||
namespace Prospect.Unreal.Core;
|
||||
|
||||
public class ULevel
|
||||
public class ULevel : UObject
|
||||
{
|
||||
public ULevel()
|
||||
{
|
||||
@@ -19,6 +21,13 @@ public class ULevel
|
||||
/// </summary>
|
||||
public List<AActor> Actors { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The World that has this level in its Levels array.
|
||||
/// This is not the same as GetOuter(), because GetOuter() for a streaming level is a vestigial world that is not used.
|
||||
/// It should not be accessed during BeginDestroy(), just like any other UObject references, since GC may occur in any order.
|
||||
/// </summary>
|
||||
public UWorld OwningWorld { get; private set; }
|
||||
|
||||
public void InitializeNetworkActors()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Prospect.Unreal.Core;
|
||||
|
||||
public class UObject
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user