Refactor project structure and enhance functionality

Added `InternalsVisibleTo` attribute for "Ghost.Editor" in `AssemblyInfo.cs`.
Added a binary file `Empty.zip` to the project.
Added a new `ProjectMetadata` class in `ProjectMetadata.cs`.
Added new states and interfaces for managing application states in `EditorState.cs`, `LandingState.cs`, and `IAppState.cs`.
Added a notification service in `INotificationService.cs` and `StackedNotificationService.cs`.
Added new XAML files for UI components, including `InspectorView.xaml` and `InternalControls.xaml`.

Changed the `ProjectInfo` class in `ProjectInfo.cs` to include a `MetadataPath` property instead of `Path` and `EngineVersion`.
Changed the `TemplateInfo` class in `TemplateInfo.cs` to use a struct instead of a class for `TemplateData`.
Changed the `ProjectService` class to use the new `ProjectRepository` for managing project data.

Removed several using directives and the entire `ProjectRepository` class from `ProjectRepository.cs`, replacing it with a new implementation.
Removed old methods and properties in `EntityManager` and `World` classes to improve entity management and component handling.

Updated the `Ghost.Data.csproj` file to include the new `Empty.zip` file as a content item.
Updated the `ProjectRepository` class to manage project data using SQLite.
Updated various XAML files to include new styles and controls, improving the overall UI design.
Updated the `CreateProjectViewModel` to include a notification service and handle project creation logic.
Updated the test project to include references to the new `Ghost.Graphics` project and modified test cases to align with the new structure.
This commit is contained in:
2025-05-31 01:45:34 +09:00
parent 67b6040b5e
commit 61bbb1bc68
66 changed files with 1923 additions and 733 deletions

View File

@@ -1,19 +0,0 @@
namespace Ghost.Entities.Utilities;
internal class Box<T>
where T : struct
{
public T Value
{
get;
set;
}
public Box(T value)
{
Value = value;
}
public static implicit operator T(Box<T> box) => box.Value;
public static implicit operator Box<T>(T value) => new(value);
}

View File

@@ -1,64 +0,0 @@
using System.Numerics;
namespace Ghost.Entities.Utilities;
internal readonly struct ComponentMask
{
private readonly ulong[] _words;
public ComponentMask(int entityCapacity)
{
_words = new ulong[(entityCapacity + 63) / 64];
}
public void Set(int entityIndex)
=> _words[entityIndex >> 6] |= 1UL << (entityIndex & 63);
public void Clear(int entityIndex)
=> _words[entityIndex >> 6] &= ~(1UL << (entityIndex & 63));
public bool Get(int entityIndex)
=> ((_words[entityIndex >> 6] >> (entityIndex & 63)) & 1) != 0;
// Bitwise AND
public ComponentMask And(in ComponentMask other)
{
var result = new ComponentMask(_words.Length * 64);
for (var i = 0; i < _words.Length; i++)
result._words[i] = _words[i] & other._words[i];
return result;
}
// Bitwise OR
public ComponentMask Or(in ComponentMask other)
{
var result = new ComponentMask(_words.Length * 64);
for (var i = 0; i < _words.Length; i++)
result._words[i] = _words[i] | other._words[i];
return result;
}
// Bitwise NOT
public ComponentMask Not()
{
var result = new ComponentMask(_words.Length * 64);
for (var i = 0; i < _words.Length; i++)
result._words[i] = ~_words[i];
return result;
}
// Iterate set bits (fast scan)
public IEnumerable<int> GetEntityIndices()
{
for (var word = 0; word < _words.Length; word++)
{
var bits = _words[word];
while (bits != 0)
{
var lowBit = BitOperations.TrailingZeroCount(bits);
yield return (word << 6) + lowBit;
bits &= bits - 1; // clear lowest set bit
}
}
}
}