tscn patch system
This commit is contained in:
1 parent
d82733e3f7
commit
03ee4dbc8f
4 files changed
+55
-1
No files matched your search
@@ -168,3 +168,9 @@ tools/map_editor/preview_tip = View the map as in game: hover, location card, ma
|
|||||||
tools/map_editor/preview_on = Preview mode: Esc or ✕ returns to the editor.
|
tools/map_editor/preview_on = Preview mode: Esc or ✕ returns to the editor.
|
||||||
tools/map_editor/preview_off = Edit mode.
|
tools/map_editor/preview_off = Edit mode.
|
||||||
tools/map_editor/preview_missing = Failed to load the map widget scene (map_widget.tscn).
|
tools/map_editor/preview_missing = Failed to load the map widget scene (map_widget.tscn).
|
||||||
|
tools/map_editor/effective = In game:
|
||||||
|
tools/map_editor/effective_open = available
|
||||||
|
tools/map_editor/effective_locked = closed (flag)
|
||||||
|
tools/map_editor/effective_no_scene = closed (no scene)
|
||||||
|
tools/map_editor/effective_unknown_scene = closed (scene not found)
|
||||||
|
tools/map_editor/effective_hidden = hidden from map
|
||||||
@@ -167,3 +167,9 @@ tools/map_editor/preview_tip = Посмотреть карту как в игр
|
|||||||
tools/map_editor/preview_on = Режим просмотра: Esc или ✕ — вернуться к редактору.
|
tools/map_editor/preview_on = Режим просмотра: Esc или ✕ — вернуться к редактору.
|
||||||
tools/map_editor/preview_off = Режим редактирования.
|
tools/map_editor/preview_off = Режим редактирования.
|
||||||
tools/map_editor/preview_missing = Не удалось загрузить сцену карты (map_widget.tscn).
|
tools/map_editor/preview_missing = Не удалось загрузить сцену карты (map_widget.tscn).
|
||||||
|
tools/map_editor/effective = В игре:
|
||||||
|
tools/map_editor/effective_open = доступна
|
||||||
|
tools/map_editor/effective_locked = закрыта (флаг «Закрыта»)
|
||||||
|
tools/map_editor/effective_no_scene = закрыта (сцена не задана)
|
||||||
|
tools/map_editor/effective_unknown_scene = закрыта (сцена не найдена)
|
||||||
|
tools/map_editor/effective_hidden = скрыта с карты
|
||||||
@@ -272,7 +272,10 @@ namespace Cthangover.Tools.MapEditor
|
|||||||
private void DrawZone(MapZone zone, Rect2 rect, bool selected)
|
private void DrawZone(MapZone zone, Rect2 rect, bool selected)
|
||||||
{
|
{
|
||||||
if (zone.Points != null && zone.Points.Count >= 2)
|
if (zone.Points != null && zone.Points.Count >= 2)
|
||||||
MapZoneStyle.Draw(this, ToPixels(zone.Points, rect), selected, false, zone.Locked);
|
{
|
||||||
|
var locked = MapZoneRules.IsLocked(zone, !zone.Locked);
|
||||||
|
MapZoneStyle.Draw(this, ToPixels(zone.Points, rect), selected, false, locked, zone.Hidden);
|
||||||
|
}
|
||||||
|
|
||||||
if (HasMarker(zone))
|
if (HasMarker(zone))
|
||||||
DrawMarker(zone, ToPixel(zone.ImagePos, rect), selected);
|
DrawMarker(zone, ToPixel(zone.ImagePos, rect), selected);
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ namespace Cthangover.Tools.MapEditor
|
|||||||
private ItemList _iconList;
|
private ItemList _iconList;
|
||||||
private CheckBox _lockedCheck;
|
private CheckBox _lockedCheck;
|
||||||
private CheckBox _hiddenCheck;
|
private CheckBox _hiddenCheck;
|
||||||
|
private Label _availabilityLabel;
|
||||||
private CheckBox _labelCheck;
|
private CheckBox _labelCheck;
|
||||||
private LineEdit _posX;
|
private LineEdit _posX;
|
||||||
private LineEdit _posY;
|
private LineEdit _posY;
|
||||||
@@ -256,6 +257,10 @@ namespace Cthangover.Tools.MapEditor
|
|||||||
_hiddenCheck.Toggled += _ => OnFieldsChanged();
|
_hiddenCheck.Toggled += _ => OnFieldsChanged();
|
||||||
sidebar.AddChild(_hiddenCheck);
|
sidebar.AddChild(_hiddenCheck);
|
||||||
|
|
||||||
|
_availabilityLabel = new Label { AutowrapMode = TextServer.AutowrapMode.WordSmart };
|
||||||
|
_availabilityLabel.AddThemeColorOverride("font_color", UiTokens.Faint);
|
||||||
|
sidebar.AddChild(_availabilityLabel);
|
||||||
|
|
||||||
sidebar.AddChild(new Label { Text = Tr("tools/map_editor/vertices") });
|
sidebar.AddChild(new Label { Text = Tr("tools/map_editor/vertices") });
|
||||||
|
|
||||||
var vertexButtons = new HBoxContainer();
|
var vertexButtons = new HBoxContainer();
|
||||||
@@ -722,6 +727,8 @@ namespace Cthangover.Tools.MapEditor
|
|||||||
SetDirty();
|
SetDirty();
|
||||||
RefreshJson();
|
RefreshJson();
|
||||||
UpdateZoneListLabel();
|
UpdateZoneListLabel();
|
||||||
|
UpdateAvailability(zone);
|
||||||
|
_canvas.QueueRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnImageChanged()
|
private void OnImageChanged()
|
||||||
@@ -893,6 +900,7 @@ namespace Cthangover.Tools.MapEditor
|
|||||||
_labelX.Text = string.Empty;
|
_labelX.Text = string.Empty;
|
||||||
_labelY.Text = string.Empty;
|
_labelY.Text = string.Empty;
|
||||||
_labelCheck.ButtonPressed = false;
|
_labelCheck.ButtonPressed = false;
|
||||||
|
_availabilityLabel.Text = string.Empty;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,6 +921,37 @@ namespace Cthangover.Tools.MapEditor
|
|||||||
|
|
||||||
WritePositionsToSidebar(zone);
|
WritePositionsToSidebar(zone);
|
||||||
UpdateTitlePreview();
|
UpdateTitlePreview();
|
||||||
|
UpdateAvailability(zone);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows the availability the current authoring data produces in the
|
||||||
|
/// game. The sidebar flags alone are not the whole truth: the player
|
||||||
|
/// also refuses to travel to a zone with an empty or unregistered
|
||||||
|
/// scene, so the hint goes through the shared <see cref="MapZoneRules"/>
|
||||||
|
/// and the editor cannot disagree with the map the player sees.
|
||||||
|
/// </summary>
|
||||||
|
private void UpdateAvailability(MapZone zone)
|
||||||
|
{
|
||||||
|
if (zone == null)
|
||||||
|
{
|
||||||
|
_availabilityLabel.Text = string.Empty;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string state;
|
||||||
|
if (zone.Hidden)
|
||||||
|
state = Tr("tools/map_editor/effective_hidden");
|
||||||
|
else if (zone.Locked)
|
||||||
|
state = Tr("tools/map_editor/effective_locked");
|
||||||
|
else if (string.IsNullOrEmpty(zone.Scene))
|
||||||
|
state = Tr("tools/map_editor/effective_no_scene");
|
||||||
|
else if (MapZoneRules.IsLocked(zone, true))
|
||||||
|
state = Tr("tools/map_editor/effective_unknown_scene");
|
||||||
|
else
|
||||||
|
state = Tr("tools/map_editor/effective_open");
|
||||||
|
|
||||||
|
_availabilityLabel.Text = $"{Tr("tools/map_editor/effective")} {state}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WritePositionsToSidebar(MapZone zone)
|
private void WritePositionsToSidebar(MapZone zone)
|
||||||
|
|||||||
Reference in new issue
Block a user