Refine movement, water recovery, and UI baseline
This commit is contained in:
parent
d2fe367891
commit
e2067e3bf4
23 changed files with 905 additions and 146 deletions
174
ui/game_theme.tres
Normal file
174
ui/game_theme.tres
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
[gd_resource type="Theme" load_steps=12 format=3]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="Panel"]
|
||||
bg_color = Color(0.075, 0.145, 0.17, 0.96)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0.2, 0.55, 0.59, 0.65)
|
||||
corner_radius_top_left = 10
|
||||
corner_radius_top_right = 10
|
||||
corner_radius_bottom_right = 10
|
||||
corner_radius_bottom_left = 10
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="ButtonNormal"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 7.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 7.0
|
||||
bg_color = Color(0.13, 0.27, 0.31, 1)
|
||||
corner_radius_top_left = 7
|
||||
corner_radius_top_right = 7
|
||||
corner_radius_bottom_right = 7
|
||||
corner_radius_bottom_left = 7
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="ButtonHover"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 7.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 7.0
|
||||
bg_color = Color(0.14, 0.48, 0.52, 1)
|
||||
corner_radius_top_left = 7
|
||||
corner_radius_top_right = 7
|
||||
corner_radius_bottom_right = 7
|
||||
corner_radius_bottom_left = 7
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="ButtonPressed"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 7.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 7.0
|
||||
bg_color = Color(0.208, 0.725, 0.78, 1)
|
||||
corner_radius_top_left = 7
|
||||
corner_radius_top_right = 7
|
||||
corner_radius_bottom_right = 7
|
||||
corner_radius_bottom_left = 7
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="ButtonDisabled"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 7.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 7.0
|
||||
bg_color = Color(0.12, 0.18, 0.2, 0.8)
|
||||
corner_radius_top_left = 7
|
||||
corner_radius_top_right = 7
|
||||
corner_radius_bottom_right = 7
|
||||
corner_radius_bottom_left = 7
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="DangerNormal"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 7.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 7.0
|
||||
bg_color = Color(0.55, 0.17, 0.19, 1)
|
||||
corner_radius_top_left = 7
|
||||
corner_radius_top_right = 7
|
||||
corner_radius_bottom_right = 7
|
||||
corner_radius_bottom_left = 7
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="DangerHover"]
|
||||
content_margin_left = 12.0
|
||||
content_margin_top = 7.0
|
||||
content_margin_right = 12.0
|
||||
content_margin_bottom = 7.0
|
||||
bg_color = Color(0.82, 0.26, 0.29, 1)
|
||||
corner_radius_top_left = 7
|
||||
corner_radius_top_right = 7
|
||||
corner_radius_bottom_right = 7
|
||||
corner_radius_bottom_left = 7
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="CardNormal"]
|
||||
content_margin_left = 7.0
|
||||
content_margin_top = 7.0
|
||||
content_margin_right = 7.0
|
||||
content_margin_bottom = 7.0
|
||||
bg_color = Color(0.105, 0.205, 0.235, 1)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0.2, 0.36, 0.4, 1)
|
||||
corner_radius_top_left = 8
|
||||
corner_radius_top_right = 8
|
||||
corner_radius_bottom_right = 8
|
||||
corner_radius_bottom_left = 8
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="CardHover"]
|
||||
content_margin_left = 7.0
|
||||
content_margin_top = 7.0
|
||||
content_margin_right = 7.0
|
||||
content_margin_bottom = 7.0
|
||||
bg_color = Color(0.13, 0.28, 0.32, 1)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0.208, 0.725, 0.78, 1)
|
||||
corner_radius_top_left = 8
|
||||
corner_radius_top_right = 8
|
||||
corner_radius_bottom_right = 8
|
||||
corner_radius_bottom_left = 8
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="CardPressed"]
|
||||
content_margin_left = 7.0
|
||||
content_margin_top = 7.0
|
||||
content_margin_right = 7.0
|
||||
content_margin_bottom = 7.0
|
||||
bg_color = Color(0.11, 0.36, 0.4, 1)
|
||||
border_width_left = 3
|
||||
border_width_top = 3
|
||||
border_width_right = 3
|
||||
border_width_bottom = 3
|
||||
border_color = Color(1, 0.82, 0.4, 1)
|
||||
corner_radius_top_left = 8
|
||||
corner_radius_top_right = 8
|
||||
corner_radius_bottom_right = 8
|
||||
corner_radius_bottom_left = 8
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="LineEdit"]
|
||||
content_margin_left = 8.0
|
||||
content_margin_top = 5.0
|
||||
content_margin_right = 8.0
|
||||
content_margin_bottom = 5.0
|
||||
bg_color = Color(0.08, 0.16, 0.19, 1)
|
||||
border_width_left = 1
|
||||
border_width_top = 1
|
||||
border_width_right = 1
|
||||
border_width_bottom = 1
|
||||
border_color = Color(0.2, 0.45, 0.5, 1)
|
||||
corner_radius_top_left = 6
|
||||
corner_radius_top_right = 6
|
||||
corner_radius_bottom_right = 6
|
||||
corner_radius_bottom_left = 6
|
||||
|
||||
[resource]
|
||||
default_font_size = 15
|
||||
Label/colors/font_color = Color(0.956, 0.972, 0.976, 1)
|
||||
Label/colors/font_shadow_color = Color(0, 0, 0, 0)
|
||||
PanelContainer/styles/panel = SubResource("Panel")
|
||||
Button/colors/font_color = Color(0.956, 0.972, 0.976, 1)
|
||||
Button/colors/font_hover_color = Color(1, 1, 1, 1)
|
||||
Button/colors/font_pressed_color = Color(0.04, 0.12, 0.14, 1)
|
||||
Button/colors/font_disabled_color = Color(0.48, 0.55, 0.58, 1)
|
||||
Button/styles/normal = SubResource("ButtonNormal")
|
||||
Button/styles/hover = SubResource("ButtonHover")
|
||||
Button/styles/pressed = SubResource("ButtonPressed")
|
||||
Button/styles/focus = SubResource("ButtonHover")
|
||||
Button/styles/disabled = SubResource("ButtonDisabled")
|
||||
OptionButton/styles/normal = SubResource("ButtonNormal")
|
||||
OptionButton/styles/hover = SubResource("ButtonHover")
|
||||
OptionButton/styles/pressed = SubResource("ButtonPressed")
|
||||
OptionButton/styles/focus = SubResource("ButtonHover")
|
||||
DangerButton/base_type = &"Button"
|
||||
DangerButton/styles/normal = SubResource("DangerNormal")
|
||||
DangerButton/styles/hover = SubResource("DangerHover")
|
||||
DangerButton/styles/pressed = SubResource("DangerHover")
|
||||
DangerButton/styles/focus = SubResource("DangerHover")
|
||||
CardButton/base_type = &"Button"
|
||||
CardButton/styles/normal = SubResource("CardNormal")
|
||||
CardButton/styles/hover = SubResource("CardHover")
|
||||
CardButton/styles/pressed = SubResource("CardPressed")
|
||||
CardButton/styles/focus = SubResource("CardHover")
|
||||
CardButton/colors/font_pressed_color = Color(0.956, 0.972, 0.976, 1)
|
||||
LineEdit/styles/normal = SubResource("LineEdit")
|
||||
|
|
@ -21,8 +21,10 @@ const PlayerWalletType = preload("res://economy/player_wallet.gd")
|
|||
@onready var _showcase_details: Label = %ShowcaseDetails
|
||||
@onready var _fishing_panel: PanelContainer = %FishingPanel
|
||||
@onready var _player_menu: PlayerMenuType = %PlayerMenu
|
||||
@onready var _screen_fade: ScreenFade = %ScreenFade
|
||||
|
||||
var _showcase_active: bool = false
|
||||
var _player_menu_open: bool = false
|
||||
|
||||
|
||||
func setup(
|
||||
|
|
@ -53,11 +55,36 @@ func setup(
|
|||
)
|
||||
|
||||
|
||||
func close_player_menu() -> void:
|
||||
_player_menu.close_menu()
|
||||
|
||||
|
||||
func get_screen_fade() -> ScreenFade:
|
||||
return _screen_fade
|
||||
|
||||
|
||||
func _on_fishing_status_changed(status: String) -> void:
|
||||
if _showcase_active:
|
||||
return
|
||||
_status_label.text = status
|
||||
_status_label.visible = not status.is_empty()
|
||||
_set_fishing_status(status)
|
||||
|
||||
|
||||
func _set_fishing_status(text: String) -> void:
|
||||
var normalized_text: String = text.strip_edges()
|
||||
_status_label.text = normalized_text
|
||||
_status_label.visible = not normalized_text.is_empty()
|
||||
_refresh_fishing_panel_visibility()
|
||||
|
||||
|
||||
func _refresh_fishing_panel_visibility() -> void:
|
||||
var has_content: bool = (
|
||||
not _status_label.text.strip_edges().is_empty()
|
||||
or not _showcase_details.text.strip_edges().is_empty()
|
||||
or _catch_track.visible
|
||||
or _barrier_summary.visible
|
||||
or _barrier_health.visible
|
||||
)
|
||||
_fishing_panel.visible = has_content and not _player_menu_open
|
||||
|
||||
|
||||
func _on_catch_display_changed(
|
||||
|
|
@ -78,6 +105,7 @@ func _on_catch_display_changed(
|
|||
_clear_barrier_markers()
|
||||
_barrier_summary.text = ""
|
||||
_barrier_health.text = ""
|
||||
_refresh_fishing_panel_visibility()
|
||||
return
|
||||
|
||||
_update_barrier_markers(
|
||||
|
|
@ -128,6 +156,7 @@ func _on_catch_display_changed(
|
|||
visible
|
||||
and (active_barrier_index >= 0 or chase_gap <= 0.05)
|
||||
)
|
||||
_refresh_fishing_panel_visibility()
|
||||
|
||||
|
||||
func _update_barrier_markers(
|
||||
|
|
@ -142,9 +171,13 @@ func _update_barrier_markers(
|
|||
barrier_index < health.size()
|
||||
and health[barrier_index] <= 0
|
||||
)
|
||||
marker.color = Color(0.35, 0.38, 0.42, 0.8) if defeated else Color(1.0, 0.82, 0.2, 1.0)
|
||||
marker.color = (
|
||||
UIPalette.DISABLED
|
||||
if defeated
|
||||
else UIPalette.SECONDARY
|
||||
)
|
||||
if barrier_index == active_index:
|
||||
marker.color = Color(1.0, 1.0, 1.0, 1.0)
|
||||
marker.color = UIPalette.TEXT
|
||||
marker.set_anchors_preset(Control.PRESET_TOP_LEFT)
|
||||
marker.anchor_left = positions[barrier_index]
|
||||
marker.anchor_right = positions[barrier_index]
|
||||
|
|
@ -169,23 +202,22 @@ func _on_showcase_changed(
|
|||
) -> void:
|
||||
_showcase_active = visible
|
||||
if not visible:
|
||||
_status_label.text = ""
|
||||
_status_label.visible = false
|
||||
_showcase_details.text = ""
|
||||
_showcase_details.visible = false
|
||||
_set_fishing_status("")
|
||||
return
|
||||
_catch_track.visible = false
|
||||
_barrier_summary.visible = false
|
||||
_barrier_health.visible = false
|
||||
_clear_barrier_markers()
|
||||
_status_label.text = "You caught a %s!" % fish_name
|
||||
_status_label.visible = true
|
||||
_showcase_details.text = (
|
||||
"%.1f lb • %s\nLeft click or Escape to put away"
|
||||
% [weight_lb, rarity_name]
|
||||
)
|
||||
_showcase_details.visible = true
|
||||
_set_fishing_status("You caught a %s!" % fish_name)
|
||||
|
||||
|
||||
func _on_player_menu_visibility_changed(is_open: bool) -> void:
|
||||
_fishing_panel.visible = not is_open
|
||||
_player_menu_open = is_open
|
||||
_refresh_fishing_panel_visibility()
|
||||
|
|
|
|||
|
|
@ -1,16 +1,30 @@
|
|||
[gd_scene load_steps=7 format=3]
|
||||
[gd_scene load_steps=9 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://ui/game_ui.gd" id="1_ui"]
|
||||
[ext_resource type="PackedScene" path="res://ui/player_menu.tscn" id="2_menu"]
|
||||
[ext_resource type="Theme" path="res://ui/game_theme.tres" id="3_theme"]
|
||||
[ext_resource type="Script" path="res://ui/screen_fade.gd" id="4_fade"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_chase_background"]
|
||||
bg_color = Color(0.08, 0.08, 0.1, 0.9)
|
||||
bg_color = Color(0.055, 0.105, 0.125, 1)
|
||||
corner_radius_top_left = 6
|
||||
corner_radius_top_right = 6
|
||||
corner_radius_bottom_right = 6
|
||||
corner_radius_bottom_left = 6
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_chase_fill"]
|
||||
bg_color = Color(0.85, 0.12, 0.12, 0.95)
|
||||
bg_color = Color(0.937, 0.357, 0.384, 0.95)
|
||||
corner_radius_top_left = 6
|
||||
corner_radius_top_right = 6
|
||||
corner_radius_bottom_right = 6
|
||||
corner_radius_bottom_left = 6
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_catch_fill"]
|
||||
bg_color = Color(0.16, 0.82, 0.28, 0.9)
|
||||
bg_color = Color(0.275, 0.784, 0.471, 0.92)
|
||||
corner_radius_top_left = 6
|
||||
corner_radius_top_right = 6
|
||||
corner_radius_bottom_right = 6
|
||||
corner_radius_bottom_left = 6
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_transparent"]
|
||||
bg_color = Color(0, 0, 0, 0)
|
||||
|
|
@ -20,32 +34,36 @@ script = ExtResource("1_ui")
|
|||
|
||||
[node name="FishingPanel" type="PanelContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
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
|
||||
offset_left = -210.0
|
||||
offset_top = -130.0
|
||||
offset_right = 210.0
|
||||
offset_bottom = -24.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("3_theme")
|
||||
|
||||
[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
|
||||
theme_override_constants/margin_left = 18
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 18
|
||||
theme_override_constants/margin_bottom = 12
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="FishingPanel/MarginContainer"]
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="StatusLabel" type="Label" parent="FishingPanel/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
text = ""
|
||||
horizontal_alignment = 1
|
||||
theme_override_font_sizes/font_size = 17
|
||||
|
||||
[node name="ShowcaseDetails" type="Label" parent="FishingPanel/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
|
|
@ -55,7 +73,7 @@ horizontal_alignment = 1
|
|||
[node name="CatchTrack" type="Control" parent="FishingPanel/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(0, 18)
|
||||
custom_minimum_size = Vector2(0, 22)
|
||||
|
||||
[node name="GreenCatchProgress" type="ProgressBar" parent="FishingPanel/MarginContainer/VBoxContainer/CatchTrack"]
|
||||
unique_name_in_owner = true
|
||||
|
|
@ -107,3 +125,16 @@ horizontal_alignment = 1
|
|||
|
||||
[node name="PlayerMenu" parent="." instance=ExtResource("2_menu")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="ScreenFade" type="ColorRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
z_index = 100
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 0
|
||||
color = Color(0, 0, 0, 1)
|
||||
script = ExtResource("4_fade")
|
||||
|
|
|
|||
|
|
@ -328,37 +328,103 @@ func _compare_catches(left: FishCatchType, right: FishCatchType) -> bool:
|
|||
|
||||
func _create_inventory_card(fish_catch: FishCatchType) -> Button:
|
||||
var card := Button.new()
|
||||
card.custom_minimum_size = Vector2(170.0, 160.0)
|
||||
card.theme_type_variation = &"CardButton"
|
||||
card.custom_minimum_size = Vector2(152.0, 140.0)
|
||||
card.toggle_mode = true
|
||||
card.button_pressed = fish_catch.catch_id == _selected_catch_id
|
||||
card.tooltip_text = String(fish_catch.catch_id)
|
||||
card.pressed.connect(_select_catch.bind(fish_catch.catch_id))
|
||||
_apply_inventory_card_styles(
|
||||
card,
|
||||
UIPalette.get_rarity_color(fish_catch.fish.rarity)
|
||||
)
|
||||
|
||||
var content := VBoxContainer.new()
|
||||
content.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT, Control.PRESET_MODE_MINSIZE, 8)
|
||||
content.add_theme_constant_override("separation", 3)
|
||||
content.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
card.add_child(content)
|
||||
content.add_child(_create_texture_frame(fish_catch.fish.display_texture, Vector2(138.0, 82.0)))
|
||||
content.add_child(_create_texture_frame(
|
||||
fish_catch.fish.display_texture,
|
||||
Vector2(124.0, 78.0)
|
||||
))
|
||||
var name_label := Label.new()
|
||||
name_label.text = fish_catch.fish.display_name
|
||||
name_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
name_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
content.add_child(name_label)
|
||||
var data_label := Label.new()
|
||||
data_label.text = "%.2f lb • %s\nCatch #%d" % [
|
||||
fish_catch.weight_lb,
|
||||
fish_catch.fish.get_rarity_name(),
|
||||
fish_catch.catch_sequence,
|
||||
]
|
||||
data_label.text += "\nBase value: $%d" % fish_catch.sale_value
|
||||
var weight_label := Label.new()
|
||||
weight_label.text = "%.2f lb" % fish_catch.weight_lb
|
||||
weight_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
weight_label.add_theme_color_override(
|
||||
"font_color",
|
||||
UIPalette.MUTED_TEXT
|
||||
)
|
||||
weight_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
content.add_child(weight_label)
|
||||
if fish_catch.is_favorited:
|
||||
data_label.text += " • ★"
|
||||
data_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
data_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
content.add_child(data_label)
|
||||
var favorite_marker := Label.new()
|
||||
favorite_marker.text = "★"
|
||||
favorite_marker.add_theme_color_override(
|
||||
"font_color",
|
||||
UIPalette.SECONDARY
|
||||
)
|
||||
favorite_marker.add_theme_font_size_override("font_size", 18)
|
||||
favorite_marker.set_anchors_preset(Control.PRESET_TOP_RIGHT)
|
||||
favorite_marker.offset_left = -28.0
|
||||
favorite_marker.offset_top = 5.0
|
||||
favorite_marker.offset_right = -8.0
|
||||
favorite_marker.offset_bottom = 29.0
|
||||
favorite_marker.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
favorite_marker.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
card.add_child(favorite_marker)
|
||||
return card
|
||||
|
||||
|
||||
func _apply_inventory_card_styles(
|
||||
card: Button,
|
||||
rarity_color: Color,
|
||||
) -> void:
|
||||
card.add_theme_stylebox_override(
|
||||
"normal",
|
||||
_create_inventory_card_style(rarity_color, 0)
|
||||
)
|
||||
card.add_theme_stylebox_override(
|
||||
"hover",
|
||||
_create_inventory_card_style(rarity_color, 1)
|
||||
)
|
||||
card.add_theme_stylebox_override(
|
||||
"focus",
|
||||
_create_inventory_card_style(rarity_color, 1)
|
||||
)
|
||||
card.add_theme_stylebox_override(
|
||||
"pressed",
|
||||
_create_inventory_card_style(rarity_color, 2)
|
||||
)
|
||||
|
||||
|
||||
func _create_inventory_card_style(
|
||||
rarity_color: Color,
|
||||
state_index: int,
|
||||
) -> StyleBoxFlat:
|
||||
var style := StyleBoxFlat.new()
|
||||
match state_index:
|
||||
1:
|
||||
style.bg_color = UIPalette.ELEVATED_PANEL.lightened(0.1)
|
||||
2:
|
||||
style.bg_color = UIPalette.PRIMARY.darkened(0.48)
|
||||
_:
|
||||
style.bg_color = UIPalette.ELEVATED_PANEL
|
||||
style.border_color = rarity_color
|
||||
var border_width: int = 4 if state_index == 2 else 2
|
||||
style.set_border_width_all(border_width)
|
||||
style.set_corner_radius_all(8)
|
||||
style.content_margin_left = 7.0
|
||||
style.content_margin_top = 7.0
|
||||
style.content_margin_right = 7.0
|
||||
style.content_margin_bottom = 7.0
|
||||
return style
|
||||
|
||||
|
||||
func _select_catch(catch_id: StringName) -> void:
|
||||
if _inventory == null:
|
||||
return
|
||||
|
|
@ -395,13 +461,11 @@ func _update_inventory_detail(fish_catch: FishCatchType) -> void:
|
|||
_default_buyer.display_name,
|
||||
buyer_offer,
|
||||
]
|
||||
_detail_data.text = "%.2f lb\n%s\nBase value: $%d\n%s\nCatch #%d\n%s" % [
|
||||
_detail_data.text = "%.2f lb\n%s\nBase value: $%d\n%s" % [
|
||||
fish_catch.weight_lb,
|
||||
fish_catch.fish.get_rarity_name(),
|
||||
fish_catch.sale_value,
|
||||
buyer_offer_text,
|
||||
fish_catch.catch_sequence,
|
||||
String(fish_catch.catch_id),
|
||||
]
|
||||
_favorite_button.disabled = false
|
||||
_favorite_button.text = (
|
||||
|
|
@ -601,16 +665,16 @@ func _create_logbook_card(fish: FishDataType) -> Control:
|
|||
and _collection_log.has_discovered(fish.id)
|
||||
)
|
||||
var card := PanelContainer.new()
|
||||
card.custom_minimum_size = Vector2(190.0, 170.0)
|
||||
card.custom_minimum_size = Vector2(158.0, 154.0)
|
||||
var content := VBoxContainer.new()
|
||||
content.add_theme_constant_override("separation", 4)
|
||||
card.add_child(content)
|
||||
var texture_frame: TextureRect = _create_texture_frame(
|
||||
fish.display_texture,
|
||||
Vector2(170.0, 92.0)
|
||||
Vector2(142.0, 82.0)
|
||||
)
|
||||
if not discovered:
|
||||
texture_frame.modulate = Color(0.08, 0.1, 0.12, 1.0)
|
||||
texture_frame.modulate = UIPalette.PANEL
|
||||
content.add_child(texture_frame)
|
||||
var name_label := Label.new()
|
||||
name_label.text = fish.display_name if discovered else "???"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=2 format=3]
|
||||
[gd_scene load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://ui/player_menu.gd" id="1_menu"]
|
||||
[ext_resource type="Theme" path="res://ui/game_theme.tres" id="2_theme"]
|
||||
|
||||
[node name="PlayerMenu" type="Control"]
|
||||
process_mode = 3
|
||||
|
|
@ -12,6 +13,7 @@ anchor_bottom = 1.0
|
|||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 0
|
||||
theme = ExtResource("2_theme")
|
||||
script = ExtResource("1_menu")
|
||||
|
||||
[node name="Dimmer" type="ColorRect" parent="."]
|
||||
|
|
@ -26,59 +28,60 @@ color = Color(0.015, 0.02, 0.03, 0.72)
|
|||
|
||||
[node name="MenuPanel" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -480.0
|
||||
offset_top = -310.0
|
||||
offset_right = 480.0
|
||||
offset_bottom = 310.0
|
||||
anchor_left = 0.055
|
||||
anchor_top = 0.045
|
||||
anchor_right = 0.945
|
||||
anchor_bottom = 0.955
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="MenuPanel"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 18
|
||||
theme_override_constants/margin_top = 14
|
||||
theme_override_constants/margin_right = 18
|
||||
theme_override_constants/margin_bottom = 16
|
||||
theme_override_constants/margin_left = 22
|
||||
theme_override_constants/margin_top = 18
|
||||
theme_override_constants/margin_right = 22
|
||||
theme_override_constants/margin_bottom = 20
|
||||
|
||||
[node name="Layout" type="VBoxContainer" parent="MenuPanel/Margin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="Header" type="HBoxContainer" parent="MenuPanel/Margin/Layout"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="Title" type="Label" parent="MenuPanel/Margin/Layout/Header"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 24
|
||||
theme_override_colors/font_color = Color(0.208, 0.725, 0.78, 1)
|
||||
theme_override_font_sizes/font_size = 26
|
||||
text = "Player Menu"
|
||||
|
||||
[node name="WalletBalance" type="Label" parent="MenuPanel/Margin/Layout/Header"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Wallet: $0"
|
||||
theme_override_colors/font_color = Color(1, 0.82, 0.4, 1)
|
||||
|
||||
[node name="InventoryTab" type="Button" parent="MenuPanel/Margin/Layout/Header"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
text = "Inventory"
|
||||
custom_minimum_size = Vector2(104, 36)
|
||||
|
||||
[node name="LogbookTab" type="Button" parent="MenuPanel/Margin/Layout/Header"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
text = "Logbook"
|
||||
custom_minimum_size = Vector2(104, 36)
|
||||
|
||||
[node name="CloseButton" type="Button" parent="MenuPanel/Margin/Layout/Header"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Close"
|
||||
custom_minimum_size = Vector2(76, 36)
|
||||
|
||||
[node name="Separator" type="HSeparator" parent="MenuPanel/Margin/Layout"]
|
||||
layout_mode = 2
|
||||
|
|
@ -88,9 +91,11 @@ unique_name_in_owner = true
|
|||
layout_mode = 2
|
||||
text = ""
|
||||
horizontal_alignment = 1
|
||||
theme_override_colors/font_color = Color(1, 0.82, 0.4, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
|
||||
[node name="Content" type="Control" parent="MenuPanel/Margin/Layout"]
|
||||
custom_minimum_size = Vector2(0, 530)
|
||||
custom_minimum_size = Vector2(0, 390)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
|
|
@ -102,9 +107,11 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="SortBar" type="HBoxContainer" parent="MenuPanel/Margin/Layout/Content/InventorySection"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="SortLabel" type="Label" parent="MenuPanel/Margin/Layout/Content/InventorySection/SortBar"]
|
||||
layout_mode = 2
|
||||
|
|
@ -113,12 +120,12 @@ text = "Sort:"
|
|||
[node name="SortOption" type="OptionButton" parent="MenuPanel/Margin/Layout/Content/InventorySection/SortBar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(160, 0)
|
||||
custom_minimum_size = Vector2(145, 36)
|
||||
|
||||
[node name="SortDirection" type="Button" parent="MenuPanel/Margin/Layout/Content/InventorySection/SortBar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(130, 0)
|
||||
custom_minimum_size = Vector2(125, 36)
|
||||
text = "Newest first"
|
||||
|
||||
[node name="SortSpacer" type="Control" parent="MenuPanel/Margin/Layout/Content/InventorySection/SortBar"]
|
||||
|
|
@ -129,25 +136,28 @@ size_flags_horizontal = 3
|
|||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Held fish base value: $0"
|
||||
theme_override_colors/font_color = Color(0.682, 0.733, 0.761, 1)
|
||||
|
||||
[node name="InventoryBody" type="HSplitContainer" parent="MenuPanel/Margin/Layout/Content/InventorySection"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
split_offset = 620
|
||||
split_offset = 560
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="InventoryList" type="PanelContainer" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody"]
|
||||
custom_minimum_size = Vector2(610, 0)
|
||||
custom_minimum_size = Vector2(400, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="InventoryListMargin" type="MarginContainer" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody/InventoryList"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 8
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_right = 8
|
||||
theme_override_constants/margin_bottom = 8
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
|
||||
[node name="InventoryStack" type="VBoxContainer" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody/InventoryList/InventoryListMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="InventoryEmpty" type="Label" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody/InventoryList/InventoryListMargin/InventoryStack"]
|
||||
unique_name_in_owner = true
|
||||
|
|
@ -164,20 +174,20 @@ horizontal_scroll_mode = 0
|
|||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/h_separation = 8
|
||||
theme_override_constants/v_separation = 8
|
||||
theme_override_constants/h_separation = 10
|
||||
theme_override_constants/v_separation = 10
|
||||
columns = 3
|
||||
|
||||
[node name="DetailPanel" type="PanelContainer" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody"]
|
||||
custom_minimum_size = Vector2(270, 0)
|
||||
custom_minimum_size = Vector2(240, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DetailMargin" type="MarginContainer" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody/DetailPanel"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
theme_override_constants/margin_left = 16
|
||||
theme_override_constants/margin_top = 14
|
||||
theme_override_constants/margin_right = 16
|
||||
theme_override_constants/margin_bottom = 14
|
||||
|
||||
[node name="DetailStack" type="VBoxContainer" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody/DetailPanel/DetailMargin"]
|
||||
layout_mode = 2
|
||||
|
|
@ -185,7 +195,7 @@ theme_override_constants/separation = 10
|
|||
|
||||
[node name="DetailTexture" type="TextureRect" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody/DetailPanel/DetailMargin/DetailStack"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(240, 180)
|
||||
custom_minimum_size = Vector2(208, 140)
|
||||
layout_mode = 2
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
|
@ -194,6 +204,7 @@ texture_filter = 1
|
|||
[node name="DetailName" type="Label" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody/DetailPanel/DetailMargin/DetailStack"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.208, 0.725, 0.78, 1)
|
||||
theme_override_font_sizes/font_size = 22
|
||||
horizontal_alignment = 1
|
||||
|
||||
|
|
@ -214,6 +225,7 @@ unique_name_in_owner = true
|
|||
layout_mode = 2
|
||||
disabled = true
|
||||
text = "Sell"
|
||||
theme_type_variation = &"DangerButton"
|
||||
|
||||
[node name="SaleUnavailable" type="Label" parent="MenuPanel/Margin/Layout/Content/InventorySection/InventoryBody/DetailPanel/DetailMargin/DetailStack"]
|
||||
unique_name_in_owner = true
|
||||
|
|
@ -221,6 +233,7 @@ visible = false
|
|||
layout_mode = 2
|
||||
autowrap_mode = 2
|
||||
horizontal_alignment = 1
|
||||
theme_override_colors/font_color = Color(1, 0.702, 0.278, 1)
|
||||
|
||||
[node name="LogbookSection" type="VBoxContainer" parent="MenuPanel/Margin/Layout/Content"]
|
||||
unique_name_in_owner = true
|
||||
|
|
@ -231,6 +244,7 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="LogbookEmpty" type="Label" parent="MenuPanel/Margin/Layout/Content/LogbookSection"]
|
||||
unique_name_in_owner = true
|
||||
|
|
@ -247,8 +261,8 @@ horizontal_scroll_mode = 0
|
|||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/h_separation = 12
|
||||
theme_override_constants/v_separation = 12
|
||||
theme_override_constants/h_separation = 10
|
||||
theme_override_constants/v_separation = 10
|
||||
columns = 4
|
||||
|
||||
[node name="SaleConfirmation" type="PanelContainer" parent="MenuPanel/Margin/Layout/Content"]
|
||||
|
|
@ -260,19 +274,19 @@ anchor_left = 0.5
|
|||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -220.0
|
||||
offset_top = -90.0
|
||||
offset_right = 220.0
|
||||
offset_bottom = 90.0
|
||||
offset_left = -230.0
|
||||
offset_top = -105.0
|
||||
offset_right = 230.0
|
||||
offset_bottom = 105.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ConfirmationMargin" type="MarginContainer" parent="MenuPanel/Margin/Layout/Content/SaleConfirmation"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 18
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_right = 18
|
||||
theme_override_constants/margin_bottom = 16
|
||||
theme_override_constants/margin_left = 22
|
||||
theme_override_constants/margin_top = 20
|
||||
theme_override_constants/margin_right = 22
|
||||
theme_override_constants/margin_bottom = 20
|
||||
|
||||
[node name="ConfirmationLayout" type="VBoxContainer" parent="MenuPanel/Margin/Layout/Content/SaleConfirmation/ConfirmationMargin"]
|
||||
layout_mode = 2
|
||||
|
|
@ -292,8 +306,11 @@ alignment = 1
|
|||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Confirm"
|
||||
theme_type_variation = &"DangerButton"
|
||||
custom_minimum_size = Vector2(120, 38)
|
||||
|
||||
[node name="CancelSaleButton" type="Button" parent="MenuPanel/Margin/Layout/Content/SaleConfirmation/ConfirmationMargin/ConfirmationLayout/ConfirmationButtons"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Cancel"
|
||||
custom_minimum_size = Vector2(120, 38)
|
||||
|
|
|
|||
65
ui/screen_fade.gd
Normal file
65
ui/screen_fade.gd
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
class_name ScreenFade
|
||||
extends ColorRect
|
||||
|
||||
signal transition_completed(generation: int, faded_to_black: bool)
|
||||
|
||||
@export_range(0.01, 3.0, 0.01) var fade_out_duration: float = 0.4
|
||||
@export_range(0.01, 3.0, 0.01) var fade_in_duration: float = 0.45
|
||||
|
||||
var _fade_tween: Tween
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
modulate.a = 0.0
|
||||
visible = false
|
||||
|
||||
|
||||
func fade_to_black(generation: int) -> void:
|
||||
_start_fade(1.0, fade_out_duration, generation, true)
|
||||
|
||||
|
||||
func fade_from_black(generation: int) -> void:
|
||||
visible = true
|
||||
modulate.a = 1.0
|
||||
_start_fade(0.0, fade_in_duration, generation, false)
|
||||
|
||||
|
||||
func reset_immediately() -> void:
|
||||
if _fade_tween != null and _fade_tween.is_valid():
|
||||
_fade_tween.kill()
|
||||
_fade_tween = null
|
||||
modulate.a = 0.0
|
||||
visible = false
|
||||
|
||||
|
||||
func _start_fade(
|
||||
target_alpha: float,
|
||||
duration: float,
|
||||
generation: int,
|
||||
faded_to_black: bool,
|
||||
) -> void:
|
||||
if _fade_tween != null and _fade_tween.is_valid():
|
||||
_fade_tween.kill()
|
||||
visible = true
|
||||
_fade_tween = create_tween()
|
||||
_fade_tween.set_trans(Tween.TRANS_QUAD)
|
||||
_fade_tween.set_ease(
|
||||
Tween.EASE_IN if faded_to_black else Tween.EASE_OUT
|
||||
)
|
||||
_fade_tween.tween_property(
|
||||
self,
|
||||
"modulate:a",
|
||||
target_alpha,
|
||||
maxf(duration, 0.01)
|
||||
)
|
||||
_fade_tween.finished.connect(
|
||||
_on_fade_finished.bind(generation, faded_to_black),
|
||||
CONNECT_ONE_SHOT
|
||||
)
|
||||
|
||||
|
||||
func _on_fade_finished(generation: int, faded_to_black: bool) -> void:
|
||||
_fade_tween = null
|
||||
if not faded_to_black:
|
||||
visible = false
|
||||
transition_completed.emit(generation, faded_to_black)
|
||||
1
ui/screen_fade.gd.uid
Normal file
1
ui/screen_fade.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cypipneoh61j3
|
||||
33
ui/ui_palette.gd
Normal file
33
ui/ui_palette.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
class_name UIPalette
|
||||
extends RefCounted
|
||||
|
||||
const PRIMARY := Color("35b9c7")
|
||||
const SECONDARY := Color("ffd166")
|
||||
const SUCCESS := Color("46c878")
|
||||
const WARNING := Color("ffb347")
|
||||
const DANGER := Color("ef5b62")
|
||||
const TEXT := Color("f4f7f8")
|
||||
const MUTED_TEXT := Color("aebbc2")
|
||||
const DISABLED := Color("66747b")
|
||||
const PANEL := Color("19313a")
|
||||
const ELEVATED_PANEL := Color("244550")
|
||||
|
||||
const RARITY_COMMON := Color("e8eef0")
|
||||
const RARITY_UNCOMMON := Color("58d279")
|
||||
const RARITY_RARE := Color("5596f6")
|
||||
const RARITY_EPIC := Color("b176e8")
|
||||
const RARITY_LEGENDARY := Color("f276b3")
|
||||
|
||||
|
||||
static func get_rarity_color(rarity: int) -> Color:
|
||||
match rarity:
|
||||
1:
|
||||
return RARITY_UNCOMMON
|
||||
2:
|
||||
return RARITY_RARE
|
||||
3:
|
||||
return RARITY_EPIC
|
||||
4:
|
||||
return RARITY_LEGENDARY
|
||||
_:
|
||||
return RARITY_COMMON
|
||||
1
ui/ui_palette.gd.uid
Normal file
1
ui/ui_palette.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d4g6ks171n65j
|
||||
Loading…
Add table
Add a link
Reference in a new issue