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

@@ -2,15 +2,19 @@ extends Control
@onready var settings_menu: Control = $%SettingsMenu
@onready var option_menu: Control = $%OptionMenu
@onready var show_container_tween: ContainerTween = $%ShowContainerTween
@onready var hide_container_tween: ContainerTween = $%HideContainerTween
func _ready() -> void:
option_menu.settings_button.pressed.connect(_on_settings_button_pressed)
func _on_settings_button_pressed() -> void:
if TweenFX.is_playing(settings_menu, TweenFX.Animations.FOLD_IN) or TweenFX.is_playing(settings_menu, TweenFX.Animations.FOLD_OUT):
return
if settings_menu.visible:
hide_container_tween.start_tween()
TweenFX.fold_out(settings_menu)
await TweenFX.fold_out(settings_menu).finished
settings_menu.hide()
else:
show_container_tween.start_tween()
settings_menu.scale = Vector2(1,1)
settings_menu.show()
TweenFX.fold_in(settings_menu)

View File

@@ -4,7 +4,6 @@
[ext_resource type="PackedScene" uid="uid://cxf8s80ivwj1p" path="res://core/game_menu/option_menu.tscn" id="1_uvy4f"]
[ext_resource type="Texture2D" uid="uid://buy4x63u237np" path="res://core/main_menu/assets/main_menu_background.png" id="2_mloc8"]
[ext_resource type="PackedScene" uid="uid://caqf471x0kttc" path="res://core/game_menu/settings_menu.tscn" id="3_26agx"]
[ext_resource type="PackedScene" uid="uid://dxun0jk5t0n6" path="res://core/tween/container_tween.tscn" id="4_mloc8"]
[node name="MainMenu" type="Control" unique_id=889720172]
layout_mode = 3
@@ -61,16 +60,4 @@ offset_right = 552.0
offset_bottom = 256.0
grow_vertical = 2
[node name="ShowContainerTween" parent="." unique_id=160227524 node_paths=PackedStringArray("targets") instance=ExtResource("4_mloc8")]
unique_name_in_owner = true
targets = [NodePath("../SettingsMenu")]
tween_types = Array[String](["fold_in"])
show_on_start = true
[node name="HideContainerTween" parent="." unique_id=570405239 node_paths=PackedStringArray("targets") instance=ExtResource("4_mloc8")]
unique_name_in_owner = true
targets = [NodePath("../SettingsMenu")]
tween_types = Array[String](["fold_out"])
hide_on_finish = true
[editable path="OptionMenu"]

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"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dcsy5yawnlxhq"
path="res://.godot/imported/reticolo.png-dba8a0c9eb8601e74902df2dc1fc51e5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/photo_mode/assets/reticolo.png"
dest_files=["res://.godot/imported/reticolo.png-dba8a0c9eb8601e74902df2dc1fc51e5.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -48,9 +48,9 @@ func disable_photo_mode() -> void:
func _input(event: InputEvent) -> void:
if event.is_action_pressed("toggle_photo_mode"):
if not is_active:
enable_photo_mode()
GameState.on_enable_photo_mode_request.emit()
else:
disable_photo_mode()
GameState.on_disable_photo_mode_request.emit()
if event is InputEventMouseMotion and is_active:
total_yaw -= event.relative.x * rotation_speed