improve ui

This commit is contained in:
2026-06-01 20:17:20 +02:00
parent 0c44b420d1
commit 6c4f659fd0
7 changed files with 82 additions and 39 deletions

View File

@@ -8,21 +8,22 @@ enum Weather {RAIN, SNOW}
@onready var photo_icon_button: Button = $%PhotoIconButton
@onready var collectible_icon_button: Button = $%CollectibleIconButton
@onready var resume_button: Button = $GameMenuPanel/GameMenu/Pages/Page3/OptionMenu/VBoxContainer/ResumeButton
@onready var show_container_tween: ContainerTween = $%ShowContainerTween
@onready var hide_container_tween: ContainerTween = $%HideContainerTween
@onready var weather_row: HBoxContainer = $%WeatherRow
@onready var photo_mode_texture_mask: TextureRect = $%PhotoModeTextureMask
func _ready() -> void:
GameState.on_enable_photo_mode_request.connect(_on_enable_photo_mode)
GameState.on_disable_photo_mode_request.connect(_on_disable_photo_mode)
menu_icon_button.pressed.connect(_on_menu_icon_button_pressed)
photo_icon_button.pressed.connect(_on_photo_icon_button_pressed)
collectible_icon_button.pressed.connect(_on_collectible_icon_button_pressed)
resume_button.pressed.connect(_on_resume_button_pressed)
func _on_menu_icon_button_pressed() -> void:
GameState.pause_game()
game_menu_panel.show()
show_container_tween.start_tween()
game_menu.scale = Vector2(1, 1)
TweenFX.fold_in(game_menu)
func _on_photo_icon_button_pressed() -> void:
GameState.on_enable_photo_mode_request.emit()
@@ -31,11 +32,12 @@ func _on_collectible_icon_button_pressed() -> void:
GameState.pause_game()
game_menu.on_tab_pressed(1, true)
game_menu_panel.show()
show_container_tween.start_tween()
game_menu.scale = Vector2(1, 1)
TweenFX.fold_in(game_menu)
func _on_resume_button_pressed() -> void:
hide_container_tween.start_tween()
await hide_container_tween.finished
TweenFX.fold_out(game_menu)
await TweenFX.fold_out(game_menu).finished
game_menu_panel.hide()
GameState.resume_game()
@@ -76,3 +78,13 @@ func pick_random_weather() -> void:
if valid_buttons.size() > 0:
var random_button = valid_buttons.pick_random()
weather_row.on_icon_pressed_changed(random_button)
func _on_enable_photo_mode() -> void:
photo_mode_texture_mask.scale = Vector2(1,1)
photo_mode_texture_mask.show()
TweenFX.fold_in(photo_mode_texture_mask)
func _on_disable_photo_mode() -> void:
TweenFX.fold_out(photo_mode_texture_mask)
await TweenFX.fold_out(photo_mode_texture_mask).finished
photo_mode_texture_mask.hide()

View File

@@ -7,7 +7,7 @@
[ext_resource type="PackedScene" uid="uid://cpeyt1dgrtglc" path="res://core/radio/radio.tscn" id="5_nevjt"]
[ext_resource type="AudioStream" uid="uid://70cc8she43re" path="res://docs/gyms/radio/lofi_01.ogg" id="6_kd244"]
[ext_resource type="PackedScene" uid="uid://dg4f3v0ukpmay" path="res://core/main_scene_ui/audio_player.tscn" id="7_lapqe"]
[ext_resource type="PackedScene" uid="uid://dxun0jk5t0n6" path="res://core/tween/container_tween.tscn" id="8_msh61"]
[ext_resource type="Texture2D" uid="uid://dcsy5yawnlxhq" path="res://core/photo_mode/assets/reticolo.png" id="9_4cc8f"]
[node name="MainSceneUi" type="Control" unique_id=1359391222]
process_mode = 3
@@ -142,21 +142,21 @@ grow_vertical = 2
unique_name_in_owner = true
layout_mode = 1
[node name="PhotoModeTextureMask" type="TextureRect" parent="." unique_id=1377788813]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset_ratio = Vector2(0.5, 0.5)
texture = ExtResource("9_4cc8f")
[node name="Radio" parent="." unique_id=1234112225 instance=ExtResource("5_nevjt")]
playlist = Array[AudioStream]([ExtResource("6_kd244")])
[node name="ShowContainerTween" parent="." unique_id=902285649 node_paths=PackedStringArray("targets") instance=ExtResource("8_msh61")]
unique_name_in_owner = true
targets = [NodePath("../GameMenuPanel/GameMenu")]
tween_types = Array[String](["fold_in"])
show_on_start = true
[node name="HideContainerTween" parent="." unique_id=1041880010 node_paths=PackedStringArray("targets") instance=ExtResource("8_msh61")]
unique_name_in_owner = true
targets = [NodePath("../GameMenuPanel/GameMenu")]
tween_types = Array[String](["fold_out"])
hide_on_finish = true
[connection signal="on_option_changed" from="VBoxContainer/TimeOfDayRow" to="." method="_on_time_of_day_row_on_option_changed"]
[connection signal="on_option_changed" from="VBoxContainer/WeatherRow" to="." method="_on_weather_row_on_option_changed"]