upd: sync local changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
iisaevandClaude Opus 5.5 committed 2026-10-16 16:18:22 +00:00
1 parent 03ee4dbc8f
commit e9b9205514
39 files changed
+84 -12

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
{ {
"id": "dev_tools", "id": "dev_tools",
"kind": "toolset",
"name": "Developer Tools", "name": "Developer Tools",
"author": "ct", "author": "ct",
"version": "1.0.0", "version": "1.0.0",
+1 -1
View File
@@ -1,5 +1,5 @@
mod_tools_name = Tools mod_tools_name = Tools
mod_tools_desc = Development tools mod_tools_desc = Developer toolbox: scenario graph editor, map editor with zones, scene builder with inspector, interactive and light editors, and the mod catalog export window.
tools/light_editor/title = Light Editor tools/light_editor/title = Light Editor
tools/light_editor/background = Background tools/light_editor/background = Background
+1 -1
View File
@@ -1,6 +1,6 @@
# Русская локализация для инструментов разработки # Русская локализация для инструментов разработки
mod_tools_name = Инструменты mod_tools_name = Инструменты
mod_tools_desc = Инструменты разработчика mod_tools_desc = Инструменты разработчика: редактор сценариев (граф), редактор карты с зонами, конструктор сцен с инспектором, редакторы интерактива и света, экспорт каталога модов.
tools/light_editor/title = Редактор освещения tools/light_editor/title = Редактор освещения
tools/light_editor/background = Фон tools/light_editor/background = Фон
+2 -2
View File
@@ -3,10 +3,10 @@
"name": "Tools", "name": "Tools",
"version": "1.0.0", "version": "1.0.0",
"author": "ct", "author": "ct",
"description": "Development tools", "description": "Developer toolbox of ToolBox windows: scenario graph editor, map editor with zones, scene builder with inspector, interactive and light editors, and the mod catalog export window.",
"category": "tools, editor", "category": "tools, editor",
"sources": [ "sources": [
"src/**/*.cs" "src/**/*.cs"
], ],
"depends": ["visual_novel_core>=1"] "depends": ["visual_novel_core>=1", "dialog_base>=1", "interactive_base>=1", "time_base>=1", "map_base>=1", "interface>=1"]
} }
@@ -1,6 +1,7 @@
using Cthangover.Core.UI.Tool; using Cthangover.Core.UI.Tool;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Core.UI.Tool.CatalogExport namespace Cthangover.Core.UI.Tool.CatalogExport
{ {
/// <summary> /// <summary>
+1
View File
@@ -8,6 +8,7 @@ using Cthangover.Core.UI.Tool;
using Cthangover.Core.Utils; using Cthangover.Core.Utils;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Core.UI.Tool.CatalogExport namespace Cthangover.Core.UI.Tool.CatalogExport
{ {
/// <summary> /// <summary>
@@ -1,6 +1,7 @@
using Cthangover.Core.UI.Tool; using Cthangover.Core.UI.Tool;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Tools.InteractiveEditor namespace Cthangover.Tools.InteractiveEditor
{ {
/// <summary> /// <summary>
@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Cthangover.Core.Interactive; using Cthangover.Core.Interactive;
using Cthangover.Core.Mods; using Cthangover.Core.Mods;
@@ -10,8 +10,15 @@ using Cthangover.Core.Utils;
using Cthangover.Tools.Services; using Cthangover.Tools.Services;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Tools.InteractiveEditor namespace Cthangover.Tools.InteractiveEditor
{ {
/// <summary>
/// Tool window for creating and editing interactive object definitions:
/// renders the selected background with draggable collider handles
/// (rect, circle, polygon), edits the definition's fields, and writes the
/// resulting JSON back into a mod directory.
/// </summary>
public partial class InteractiveEditorWindow : ToolWindow public partial class InteractiveEditorWindow : ToolWindow
{ {
private static readonly Color _rectColor = UiTokens.Alpha(UiTokens.Success, 0.6f); private static readonly Color _rectColor = UiTokens.Alpha(UiTokens.Success, 0.6f);
+1 -1
View File
@@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Text.Json; using System.Text.Json;
using Cthangover.Core.Mods; using Cthangover.Core.Mods;
using Cthangover.Core.Mods.Resolvers; using Cthangover.Core.Mods.Resolvers;
using Cthangover.Core.UI.Lights; using Cthangover.Mods.Time;
using Cthangover.Core.UI.Theming; using Cthangover.Core.UI.Theming;
using Godot; using Godot;
+1 -1
View File
@@ -1,4 +1,4 @@
using Cthangover.Core.UI.Lights; using Cthangover.Mods.Time;
using Godot; using Godot;
namespace Cthangover.Core.UI.Tool.LightEditor namespace Cthangover.Core.UI.Tool.LightEditor
@@ -1,6 +1,7 @@
using Cthangover.Core.UI.Tool; using Cthangover.Core.UI.Tool;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Core.UI.Tool.LightEditor namespace Cthangover.Core.UI.Tool.LightEditor
{ {
/// <summary>Registers the light editor as a tool window. Creates <see cref="LightEditorWindow"/> instances.</summary> /// <summary>Registers the light editor as a tool window. Creates <see cref="LightEditorWindow"/> instances.</summary>
+2 -1
View File
@@ -2,12 +2,13 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Json; using System.Text.Json;
using Cthangover.Core.Factories.Impls; using Cthangover.Core.Factories.Impls;
using Cthangover.Core.UI.Lights; using Cthangover.Mods.Time;
using Cthangover.Core.UI.Theming; using Cthangover.Core.UI.Theming;
using Cthangover.Core.Utils; using Cthangover.Core.Utils;
using Cthangover.Tools.Services; using Cthangover.Tools.Services;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Core.UI.Tool.LightEditor namespace Cthangover.Core.UI.Tool.LightEditor
{ {
/// <summary> /// <summary>
+1 -1
View File
@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using Cthangover.Core.Mods.Resolvers; using Cthangover.Core.Mods.Resolvers;
using Cthangover.Core.UI.Theming; using Cthangover.Core.UI.Theming;
using Cthangover.Core.UI.Tool; using Cthangover.Mods.Map;
using Godot; using Godot;
namespace Cthangover.Tools.MapEditor namespace Cthangover.Tools.MapEditor
+1 -1
View File
@@ -1,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Cthangover.Core.UI.Tool; using Cthangover.Mods.Map;
using Cthangover.Tools.Services; using Cthangover.Tools.Services;
using Godot; using Godot;
+1
View File
@@ -1,6 +1,7 @@
using Cthangover.Core.UI.Tool; using Cthangover.Core.UI.Tool;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Tools.MapEditor namespace Cthangover.Tools.MapEditor
{ {
/// <summary> /// <summary>
+2
View File
@@ -8,11 +8,13 @@ using Cthangover.Core.Scenes;
using Cthangover.Core.Settings; using Cthangover.Core.Settings;
using Cthangover.Core.UI; using Cthangover.Core.UI;
using Cthangover.Core.UI.Theming; using Cthangover.Core.UI.Theming;
using Cthangover.Mods.Map;
using Cthangover.Core.UI.Tool; using Cthangover.Core.UI.Tool;
using Cthangover.Core.Utils; using Cthangover.Core.Utils;
using Cthangover.Tools.Services; using Cthangover.Tools.Services;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Tools.MapEditor namespace Cthangover.Tools.MapEditor
{ {
/// <summary> /// <summary>
+12
View File
@@ -8,6 +8,7 @@ using Godot;
namespace Cthangover.Core.UI.Tool.ScenarioEditor 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 sealed class TabData
{ {
public string Key; public string Key;
@@ -18,6 +19,11 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
public bool IsDirty; 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 public partial class ScenarioEditTabs : VBoxContainer
{ {
private const int GraphTabIndex = 0; private const int GraphTabIndex = 0;
@@ -79,6 +85,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
AddChild(_graphView); AddChild(_graphView);
} }
/// <summary>Opens the scenario in a new tab, or just activates its existing tab.</summary>
public void OpenFile(string key) public void OpenFile(string key)
{ {
for (int i = 0; i < _tabs.Count; i++) 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() public void SaveCurrentFile()
{ {
if (_activeTabIndex < 0 || _activeTabIndex >= _tabs.Count) 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) public void SetTextSilent(string text)
{ {
_suppressTextChanged = true; _suppressTextChanged = true;
@@ -145,6 +154,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
_suppressTextChanged = false; _suppressTextChanged = false;
} }
/// <summary>Switches to the graph tab when no file tabs are open.</summary>
public void SetViewToGraph() public void SetViewToGraph()
{ {
if (_tabs.Count > 0) if (_tabs.Count > 0)
@@ -156,6 +166,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
GraphTabSelected?.Invoke(); GraphTabSelected?.Invoke();
} }
/// <summary>Rebuilds the graph from the current scenario files, if the graph tab is visible.</summary>
public void RefreshGraph() public void RefreshGraph()
{ {
if (_graphView.Visible) 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() public bool ConfirmCloseAll()
{ {
for (int i = _tabs.Count - 1; i >= 0; i--) for (int i = _tabs.Count - 1; i >= 0; i--)
@@ -1,6 +1,7 @@
using Cthangover.Core.UI.Tool; using Cthangover.Core.UI.Tool;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Core.UI.Tool.ScenarioEditor namespace Cthangover.Core.UI.Tool.ScenarioEditor
{ {
/// <summary>Registers the scenario editor as a tool window. Creates <see cref="ScenarioEditorWindow"/> instances.</summary> /// <summary>Registers the scenario editor as a tool window. Creates <see cref="ScenarioEditorWindow"/> instances.</summary>
+9 -1
View File
@@ -1,12 +1,18 @@
using System; using System;
using Cthangover.Core.Scenes; using Cthangover.Core.Scenes;
using Cthangover.Core.UI.Theming; using Cthangover.Core.UI.Theming;
using Cthangover.Core.Utils; using Cthangover.Core.Utils;
using Cthangover.Tools.Services; using Cthangover.Tools.Services;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Core.UI.Tool.ScenarioEditor 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 public partial class ScenarioEditorWindow : ToolWindow
{ {
private Control _editLayout; private Control _editLayout;
@@ -32,6 +38,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
BuildUI(); BuildUI();
} }
/// <summary>Opens with the graph view so the editor starts on the cross-scene map.</summary>
public override void _Ready() public override void _Ready()
{ {
_editTabs.SetViewToGraph(); _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) public override void _Process(double delta)
{ {
if (_playActive && !SceneManager.IsTestPlayActive) if (_playActive && !SceneManager.IsTestPlayActive)
@@ -6,6 +6,7 @@ using Godot;
namespace Cthangover.Core.UI.Tool.ScenarioEditor 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 public partial class ScenarioFileTreePanel : VBoxContainer
{ {
private Tree _fileTree; private Tree _fileTree;
@@ -70,6 +71,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
return item.GetInstanceId().ToString(); return item.GetInstanceId().ToString();
} }
/// <summary>Programmatically selects the tree row for a scenario key (no selection event).</summary>
public void SelectFile(string key) public void SelectFile(string key)
{ {
if (!_keyToTreeItem.TryGetValue(key, out var item)) if (!_keyToTreeItem.TryGetValue(key, out var item))
+3
View File
@@ -5,8 +5,10 @@ using Cthangover.Core.UI.Theming;
using Cthangover.Tools.Services; using Cthangover.Tools.Services;
using Godot; using Godot;
using Cthangover.Mods.Interface.Theming;
namespace Cthangover.Core.UI.Tool.ScenarioEditor 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 public partial class ScenarioGraphView : HSplitContainer
{ {
private GraphEdit _graph; private GraphEdit _graph;
@@ -60,6 +62,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
panel.AddChild(_infoLabel); panel.AddChild(_infoLabel);
} }
/// <summary>Rebuilds the graph nodes and edges, preserving the nodes' saved canvas positions.</summary>
public void Populate(SceneGraphData data) public void Populate(SceneGraphData data)
{ {
var savedPositions = SaveNodePositions(); var savedPositions = SaveNodePositions();
+3
View File
@@ -4,6 +4,7 @@ using Godot;
namespace Cthangover.Core.UI.Tool.ScenarioEditor 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 public partial class ScenarioInfoPanel : VBoxContainer
{ {
private Label _infoScene; private Label _infoScene;
@@ -30,6 +31,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
_infoQuestRefs = GetNode<Label>("Scroll/VBox/InfoQuestRefs"); _infoQuestRefs = GetNode<Label>("Scroll/VBox/InfoQuestRefs");
} }
/// <summary>Parses the given scenario text and refreshes every metadata row.</summary>
public void Update(string text) public void Update(string text)
{ {
if (string.IsNullOrEmpty(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()) : "-"; _infoQuestRefs.Text = refs.QuestRefs.Count > 0 ? string.Join(", ", refs.QuestRefs.Distinct()) : "-";
} }
/// <summary>Resets every metadata row to the "-" placeholder.</summary>
public void Clear() public void Clear()
{ {
_infoScene.Text = "-"; _infoScene.Text = "-";
@@ -4,6 +4,7 @@ using Godot;
namespace Cthangover.Core.UI.Tool.ScenarioEditor 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 public partial class ScenarioThumbnailPanel : ScrollContainer
{ {
private HBoxContainer _thumbContainer; private HBoxContainer _thumbContainer;
@@ -13,6 +14,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
_thumbContainer = GetNode<HBoxContainer>("ThumbContainer"); _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) public void Load(string text)
{ {
Clear(); Clear();
@@ -57,6 +59,7 @@ namespace Cthangover.Core.UI.Tool.ScenarioEditor
} }
} }
/// <summary>Removes every thumbnail from the row.</summary>
public new void Clear() public new void Clear()
{ {
foreach (var c in _thumbContainer.GetChildren()) foreach (var c in _thumbContainer.GetChildren())
+1
View File
@@ -10,6 +10,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
private string _key; private string _key;
/// <summary>Binds the checkbox to the property key and seeds it with the current value.</summary>
public void Setup(InspectableProperty property, bool value) public void Setup(InspectableProperty property, bool value)
{ {
_key = property.Key; _key = property.Key;
+1
View File
@@ -10,6 +10,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
private string _key; private string _key;
/// <summary>Binds the picker to the property key and seeds it with the current color.</summary>
public void Setup(InspectableProperty property, Color value) public void Setup(InspectableProperty property, Color value)
{ {
_key = property.Key; _key = property.Key;
+1
View File
@@ -15,6 +15,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
private InspectableProperty _property; private InspectableProperty _property;
/// <summary>Populates the dropdown from the property's enum labels and selects the current value, if known.</summary>
public void Setup(InspectableProperty property, long currentValue) public void Setup(InspectableProperty property, long currentValue)
{ {
_property = property; _property = property;
@@ -17,6 +17,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
private string _key; private string _key;
private bool _integer; private bool _integer;
/// <summary>Applies the property's min/max/step and integer mode, then seeds the initial (clamped) value.</summary>
public void Setup(InspectableProperty property, double initialValue) public void Setup(InspectableProperty property, double initialValue)
{ {
_key = property.Key; _key = property.Key;
+1
View File
@@ -4,6 +4,7 @@ using Cthangover.Core.UI;
using Cthangover.Core.UI.Theming; using Cthangover.Core.UI.Theming;
using Godot; using Godot;
using Cthangover.Mods.Interface.Base.Lists;
namespace Cthangover.Core.UI.Tool.SceneBuilder namespace Cthangover.Core.UI.Tool.SceneBuilder
{ {
/// <summary> /// <summary>
+1
View File
@@ -10,6 +10,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
private string _key; private string _key;
/// <summary>Binds the line edit to the property key and seeds it with the current text.</summary>
public void Setup(InspectableProperty property, string value) public void Setup(InspectableProperty property, string value)
{ {
_key = property.Key; _key = property.Key;
@@ -16,6 +16,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
private SpinBox _x; private SpinBox _x;
private SpinBox _y; private SpinBox _y;
/// <summary>Builds the x/y spin pair bound to the property key and seeds both axes.</summary>
public void Setup(InspectableProperty property, Vector2 initialValue) public void Setup(InspectableProperty property, Vector2 initialValue)
{ {
_key = property.Key; _key = property.Key;
@@ -341,6 +341,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
} }
} }
/// <summary>Hierarchy tree item for a live node; null when unmapped.</summary>
public TreeItem GetItemForNode(Node node) public TreeItem GetItemForNode(Node node)
{ {
_nodeToItem.TryGetValue(node, out var item); _nodeToItem.TryGetValue(node, out var item);
@@ -392,6 +393,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
return string.Join("/", segments); return string.Join("/", segments);
} }
/// <summary>Topmost loaded-scene node whose visual rect contains the viewport position; null when nothing matches.</summary>
public Node FindNodeAtPosition(Vector2 position) public Node FindNodeAtPosition(Vector2 position)
{ {
if (_loadedRoot == null) if (_loadedRoot == null)
@@ -1,6 +1,7 @@
using Cthangover.Core.UI.Tool; using Cthangover.Core.UI.Tool;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Core.UI.Tool.SceneBuilder namespace Cthangover.Core.UI.Tool.SceneBuilder
{ {
/// <summary>Registers the scene builder as a tool window. Creates <see cref="SceneBuilderWindow"/> instances.</summary> /// <summary>Registers the scene builder as a tool window. Creates <see cref="SceneBuilderWindow"/> instances.</summary>
+1
View File
@@ -5,6 +5,7 @@ using Cthangover.Core.UI.Theming;
using Cthangover.Core.Utils; using Cthangover.Core.Utils;
using Godot; using Godot;
using Cthangover.Mods.Interface.Tool;
namespace Cthangover.Core.UI.Tool.SceneBuilder namespace Cthangover.Core.UI.Tool.SceneBuilder
{ {
/// <summary> /// <summary>
+1
View File
@@ -4,6 +4,7 @@ using Cthangover.Core.UI;
using Cthangover.Core.UI.Theming; using Cthangover.Core.UI.Theming;
using Godot; using Godot;
using Cthangover.Mods.Interface.Base.Lists;
namespace Cthangover.Core.UI.Tool.SceneBuilder namespace Cthangover.Core.UI.Tool.SceneBuilder
{ {
/// <summary> /// <summary>
+5
View File
@@ -13,6 +13,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
/// </summary> /// </summary>
public static class TscnLiteralReader public static class TscnLiteralReader
{ {
/// <summary>Parses a bare .tscn float literal; constructors and references return false.</summary>
public static bool TryReadFloat(string raw, out double value) public static bool TryReadFloat(string raw, out double value)
{ {
value = 0d; value = 0d;
@@ -21,6 +22,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
return double.TryParse(raw.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out value); return double.TryParse(raw.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out value);
} }
/// <summary>Parses a bare .tscn integer literal; floats and constructors return false.</summary>
public static bool TryReadLong(string raw, out long value) public static bool TryReadLong(string raw, out long value)
{ {
value = 0; value = 0;
@@ -29,6 +31,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
return long.TryParse(raw.Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out value); return long.TryParse(raw.Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out value);
} }
/// <summary>Parses a .tscn boolean literal (true/false).</summary>
public static bool TryReadBool(string raw, out bool value) public static bool TryReadBool(string raw, out bool value)
{ {
var t = raw?.Trim(); var t = raw?.Trim();
@@ -56,6 +59,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
.Replace("\\\\", "\\"); .Replace("\\\\", "\\");
} }
/// <summary>Parses a <c>Vector2(x, y)</c> constructor literal.</summary>
public static bool TryReadVector2(string raw, out Vector2 value) public static bool TryReadVector2(string raw, out Vector2 value)
{ {
value = Vector2.Zero; value = Vector2.Zero;
@@ -68,6 +72,7 @@ namespace Cthangover.Core.UI.Tool.SceneBuilder
return true; return true;
} }
/// <summary>Parses a <c>Color(r, g, b[, a])</c> constructor literal.</summary>
public static bool TryReadColor(string raw, out Color value) public static bool TryReadColor(string raw, out Color value)
{ {
value = Colors.White; value = Colors.White;
+1 -1
View File
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text.Json; using System.Text.Json;
using Cthangover.Core.Mods; using Cthangover.Core.Mods;
using Cthangover.Core.Mods.Providers; using Cthangover.Core.Mods.Providers;
using Cthangover.Core.UI.Tool; using Cthangover.Mods.Map;
using Cthangover.Core.Utils; using Cthangover.Core.Utils;
namespace Cthangover.Tools.Services namespace Cthangover.Tools.Services
+2
View File
@@ -1,4 +1,5 @@
using System; using System;
using Cthangover.Mods.Dialog.Scenarios;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@@ -288,6 +289,7 @@ namespace Cthangover.Tools.Services
return "mods/" + modId + "/" + relativePath; return "mods/" + modId + "/" + relativePath;
} }
/// <summary>Scans every mod's scenarios and builds the cross-scene graph (nodes per scene, edges per switch target).</summary>
public static SceneGraphData BuildSceneGraph() public static SceneGraphData BuildSceneGraph()
{ {
var data = new SceneGraphData(); var data = new SceneGraphData();
+4
View File
@@ -2,6 +2,7 @@ using System.Collections.Generic;
namespace Cthangover.Tools.Services namespace Cthangover.Tools.Services
{ {
/// <summary>One scenario attached to a scene node (shown on the graph node and in its detail links).</summary>
public sealed class ScenarioGraphLink public sealed class ScenarioGraphLink
{ {
public string Name { get; set; } public string Name { get; set; }
@@ -9,6 +10,7 @@ namespace Cthangover.Tools.Services
public string Key { get; set; } public string Key { get; set; }
} }
/// <summary>One scene of the cross-scenario graph: owning mod, background list, start-scene flag and its scenarios.</summary>
public sealed class SceneGraphNode public sealed class SceneGraphNode
{ {
public string SceneName { get; set; } public string SceneName { get; set; }
@@ -20,12 +22,14 @@ namespace Cthangover.Tools.Services
public bool HasErrors { get; set; } public bool HasErrors { get; set; }
} }
/// <summary>Directed switch-target link between two scenes of the graph.</summary>
public sealed class SceneGraphEdge public sealed class SceneGraphEdge
{ {
public string FromScene { get; set; } public string FromScene { get; set; }
public string ToScene { get; set; } public string ToScene { get; set; }
} }
/// <summary>Complete graph model consumed by <c>ScenarioGraphView</c>.</summary>
public sealed class SceneGraphData public sealed class SceneGraphData
{ {
public List<SceneGraphNode> Nodes { get; set; } = new(); public List<SceneGraphNode> Nodes { get; set; } = new();
+1
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using Cthangover.Mods.Dialog.Scenarios;
using Cthangover.Core.Scenarios; using Cthangover.Core.Scenarios;
using Cthangover.Core.Factories.Impls; using Cthangover.Core.Factories.Impls;
using Cthangover.Core.UI.Theming; using Cthangover.Core.UI.Theming;