2026-07-30 23:16:28 -04:00
|
|
|
|
class_name LogbookPage
|
|
|
|
|
|
extends Control
|
|
|
|
|
|
|
|
|
|
|
|
const CollectionLogType = preload("res://collection/collection_log.gd")
|
|
|
|
|
|
const FishDataType = preload("res://fish/fish_data.gd")
|
2026-08-02 17:44:11 -04:00
|
|
|
|
const FishQualityType = preload("res://fish/fish_quality.gd")
|
2026-07-30 23:16:28 -04:00
|
|
|
|
const FishInventoryType = preload("res://inventory/fish_inventory.gd")
|
|
|
|
|
|
const FishPoolType = preload("res://fish/fish_pool.gd")
|
2026-07-31 00:03:47 -04:00
|
|
|
|
const SILHOUETTE_SHADER: Shader = preload(
|
|
|
|
|
|
"res://ui/logbook_silhouette.gdshader"
|
|
|
|
|
|
)
|
2026-07-31 10:20:18 -04:00
|
|
|
|
const OrganizerTabType = preload("res://ui/components/organizer_tab.gd")
|
2026-08-02 09:57:05 -04:00
|
|
|
|
const InventoryNotepadType = preload(
|
|
|
|
|
|
"res://ui/components/inventory_notepad.gd"
|
|
|
|
|
|
)
|
|
|
|
|
|
const LogbookPortraitType = preload(
|
|
|
|
|
|
"res://ui/components/logbook_portrait.gd"
|
|
|
|
|
|
)
|
2026-08-13 14:53:39 -04:00
|
|
|
|
const CurrencyPresentationType = preload(
|
|
|
|
|
|
"res://ui/currency_presentation.gd"
|
|
|
|
|
|
)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
const DETAIL_FADE_DURATION: float = 0.12
|
|
|
|
|
|
const CATEGORY_FADE_DURATION: float = UIMotion.UTILITY_EXIT_DURATION
|
2026-08-02 09:57:05 -04:00
|
|
|
|
const HANDWRITTEN_NUMERIC_SCALE: float = 0.8
|
|
|
|
|
|
const PORTRAIT_VIEW_MAX_SIZE := Vector2(860.0, 480.0)
|
2026-08-15 19:20:42 -04:00
|
|
|
|
const DETAIL_OVERLAY_EDGE_MARGIN: int = 22
|
|
|
|
|
|
const DETAIL_OVERLAY_CONTENT_MARGIN: int = 34
|
|
|
|
|
|
const DETAIL_OVERLAY_TITLE_FONT_SIZE: int = 40
|
|
|
|
|
|
const DETAIL_OVERLAY_TEXT_FONT_SIZE: int = 36
|
2026-07-30 23:16:28 -04:00
|
|
|
|
const INK := Color("251b10")
|
|
|
|
|
|
const MUTED_INK := Color("6d5b45")
|
2026-08-08 00:34:06 -04:00
|
|
|
|
const LOGBOOK_ARTWORK: Texture2D = preload(
|
|
|
|
|
|
"res://ui/assets/logbook/ui_logbook.png"
|
|
|
|
|
|
)
|
|
|
|
|
|
const SCROLL_UP_TEXTURE: Texture2D = preload(
|
|
|
|
|
|
"res://ui/icons/pictograms/arrow_dark_up_full.png"
|
|
|
|
|
|
)
|
|
|
|
|
|
const SCROLL_DOWN_TEXTURE: Texture2D = preload(
|
|
|
|
|
|
"res://ui/icons/pictograms/arrow_dark_down_full.png"
|
|
|
|
|
|
)
|
|
|
|
|
|
const LOGBOOK_ARTWORK_SOURCE_SIZE := Vector2(512.0, 247.0)
|
|
|
|
|
|
const LEFT_PAGE_CONTENT_RECT := Rect2(56.0, 26.0, 190.0, 198.0)
|
|
|
|
|
|
const RIGHT_PAGE_CONTENT_RECT := Rect2(267.0, 26.0, 210.0, 198.0)
|
2026-08-15 14:28:13 -04:00
|
|
|
|
const LOGBOOK_TAB_LEFT_INSET: float = 92.0
|
|
|
|
|
|
const LOGBOOK_TAB_SIZE := Vector2(108.0, 38.0)
|
|
|
|
|
|
const LOGBOOK_TAB_SEPARATION: float = 6.0
|
|
|
|
|
|
const LOGBOOK_TAB_TEXT_SIDE_INSET: float = 10.0
|
2026-08-08 00:34:06 -04:00
|
|
|
|
const PAGE_CONTENT_SCALE: float = 0.97
|
|
|
|
|
|
const CATALOG_PORTRAIT_SIZE := Vector2(78.0, 36.0)
|
|
|
|
|
|
const CATALOG_ENTRY_SIZE := Vector2(92.0, 92.0)
|
|
|
|
|
|
const CATALOG_ROW_STEP: float = 98.0
|
|
|
|
|
|
const CATALOG_SNAP_DELAY: float = 0.12
|
|
|
|
|
|
const DETAIL_PORTRAIT_SIZE := Vector2(160.0, 88.0)
|
|
|
|
|
|
const DETAIL_BOTTOM_INSET: float = 35.0
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
2026-08-15 19:20:42 -04:00
|
|
|
|
enum ControllerZone {
|
|
|
|
|
|
TABS,
|
|
|
|
|
|
ENTRIES,
|
|
|
|
|
|
DETAILS,
|
|
|
|
|
|
OVERLAY,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-30 23:16:28 -04:00
|
|
|
|
var _collection_log: CollectionLogType
|
|
|
|
|
|
var _inventory: FishInventoryType
|
|
|
|
|
|
var _catalog: FishPoolType
|
2026-08-14 22:11:49 -04:00
|
|
|
|
var _category: LogbookCatalog.Category = (
|
|
|
|
|
|
LogbookCatalog.Category.FRESH_WATER
|
|
|
|
|
|
)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
var _selected_id: StringName
|
|
|
|
|
|
var _selected_entry_key: StringName
|
|
|
|
|
|
var _active: bool = false
|
|
|
|
|
|
var _interactive: bool = false
|
|
|
|
|
|
var _entry_buttons: Dictionary[StringName, Button] = {}
|
|
|
|
|
|
var _detail_generation: int = 0
|
|
|
|
|
|
var _detail_tween: Tween
|
|
|
|
|
|
var _category_generation: int = 0
|
|
|
|
|
|
var _category_tween: Tween
|
2026-07-31 00:03:47 -04:00
|
|
|
|
var _silhouette_material: ShaderMaterial
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var _snapping_catalog_scroll: bool = false
|
|
|
|
|
|
var _catalog_scroll_snap_timer: Timer
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
var _category_tabs: Array[Button] = []
|
2026-08-15 14:28:13 -04:00
|
|
|
|
var _category_tab_categories: Array[LogbookCatalog.Category] = []
|
2026-07-30 23:16:28 -04:00
|
|
|
|
var _catalog_scroll: ScrollContainer
|
|
|
|
|
|
var _catalog_grid: GridContainer
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var _catalog_scroll_up_indicator: TextureRect
|
|
|
|
|
|
var _catalog_scroll_down_indicator: TextureRect
|
2026-07-30 23:16:28 -04:00
|
|
|
|
var _empty_state: Label
|
|
|
|
|
|
var _detail_body: VBoxContainer
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var _detail_portrait_button: Button
|
2026-08-15 19:20:42 -04:00
|
|
|
|
var _detail_buttons: Array[Button] = []
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var _portrait_overlay: Control
|
|
|
|
|
|
var _portrait_overlay_backdrop: Button
|
|
|
|
|
|
var _portrait_overlay_artwork: LogbookPortraitType
|
2026-08-15 19:20:42 -04:00
|
|
|
|
var _portrait_overlay_title: Label
|
|
|
|
|
|
var _portrait_overlay_text: Label
|
|
|
|
|
|
var _overlay_return_focus: Control
|
|
|
|
|
|
var _controller_zone: ControllerZone = ControllerZone.TABS
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2026-07-31 00:03:47 -04:00
|
|
|
|
_silhouette_material = ShaderMaterial.new()
|
|
|
|
|
|
_silhouette_material.shader = SILHOUETTE_SHADER
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_build_interface()
|
|
|
|
|
|
set_interactive(false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func setup(
|
|
|
|
|
|
collection_log: CollectionLogType,
|
|
|
|
|
|
inventory: FishInventoryType,
|
|
|
|
|
|
catalog: FishPoolType,
|
|
|
|
|
|
) -> void:
|
|
|
|
|
|
_collection_log = collection_log
|
|
|
|
|
|
_inventory = inventory
|
|
|
|
|
|
_catalog = catalog
|
|
|
|
|
|
if not _collection_log.fish_discovered.is_connected(
|
|
|
|
|
|
_on_fish_discovered
|
|
|
|
|
|
):
|
|
|
|
|
|
_collection_log.fish_discovered.connect(_on_fish_discovered)
|
|
|
|
|
|
if not _collection_log.collection_changed.is_connected(
|
|
|
|
|
|
_on_collection_changed
|
|
|
|
|
|
):
|
|
|
|
|
|
_collection_log.collection_changed.connect(_on_collection_changed)
|
|
|
|
|
|
if not _inventory.catches_changed.is_connected(_on_inventory_changed):
|
|
|
|
|
|
_inventory.catches_changed.connect(_on_inventory_changed)
|
|
|
|
|
|
_refresh_catalog()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func activate() -> void:
|
|
|
|
|
|
_active = true
|
|
|
|
|
|
set_interactive(true)
|
|
|
|
|
|
_refresh_catalog()
|
2026-07-31 10:20:18 -04:00
|
|
|
|
_animate_tab_entry()
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func deactivate() -> void:
|
|
|
|
|
|
_active = false
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_hide_portrait_overlay(false)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
set_interactive(false)
|
2026-07-31 10:20:18 -04:00
|
|
|
|
_settle_tabs_for_close()
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_cancel_detail_tween()
|
|
|
|
|
|
_cancel_category_tween()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func set_interactive(value: bool) -> void:
|
|
|
|
|
|
_interactive = value and _active
|
|
|
|
|
|
mouse_filter = (
|
|
|
|
|
|
Control.MOUSE_FILTER_PASS
|
|
|
|
|
|
if _interactive
|
|
|
|
|
|
else Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
)
|
|
|
|
|
|
for tab: Button in _category_tabs:
|
|
|
|
|
|
tab.focus_mode = (
|
2026-08-15 19:20:42 -04:00
|
|
|
|
Control.FOCUS_ALL
|
|
|
|
|
|
if _interactive and _controller_zone == ControllerZone.TABS
|
|
|
|
|
|
else Control.FOCUS_NONE
|
2026-07-30 23:16:28 -04:00
|
|
|
|
)
|
|
|
|
|
|
tab.mouse_filter = (
|
|
|
|
|
|
Control.MOUSE_FILTER_STOP
|
2026-07-31 13:14:55 -04:00
|
|
|
|
if _interactive and not tab.button_pressed
|
2026-07-30 23:16:28 -04:00
|
|
|
|
else Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
)
|
|
|
|
|
|
for entry: Button in _entry_buttons.values():
|
|
|
|
|
|
entry.focus_mode = (
|
2026-08-15 19:20:42 -04:00
|
|
|
|
Control.FOCUS_ALL
|
|
|
|
|
|
if _interactive and _controller_zone == ControllerZone.ENTRIES
|
|
|
|
|
|
else Control.FOCUS_NONE
|
2026-07-30 23:16:28 -04:00
|
|
|
|
)
|
|
|
|
|
|
entry.mouse_filter = (
|
|
|
|
|
|
Control.MOUSE_FILTER_STOP
|
|
|
|
|
|
if _interactive
|
|
|
|
|
|
else Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
)
|
2026-08-15 19:20:42 -04:00
|
|
|
|
for detail_button: Button in _detail_buttons:
|
|
|
|
|
|
if not is_instance_valid(detail_button):
|
|
|
|
|
|
continue
|
|
|
|
|
|
detail_button.focus_mode = (
|
|
|
|
|
|
Control.FOCUS_ALL
|
|
|
|
|
|
if _interactive and _controller_zone == ControllerZone.DETAILS
|
|
|
|
|
|
else Control.FOCUS_NONE
|
|
|
|
|
|
)
|
|
|
|
|
|
if _portrait_overlay_backdrop != null:
|
|
|
|
|
|
_portrait_overlay_backdrop.focus_mode = (
|
|
|
|
|
|
Control.FOCUS_ALL
|
|
|
|
|
|
if _interactive and _controller_zone == ControllerZone.OVERLAY
|
|
|
|
|
|
else Control.FOCUS_NONE
|
|
|
|
|
|
)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func focus_initial() -> void:
|
|
|
|
|
|
if not _active or not _interactive:
|
|
|
|
|
|
return
|
2026-08-15 19:20:42 -04:00
|
|
|
|
if _controller_zone == ControllerZone.OVERLAY:
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_portrait_overlay_backdrop.grab_focus()
|
|
|
|
|
|
return
|
2026-08-15 19:20:42 -04:00
|
|
|
|
if _controller_zone == ControllerZone.TABS:
|
|
|
|
|
|
var category_tab_index: int = _category_tab_categories.find(_category)
|
|
|
|
|
|
if category_tab_index >= 0:
|
|
|
|
|
|
_category_tabs[category_tab_index].grab_focus()
|
|
|
|
|
|
return
|
|
|
|
|
|
if _controller_zone == ControllerZone.DETAILS:
|
|
|
|
|
|
if not _detail_buttons.is_empty():
|
|
|
|
|
|
_detail_buttons.front().grab_focus()
|
|
|
|
|
|
return
|
|
|
|
|
|
var selected := _entry_buttons.get(_selected_entry_key) as Button
|
2026-07-30 23:16:28 -04:00
|
|
|
|
if selected != null:
|
|
|
|
|
|
selected.grab_focus()
|
|
|
|
|
|
elif not _entry_buttons.is_empty():
|
|
|
|
|
|
var first := _entry_buttons.values().front() as Button
|
|
|
|
|
|
first.grab_focus()
|
2026-08-15 19:20:42 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func reset_controller_zone() -> void:
|
|
|
|
|
|
_controller_zone = ControllerZone.TABS
|
|
|
|
|
|
set_interactive(_interactive)
|
|
|
|
|
|
call_deferred("focus_initial")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func handle_controller_input(event: InputEvent) -> bool:
|
|
|
|
|
|
if not _active or not _interactive:
|
|
|
|
|
|
return false
|
|
|
|
|
|
var accept_pressed: bool = event.is_action_pressed("ui_accept")
|
|
|
|
|
|
var cancel_pressed: bool = event.is_action_pressed("ui_cancel")
|
|
|
|
|
|
if cancel_pressed:
|
|
|
|
|
|
match _controller_zone:
|
|
|
|
|
|
ControllerZone.OVERLAY:
|
|
|
|
|
|
_hide_portrait_overlay()
|
|
|
|
|
|
ControllerZone.DETAILS:
|
|
|
|
|
|
_set_controller_zone(ControllerZone.ENTRIES)
|
|
|
|
|
|
ControllerZone.ENTRIES:
|
|
|
|
|
|
_set_controller_zone(ControllerZone.TABS)
|
|
|
|
|
|
ControllerZone.TABS:
|
|
|
|
|
|
return false
|
|
|
|
|
|
return true
|
|
|
|
|
|
if _controller_zone == ControllerZone.TABS:
|
|
|
|
|
|
if event.is_action_pressed("ui_left"):
|
|
|
|
|
|
_select_adjacent_controller_category(-1)
|
|
|
|
|
|
return true
|
|
|
|
|
|
if event.is_action_pressed("ui_right"):
|
|
|
|
|
|
_select_adjacent_controller_category(1)
|
|
|
|
|
|
return true
|
|
|
|
|
|
if accept_pressed:
|
|
|
|
|
|
if not _entry_buttons.is_empty():
|
|
|
|
|
|
_set_controller_zone(ControllerZone.ENTRIES)
|
|
|
|
|
|
return true
|
|
|
|
|
|
if _controller_zone == ControllerZone.ENTRIES and accept_pressed:
|
|
|
|
|
|
if not _selected_entry_key.is_empty() and not _detail_buttons.is_empty():
|
|
|
|
|
|
_set_controller_zone(ControllerZone.DETAILS)
|
|
|
|
|
|
return true
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _set_controller_zone(zone: ControllerZone) -> void:
|
|
|
|
|
|
_controller_zone = zone
|
|
|
|
|
|
set_interactive(_interactive)
|
|
|
|
|
|
call_deferred("focus_initial")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _select_adjacent_controller_category(direction: int) -> void:
|
|
|
|
|
|
var current_index: int = _category_tab_categories.find(_category)
|
|
|
|
|
|
var target_index: int = clampi(
|
|
|
|
|
|
current_index + direction,
|
|
|
|
|
|
0,
|
|
|
|
|
|
_category_tab_categories.size() - 1,
|
|
|
|
|
|
)
|
|
|
|
|
|
if target_index != current_index:
|
|
|
|
|
|
_select_category(_category_tab_categories[target_index])
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _build_interface() -> void:
|
|
|
|
|
|
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
|
|
|
|
var outer := MarginContainer.new()
|
|
|
|
|
|
outer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
|
|
|
|
outer.add_theme_constant_override("margin_left", 52)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
outer.add_theme_constant_override("margin_top", 85)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
outer.add_theme_constant_override("margin_right", 52)
|
|
|
|
|
|
outer.add_theme_constant_override("margin_bottom", 18)
|
|
|
|
|
|
add_child(outer)
|
|
|
|
|
|
|
2026-07-31 10:20:18 -04:00
|
|
|
|
var stack := Control.new()
|
|
|
|
|
|
stack.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
outer.add_child(stack)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
var tabs := HBoxContainer.new()
|
2026-08-08 00:34:06 -04:00
|
|
|
|
# Align the first flange with the authored left paper edge.
|
|
|
|
|
|
tabs.position = Vector2(LOGBOOK_TAB_LEFT_INSET, 37.0)
|
2026-08-15 14:28:13 -04:00
|
|
|
|
var category_order: Array[LogbookCatalog.Category] = [
|
2026-08-14 22:11:49 -04:00
|
|
|
|
LogbookCatalog.Category.FRESH_WATER,
|
|
|
|
|
|
LogbookCatalog.Category.SALT_WATER,
|
|
|
|
|
|
LogbookCatalog.Category.SHELLFISH,
|
2026-08-15 14:28:13 -04:00
|
|
|
|
LogbookCatalog.Category.OTHER,
|
|
|
|
|
|
]
|
|
|
|
|
|
tabs.size = Vector2(
|
|
|
|
|
|
LOGBOOK_TAB_SIZE.x * float(category_order.size())
|
|
|
|
|
|
+ LOGBOOK_TAB_SEPARATION * float(category_order.size() - 1),
|
|
|
|
|
|
LOGBOOK_TAB_SIZE.y,
|
|
|
|
|
|
)
|
|
|
|
|
|
tabs.z_index = 10
|
|
|
|
|
|
tabs.mouse_filter = Control.MOUSE_FILTER_PASS
|
|
|
|
|
|
tabs.add_theme_constant_override(
|
|
|
|
|
|
"separation", roundi(LOGBOOK_TAB_SEPARATION)
|
|
|
|
|
|
)
|
|
|
|
|
|
stack.add_child(tabs)
|
|
|
|
|
|
for category: LogbookCatalog.Category in category_order:
|
2026-07-31 10:20:18 -04:00
|
|
|
|
var tab := OrganizerTabType.new()
|
2026-08-15 14:28:13 -04:00
|
|
|
|
tab.custom_minimum_size = LOGBOOK_TAB_SIZE
|
2026-07-30 23:16:28 -04:00
|
|
|
|
tab.toggle_mode = true
|
|
|
|
|
|
tab.text = LogbookCatalog.category_label(category)
|
2026-07-31 13:14:55 -04:00
|
|
|
|
tab.palette_index = int(category)
|
|
|
|
|
|
tab.set_selected(category == _category, false)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
tab.pressed.connect(_select_category.bind(category))
|
|
|
|
|
|
tabs.add_child(tab)
|
|
|
|
|
|
_category_tabs.append(tab)
|
2026-08-15 14:28:13 -04:00
|
|
|
|
_category_tab_categories.append(category)
|
2026-07-31 10:20:18 -04:00
|
|
|
|
_configure_category_focus()
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var book := Control.new()
|
2026-07-31 10:20:18 -04:00
|
|
|
|
book.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
|
|
|
|
book.offset_top = 50.0
|
|
|
|
|
|
book.z_index = 20
|
2026-08-08 00:34:06 -04:00
|
|
|
|
book.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
2026-07-31 10:20:18 -04:00
|
|
|
|
stack.add_child(book)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var artwork := TextureRect.new()
|
|
|
|
|
|
artwork.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
|
|
|
|
artwork.texture = LOGBOOK_ARTWORK
|
|
|
|
|
|
artwork.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
|
|
|
|
artwork.stretch_mode = TextureRect.STRETCH_SCALE
|
|
|
|
|
|
artwork.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
|
|
|
|
|
artwork.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
book.add_child(artwork)
|
|
|
|
|
|
|
|
|
|
|
|
var left_page := Control.new()
|
|
|
|
|
|
left_page.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
_apply_artwork_rect(left_page, LEFT_PAGE_CONTENT_RECT)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
book.add_child(left_page)
|
|
|
|
|
|
var left_layout := VBoxContainer.new()
|
2026-08-08 00:34:06 -04:00
|
|
|
|
left_layout.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
left_layout.add_theme_constant_override("separation", 8)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
left_page.add_child(left_layout)
|
|
|
|
|
|
_apply_page_content_scale(left_layout)
|
|
|
|
|
|
var scroll_indicator_top_lane := Control.new()
|
|
|
|
|
|
scroll_indicator_top_lane.custom_minimum_size.y = 20.0
|
|
|
|
|
|
scroll_indicator_top_lane.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
left_layout.add_child(scroll_indicator_top_lane)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_empty_state = _label("", 18)
|
|
|
|
|
|
_empty_state.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
|
|
_empty_state.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
|
|
|
|
_empty_state.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
left_layout.add_child(_empty_state)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var catalog_scroll_margin := MarginContainer.new()
|
|
|
|
|
|
catalog_scroll_margin.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
catalog_scroll_margin.add_theme_constant_override("margin_left", 20)
|
|
|
|
|
|
left_layout.add_child(catalog_scroll_margin)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_catalog_scroll = ScrollContainer.new()
|
|
|
|
|
|
_catalog_scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
_catalog_scroll.horizontal_scroll_mode = (
|
|
|
|
|
|
ScrollContainer.SCROLL_MODE_DISABLED
|
|
|
|
|
|
)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
_catalog_scroll.scroll_vertical_custom_step = CATALOG_ROW_STEP
|
|
|
|
|
|
catalog_scroll_margin.add_child(_catalog_scroll)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_catalog_grid = GridContainer.new()
|
2026-08-08 00:34:06 -04:00
|
|
|
|
_catalog_grid.columns = 4
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_catalog_grid.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
2026-08-08 00:34:06 -04:00
|
|
|
|
_catalog_grid.add_theme_constant_override("h_separation", 6)
|
|
|
|
|
|
_catalog_grid.add_theme_constant_override("v_separation", 6)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_catalog_scroll.add_child(_catalog_grid)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var scroll_indicator_bottom_lane := Control.new()
|
|
|
|
|
|
scroll_indicator_bottom_lane.custom_minimum_size.y = 32.0
|
|
|
|
|
|
scroll_indicator_bottom_lane.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
left_layout.add_child(scroll_indicator_bottom_lane)
|
|
|
|
|
|
_configure_catalog_scroll_bar()
|
|
|
|
|
|
_catalog_scroll_up_indicator = _make_scroll_indicator(
|
|
|
|
|
|
"CatalogScrollUpIndicator",
|
|
|
|
|
|
SCROLL_UP_TEXTURE,
|
|
|
|
|
|
true,
|
2026-07-30 23:16:28 -04:00
|
|
|
|
)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
left_page.add_child(_catalog_scroll_up_indicator)
|
|
|
|
|
|
_catalog_scroll_down_indicator = _make_scroll_indicator(
|
|
|
|
|
|
"CatalogScrollDownIndicator",
|
|
|
|
|
|
SCROLL_DOWN_TEXTURE,
|
|
|
|
|
|
false,
|
|
|
|
|
|
)
|
|
|
|
|
|
left_page.add_child(_catalog_scroll_down_indicator)
|
|
|
|
|
|
|
|
|
|
|
|
var right_page := Control.new()
|
|
|
|
|
|
right_page.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
_apply_artwork_rect(right_page, RIGHT_PAGE_CONTENT_RECT)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
book.add_child(right_page)
|
|
|
|
|
|
_detail_body = VBoxContainer.new()
|
2026-08-08 00:34:06 -04:00
|
|
|
|
_detail_body.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_detail_body.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_detail_body.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
_detail_body.add_theme_constant_override("separation", 16)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
right_page.add_child(_detail_body)
|
|
|
|
|
|
_apply_page_content_scale(_detail_body)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_show_no_selection()
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_build_portrait_overlay()
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
2026-08-08 00:34:06 -04:00
|
|
|
|
func _apply_artwork_rect(control: Control, source_rect: Rect2) -> void:
|
|
|
|
|
|
control.anchor_left = source_rect.position.x / LOGBOOK_ARTWORK_SOURCE_SIZE.x
|
|
|
|
|
|
control.anchor_top = source_rect.position.y / LOGBOOK_ARTWORK_SOURCE_SIZE.y
|
|
|
|
|
|
control.anchor_right = source_rect.end.x / LOGBOOK_ARTWORK_SOURCE_SIZE.x
|
|
|
|
|
|
control.anchor_bottom = source_rect.end.y / LOGBOOK_ARTWORK_SOURCE_SIZE.y
|
|
|
|
|
|
control.offset_left = 0.0
|
|
|
|
|
|
control.offset_top = 0.0
|
|
|
|
|
|
control.offset_right = 0.0
|
|
|
|
|
|
control.offset_bottom = 0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _apply_page_content_scale(control: Control) -> void:
|
|
|
|
|
|
control.scale = Vector2.ONE * PAGE_CONTENT_SCALE
|
|
|
|
|
|
control.resized.connect(_center_scaled_content.bind(control))
|
|
|
|
|
|
_center_scaled_content.call_deferred(control)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _center_scaled_content(control: Control) -> void:
|
|
|
|
|
|
if is_instance_valid(control):
|
|
|
|
|
|
control.pivot_offset = control.size * 0.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _configure_catalog_scroll_bar() -> void:
|
|
|
|
|
|
_catalog_scroll_snap_timer = Timer.new()
|
|
|
|
|
|
_catalog_scroll_snap_timer.one_shot = true
|
|
|
|
|
|
_catalog_scroll_snap_timer.wait_time = CATALOG_SNAP_DELAY
|
|
|
|
|
|
_catalog_scroll_snap_timer.timeout.connect(_snap_catalog_scroll_to_row)
|
|
|
|
|
|
_catalog_scroll.add_child(_catalog_scroll_snap_timer)
|
|
|
|
|
|
var scroll_bar: VScrollBar = _catalog_scroll.get_v_scroll_bar()
|
|
|
|
|
|
scroll_bar.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
scroll_bar.focus_mode = Control.FOCUS_NONE
|
|
|
|
|
|
scroll_bar.self_modulate = Color.TRANSPARENT
|
|
|
|
|
|
scroll_bar.custom_minimum_size.x = 0.0
|
|
|
|
|
|
scroll_bar.add_theme_constant_override("scroll_size", 0)
|
|
|
|
|
|
var empty_style := StyleBoxEmpty.new()
|
|
|
|
|
|
for style_name: StringName in [
|
|
|
|
|
|
&"scroll",
|
|
|
|
|
|
&"scroll_focus",
|
|
|
|
|
|
&"grabber",
|
|
|
|
|
|
&"grabber_highlight",
|
|
|
|
|
|
&"grabber_pressed",
|
|
|
|
|
|
]:
|
|
|
|
|
|
scroll_bar.add_theme_stylebox_override(style_name, empty_style)
|
|
|
|
|
|
scroll_bar.changed.connect(_refresh_catalog_scroll_indicators)
|
|
|
|
|
|
scroll_bar.value_changed.connect(_on_catalog_scroll_value_changed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _make_scroll_indicator(
|
|
|
|
|
|
indicator_name: String,
|
|
|
|
|
|
indicator_texture: Texture2D,
|
|
|
|
|
|
at_top: bool,
|
|
|
|
|
|
) -> TextureRect:
|
|
|
|
|
|
var indicator := TextureRect.new()
|
|
|
|
|
|
indicator.name = indicator_name
|
|
|
|
|
|
indicator.anchor_left = 0.5
|
|
|
|
|
|
indicator.anchor_right = 0.5
|
|
|
|
|
|
indicator.anchor_top = 0.0 if at_top else 1.0
|
|
|
|
|
|
indicator.anchor_bottom = indicator.anchor_top
|
|
|
|
|
|
indicator.offset_left = -14.0
|
|
|
|
|
|
indicator.offset_right = 14.0
|
|
|
|
|
|
indicator.offset_top = -8.0 if at_top else -35.0
|
|
|
|
|
|
indicator.offset_bottom = 20.0 if at_top else -7.0
|
|
|
|
|
|
indicator.z_index = 30
|
|
|
|
|
|
indicator.texture = indicator_texture
|
|
|
|
|
|
indicator.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
|
|
|
|
indicator.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
|
|
|
|
|
indicator.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
|
|
|
|
|
|
indicator.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
indicator.visible = false
|
|
|
|
|
|
return indicator
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-08-09 13:31:30 -04:00
|
|
|
|
func _on_catalog_scroll_value_changed(_value: float) -> void:
|
2026-08-08 00:34:06 -04:00
|
|
|
|
if _snapping_catalog_scroll:
|
|
|
|
|
|
return
|
|
|
|
|
|
_catalog_scroll_snap_timer.start()
|
|
|
|
|
|
_refresh_catalog_scroll_indicators()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _snap_catalog_scroll_to_row() -> void:
|
|
|
|
|
|
var scroll_bar: VScrollBar = _catalog_scroll.get_v_scroll_bar()
|
|
|
|
|
|
var value: float = scroll_bar.value
|
|
|
|
|
|
var maximum_scroll: float = scroll_bar.max_value - scroll_bar.page
|
|
|
|
|
|
var snapped_value: float = clampf(
|
|
|
|
|
|
roundf(value / CATALOG_ROW_STEP) * CATALOG_ROW_STEP,
|
|
|
|
|
|
scroll_bar.min_value,
|
|
|
|
|
|
maximum_scroll,
|
|
|
|
|
|
)
|
|
|
|
|
|
if not is_equal_approx(value, snapped_value):
|
|
|
|
|
|
_snapping_catalog_scroll = true
|
|
|
|
|
|
_catalog_scroll.scroll_vertical = roundi(snapped_value)
|
|
|
|
|
|
_snapping_catalog_scroll = false
|
|
|
|
|
|
_refresh_catalog_scroll_indicators()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _refresh_catalog_scroll_indicators() -> void:
|
|
|
|
|
|
if (
|
|
|
|
|
|
_catalog_scroll == null
|
|
|
|
|
|
or _catalog_scroll_up_indicator == null
|
|
|
|
|
|
or _catalog_scroll_down_indicator == null
|
|
|
|
|
|
):
|
|
|
|
|
|
return
|
|
|
|
|
|
var scroll_bar: VScrollBar = _catalog_scroll.get_v_scroll_bar()
|
|
|
|
|
|
var maximum_scroll: float = scroll_bar.max_value - scroll_bar.page
|
|
|
|
|
|
var has_overflow: bool = (
|
|
|
|
|
|
_catalog_scroll.visible
|
|
|
|
|
|
and maximum_scroll > scroll_bar.min_value + 0.5
|
|
|
|
|
|
)
|
|
|
|
|
|
_catalog_scroll_up_indicator.visible = (
|
|
|
|
|
|
has_overflow and scroll_bar.value > scroll_bar.min_value + 0.5
|
|
|
|
|
|
)
|
|
|
|
|
|
_catalog_scroll_down_indicator.visible = (
|
|
|
|
|
|
has_overflow and scroll_bar.value < maximum_scroll - 0.5
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-30 23:16:28 -04:00
|
|
|
|
func _refresh_catalog() -> void:
|
|
|
|
|
|
if not is_node_ready():
|
|
|
|
|
|
return
|
|
|
|
|
|
var preserved_selection: StringName = _selected_id
|
|
|
|
|
|
var preserved_entry_key: StringName = _selected_entry_key
|
|
|
|
|
|
_clear_entries()
|
|
|
|
|
|
var species: Array[FishDataType] = []
|
|
|
|
|
|
if _catalog != null:
|
|
|
|
|
|
species = LogbookCatalog.ordered_species(_catalog.candidates)
|
|
|
|
|
|
for fish: FishDataType in species:
|
|
|
|
|
|
if LogbookCatalog.category_for(fish) != _category:
|
|
|
|
|
|
continue
|
|
|
|
|
|
var discovered: bool = _collection_log.has_discovered(fish.id)
|
2026-07-31 00:03:47 -04:00
|
|
|
|
var entry: Button = _make_entry(fish, discovered)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
var selection_key: StringName = (
|
|
|
|
|
|
fish.id if discovered else _unknown_selection_key(fish)
|
|
|
|
|
|
)
|
|
|
|
|
|
_entry_buttons[selection_key] = entry
|
|
|
|
|
|
entry.pressed.connect(
|
|
|
|
|
|
_select_entry.bind(
|
|
|
|
|
|
selection_key,
|
|
|
|
|
|
fish.id if discovered else StringName(),
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
entry.focus_entered.connect(
|
|
|
|
|
|
_select_entry.bind(
|
|
|
|
|
|
selection_key,
|
|
|
|
|
|
fish.id if discovered else StringName(),
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
_catalog_grid.add_child(entry)
|
|
|
|
|
|
_empty_state.text = LogbookCatalog.empty_state(_category)
|
|
|
|
|
|
_empty_state.visible = _entry_buttons.is_empty()
|
|
|
|
|
|
_catalog_scroll.visible = not _entry_buttons.is_empty()
|
|
|
|
|
|
if (
|
|
|
|
|
|
not preserved_selection.is_empty()
|
|
|
|
|
|
and _entry_buttons.has(preserved_selection)
|
|
|
|
|
|
):
|
|
|
|
|
|
_selected_id = preserved_selection
|
|
|
|
|
|
_selected_entry_key = preserved_selection
|
|
|
|
|
|
elif _entry_buttons.has(preserved_entry_key):
|
|
|
|
|
|
_selected_id = StringName()
|
|
|
|
|
|
_selected_entry_key = preserved_entry_key
|
|
|
|
|
|
else:
|
|
|
|
|
|
_selected_id = StringName()
|
|
|
|
|
|
_selected_entry_key = StringName()
|
|
|
|
|
|
_refresh_selection_styles()
|
|
|
|
|
|
_refresh_details(false)
|
|
|
|
|
|
set_interactive(_interactive)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
_refresh_catalog_scroll_indicators.call_deferred()
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
2026-07-31 00:03:47 -04:00
|
|
|
|
func _make_entry(fish: FishDataType, discovered: bool) -> Button:
|
2026-07-30 23:16:28 -04:00
|
|
|
|
var entry := Button.new()
|
2026-08-08 14:23:28 -04:00
|
|
|
|
entry.set_meta(&"controller_focus_inversion_disabled", true)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
entry.custom_minimum_size = CATALOG_ENTRY_SIZE
|
2026-08-02 09:57:05 -04:00
|
|
|
|
entry.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
entry.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
2026-07-30 23:16:28 -04:00
|
|
|
|
entry.toggle_mode = true
|
|
|
|
|
|
entry.add_theme_stylebox_override("normal", _entry_style(false))
|
|
|
|
|
|
entry.add_theme_stylebox_override("hover", _entry_style(true))
|
2026-08-02 09:57:05 -04:00
|
|
|
|
entry.add_theme_stylebox_override("hover_pressed", _entry_style(true))
|
2026-07-30 23:16:28 -04:00
|
|
|
|
entry.add_theme_stylebox_override("focus", _entry_style(true))
|
|
|
|
|
|
entry.add_theme_stylebox_override("pressed", _entry_style(true))
|
2026-08-02 09:57:05 -04:00
|
|
|
|
entry.text = ""
|
2026-07-31 00:03:47 -04:00
|
|
|
|
if not discovered:
|
2026-07-30 23:16:28 -04:00
|
|
|
|
entry.tooltip_text = ""
|
|
|
|
|
|
entry.accessibility_name = "Unknown catalog entry"
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_add_entry_content(entry, fish.display_texture, "???", true)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
else:
|
|
|
|
|
|
entry.tooltip_text = fish.display_name
|
|
|
|
|
|
entry.accessibility_name = fish.display_name
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_add_entry_content(
|
|
|
|
|
|
entry, fish.display_texture, fish.display_name, false
|
|
|
|
|
|
)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
return entry
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-08-02 09:57:05 -04:00
|
|
|
|
func _add_entry_content(
|
2026-07-31 00:03:47 -04:00
|
|
|
|
entry: Button,
|
|
|
|
|
|
portrait: Texture2D,
|
2026-08-02 09:57:05 -04:00
|
|
|
|
entry_name: String,
|
|
|
|
|
|
unknown: bool,
|
2026-07-31 00:03:47 -04:00
|
|
|
|
) -> void:
|
|
|
|
|
|
var content_margin := MarginContainer.new()
|
|
|
|
|
|
content_margin.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
content_margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
content_margin.add_theme_constant_override("margin_left", 5)
|
|
|
|
|
|
content_margin.add_theme_constant_override("margin_top", 8)
|
|
|
|
|
|
content_margin.add_theme_constant_override("margin_right", 5)
|
|
|
|
|
|
content_margin.add_theme_constant_override("margin_bottom", 2)
|
2026-07-31 00:03:47 -04:00
|
|
|
|
entry.add_child(content_margin)
|
|
|
|
|
|
|
|
|
|
|
|
var content := VBoxContainer.new()
|
|
|
|
|
|
content.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
2026-08-02 09:57:05 -04:00
|
|
|
|
content.alignment = BoxContainer.ALIGNMENT_CENTER
|
|
|
|
|
|
content.add_theme_constant_override("separation", 4)
|
2026-07-31 00:03:47 -04:00
|
|
|
|
content_margin.add_child(content)
|
|
|
|
|
|
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var portrait_view := LogbookPortraitType.new()
|
|
|
|
|
|
portrait_view.configure(
|
|
|
|
|
|
portrait,
|
2026-08-08 00:34:06 -04:00
|
|
|
|
CATALOG_PORTRAIT_SIZE,
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_silhouette_material if unknown else null,
|
|
|
|
|
|
)
|
2026-07-31 00:03:47 -04:00
|
|
|
|
content.add_child(portrait_view)
|
|
|
|
|
|
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var name_label := _label(_entry_label_text(entry_name), 16)
|
|
|
|
|
|
name_label.custom_minimum_size.y = 38.0
|
|
|
|
|
|
name_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
name_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
|
|
name_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
|
|
|
|
name_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
|
content.add_child(name_label)
|
2026-07-31 00:03:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
2026-08-14 22:11:49 -04:00
|
|
|
|
func _select_category(category: LogbookCatalog.Category) -> void:
|
2026-07-30 23:16:28 -04:00
|
|
|
|
if category == _category:
|
|
|
|
|
|
return
|
|
|
|
|
|
_category = category
|
|
|
|
|
|
_selected_id = StringName()
|
|
|
|
|
|
_selected_entry_key = StringName()
|
|
|
|
|
|
for index: int in _category_tabs.size():
|
2026-07-31 13:14:55 -04:00
|
|
|
|
(_category_tabs[index] as OrganizerTabType).set_selected(
|
2026-08-15 14:28:13 -04:00
|
|
|
|
_category_tab_categories[index] == _category
|
2026-07-31 13:14:55 -04:00
|
|
|
|
)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_begin_category_transition()
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-31 10:20:18 -04:00
|
|
|
|
func _configure_category_focus() -> void:
|
|
|
|
|
|
for index: int in _category_tabs.size():
|
|
|
|
|
|
var tab: Button = _category_tabs[index]
|
|
|
|
|
|
tab.focus_neighbor_left = tab.get_path_to(
|
|
|
|
|
|
_category_tabs[maxi(index - 1, 0)]
|
|
|
|
|
|
)
|
|
|
|
|
|
tab.focus_neighbor_right = tab.get_path_to(
|
|
|
|
|
|
_category_tabs[mini(index + 1, _category_tabs.size() - 1)]
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _animate_tab_entry() -> void:
|
|
|
|
|
|
for index: int in _category_tabs.size():
|
|
|
|
|
|
(_category_tabs[index] as OrganizerTabType).animate_entrance(
|
|
|
|
|
|
float(index) * 0.025
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _settle_tabs_for_close() -> void:
|
|
|
|
|
|
for tab: OrganizerTabType in _category_tabs:
|
|
|
|
|
|
tab.settle_for_close()
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-30 23:16:28 -04:00
|
|
|
|
func _begin_category_transition() -> void:
|
|
|
|
|
|
_cancel_category_tween()
|
|
|
|
|
|
_category_generation += 1
|
|
|
|
|
|
var generation: int = _category_generation
|
|
|
|
|
|
var restore_interactive: bool = _interactive
|
|
|
|
|
|
set_interactive(false)
|
|
|
|
|
|
_category_tween = create_tween()
|
|
|
|
|
|
_category_tween.tween_method(
|
|
|
|
|
|
_set_category_content_alpha,
|
|
|
|
|
|
1.0,
|
|
|
|
|
|
0.0,
|
|
|
|
|
|
CATEGORY_FADE_DURATION * 0.5,
|
|
|
|
|
|
).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
|
|
|
|
|
_category_tween.tween_callback(
|
|
|
|
|
|
func() -> void:
|
|
|
|
|
|
if generation != _category_generation:
|
|
|
|
|
|
return
|
|
|
|
|
|
_refresh_catalog()
|
|
|
|
|
|
_set_category_content_alpha(0.0)
|
|
|
|
|
|
)
|
|
|
|
|
|
_category_tween.tween_method(
|
|
|
|
|
|
_set_category_content_alpha,
|
|
|
|
|
|
0.0,
|
|
|
|
|
|
1.0,
|
|
|
|
|
|
CATEGORY_FADE_DURATION * 0.5,
|
|
|
|
|
|
).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
|
|
|
|
|
_category_tween.finished.connect(
|
|
|
|
|
|
func() -> void:
|
|
|
|
|
|
if generation != _category_generation:
|
|
|
|
|
|
return
|
|
|
|
|
|
_category_tween = null
|
|
|
|
|
|
_set_category_content_alpha(1.0)
|
|
|
|
|
|
set_interactive(restore_interactive)
|
|
|
|
|
|
focus_initial(),
|
|
|
|
|
|
CONNECT_ONE_SHOT,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _cancel_category_tween() -> void:
|
|
|
|
|
|
_category_generation += 1
|
|
|
|
|
|
if _category_tween != null:
|
|
|
|
|
|
_category_tween.kill()
|
|
|
|
|
|
_category_tween = null
|
|
|
|
|
|
_set_category_content_alpha(1.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _set_category_content_alpha(alpha: float) -> void:
|
|
|
|
|
|
if _catalog_scroll != null:
|
|
|
|
|
|
_catalog_scroll.modulate.a = alpha
|
|
|
|
|
|
if _empty_state != null:
|
|
|
|
|
|
_empty_state.modulate.a = alpha
|
|
|
|
|
|
if _detail_body != null:
|
|
|
|
|
|
_detail_body.modulate.a = alpha
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _select_entry(entry_key: StringName, fish_id: StringName) -> void:
|
|
|
|
|
|
if fish_id.is_empty():
|
|
|
|
|
|
_selected_id = StringName()
|
|
|
|
|
|
_selected_entry_key = entry_key
|
|
|
|
|
|
_refresh_selection_styles()
|
|
|
|
|
|
_show_unknown()
|
|
|
|
|
|
return
|
|
|
|
|
|
if (
|
|
|
|
|
|
_collection_log == null
|
|
|
|
|
|
or not _collection_log.has_discovered(fish_id)
|
|
|
|
|
|
):
|
|
|
|
|
|
return
|
|
|
|
|
|
_selected_id = fish_id
|
|
|
|
|
|
_selected_entry_key = entry_key
|
|
|
|
|
|
_refresh_selection_styles()
|
|
|
|
|
|
_refresh_details(true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _refresh_details(animate: bool) -> void:
|
|
|
|
|
|
if _selected_id.is_empty():
|
|
|
|
|
|
_show_no_selection()
|
|
|
|
|
|
return
|
|
|
|
|
|
if (
|
|
|
|
|
|
_collection_log == null
|
|
|
|
|
|
or not _collection_log.has_discovered(_selected_id)
|
|
|
|
|
|
):
|
|
|
|
|
|
_show_unknown()
|
|
|
|
|
|
return
|
|
|
|
|
|
var fish: FishDataType = (
|
|
|
|
|
|
_catalog.get_fish_by_id(_selected_id)
|
|
|
|
|
|
if _catalog != null
|
|
|
|
|
|
else null
|
|
|
|
|
|
)
|
|
|
|
|
|
if fish == null:
|
|
|
|
|
|
_show_no_selection()
|
|
|
|
|
|
return
|
|
|
|
|
|
var rebuild: Callable = _build_known_details.bind(fish)
|
|
|
|
|
|
if animate:
|
|
|
|
|
|
_crossfade_details(rebuild)
|
|
|
|
|
|
else:
|
|
|
|
|
|
rebuild.call()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _build_known_details(fish: FishDataType) -> void:
|
|
|
|
|
|
_clear_details()
|
2026-08-14 16:31:28 -04:00
|
|
|
|
var catalog_number: int = LogbookCatalog.catalog_number(fish)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var summary_margin := MarginContainer.new()
|
|
|
|
|
|
summary_margin.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
_set_margins(summary_margin, 40, 0, 40, 0)
|
|
|
|
|
|
_detail_body.add_child(summary_margin)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var summary_columns := HBoxContainer.new()
|
|
|
|
|
|
summary_columns.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
summary_columns.add_theme_constant_override("separation", 24)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
summary_margin.add_child(summary_columns)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
|
|
|
|
|
|
var portrait_column := VBoxContainer.new()
|
|
|
|
|
|
portrait_column.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
portrait_column.size_flags_stretch_ratio = 1.0
|
|
|
|
|
|
portrait_column.add_theme_constant_override("separation", 4)
|
|
|
|
|
|
summary_columns.add_child(portrait_column)
|
|
|
|
|
|
var title := _label(fish.display_name, 26)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
2026-08-02 09:57:05 -04:00
|
|
|
|
portrait_column.add_child(title)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
if fish.display_texture != null:
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_detail_portrait_button = Button.new()
|
2026-08-08 00:34:06 -04:00
|
|
|
|
_detail_portrait_button.custom_minimum_size = DETAIL_PORTRAIT_SIZE
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_detail_portrait_button.size_flags_horizontal = (
|
|
|
|
|
|
Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
_detail_portrait_button.clip_contents = true
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_detail_portrait_button.tooltip_text = "View larger artwork"
|
|
|
|
|
|
_detail_portrait_button.accessibility_name = (
|
|
|
|
|
|
"View larger artwork for %s" % fish.display_name
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_portrait_button.add_theme_stylebox_override(
|
|
|
|
|
|
"normal", _portrait_button_style(false)
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_portrait_button.add_theme_stylebox_override(
|
|
|
|
|
|
"hover", _portrait_button_style(true)
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_portrait_button.add_theme_stylebox_override(
|
|
|
|
|
|
"focus", _portrait_button_style(true)
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_portrait_button.add_theme_stylebox_override(
|
|
|
|
|
|
"pressed", _portrait_button_style(true)
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_portrait_button.pressed.connect(
|
|
|
|
|
|
_show_portrait_overlay.bind(fish.display_texture)
|
|
|
|
|
|
)
|
2026-08-15 19:20:42 -04:00
|
|
|
|
_detail_buttons.append(_detail_portrait_button)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
portrait_column.add_child(_detail_portrait_button)
|
|
|
|
|
|
var artwork_center := CenterContainer.new()
|
|
|
|
|
|
artwork_center.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
artwork_center.set_anchors_and_offsets_preset(
|
|
|
|
|
|
Control.PRESET_FULL_RECT
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_portrait_button.add_child(artwork_center)
|
|
|
|
|
|
var artwork := LogbookPortraitType.new()
|
|
|
|
|
|
artwork.configure(
|
|
|
|
|
|
fish.display_texture,
|
2026-08-08 00:34:06 -04:00
|
|
|
|
DETAIL_PORTRAIT_SIZE,
|
2026-08-02 09:57:05 -04:00
|
|
|
|
)
|
|
|
|
|
|
artwork_center.add_child(artwork)
|
|
|
|
|
|
|
2026-08-15 19:20:42 -04:00
|
|
|
|
var facts_text: String = LogbookCatalog.facts_for(fish)
|
|
|
|
|
|
var facts_button := _make_detail_section_button(
|
|
|
|
|
|
"fish facts",
|
|
|
|
|
|
facts_text,
|
|
|
|
|
|
)
|
|
|
|
|
|
facts_button.custom_minimum_size = Vector2(190.0, 132.0)
|
|
|
|
|
|
facts_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
facts_button.size_flags_stretch_ratio = 1.0
|
|
|
|
|
|
summary_columns.add_child(facts_button)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var facts_column := VBoxContainer.new()
|
2026-08-15 19:20:42 -04:00
|
|
|
|
facts_column.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
|
|
|
|
facts_column.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
2026-08-02 09:57:05 -04:00
|
|
|
|
facts_column.add_theme_constant_override("separation", 6)
|
2026-08-15 19:20:42 -04:00
|
|
|
|
facts_button.add_child(facts_column)
|
2026-08-14 22:11:49 -04:00
|
|
|
|
var facts_heading := _field_label(
|
|
|
|
|
|
"shellfish facts"
|
|
|
|
|
|
if fish.logbook_section == FishDataType.LogbookSection.SHELLFISH
|
|
|
|
|
|
else "fish facts",
|
|
|
|
|
|
16,
|
|
|
|
|
|
)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
facts_column.add_child(facts_heading)
|
2026-08-15 19:20:42 -04:00
|
|
|
|
var facts := _label(facts_text, 16)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
facts.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
|
facts.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
facts_column.add_child(facts)
|
2026-08-15 19:20:42 -04:00
|
|
|
|
var quality_button := _make_detail_section_button(
|
|
|
|
|
|
"quality collection",
|
|
|
|
|
|
_quality_overlay_text(fish.id),
|
|
|
|
|
|
)
|
|
|
|
|
|
quality_button.custom_minimum_size.y = 132.0
|
|
|
|
|
|
quality_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
_detail_body.add_child(quality_button)
|
|
|
|
|
|
var quality_progress := _build_quality_progress(fish.id)
|
|
|
|
|
|
quality_progress.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
|
|
|
|
quality_progress.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
quality_button.add_child(quality_progress)
|
|
|
|
|
|
|
|
|
|
|
|
var stats_button := _make_detail_section_button(
|
|
|
|
|
|
"fish stats",
|
|
|
|
|
|
_stats_overlay_text(fish, catalog_number),
|
|
|
|
|
|
)
|
|
|
|
|
|
stats_button.custom_minimum_size.y = 190.0
|
|
|
|
|
|
stats_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
stats_button.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
_detail_body.add_child(stats_button)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var stats_anchor := VBoxContainer.new()
|
2026-08-15 19:20:42 -04:00
|
|
|
|
stats_anchor.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
|
|
|
|
stats_anchor.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
2026-08-08 00:34:06 -04:00
|
|
|
|
stats_anchor.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
stats_anchor.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
stats_anchor.alignment = BoxContainer.ALIGNMENT_END
|
2026-08-15 19:20:42 -04:00
|
|
|
|
stats_button.add_child(stats_anchor)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var stats_columns := HBoxContainer.new()
|
|
|
|
|
|
stats_columns.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
stats_columns.add_theme_constant_override("separation", 28)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
stats_anchor.add_child(stats_columns)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var left_stats := _make_stats_column()
|
|
|
|
|
|
var right_stats := _make_stats_column()
|
|
|
|
|
|
stats_columns.add_child(left_stats)
|
|
|
|
|
|
stats_columns.add_child(right_stats)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_add_detail_row(
|
2026-08-02 09:57:05 -04:00
|
|
|
|
left_stats,
|
2026-07-30 23:16:28 -04:00
|
|
|
|
"catalog number",
|
2026-08-02 09:57:05 -04:00
|
|
|
|
"#%03d" % catalog_number if catalog_number > 0 else "unknown",
|
|
|
|
|
|
)
|
|
|
|
|
|
_add_detail_row(
|
|
|
|
|
|
left_stats,
|
2026-08-14 22:11:49 -04:00
|
|
|
|
(
|
|
|
|
|
|
"habitat"
|
|
|
|
|
|
if fish.logbook_section == FishDataType.LogbookSection.SHELLFISH
|
|
|
|
|
|
else "body of water"
|
|
|
|
|
|
),
|
|
|
|
|
|
fish.get_habitat_label(),
|
2026-07-30 23:16:28 -04:00
|
|
|
|
)
|
|
|
|
|
|
_add_detail_row(
|
2026-08-02 09:57:05 -04:00
|
|
|
|
left_stats,
|
2026-07-30 23:16:28 -04:00
|
|
|
|
"weight range",
|
|
|
|
|
|
"%.2f–%.2f lb" % [
|
|
|
|
|
|
fish.get_minimum_weight(),
|
|
|
|
|
|
fish.get_maximum_weight(),
|
|
|
|
|
|
],
|
|
|
|
|
|
)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_add_detail_row(left_stats, "number caught", "unknown")
|
|
|
|
|
|
_add_detail_row(right_stats, "rarity", fish.get_rarity_name().to_lower())
|
|
|
|
|
|
_add_detail_row(right_stats, "time of day", _availability_text(fish))
|
2026-08-13 14:53:39 -04:00
|
|
|
|
_add_currency_detail_row(
|
2026-08-02 09:57:05 -04:00
|
|
|
|
right_stats,
|
2026-07-30 23:16:28 -04:00
|
|
|
|
"value range",
|
2026-08-13 14:53:39 -04:00
|
|
|
|
FishQualityType.apply_sale_value(
|
|
|
|
|
|
fish.sell_value_min,
|
|
|
|
|
|
FishQualityType.Tier.BORING,
|
|
|
|
|
|
),
|
|
|
|
|
|
FishQualityType.apply_sale_value(
|
|
|
|
|
|
fish.sell_value_max,
|
|
|
|
|
|
FishQualityType.Tier.SHINY,
|
|
|
|
|
|
),
|
2026-07-30 23:16:28 -04:00
|
|
|
|
)
|
|
|
|
|
|
_add_detail_row(
|
2026-08-02 09:57:05 -04:00
|
|
|
|
right_stats,
|
2026-07-30 23:16:28 -04:00
|
|
|
|
"number owned",
|
|
|
|
|
|
str(_inventory.get_count(fish.id) if _inventory != null else 0),
|
|
|
|
|
|
)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var bottom_inset := Control.new()
|
|
|
|
|
|
bottom_inset.custom_minimum_size.y = DETAIL_BOTTOM_INSET
|
|
|
|
|
|
bottom_inset.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
stats_anchor.add_child(bottom_inset)
|
2026-08-15 19:20:42 -04:00
|
|
|
|
_configure_detail_focus(
|
|
|
|
|
|
_detail_portrait_button,
|
|
|
|
|
|
facts_button,
|
|
|
|
|
|
quality_button,
|
|
|
|
|
|
stats_button,
|
|
|
|
|
|
)
|
|
|
|
|
|
set_interactive(_interactive)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _configure_detail_focus(
|
|
|
|
|
|
portrait: Button,
|
|
|
|
|
|
facts: Button,
|
|
|
|
|
|
quality: Button,
|
|
|
|
|
|
stats: Button,
|
|
|
|
|
|
) -> void:
|
|
|
|
|
|
var top_left: Button = portrait if portrait != null else facts
|
|
|
|
|
|
if portrait != null:
|
|
|
|
|
|
portrait.focus_neighbor_left = portrait.get_path_to(portrait)
|
|
|
|
|
|
portrait.focus_neighbor_right = portrait.get_path_to(facts)
|
|
|
|
|
|
portrait.focus_neighbor_top = portrait.get_path_to(portrait)
|
|
|
|
|
|
portrait.focus_neighbor_bottom = portrait.get_path_to(quality)
|
|
|
|
|
|
portrait.focus_previous = portrait.get_path_to(stats)
|
|
|
|
|
|
portrait.focus_next = portrait.get_path_to(facts)
|
|
|
|
|
|
facts.focus_neighbor_left = facts.get_path_to(top_left)
|
|
|
|
|
|
facts.focus_neighbor_right = facts.get_path_to(facts)
|
|
|
|
|
|
facts.focus_neighbor_top = facts.get_path_to(facts)
|
|
|
|
|
|
facts.focus_neighbor_bottom = facts.get_path_to(quality)
|
|
|
|
|
|
facts.focus_previous = facts.get_path_to(top_left)
|
|
|
|
|
|
facts.focus_next = facts.get_path_to(quality)
|
|
|
|
|
|
quality.focus_neighbor_left = quality.get_path_to(quality)
|
|
|
|
|
|
quality.focus_neighbor_right = quality.get_path_to(quality)
|
|
|
|
|
|
quality.focus_neighbor_top = quality.get_path_to(facts)
|
|
|
|
|
|
quality.focus_neighbor_bottom = quality.get_path_to(stats)
|
|
|
|
|
|
quality.focus_previous = quality.get_path_to(facts)
|
|
|
|
|
|
quality.focus_next = quality.get_path_to(stats)
|
|
|
|
|
|
stats.focus_neighbor_left = stats.get_path_to(stats)
|
|
|
|
|
|
stats.focus_neighbor_right = stats.get_path_to(stats)
|
|
|
|
|
|
stats.focus_neighbor_top = stats.get_path_to(quality)
|
|
|
|
|
|
stats.focus_neighbor_bottom = stats.get_path_to(stats)
|
|
|
|
|
|
stats.focus_previous = stats.get_path_to(quality)
|
|
|
|
|
|
stats.focus_next = stats.get_path_to(top_left)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
2026-08-02 17:44:11 -04:00
|
|
|
|
func _build_quality_progress(fish_id: StringName) -> VBoxContainer:
|
|
|
|
|
|
var quality_section := VBoxContainer.new()
|
2026-08-08 00:34:06 -04:00
|
|
|
|
quality_section.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
quality_section.add_theme_constant_override("separation", 6)
|
2026-08-02 17:44:11 -04:00
|
|
|
|
var discovered_count: int = 0
|
|
|
|
|
|
for quality: int in FishQualityType.TIER_COUNT:
|
|
|
|
|
|
if _collection_log.has_discovered_quality(fish_id, quality):
|
|
|
|
|
|
discovered_count += 1
|
|
|
|
|
|
var heading := _field_label(
|
|
|
|
|
|
"quality collection • %d / %d" % [
|
|
|
|
|
|
discovered_count,
|
|
|
|
|
|
FishQualityType.TIER_COUNT,
|
|
|
|
|
|
],
|
2026-08-08 00:34:06 -04:00
|
|
|
|
17,
|
2026-08-02 17:44:11 -04:00
|
|
|
|
)
|
|
|
|
|
|
heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
|
|
heading.add_theme_color_override("font_color", MUTED_INK)
|
|
|
|
|
|
quality_section.add_child(heading)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var tiers := VBoxContainer.new()
|
|
|
|
|
|
tiers.add_theme_constant_override("separation", 6)
|
2026-08-02 17:44:11 -04:00
|
|
|
|
quality_section.add_child(tiers)
|
|
|
|
|
|
for quality: int in FishQualityType.TIER_COUNT:
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var row: HBoxContainer
|
|
|
|
|
|
if quality % 2 == 0:
|
|
|
|
|
|
row = HBoxContainer.new()
|
|
|
|
|
|
row.alignment = BoxContainer.ALIGNMENT_CENTER
|
|
|
|
|
|
row.add_theme_constant_override("separation", 28)
|
|
|
|
|
|
tiers.add_child(row)
|
|
|
|
|
|
else:
|
|
|
|
|
|
row = tiers.get_child(tiers.get_child_count() - 1) as HBoxContainer
|
2026-08-02 17:44:11 -04:00
|
|
|
|
var discovered: bool = _collection_log.has_discovered_quality(
|
|
|
|
|
|
fish_id,
|
|
|
|
|
|
quality,
|
|
|
|
|
|
)
|
|
|
|
|
|
var tier := HBoxContainer.new()
|
|
|
|
|
|
tier.alignment = BoxContainer.ALIGNMENT_CENTER
|
2026-08-08 00:34:06 -04:00
|
|
|
|
tier.add_theme_constant_override("separation", 5)
|
2026-08-02 17:44:11 -04:00
|
|
|
|
var quality_color: Color = UIPalette.get_quality_color(quality)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var dot := _label("●" if discovered else "○", 17)
|
2026-08-02 17:44:11 -04:00
|
|
|
|
dot.add_theme_color_override("font_color", quality_color)
|
|
|
|
|
|
dot.modulate.a = 1.0 if discovered else 0.48
|
|
|
|
|
|
tier.add_child(dot)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
var tier_label := _label(FishQualityType.display_name(quality), 16)
|
2026-08-02 17:44:11 -04:00
|
|
|
|
tier_label.add_theme_color_override(
|
|
|
|
|
|
"font_color",
|
|
|
|
|
|
INK if discovered else MUTED_INK,
|
|
|
|
|
|
)
|
|
|
|
|
|
tier_label.modulate.a = 1.0 if discovered else 0.58
|
|
|
|
|
|
tier.tooltip_text = (
|
|
|
|
|
|
"%s quality collected"
|
|
|
|
|
|
if discovered
|
|
|
|
|
|
else "%s quality not yet collected"
|
|
|
|
|
|
) % FishQualityType.display_name(quality)
|
|
|
|
|
|
tier.add_child(tier_label)
|
2026-08-08 00:34:06 -04:00
|
|
|
|
row.add_child(tier)
|
2026-08-02 17:44:11 -04:00
|
|
|
|
return quality_section
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-08-15 19:20:42 -04:00
|
|
|
|
func _make_detail_section_button(
|
|
|
|
|
|
section_title: String,
|
|
|
|
|
|
section_text: String,
|
|
|
|
|
|
) -> Button:
|
|
|
|
|
|
var button := Button.new()
|
|
|
|
|
|
button.text = ""
|
|
|
|
|
|
button.tooltip_text = "View %s larger" % section_title
|
|
|
|
|
|
button.accessibility_name = "View %s larger" % section_title
|
|
|
|
|
|
button.add_theme_stylebox_override("normal", _portrait_button_style(false))
|
|
|
|
|
|
button.add_theme_stylebox_override("hover", _portrait_button_style(true))
|
|
|
|
|
|
button.add_theme_stylebox_override("focus", _portrait_button_style(true))
|
|
|
|
|
|
button.add_theme_stylebox_override("pressed", _portrait_button_style(true))
|
|
|
|
|
|
button.pressed.connect(
|
|
|
|
|
|
_show_detail_text_overlay.bind(section_title, section_text, button)
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_buttons.append(button)
|
|
|
|
|
|
return button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _quality_overlay_text(fish_id: StringName) -> String:
|
|
|
|
|
|
var lines: Array[String] = []
|
|
|
|
|
|
for quality: int in FishQualityType.TIER_COUNT:
|
|
|
|
|
|
var collected: bool = _collection_log.has_discovered_quality(
|
|
|
|
|
|
fish_id,
|
|
|
|
|
|
quality,
|
|
|
|
|
|
)
|
|
|
|
|
|
lines.append("%s %s" % [
|
|
|
|
|
|
"collected" if collected else "not collected",
|
|
|
|
|
|
FishQualityType.display_name(quality),
|
|
|
|
|
|
])
|
|
|
|
|
|
return "\n".join(lines)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _stats_overlay_text(fish: FishDataType, catalog_number: int) -> String:
|
|
|
|
|
|
var habitat_label: String = (
|
|
|
|
|
|
"habitat"
|
|
|
|
|
|
if fish.logbook_section == FishDataType.LogbookSection.SHELLFISH
|
|
|
|
|
|
else "body of water"
|
|
|
|
|
|
)
|
|
|
|
|
|
return "\n".join([
|
|
|
|
|
|
"catalog number: %s" % (
|
|
|
|
|
|
"#%03d" % catalog_number if catalog_number > 0 else "unknown"
|
|
|
|
|
|
),
|
|
|
|
|
|
"%s: %s" % [habitat_label, fish.get_habitat_label()],
|
|
|
|
|
|
"weight range: %.2f–%.2f lb" % [
|
|
|
|
|
|
fish.get_minimum_weight(),
|
|
|
|
|
|
fish.get_maximum_weight(),
|
|
|
|
|
|
],
|
|
|
|
|
|
"rarity: %s" % fish.get_rarity_name().to_lower(),
|
|
|
|
|
|
"time of day: %s" % _availability_text(fish),
|
|
|
|
|
|
"value range: %d–%d" % [
|
|
|
|
|
|
FishQualityType.apply_sale_value(
|
|
|
|
|
|
fish.sell_value_min,
|
|
|
|
|
|
FishQualityType.Tier.BORING,
|
|
|
|
|
|
),
|
|
|
|
|
|
FishQualityType.apply_sale_value(
|
|
|
|
|
|
fish.sell_value_max,
|
|
|
|
|
|
FishQualityType.Tier.SHINY,
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
"number owned: %d" % (
|
|
|
|
|
|
_inventory.get_count(fish.id) if _inventory != null else 0
|
|
|
|
|
|
),
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-30 23:16:28 -04:00
|
|
|
|
func _show_no_selection() -> void:
|
|
|
|
|
|
_clear_details()
|
|
|
|
|
|
var instruction := _label("Select an entry to read its catch record.", 21)
|
|
|
|
|
|
instruction.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
|
instruction.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
|
|
instruction.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
|
|
|
|
instruction.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
_detail_body.add_child(instruction)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _show_unknown() -> void:
|
|
|
|
|
|
_clear_details()
|
|
|
|
|
|
var unknown := _label("???", 34)
|
|
|
|
|
|
unknown.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
|
|
_detail_body.add_child(unknown)
|
|
|
|
|
|
var instruction := _label("Catch this creature to learn more.", 20)
|
|
|
|
|
|
instruction.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
|
instruction.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
|
|
_detail_body.add_child(instruction)
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-08-02 09:57:05 -04:00
|
|
|
|
func _add_detail_row(
|
|
|
|
|
|
parent: VBoxContainer,
|
|
|
|
|
|
row_name: String,
|
|
|
|
|
|
value: String,
|
|
|
|
|
|
) -> void:
|
2026-07-30 23:16:28 -04:00
|
|
|
|
var row := VBoxContainer.new()
|
2026-08-02 09:57:05 -04:00
|
|
|
|
row.add_theme_constant_override("separation", 2)
|
|
|
|
|
|
var heading := _field_label(row_name, 14)
|
|
|
|
|
|
heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
2026-07-30 23:16:28 -04:00
|
|
|
|
heading.add_theme_color_override("font_color", MUTED_INK)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var content := _handwritten_value_label(value.to_lower(), 16)
|
|
|
|
|
|
content.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
2026-07-30 23:16:28 -04:00
|
|
|
|
content.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
|
row.add_child(heading)
|
|
|
|
|
|
row.add_child(content)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
parent.add_child(row)
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-08-13 14:53:39 -04:00
|
|
|
|
func _add_currency_detail_row(
|
|
|
|
|
|
parent: VBoxContainer,
|
|
|
|
|
|
row_name: String,
|
|
|
|
|
|
minimum_value: int,
|
|
|
|
|
|
maximum_value: int,
|
|
|
|
|
|
) -> void:
|
|
|
|
|
|
var row := VBoxContainer.new()
|
|
|
|
|
|
row.add_theme_constant_override("separation", 2)
|
|
|
|
|
|
var heading := _field_label(row_name, 14)
|
|
|
|
|
|
heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
|
|
heading.add_theme_color_override("font_color", MUTED_INK)
|
|
|
|
|
|
row.add_child(heading)
|
|
|
|
|
|
var value: CurrencyAmount = (
|
|
|
|
|
|
CurrencyPresentationType.instantiate_amount(minimum_value, 16.0)
|
|
|
|
|
|
)
|
|
|
|
|
|
value.set_amount_text("%d–%d" % [minimum_value, maximum_value])
|
|
|
|
|
|
value.get_amount_label().add_theme_font_override(
|
|
|
|
|
|
"font", InventoryNotepadType.HANDWRITTEN_FONT
|
|
|
|
|
|
)
|
|
|
|
|
|
value.get_amount_label().add_theme_font_size_override("font_size", 16)
|
|
|
|
|
|
value.get_amount_label().add_theme_color_override("font_color", INK)
|
|
|
|
|
|
row.add_child(value)
|
|
|
|
|
|
parent.add_child(row)
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-08-02 09:57:05 -04:00
|
|
|
|
func _make_stats_column() -> VBoxContainer:
|
|
|
|
|
|
var column := VBoxContainer.new()
|
|
|
|
|
|
column.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
column.size_flags_stretch_ratio = 1.0
|
|
|
|
|
|
column.add_theme_constant_override("separation", 12)
|
|
|
|
|
|
return column
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _availability_text(fish: FishDataType) -> String:
|
|
|
|
|
|
if fish.availability == null:
|
2026-08-02 09:57:05 -04:00
|
|
|
|
return "unknown"
|
2026-07-30 23:16:28 -04:00
|
|
|
|
if fish.availability.allow_day and fish.availability.allow_night:
|
|
|
|
|
|
return "day and night"
|
|
|
|
|
|
if fish.availability.allow_day:
|
|
|
|
|
|
return "day"
|
|
|
|
|
|
if fish.availability.allow_night:
|
|
|
|
|
|
return "night"
|
2026-08-02 09:57:05 -04:00
|
|
|
|
return "unknown"
|
2026-07-30 23:16:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _crossfade_details(rebuild: Callable) -> void:
|
|
|
|
|
|
_cancel_detail_tween()
|
|
|
|
|
|
_detail_generation += 1
|
|
|
|
|
|
var generation: int = _detail_generation
|
|
|
|
|
|
_detail_tween = create_tween()
|
|
|
|
|
|
_detail_tween.tween_property(
|
|
|
|
|
|
_detail_body, "modulate:a", 0.0, DETAIL_FADE_DURATION * 0.5
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_tween.tween_callback(
|
|
|
|
|
|
func() -> void:
|
|
|
|
|
|
if generation == _detail_generation:
|
|
|
|
|
|
rebuild.call()
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_tween.tween_property(
|
|
|
|
|
|
_detail_body, "modulate:a", 1.0, DETAIL_FADE_DURATION * 0.5
|
|
|
|
|
|
)
|
|
|
|
|
|
_detail_tween.finished.connect(
|
|
|
|
|
|
func() -> void:
|
|
|
|
|
|
if generation == _detail_generation:
|
|
|
|
|
|
_detail_tween = null,
|
|
|
|
|
|
CONNECT_ONE_SHOT,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _cancel_detail_tween() -> void:
|
|
|
|
|
|
_detail_generation += 1
|
|
|
|
|
|
if _detail_tween != null:
|
|
|
|
|
|
_detail_tween.kill()
|
|
|
|
|
|
_detail_tween = null
|
|
|
|
|
|
if _detail_body != null:
|
|
|
|
|
|
_detail_body.modulate.a = 1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _clear_entries() -> void:
|
|
|
|
|
|
for child: Node in _catalog_grid.get_children():
|
|
|
|
|
|
_catalog_grid.remove_child(child)
|
|
|
|
|
|
child.queue_free()
|
|
|
|
|
|
_entry_buttons.clear()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _clear_details() -> void:
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_detail_portrait_button = null
|
2026-08-15 19:20:42 -04:00
|
|
|
|
_detail_buttons.clear()
|
2026-07-30 23:16:28 -04:00
|
|
|
|
for child: Node in _detail_body.get_children():
|
|
|
|
|
|
_detail_body.remove_child(child)
|
|
|
|
|
|
child.queue_free()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _refresh_selection_styles() -> void:
|
|
|
|
|
|
for fish_id: StringName in _entry_buttons:
|
|
|
|
|
|
_entry_buttons[fish_id].button_pressed = (
|
|
|
|
|
|
fish_id == _selected_entry_key
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_fish_discovered(fish_id: StringName) -> void:
|
2026-07-31 00:03:47 -04:00
|
|
|
|
if _catalog == null:
|
2026-07-30 23:16:28 -04:00
|
|
|
|
return
|
2026-07-31 00:03:47 -04:00
|
|
|
|
var fish: FishDataType = _catalog.get_fish_by_id(fish_id)
|
|
|
|
|
|
if fish == null:
|
|
|
|
|
|
return
|
|
|
|
|
|
if _selected_entry_key == _unknown_selection_key(fish):
|
|
|
|
|
|
_selected_id = fish_id
|
|
|
|
|
|
_selected_entry_key = fish_id
|
2026-07-30 23:16:28 -04:00
|
|
|
|
_refresh_catalog()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_collection_changed() -> void:
|
|
|
|
|
|
_refresh_catalog()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_inventory_changed() -> void:
|
|
|
|
|
|
_refresh_details(false)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _unknown_selection_key(fish: FishDataType) -> StringName:
|
2026-08-14 16:31:28 -04:00
|
|
|
|
var number: int = LogbookCatalog.catalog_number(fish)
|
2026-07-30 23:16:28 -04:00
|
|
|
|
return StringName("unknown_%d" % number)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _label(text: String, font_size: int) -> Label:
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var label := Label.new()
|
|
|
|
|
|
label.text = text
|
|
|
|
|
|
label.add_theme_font_override(
|
|
|
|
|
|
"font", InventoryNotepadType.HANDWRITTEN_FONT
|
|
|
|
|
|
)
|
|
|
|
|
|
label.add_theme_font_size_override("font_size", font_size)
|
|
|
|
|
|
label.add_theme_color_override("font_color", INK)
|
|
|
|
|
|
return label
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _field_label(text: String, font_size: int) -> Label:
|
2026-07-30 23:16:28 -04:00
|
|
|
|
var label := Label.new()
|
|
|
|
|
|
label.text = text
|
|
|
|
|
|
label.add_theme_font_override("font", UtilityPageStyle.TuffyFont)
|
|
|
|
|
|
label.add_theme_font_size_override("font_size", font_size)
|
|
|
|
|
|
label.add_theme_color_override("font_color", INK)
|
|
|
|
|
|
return label
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-08-02 09:57:05 -04:00
|
|
|
|
func _handwritten_value_label(text: String, font_size: int) -> Label:
|
|
|
|
|
|
var adjusted_size: int = font_size
|
|
|
|
|
|
if _contains_ascii_digit(text):
|
|
|
|
|
|
adjusted_size = roundi(
|
|
|
|
|
|
float(font_size) * HANDWRITTEN_NUMERIC_SCALE
|
|
|
|
|
|
)
|
|
|
|
|
|
return _label(text, adjusted_size)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _contains_ascii_digit(text: String) -> bool:
|
|
|
|
|
|
for codepoint: int in text.to_utf32_buffer():
|
|
|
|
|
|
if codepoint >= 48 and codepoint <= 57:
|
|
|
|
|
|
return true
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _entry_label_text(entry_name: String) -> String:
|
|
|
|
|
|
var split_index: int = entry_name.find(" ")
|
|
|
|
|
|
if split_index < 0:
|
|
|
|
|
|
return entry_name
|
|
|
|
|
|
return (
|
|
|
|
|
|
entry_name.substr(0, split_index)
|
|
|
|
|
|
+ "\n"
|
|
|
|
|
|
+ entry_name.substr(split_index + 1)
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _build_portrait_overlay() -> void:
|
|
|
|
|
|
_portrait_overlay = Control.new()
|
|
|
|
|
|
_portrait_overlay.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
|
|
|
|
_portrait_overlay.z_index = 500
|
|
|
|
|
|
_portrait_overlay.visible = false
|
|
|
|
|
|
_portrait_overlay.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
add_child(_portrait_overlay)
|
|
|
|
|
|
|
|
|
|
|
|
_portrait_overlay_backdrop = Button.new()
|
|
|
|
|
|
_portrait_overlay_backdrop.set_anchors_and_offsets_preset(
|
|
|
|
|
|
Control.PRESET_FULL_RECT
|
|
|
|
|
|
)
|
|
|
|
|
|
_portrait_overlay_backdrop.text = ""
|
|
|
|
|
|
_portrait_overlay_backdrop.tooltip_text = "Return to logbook"
|
|
|
|
|
|
_portrait_overlay_backdrop.accessibility_name = "Return to logbook"
|
|
|
|
|
|
_portrait_overlay_backdrop.focus_neighbor_top = NodePath(".")
|
|
|
|
|
|
_portrait_overlay_backdrop.focus_neighbor_bottom = NodePath(".")
|
|
|
|
|
|
_portrait_overlay_backdrop.focus_neighbor_left = NodePath(".")
|
|
|
|
|
|
_portrait_overlay_backdrop.focus_neighbor_right = NodePath(".")
|
|
|
|
|
|
_portrait_overlay_backdrop.focus_next = NodePath(".")
|
|
|
|
|
|
_portrait_overlay_backdrop.focus_previous = NodePath(".")
|
|
|
|
|
|
var transparent_style := StyleBoxEmpty.new()
|
|
|
|
|
|
for state: StringName in [
|
|
|
|
|
|
&"normal", &"hover", &"focus", &"pressed", &"disabled",
|
|
|
|
|
|
]:
|
|
|
|
|
|
_portrait_overlay_backdrop.add_theme_stylebox_override(
|
|
|
|
|
|
state, transparent_style
|
|
|
|
|
|
)
|
|
|
|
|
|
_portrait_overlay_backdrop.pressed.connect(_hide_portrait_overlay)
|
|
|
|
|
|
_portrait_overlay_backdrop.gui_input.connect(
|
|
|
|
|
|
_on_portrait_overlay_backdrop_input
|
|
|
|
|
|
)
|
|
|
|
|
|
_portrait_overlay.add_child(_portrait_overlay_backdrop)
|
|
|
|
|
|
|
2026-08-15 19:20:42 -04:00
|
|
|
|
var overlay_margin := MarginContainer.new()
|
|
|
|
|
|
overlay_margin.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
overlay_margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
|
|
|
|
_set_margins(
|
|
|
|
|
|
overlay_margin,
|
|
|
|
|
|
DETAIL_OVERLAY_EDGE_MARGIN,
|
|
|
|
|
|
DETAIL_OVERLAY_EDGE_MARGIN,
|
|
|
|
|
|
DETAIL_OVERLAY_EDGE_MARGIN,
|
|
|
|
|
|
DETAIL_OVERLAY_EDGE_MARGIN,
|
|
|
|
|
|
)
|
|
|
|
|
|
_portrait_overlay.add_child(overlay_margin)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var card := PanelContainer.new()
|
|
|
|
|
|
card.mouse_filter = Control.MOUSE_FILTER_STOP
|
2026-08-15 19:20:42 -04:00
|
|
|
|
card.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
card.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
2026-08-02 09:57:05 -04:00
|
|
|
|
card.add_theme_stylebox_override("panel", _portrait_view_style())
|
2026-08-15 19:20:42 -04:00
|
|
|
|
overlay_margin.add_child(card)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
var margin := MarginContainer.new()
|
2026-08-15 19:20:42 -04:00
|
|
|
|
_set_margins(
|
|
|
|
|
|
margin,
|
|
|
|
|
|
DETAIL_OVERLAY_CONTENT_MARGIN,
|
|
|
|
|
|
DETAIL_OVERLAY_CONTENT_MARGIN,
|
|
|
|
|
|
DETAIL_OVERLAY_CONTENT_MARGIN,
|
|
|
|
|
|
DETAIL_OVERLAY_CONTENT_MARGIN,
|
|
|
|
|
|
)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
card.add_child(margin)
|
2026-08-15 19:20:42 -04:00
|
|
|
|
var overlay_stack := VBoxContainer.new()
|
|
|
|
|
|
overlay_stack.alignment = BoxContainer.ALIGNMENT_CENTER
|
|
|
|
|
|
overlay_stack.add_theme_constant_override("separation", 18)
|
|
|
|
|
|
margin.add_child(overlay_stack)
|
|
|
|
|
|
_portrait_overlay_title = _field_label(
|
|
|
|
|
|
"", DETAIL_OVERLAY_TITLE_FONT_SIZE
|
|
|
|
|
|
)
|
|
|
|
|
|
_portrait_overlay_title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
|
|
overlay_stack.add_child(_portrait_overlay_title)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_portrait_overlay_artwork = LogbookPortraitType.new()
|
2026-08-15 19:20:42 -04:00
|
|
|
|
_portrait_overlay_artwork.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
|
|
|
|
|
|
overlay_stack.add_child(_portrait_overlay_artwork)
|
|
|
|
|
|
_portrait_overlay_text = _label("", DETAIL_OVERLAY_TEXT_FONT_SIZE)
|
|
|
|
|
|
_portrait_overlay_text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
_portrait_overlay_text.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
|
|
|
|
|
_portrait_overlay_text.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
|
|
|
|
|
_portrait_overlay_text.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
|
|
|
|
_portrait_overlay_text.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
|
|
|
|
overlay_stack.add_child(_portrait_overlay_text)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _show_portrait_overlay(portrait_texture: Texture2D) -> void:
|
|
|
|
|
|
if portrait_texture == null or _portrait_overlay == null:
|
|
|
|
|
|
return
|
|
|
|
|
|
_portrait_overlay_artwork.configure_fitted(
|
|
|
|
|
|
portrait_texture,
|
|
|
|
|
|
PORTRAIT_VIEW_MAX_SIZE,
|
|
|
|
|
|
)
|
2026-08-15 19:20:42 -04:00
|
|
|
|
_portrait_overlay_title.text = "artwork"
|
|
|
|
|
|
_portrait_overlay_artwork.visible = true
|
|
|
|
|
|
_portrait_overlay_text.visible = false
|
|
|
|
|
|
_overlay_return_focus = _detail_portrait_button
|
|
|
|
|
|
_controller_zone = ControllerZone.OVERLAY
|
|
|
|
|
|
set_interactive(_interactive)
|
|
|
|
|
|
_portrait_overlay.visible = true
|
|
|
|
|
|
_portrait_overlay.mouse_filter = Control.MOUSE_FILTER_STOP
|
|
|
|
|
|
_portrait_overlay_backdrop.grab_focus()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _show_detail_text_overlay(
|
|
|
|
|
|
section_title: String,
|
|
|
|
|
|
section_text: String,
|
|
|
|
|
|
return_focus: Control,
|
|
|
|
|
|
) -> void:
|
|
|
|
|
|
if _portrait_overlay == null:
|
|
|
|
|
|
return
|
|
|
|
|
|
_portrait_overlay_title.text = section_title
|
|
|
|
|
|
_portrait_overlay_artwork.visible = false
|
|
|
|
|
|
_portrait_overlay_text.text = section_text
|
|
|
|
|
|
_portrait_overlay_text.visible = true
|
|
|
|
|
|
_overlay_return_focus = return_focus
|
|
|
|
|
|
_controller_zone = ControllerZone.OVERLAY
|
|
|
|
|
|
set_interactive(_interactive)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
_portrait_overlay.visible = true
|
|
|
|
|
|
_portrait_overlay.mouse_filter = Control.MOUSE_FILTER_STOP
|
|
|
|
|
|
_portrait_overlay_backdrop.grab_focus()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _hide_portrait_overlay(restore_focus: bool = true) -> void:
|
|
|
|
|
|
if _portrait_overlay == null or not _portrait_overlay.visible:
|
|
|
|
|
|
return
|
|
|
|
|
|
_portrait_overlay.visible = false
|
|
|
|
|
|
_portrait_overlay.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
2026-08-15 19:20:42 -04:00
|
|
|
|
_controller_zone = ControllerZone.DETAILS
|
|
|
|
|
|
set_interactive(_interactive)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
if (
|
|
|
|
|
|
restore_focus
|
2026-08-15 19:20:42 -04:00
|
|
|
|
and _overlay_return_focus != null
|
|
|
|
|
|
and is_instance_valid(_overlay_return_focus)
|
2026-08-02 09:57:05 -04:00
|
|
|
|
and _active
|
|
|
|
|
|
and _interactive
|
|
|
|
|
|
):
|
2026-08-15 19:20:42 -04:00
|
|
|
|
_overlay_return_focus.grab_focus()
|
2026-08-02 09:57:05 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_portrait_overlay_backdrop_input(event: InputEvent) -> void:
|
|
|
|
|
|
if event.is_action_pressed("ui_cancel"):
|
|
|
|
|
|
_hide_portrait_overlay()
|
|
|
|
|
|
get_viewport().set_input_as_handled()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _portrait_button_style(highlighted: bool) -> StyleBoxFlat:
|
|
|
|
|
|
var style := StyleBoxFlat.new()
|
|
|
|
|
|
style.bg_color = (
|
|
|
|
|
|
Color(1.0, 0.96, 0.86, 0.48)
|
|
|
|
|
|
if highlighted
|
|
|
|
|
|
else Color.TRANSPARENT
|
|
|
|
|
|
)
|
|
|
|
|
|
style.set_border_width_all(0)
|
|
|
|
|
|
style.set_corner_radius_all(12)
|
|
|
|
|
|
return style
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _portrait_view_style() -> StyleBoxFlat:
|
|
|
|
|
|
var style := StyleBoxFlat.new()
|
|
|
|
|
|
style.bg_color = Color("fff5dc")
|
|
|
|
|
|
style.set_border_width_all(0)
|
|
|
|
|
|
style.set_corner_radius_all(18)
|
|
|
|
|
|
return style
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _entry_style(highlighted: bool) -> StyleBoxFlat:
|
2026-07-30 23:16:28 -04:00
|
|
|
|
var style := StyleBoxFlat.new()
|
2026-08-02 09:57:05 -04:00
|
|
|
|
style.bg_color = Color("fff5dc") if highlighted else Color.TRANSPARENT
|
|
|
|
|
|
style.set_border_width_all(0)
|
|
|
|
|
|
style.set_corner_radius_all(51)
|
|
|
|
|
|
style.content_margin_left = 5
|
|
|
|
|
|
style.content_margin_top = 5
|
|
|
|
|
|
style.content_margin_right = 5
|
|
|
|
|
|
style.content_margin_bottom = 5
|
2026-07-30 23:16:28 -04:00
|
|
|
|
return style
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _set_margins(
|
|
|
|
|
|
container: MarginContainer,
|
|
|
|
|
|
left: int,
|
|
|
|
|
|
top: int,
|
|
|
|
|
|
right: int,
|
|
|
|
|
|
bottom: int,
|
|
|
|
|
|
) -> void:
|
|
|
|
|
|
container.add_theme_constant_override("margin_left", left)
|
|
|
|
|
|
container.add_theme_constant_override("margin_top", top)
|
|
|
|
|
|
container.add_theme_constant_override("margin_right", right)
|
|
|
|
|
|
container.add_theme_constant_override("margin_bottom", bottom)
|