Update editor

This commit is contained in:
2026-02-03 21:49:14 +09:00
parent 9fcf06dbe4
commit 59991f47d5
88 changed files with 1157 additions and 1288 deletions

View File

@@ -5,6 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="using:CommunityToolkit.WinUI.Behaviors"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:controls1="using:Ghost.Editor.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ee="using:Ghost.Editor.View.Pages.EngineEditor"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
@@ -12,15 +13,13 @@
xmlns:local="using:Ghost.Editor.View.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winex="using:WinUIEx"
Activated="WindowEx_Activated"
Closed="WindowEx_Closed"
mc:Ignorable="d">
<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Loaded="MainGrid_Loaded" Unloaded="MainGrid_Unloaded">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@@ -29,29 +28,21 @@
</Grid.RowDefinitions>
<!-- Titlebar -->
<StackPanel
<TitleBar
x:Name="PART_TitleBar"
Grid.Row="0"
Padding="8"
Orientation="Horizontal">
<ImageIcon
Width="24"
Height="24"
VerticalAlignment="Center"
Source="ms-appx:///Assets/Icon.targetsize-32.png" />
<TextBlock
Margin="8,0,0,0"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.engineVersionDescriptor}" />
<TextBlock
Margin="8,0,0,0"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.CurrentProject.Metadata.Name, Mode=OneWay}" />
</StackPanel>
Background="{ThemeResource AcrylicBackgroundFillColorBaseBrush}"
Subtitle="Ghost Engine">
<TitleBar.IconSource>
<ImageIconSource ImageSource="ms-appx:///Assets/icon.targetsize-48.png" />
</TitleBar.IconSource>
</TitleBar>
<!-- Toolbar -->
<Grid Grid.Row="1" Margin="4,4">
<Grid
Grid.Row="1"
Padding="4,0,4,4"
Background="{ThemeResource AcrylicBackgroundFillColorBaseBrush}">
<controls:TabbedCommandBar>
<controls:TabbedCommandBar.MenuItems>
<controls:TabbedCommandBarItem Header="Home">
@@ -132,7 +123,7 @@
<TabViewItem.IconSource>
<FontIconSource Glyph="&#xEC50;" />
</TabViewItem.IconSource>
<ee:ProjectPage />
<controls1:ProjectBrowser />
</TabViewItem>
<TabViewItem Header="Console">
<TabViewItem.IconSource>
@@ -148,7 +139,7 @@
<Grid
Grid.Row="3"
Height="25"
Background="{ThemeResource SolidBackgroundFillColorBaseAltBrush}">
Background="{ThemeResource SmokeFillColorDefaultBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@@ -201,6 +192,7 @@
</Grid>
</Grid>
<!-- Info and Progress -->
<Grid Grid.Row="0" Grid.RowSpan="4">
<InfoBar
x:Name="InfoBar"

View File

@@ -1,13 +1,11 @@
using Ghost.Data.Resources;
using Ghost.Editor.Core.Notifications;
using Ghost.Editor.Core.Progress;
using Ghost.Editor.Core;
using Ghost.Editor.Core.Contracts;
using Ghost.Editor.Core.Services;
using Ghost.Editor.ViewModels.Windows;
using Ghost.Engine.Resources;
using System.Diagnostics;
using Windows.ApplicationModel;
using WinUIEx;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace Ghost.Editor.View.Windows;
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
@@ -29,24 +27,26 @@ internal sealed partial class EngineEditorWindow : WindowEx
_notificationService = (NotificationService)App.GetService<INotificationService>();
_progressService = (ProgressService)App.GetService<IProgressService>();
AppWindow.SetIcon(AssetsPath.s_appIconPath);
Title = EngineData.ENGINE_NAME;
ExtendsContentIntoTitleBar = true;
InitializeComponent();
AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/icon.ico"));
Title = "Ghost Engine";
ExtendsContentIntoTitleBar = true;
SetTitleBar(PART_TitleBar);
this.CenterOnScreen();
}
private void WindowEx_Activated(object sender, Microsoft.UI.Xaml.WindowActivatedEventArgs args)
private void MainGrid_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
Bindings.Update();
PART_TitleBar.Title = EditorApplication.CurrentProjectName;
PART_TitleBar.Subtitle = $"Ghost Engine {Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}";
_notificationService.SetReference(InfoBar, NotificationQueue);
_progressService.SetReference(ProgressBarContainer);
}
private void WindowEx_Closed(object sender, Microsoft.UI.Xaml.WindowEventArgs args)
private void MainGrid_Unloaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
_notificationService.ClearReference();
_progressService.ClearReference();

View File

