Add minimal Bluegill fishing loop

This commit is contained in:
Alexander Sellite 2026-07-25 11:05:37 -04:00
parent dd2563c0d8
commit bba93eb3e5
16 changed files with 461 additions and 3 deletions

35
ui/game_ui.gd Normal file
View file

@ -0,0 +1,35 @@
class_name GameUI
extends CanvasLayer
const FishInventoryType = preload("res://inventory/fish_inventory.gd")
const FishingSpotType = preload("res://fishing/fishing_spot.gd")
@onready var _status_label: Label = %StatusLabel
@onready var _bluegill_count_label: Label = %BluegillCountLabel
@onready var _reel_progress: ProgressBar = %ReelProgress
func setup(inventory: FishInventoryType, fishing_spot: FishingSpotType) -> void:
inventory.contents_changed.connect(_on_inventory_contents_changed)
fishing_spot.status_changed.connect(_on_fishing_status_changed)
fishing_spot.reel_progress_changed.connect(_on_reel_progress_changed)
_update_bluegill_count(inventory.get_count(&"bluegill"))
func _on_inventory_contents_changed(fish_id: StringName, count: int) -> void:
if fish_id == &"bluegill":
_update_bluegill_count(count)
func _on_fishing_status_changed(status: String) -> void:
_status_label.text = status
_status_label.visible = not status.is_empty()
func _on_reel_progress_changed(progress: float, visible: bool) -> void:
_reel_progress.value = progress * 100.0
_reel_progress.visible = visible
func _update_bluegill_count(count: int) -> void:
_bluegill_count_label.text = "Bluegill: %d" % count

1
ui/game_ui.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://bhxprtqbieqvc

57
ui/game_ui.tscn Normal file
View file

@ -0,0 +1,57 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://ui/game_ui.gd" id="1_ui"]
[node name="GameUI" type="CanvasLayer"]
script = ExtResource("1_ui")
[node name="InventoryPanel" type="PanelContainer" parent="."]
offset_left = 16.0
offset_top = 16.0
offset_right = 176.0
offset_bottom = 62.0
[node name="MarginContainer" type="MarginContainer" parent="InventoryPanel"]
theme_override_constants/margin_left = 12
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 12
theme_override_constants/margin_bottom = 8
[node name="BluegillCountLabel" type="Label" parent="InventoryPanel/MarginContainer"]
unique_name_in_owner = true
text = "Bluegill: 0"
[node name="FishingPanel" type="PanelContainer" parent="."]
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -160.0
offset_top = -100.0
offset_right = 160.0
offset_bottom = -20.0
grow_horizontal = 2
grow_vertical = 0
mouse_filter = 2
[node name="MarginContainer" type="MarginContainer" parent="FishingPanel"]
theme_override_constants/margin_left = 12
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 12
theme_override_constants/margin_bottom = 8
[node name="VBoxContainer" type="VBoxContainer" parent="FishingPanel/MarginContainer"]
[node name="StatusLabel" type="Label" parent="FishingPanel/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
visible = false
text = "Left click to cast"
horizontal_alignment = 1
[node name="ReelProgress" type="ProgressBar" parent="FishingPanel/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
visible = false
custom_minimum_size = Vector2(0, 18)
value = 0.0
show_percentage = false