diff --git a/locale/en.properties b/locale/en.properties index 09de939..baa5fa8 100644 --- a/locale/en.properties +++ b/locale/en.properties @@ -6,7 +6,6 @@ mod_mod_manager_desc = Nexus-style mod manager: catalog browsing, category filte mod_manager/menu_title = Mods & Collections mod_manager/title = Mod Manager mod_manager/back = Close -mod_manager/back_to_list = Back mod_manager/search_placeholder = Search mods... mod_manager/sort_name = By name mod_manager/sort_author = By author @@ -169,6 +168,7 @@ mod_manager/hub_tab_mods = Mods mod_manager/hub_tab_collections = Collections mod_manager/hub_back_to_menu = ← Menu mod_manager/hub_back_to_gallery = ← Games +mod_manager/hub_back_to_mods = ← Mods mod_manager/hub_in_one_collection = in {0} collection mod_manager/hub_in_many_collections = in {0} collections diff --git a/locale/ru.properties b/locale/ru.properties index 1a7737f..d311dbf 100644 --- a/locale/ru.properties +++ b/locale/ru.properties @@ -6,7 +6,6 @@ mod_mod_manager_desc = Менеджер модов в стиле Nexus: ката mod_manager/menu_title = Моды и коллекции mod_manager/title = Менеджер модов mod_manager/back = Закрыть -mod_manager/back_to_list = Назад mod_manager/search_placeholder = Поиск модов... mod_manager/sort_name = По имени mod_manager/sort_author = По автору @@ -169,6 +168,7 @@ mod_manager/hub_tab_mods = Моды mod_manager/hub_tab_collections = Коллекции mod_manager/hub_back_to_menu = ← Меню mod_manager/hub_back_to_gallery = ← К играм +mod_manager/hub_back_to_mods = ← К модам mod_manager/hub_in_one_collection = в {0} коллекции mod_manager/hub_in_many_collections = в {0} коллекциях diff --git a/mod.jpg b/mod.jpg new file mode 100644 index 0000000..a6a9b5b Binary files /dev/null and b/mod.jpg differ diff --git a/mod.png b/mod.png deleted file mode 100644 index 7ec3767..0000000 Binary files a/mod.png and /dev/null differ diff --git a/scenes/components/mod_card.tscn b/scenes/components/mod_card.tscn index 6fd286b..740ad7b 100644 --- a/scenes/components/mod_card.tscn +++ b/scenes/components/mod_card.tscn @@ -75,6 +75,11 @@ clip_text = true text_overrun_behavior = 3 theme_override_font_sizes/font_size = 11 +[node name="LinkRow" type="HBoxContainer" parent="VBox/Body/Box"] +custom_minimum_size = Vector2(0, 16) +layout_mode = 2 +mouse_filter = 2 + [node name="MetaRow" type="HBoxContainer" parent="VBox/Body/Box"] custom_minimum_size = Vector2(0, 28) layout_mode = 2 @@ -84,7 +89,7 @@ theme_override_constants/separation = 6 layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 4 -mouse_filter = 2 +mouse_filter = 1 clip_text = true text_overrun_behavior = 3 theme_override_font_sizes/font_size = 11 @@ -105,6 +110,8 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +clip_text = true +text_overrun_behavior = 3 theme_override_font_sizes/font_size = 11 [node name="ActionRow" type="HBoxContainer" parent="VBox/Body/Box"] diff --git a/scenes/components/mod_detail_view.tscn b/scenes/components/mod_detail_view.tscn index a8e990d..e9269db 100644 --- a/scenes/components/mod_detail_view.tscn +++ b/scenes/components/mod_detail_view.tscn @@ -63,10 +63,6 @@ layout_mode = 2 size_flags_horizontal = 3 theme_override_constants/separation = 6 -[node name="Back" type="Button" parent="Scroll/Content/Hero/HeroMargin/HeroRow/Info"] -layout_mode = 2 -size_flags_horizontal = 0 - [node name="Title" type="Label" parent="Scroll/Content/Hero/HeroMargin/HeroRow/Info"] layout_mode = 2 autowrap_mode = 3 diff --git a/src/ModHubScreen.cs b/src/ModHubScreen.cs index a8341cd..328120b 100644 --- a/src/ModHubScreen.cs +++ b/src/ModHubScreen.cs @@ -25,8 +25,9 @@ namespace Mods.ModManager /// The hub also carries the mockup's cross links: a collection link on a /// mod card switches to the collections tab, a "not found" problem in the /// editor jumps back to the mods tab with the id filled into the search - /// box (), and Escape walks back - /// editor → gallery → mods tab. + /// box (). The back button and Escape + /// walk back one level at a time — editor → gallery, an open mod card → the + /// mods grid — and only then leave to the menu. /// public partial class ModHubScreen : ModWidget { @@ -223,7 +224,7 @@ namespace Mods.ModManager return; } - _back.Text = TranslationServer.Translate("mod_manager/hub_back_to_menu"); + _back.Text = TranslationServer.Translate(ModOpen ? "mod_manager/hub_back_to_mods" : "mod_manager/hub_back_to_menu"); _back.TooltipText = _back.Text; _title.Text = TranslationServer.Translate("mod_manager/menu_title"); _segment.Visible = true; @@ -235,10 +236,13 @@ namespace Mods.ModManager _galleryRefresh.Visible = collections; } + /// Back walks one level up: scheme editor → games gallery, mod card → mods, then the menu. private void OnBackPressed() { if (_editorOpen) ShowGallery(); + else if (ModOpen) + _mods.CloseDetail(); else QueueFree(); } @@ -262,8 +266,11 @@ namespace Mods.ModManager _mods.SetAnchorsAndOffsetsPreset(LayoutPreset.FullRect); _mods.EnsureConstructed(); _mods.CollectionsLinkRequested += () => ShowTab(TabCollections); + _mods.DetailToggled += UpdateHeader; } + private bool ModOpen => _activeTab == TabMods && _mods != null && _mods.IsDetailOpen; + private void EnsureGallery() { if (_gallery != null) @@ -350,7 +357,7 @@ namespace Mods.ModManager /* ═══════════════ Escape chain ═══════════════ */ - /// Escape walks back one level: editor → gallery → mods tab. + /// Escape walks back one level: editor → gallery → mods tab, mod card → mods grid. public override void _UnhandledInput(InputEvent @event) { if (!@event.IsActionPressed("ui_cancel")) @@ -361,6 +368,11 @@ namespace Mods.ModManager ShowGallery(); GetViewport().SetInputAsHandled(); } + else if (ModOpen) + { + _mods.CloseDetail(); + GetViewport().SetInputAsHandled(); + } else if (_activeTab == TabCollections) { ShowTab(TabMods); diff --git a/src/ModManagerScreen.cs b/src/ModManagerScreen.cs index 7c3931c..3dd70bd 100644 --- a/src/ModManagerScreen.cs +++ b/src/ModManagerScreen.cs @@ -52,6 +52,12 @@ namespace Mods.ModManager /// public bool Embedded { get; set; } + /// Whether a mod card is open over the grid. + public bool IsDetailOpen => _detail != null && _detail.Visible; + + /// Raised when a mod card opens or closes (the hub relabels its back button). + public event Action DetailToggled; + /// Raised when a tile or the detail page asks to jump to the collections tab. public event Action CollectionsLinkRequested; @@ -153,7 +159,6 @@ namespace Mods.ModManager _grid.EnabledToggled += OnEnabledToggled; _grid.VersionChanged += OnVersionChanged; _grid.CollectionsLinkRequested += OnCollectionsLinkRequested; - _detail.BackRequested += OnDetailBackRequested; _detail.ActionPressed += OnActionPressed; _detail.DeleteRequested += OnDeleteRequested; _detail.EnabledToggled += OnEnabledToggled; @@ -172,7 +177,6 @@ namespace Mods.ModManager _grid.EnabledToggled -= OnEnabledToggled; _grid.VersionChanged -= OnVersionChanged; _grid.CollectionsLinkRequested -= OnCollectionsLinkRequested; - _detail.BackRequested -= OnDetailBackRequested; _detail.ActionPressed -= OnActionPressed; _detail.DeleteRequested -= OnDeleteRequested; _detail.EnabledToggled -= OnEnabledToggled; @@ -315,10 +319,17 @@ namespace Mods.ModManager QueueFree(); } - private void OnDetailBackRequested() + /// + /// Closes an open mod card and shows the grid again. The hub's back button and + /// Escape call it first, so "back" from a mod returns to the mods, not to the menu. + /// + public void CloseDetail() { + if (!_detail.Visible) + return; _detail.Visible = false; _grid.Visible = true; + DetailToggled?.Invoke(); } private void OnCardClicked(ModCardData data) @@ -326,6 +337,7 @@ namespace Mods.ModManager _detail.Open(data); _detail.Visible = true; _grid.Visible = false; + DetailToggled?.Invoke(); } private void OnSearchChanged(string text) @@ -388,7 +400,7 @@ namespace Mods.ModManager if (updated != null) _detail.Open(updated); else - OnDetailBackRequested(); + CloseDetail(); } } @@ -486,12 +498,7 @@ namespace Mods.ModManager _restartRequired = true; _statusMessage = null; - if (_detail.Visible) - { - _detail.Visible = false; - _grid.Visible = true; - } - + CloseDetail(); RefreshAll(); } diff --git a/src/UI/ModCard.cs b/src/UI/ModCard.cs index 1776b32..3870e33 100644 --- a/src/UI/ModCard.cs +++ b/src/UI/ModCard.cs @@ -29,7 +29,7 @@ namespace Mods.ModManager private OptionButton _versions; private Button _action; private CheckButton _enabled; - private HBoxContainer _metaRow; + private HBoxContainer _linkRow; private Button _collectionsLink; private bool _updatingEnabled; private bool _initialized; @@ -68,7 +68,7 @@ namespace Mods.ModManager _versions = GetNode("VBox/Body/Box/MetaRow/VersionHost/Versions"); _action = GetNode