@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<winex:WindowEx
x:Class="Ghost.Editor.View.Windows.LandingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="using:CommunityToolkit.WinUI.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:local="using:Ghost.Editor.View.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winex="using:WinUIEx"
Activated="WindowEx_Activated"
Closed="WindowEx_Closed"
IsResizable="False"
mc:Ignorable="d">
<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<TextBlock
Margin="24,0,0,0"
VerticalAlignment="Bottom"
Style="{StaticResource BodyTextBlockStyle}"
Text="Ghost Engine" />
</Grid>
<Grid Grid.Row="1" Padding="24,0,24,18">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<SelectorBar
Grid.Row="0"
HorizontalAlignment="Right"
SelectionChanged="SelectorBar_SelectionChanged">
<SelectorBarItem IsSelected="True" Text="Open">
<SelectorBarItem.Icon>
<FontIcon Glyph="&#xE838;" />
</SelectorBarItem.Icon>
</SelectorBarItem>
<SelectorBarItem Text="Create">
<SelectorBarItem.Icon>
<FontIcon Glyph="&#xE8F4;" />
</SelectorBarItem.Icon>
</SelectorBarItem>
</SelectorBar>
<Frame
x:Name="ContentFrame"
Grid.Row="1"
Padding="8"
CacheMode="BitmapCache"
CacheSize="10" />
</Grid>
<Grid Grid.Row="1" Padding="16">
<InfoBar
x:Name="InfoBar"
HorizontalAlignment="Right"
VerticalAlignment="Bottom">
<interactivity:Interaction.Behaviors>
<behaviors:StackedNotificationsBehavior x:Name="NotificationQueue" />
</interactivity:Interaction.Behaviors>
</InfoBar>
</Grid>
</Grid>
</winex:WindowEx>

View File

@@ -1,59 +0,0 @@
using Ghost.Data.Resources;
using Ghost.Editor.Core.Notifications;
using Ghost.Editor.View.Pages.Landing;
using Ghost.Engine.Resources;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
using WinUIEx;
namespace Ghost.Editor.View.Windows;
internal sealed partial class LandingWindow : WindowEx
{
private readonly NotificationService _notificationService;
private int _previousSelectedIndex;
public LandingWindow()
{
_notificationService = (NotificationService)App.GetService<INotificationService>();
AppWindow.SetIcon(AssetsPath.s_appIconPath);
Title = EngineData.ENGINE_NAME;
InitializeComponent();
this.SetWindowSize(1000, 750);
this.CenterOnScreen();
ExtendsContentIntoTitleBar = true;
}
private void WindowEx_Activated(object sender, Microsoft.UI.Xaml.WindowActivatedEventArgs args)
{
_notificationService.SetReference(InfoBar, NotificationQueue);
}
private void WindowEx_Closed(object sender, Microsoft.UI.Xaml.WindowEventArgs args)
{
_notificationService.ClearReference();
}
private void SelectorBar_SelectionChanged(SelectorBar sender, SelectorBarSelectionChangedEventArgs e)
{
var selectedItem = sender.SelectedItem;
var currentSelectedIndex = sender.Items.IndexOf(selectedItem);
var pageType = currentSelectedIndex switch
{
1 => typeof(CreateProjectPage),
_ => typeof(OpenProjectPage),
};
var slideNavigationTransitionEffect = currentSelectedIndex - _previousSelectedIndex > 0 ?
SlideNavigationTransitionEffect.FromRight : SlideNavigationTransitionEffect.FromLeft;
ContentFrame.Navigate(pageType, null, new SlideNavigationTransitionInfo() { Effect = slideNavigationTransitionEffect });
_previousSelectedIndex = currentSelectedIndex;
}
}

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8" ?>
<winex:WindowEx
x:Class="Ghost.Editor.View.Windows.SplashWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Ghost.Editor.View.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winex="using:WinUIEx"
Title="SplashWindow"
mc:Ignorable="d">
<winex:WindowEx.SystemBackdrop>
<MicaBackdrop />
</winex:WindowEx.SystemBackdrop>
<Grid Margin="32,32,32,16" Loaded="MainGrid_Loaded">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" ColumnSpacing="24">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="1.2*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" CornerRadius="8">
<Image
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="C:\Users\Misaki\Downloads\Screenshot 2024-07-20 035047.png"
Stretch="UniformToFill" />
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Style="{StaticResource TitleLargeTextBlockStyle}"
Text="Ghost Engine" />
<TextBlock
x:Name="VersionTextBlock"
Grid.Row="1"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Style="{StaticResource BodyLargeStrongTextBlockStyle}" />
<TextBlock
Grid.Row="2"
Margin="0,32,0,0"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="An open-source, modern game engine designed for flexibility and performance."
TextWrapping="WrapWholeWords" />
</Grid>
</Grid>
<ProgressBar
Grid.Row="1"
Margin="0,24,0,0"
IsIndeterminate="True" />
<TextBlock
x:Name="LoadingTextBlock"
Grid.Row="2"
Margin="0,4,0,0"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<TextBlock
x:Name="CopyrightTextBlock"
Grid.Row="3"
Margin="0,24,0,0"
HorizontalAlignment="Center"
Foreground="{ThemeResource TextFillColorTertiaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}" />
</Grid>
</winex:WindowEx>

View File

@@ -0,0 +1,33 @@
using Ghost.Editor.Core;
using Microsoft.UI.Xaml;
using Windows.ApplicationModel;
using Windows.Storage;
using WinUIEx;
namespace Ghost.Editor.View.Windows;
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
internal sealed partial class SplashWindow : WindowEx
{
public SplashWindow()
{
InitializeComponent();
IsResizable = false;
IsMaximizable = false;
IsMinimizable = false;
ExtendsContentIntoTitleBar = true;
//this.CenterOnScreen(750, 400);
}
private void MainGrid_Loaded(object sender, RoutedEventArgs e)
{
var version = Package.Current.Id.Version;
VersionTextBlock.Text = $"Version {version.Major}.{version.Minor}.{version.Build}";
LoadingTextBlock.Text = $"Loading {EditorApplication.CurrentProjectName}...";
CopyrightTextBlock.Text = $"Copyright © {DateTime.Now.Year} Ghost Engine. All rights reserved.";
}
}