Files
GhostEngine/Ghost.InternalEditor/View/Windows/LandingWindow.xaml.cs
Misaki 40d333b004 Refactor project structure and enhance functionality
Changed the project namespace from `Ghost.Editor` to `Ghost.App` across multiple files.
Changed the `InternalsVisibleTo` attribute in `AssemblyInfo.cs` to include `Ghost.App`.
Changed the `ProjectRepository` class to add new asynchronous methods for retrieving projects by ID, name, and metadata path.
Changed the `ProjectService` class to utilize the new asynchronous project loading methods.
Changed the `SceneGraph` classes to improve node management and serialization.
Changed the `EntityManager` class to enhance entity management with new component handling methods.
Added new test classes, `EntityTest` and `SerializationTest`, to ensure reliability in entity and serialization systems.
Added the `Ghost.App` project file to establish a modular project structure.
Added the `Ghost.Generator` project for automated component serialization code generation.
Updated UI components to reflect the new namespace for proper functionality.
2025-06-07 20:54:07 +09:00

61 lines
2.0 KiB
C#

using Ghost.App.Services;
using Ghost.App.View.Pages.Landing;
using Ghost.Data.Resources;
using Ghost.Engine.Resources;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
using WinUIEx;
namespace Ghost.App.View.Windows;
internal sealed partial class LandingWindow : WindowEx
{
private IServiceScope? _landingScope;
private int _previousSelectedIndex;
public LandingWindow()
{
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)
{
_landingScope?.Dispose();
_landingScope = GhostApplication.CreateScope();
GhostApplication.GetService<StackedNotificationService>().SetReference(InfoBar, NotificationQueue);
}
private void WindowEx_Closed(object sender, Microsoft.UI.Xaml.WindowEventArgs args)
{
_landingScope?.Dispose();
GhostApplication.GetService<StackedNotificationService>().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, _landingScope, new SlideNavigationTransitionInfo() { Effect = slideNavigationTransitionEffect });
_previousSelectedIndex = currentSelectedIndex;
}
}