Move Godot events to instance

This commit is contained in:
Matt Parker
2025-09-30 19:43:49 +10:00
parent 51817f580e
commit eb88897a2a
9 changed files with 43 additions and 36 deletions

View File

@@ -25,7 +25,7 @@ public partial class SolutionExplorerPanel : MarginContainer
{
_tree = GetNode<Tree>("Tree");
_tree.ItemMouseSelected += TreeOnItemMouseSelected;
GodotGlobalEvents.FileExternallySelected += OnFileExternallySelected;
GodotGlobalEvents.Instance.FileExternallySelected += OnFileExternallySelected;
}
private void TreeOnItemMouseSelected(Vector2 mousePosition, long mouseButtonIndex)
@@ -36,13 +36,13 @@ public partial class SolutionExplorerPanel : MarginContainer
if (sharpIdeFileContainer is null) return;
var sharpIdeFile = sharpIdeFileContainer.File;
Guard.Against.Null(sharpIdeFile, nameof(sharpIdeFile));
GodotGlobalEvents.InvokeFileSelected(sharpIdeFile);
GodotGlobalEvents.Instance.InvokeFileSelected(sharpIdeFile);
}
private async Task OnFileExternallySelected(SharpIdeFile file, SharpIdeFileLinePosition? fileLinePosition)
{
await Task.CompletedTask.ConfigureAwait(ConfigureAwaitOptions.ForceYielding);
var task = GodotGlobalEvents.InvokeFileSelectedAndWait(file, fileLinePosition);
var task = GodotGlobalEvents.Instance.InvokeFileSelectedAndWait(file, fileLinePosition);
var item = FindItemRecursive(_tree.GetRoot(), file);
if (item is not null)
{