upd: sync local changes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
03ee4dbc8f
commit
e9b9205514
39 files changed
+84
-12
No files matched your search
@@ -8,6 +8,7 @@ using Godot;
|
||||
|
||||
namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
{
|
||||
/// <summary>State of one open scenario file tab: identity, saved text and dirty flag.</summary>
|
||||
public sealed class TabData
|
||||
{
|
||||
public string Key;
|
||||
@@ -18,6 +19,11 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
public bool IsDirty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tabbed editor area of the scenario editor: a permanent graph tab plus
|
||||
/// one text tab per opened .scenario file, with dirty tracking and a
|
||||
/// monospace syntax-highlighted code editor.
|
||||
/// </summary>
|
||||
public partial class ScenarioEditTabs : VBoxContainer
|
||||
{
|
||||
private const int GraphTabIndex = 0;
|
||||
@@ -79,6 +85,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
AddChild(_graphView);
|
||||
}
|
||||
|
||||
/// <summary>Opens the scenario in a new tab, or just activates its existing tab.</summary>
|
||||
public void OpenFile(string key)
|
||||
{
|
||||
for (int i = 0; i < _tabs.Count; i++)
|
||||
@@ -123,6 +130,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Marks the active tab clean, remembering the editor text as the saved baseline.</summary>
|
||||
public void SaveCurrentFile()
|
||||
{
|
||||
if (_activeTabIndex < 0 || _activeTabIndex >= _tabs.Count)
|
||||
@@ -138,6 +146,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Replaces the editor text without firing the text-changed handler.</summary>
|
||||
public void SetTextSilent(string text)
|
||||
{
|
||||
_suppressTextChanged = true;
|
||||
@@ -145,6 +154,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
_suppressTextChanged = false;
|
||||
}
|
||||
|
||||
/// <summary>Switches to the graph tab when no file tabs are open.</summary>
|
||||
public void SetViewToGraph()
|
||||
{
|
||||
if (_tabs.Count > 0)
|
||||
@@ -156,6 +166,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
GraphTabSelected?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>Rebuilds the graph from the current scenario files, if the graph tab is visible.</summary>
|
||||
public void RefreshGraph()
|
||||
{
|
||||
if (_graphView.Visible)
|
||||
@@ -165,6 +176,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns false when any tab still has unsaved changes.</summary>
|
||||
public bool ConfirmCloseAll()
|
||||
{
|
||||
for (int i = _tabs.Count - 1; i >= 0; i--)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Cthangover.Core.UI.Tool;
|
||||
using Godot;
|
||||
|
||||
using Cthangover.Mods.Interface.Tool;
|
||||
namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
{
|
||||
/// <summary>Registers the scenario editor as a tool window. Creates <see cref="ScenarioEditorWindow"/> instances.</summary>
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
using System;
|
||||
using System;
|
||||
using Cthangover.Core.Scenes;
|
||||
using Cthangover.Core.UI.Theming;
|
||||
using Cthangover.Core.Utils;
|
||||
using Cthangover.Tools.Services;
|
||||
using Godot;
|
||||
|
||||
using Cthangover.Mods.Interface.Tool;
|
||||
namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Tool window hosting the scenario editor: a file tree of every mod's
|
||||
/// .scenario files, tabbed text/graph editors, metadata and thumbnail
|
||||
/// panels, plus a play-test mode that runs the current scenario in-game.
|
||||
/// </summary>
|
||||
public partial class ScenarioEditorWindow : ToolWindow
|
||||
{
|
||||
private Control _editLayout;
|
||||
@@ -32,6 +38,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
BuildUI();
|
||||
}
|
||||
|
||||
/// <summary>Opens with the graph view so the editor starts on the cross-scene map.</summary>
|
||||
public override void _Ready()
|
||||
{
|
||||
_editTabs.SetViewToGraph();
|
||||
@@ -41,6 +48,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Returns from play-test mode as soon as the in-game test play ends.</summary>
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (_playActive && !SceneManager.IsTestPlayActive)
|
||||
|
||||
@@ -6,6 +6,7 @@ using Godot;
|
||||
|
||||
namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
{
|
||||
/// <summary>Left-hand tree of every mod's scenario files, grouped by mod and subdirectory; raises <see cref="FileSelected"/> on picks.</summary>
|
||||
public partial class ScenarioFileTreePanel : VBoxContainer
|
||||
{
|
||||
private Tree _fileTree;
|
||||
@@ -70,6 +71,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
return item.GetInstanceId().ToString();
|
||||
}
|
||||
|
||||
/// <summary>Programmatically selects the tree row for a scenario key (no selection event).</summary>
|
||||
public void SelectFile(string key)
|
||||
{
|
||||
if (!_keyToTreeItem.TryGetValue(key, out var item))
|
||||
|
||||
@@ -5,8 +5,10 @@ using Cthangover.Core.UI.Theming;
|
||||
using Cthangover.Tools.Services;
|
||||
using Godot;
|
||||
|
||||
using Cthangover.Mods.Interface.Theming;
|
||||
namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
{
|
||||
/// <summary>Cross-scene graph of all scenario files: a GraphEdit of scene nodes linked by switch targets, with a detail panel for the selected scenario.</summary>
|
||||
public partial class ScenarioGraphView : HSplitContainer
|
||||
{
|
||||
private GraphEdit _graph;
|
||||
@@ -60,6 +62,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
panel.AddChild(_infoLabel);
|
||||
}
|
||||
|
||||
/// <summary>Rebuilds the graph nodes and edges, preserving the nodes' saved canvas positions.</summary>
|
||||
public void Populate(SceneGraphData data)
|
||||
{
|
||||
var savedPositions = SaveNodePositions();
|
||||
|
||||
@@ -4,6 +4,7 @@ using Godot;
|
||||
|
||||
namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
{
|
||||
/// <summary>Read-only metadata panel for the scenario in the active text tab: scene, priority, condition, switch targets, locale keys and quest references.</summary>
|
||||
public partial class ScenarioInfoPanel : VBoxContainer
|
||||
{
|
||||
private Label _infoScene;
|
||||
@@ -30,6 +31,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
_infoQuestRefs = GetNode<Label>("Scroll/VBox/InfoQuestRefs");
|
||||
}
|
||||
|
||||
/// <summary>Parses the given scenario text and refreshes every metadata row.</summary>
|
||||
public void Update(string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
@@ -49,6 +51,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
_infoQuestRefs.Text = refs.QuestRefs.Count > 0 ? string.Join(", ", refs.QuestRefs.Distinct()) : "-";
|
||||
}
|
||||
|
||||
/// <summary>Resets every metadata row to the "-" placeholder.</summary>
|
||||
public void Clear()
|
||||
{
|
||||
_infoScene.Text = "-";
|
||||
|
||||
@@ -4,6 +4,7 @@ using Godot;
|
||||
|
||||
namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
{
|
||||
/// <summary>Row of background thumbnails referenced by the scenario in the active text tab.</summary>
|
||||
public partial class ScenarioThumbnailPanel : ScrollContainer
|
||||
{
|
||||
private HBoxContainer _thumbContainer;
|
||||
@@ -13,6 +14,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
_thumbContainer = GetNode<HBoxContainer>("ThumbContainer");
|
||||
}
|
||||
|
||||
/// <summary>Loads the background thumbnails referenced by the given scenario text (missing ones render as placeholders).</summary>
|
||||
public void Load(string text)
|
||||
{
|
||||
Clear();
|
||||
@@ -57,6 +59,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Removes every thumbnail from the row.</summary>
|
||||
public new void Clear()
|
||||
{
|
||||
foreach (var c in _thumbContainer.GetChildren())
|
||||
|
||||
Reference in new issue
Block a user