Changed the project structure to reflect a shift from `Ghost.App` to `Ghost.Editor`, updating namespaces and class names throughout. Changed the application class in `App.xaml` and `App.xaml.cs` from `GhostApplication` to `EditorApplication`. Changed several service interfaces to reside under `Ghost.Editor.Services.Contracts`, including `IInspectorService`, `INotificationService`, and `IProgressService`. Added `InspectorView` and `InspectorViewModel` classes to manage inspector functionality. Added `NavigationTabView` and `NavigationTabPage` classes to facilitate navigation within the editor. Enhanced `WorldNode` and `EntityNode` classes to support scene graph functionality, including serialization and entity management. Updated the project file `Ghost.Editor.csproj` to reflect the new structure and removed old references. Modified the solution file `GhostEngine.sln` to remove references to `Ghost.App` and include `Ghost.Editor`. Updated unit tests to align with the new namespaces and project structure.
70 lines
1.6 KiB
C#
70 lines
1.6 KiB
C#
using Ghost.Editor.Contracts;
|
|
using Ghost.Editor.Resources;
|
|
using Ghost.Entities;
|
|
using Microsoft.UI.Text;
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Microsoft.UI.Xaml.Data;
|
|
|
|
namespace Ghost.Editor.Core.SceneGraph;
|
|
|
|
public partial class EntityNode : SceneGraphNode
|
|
{
|
|
private readonly Entity _entity;
|
|
|
|
public Entity Entity => _entity;
|
|
public override SceneGraphNodeType NodeType => SceneGraphNodeType.Entity;
|
|
|
|
public EntityNode(Entity entity, string name)
|
|
{
|
|
_entity = entity;
|
|
Name = name;
|
|
}
|
|
|
|
internal EntityNode()
|
|
{
|
|
}
|
|
}
|
|
|
|
public partial class EntityNode : IInspectable
|
|
{
|
|
public IconSource? Icon => EditorIconSource.entity_24;
|
|
|
|
public UIElement? HeaderContent()
|
|
{
|
|
var root = new StackPanel()
|
|
{
|
|
HorizontalAlignment = HorizontalAlignment.Stretch,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
|
|
var nameText = new TextBox
|
|
{
|
|
Text = Name,
|
|
FontWeight = FontWeights.Bold,
|
|
};
|
|
var idText = new TextBlock
|
|
{
|
|
Text = $"ID: {_entity.ID}",
|
|
Margin = new Thickness(0, 5, 0, 0),
|
|
};
|
|
|
|
nameText.SetBinding(TextBox.TextProperty, new Binding
|
|
{
|
|
Source = this,
|
|
Path = new PropertyPath(nameof(Name)),
|
|
Mode = BindingMode.TwoWay,
|
|
UpdateSourceTrigger = UpdateSourceTrigger.LostFocus,
|
|
});
|
|
|
|
root.Children.Add(nameText);
|
|
root.Children.Add(idText);
|
|
|
|
return root;
|
|
}
|
|
|
|
public UIElement? InspectorContent()
|
|
{
|
|
return null;
|
|
}
|
|
} |