forked from Misaki/GhostEngine
Refactor project management and enhance architecture
Added a new static class `AssetsPath` for asset management. Added a new icon file (`icon-256.ico`) for UI representation. Added new package references to enhance functionality. Added internals visibility attributes for better testing. Added a new `EngineEditorViewModel` class for MVVM support. Added a new `GameObject` class for component management. Added a new `BitSet` class for efficient bit manipulation. Added various utility classes to support the new entity system. Changed the `ID` property in `ProjectInfo` to internal. Changed the `AddProjectAsync` method to return the created `ProjectInfo`. Changed the connection string retrieval method to use the new `Command` constant. Changed the `DataPath` class to use `readonly` fields for folder paths. Changed the `ActivationHandler` class to use new `DataPath` constants. Changed the `OpenProjectPage` layout and interaction for better UI. Updated the target framework to a newer version for compatibility. Updated the `ProjectService` to use new constants from `DataPath`. Updated the `World` class to improve entity management. Refactored the `ProjectRepository` class to encapsulate SQL commands. Refactored the `Transform` class to use properties for better encapsulation.
This commit is contained in:
38
Ghost.Entities/Signature.cs
Normal file
38
Ghost.Entities/Signature.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Misaki.HighPerformance.Unsafe.Collections;
|
||||
using Misaki.HighPerformance.Unsafe.Helpers;
|
||||
|
||||
namespace Ghost.Entities;
|
||||
|
||||
internal struct Signature : IDisposable
|
||||
{
|
||||
internal UnsafeArray<ComponentData> _componentDatas;
|
||||
private int _hashCode;
|
||||
|
||||
public Signature(params Span<ComponentData> components)
|
||||
{
|
||||
_componentDatas = new UnsafeArray<ComponentData>(components.Length, Allocator.Persistent);
|
||||
_componentDatas.CopyFrom(components);
|
||||
|
||||
_hashCode = -1;
|
||||
_hashCode = GetHashCode();
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (_hashCode != -1)
|
||||
{
|
||||
return _hashCode;
|
||||
}
|
||||
|
||||
unchecked
|
||||
{
|
||||
_hashCode = Component.GetHashCode(_componentDatas.AsSpan());
|
||||
return _hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_componentDatas.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user