This commit is contained in:
2026-07-06 22:02:51 +02:00
parent c2b41d31bf
commit d06f693088
5 changed files with 36 additions and 23 deletions

View File

@@ -115,21 +115,21 @@ func on_change_camera_request(camera_index: int) -> void:
var next_cam = array_camera[camera_index]
set_camera(next_cam)
func _unhandled_input(event: InputEvent) -> void:
var current_cam = get_viewport().get_camera_3d()
var is_photo_mode = current_cam != null and not current_cam in array_camera
if is_photo_mode:
return
if event is InputEventKey and event.pressed and not event.echo:
match event.keycode:
KEY_1:
if array_camera.size() > 0: set_camera(array_camera[0])
KEY_2:
if array_camera.size() > 1: set_camera(array_camera[1])
KEY_3:
if array_camera.size() > 2: set_camera(array_camera[2])
KEY_4:
if array_camera.size() > 3: set_camera(array_camera[3])
KEY_5:
if array_camera.size() > 4: set_camera(array_camera[4])
#func _unhandled_input(event: InputEvent) -> void:
#var current_cam = get_viewport().get_camera_3d()
#var is_photo_mode = current_cam != null and not current_cam in array_camera
#if is_photo_mode:
#return
#
#if event is InputEventKey and event.pressed and not event.echo:
#match event.keycode:
#KEY_1:
#if array_camera.size() > 0: set_camera(array_camera[0])
#KEY_2:
#if array_camera.size() > 1: set_camera(array_camera[1])
#KEY_3:
#if array_camera.size() > 2: set_camera(array_camera[2])
#KEY_4:
#if array_camera.size() > 3: set_camera(array_camera[3])
#KEY_5:
#if array_camera.size() > 4: set_camera(array_camera[4])

View File

@@ -10,7 +10,7 @@ extends Control
@onready var collectible_icon_button: Button = $%CollectibleIconButton
@onready var weather_row: HBoxContainer = $%WeatherRow
@onready var time_of_day_row: HBoxContainer = $%TimeOfDayRow
@onready var cameras_row: HBoxContainer = $%CamerasRow
#@onready var cameras_row: HBoxContainer = $%CamerasRow
@onready var photo_mode_texture_panel: Panel = $%PhotoModeTexturePanel
@onready var photo_mode_texture_mask: TextureRect = $%PhotoModeTextureMask
@onready var photo_mode_black_screen: ColorRect = $%PhotoModeBlackScreen
@@ -223,8 +223,8 @@ func _set_buttons_mouse_filter(ignore: bool) -> void:
buttons.append_array(weather_row.options_icon_buttons)
if time_of_day_row and "options_icon_buttons" in time_of_day_row:
buttons.append_array(time_of_day_row.options_icon_buttons)
if cameras_row and "options_icon_buttons" in cameras_row:
buttons.append_array(cameras_row.options_icon_buttons)
#if cameras_row and "options_icon_buttons" in cameras_row:
#buttons.append_array(cameras_row.options_icon_buttons)
for btn in buttons:
if btn is Control:
@@ -233,16 +233,17 @@ func _set_buttons_mouse_filter(ignore: bool) -> void:
func hide_ui() -> void:
_ui_hidden = true
_set_buttons_mouse_filter(true)
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, cameras_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label]
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label]
for element in hud_elements:
element.visible = false
element.visible = true
TweenFX.fade_out(element, 0.25)
func show_ui() -> void:
UIEvents.on_show_ui_requested.emit()
_ui_hidden = false
_set_buttons_mouse_filter(false)
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, cameras_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label, tooltips]
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label, tooltips]
for element in hud_elements:
element.show()
TweenFX.fade_in(element, 0.25)

View File

@@ -233,6 +233,7 @@ offset_bottom = 220.0
[node name="CamerasRow" parent="InfoLabels" unique_id=1233961141 instance=ExtResource("2_4cc8f")]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_vertical = 1

View File

@@ -31,11 +31,15 @@ var initial_local_basis: Basis
var is_making_photo = false
var captured_image: Image
var _ui_is_visible = true
func _ready() -> void:
GameState.on_enable_photo_mode_request.connect(enable_photo_mode)
GameState.on_disable_photo_mode_request.connect(disable_photo_mode)
GameState.on_photo_taken_making.connect(take_photo_async)
GameState.on_photo_mode_black_screen_disappeared.connect(_on_photo_mode_black_screen_disappeared)
UIEvents.on_show_ui_requested.connect(update_ui_visibility.bind(true))
UIEvents.on_hide_ui_requested.connect(update_ui_visibility.bind(false))
initial_local_pos = position
initial_local_basis = basis
@@ -131,6 +135,8 @@ func _input(event: InputEvent) -> void:
if event.is_action_pressed("toggle_photo_mode"):
if get_tree().paused:
return
if !_ui_is_visible:
return
if not is_active:
GameState.on_enable_photo_mode_request.emit()
else:
@@ -192,3 +198,6 @@ func take_photo_async() -> void:
func _on_photo_mode_black_screen_disappeared() -> void:
is_making_photo = false
func update_ui_visibility(ui_is_visible) -> void:
_ui_is_visible = ui_is_visible

View File

@@ -52,6 +52,8 @@ signal toot_toot(update_stats: bool)
@warning_ignore("unused_signal")
signal resume_game_requested
@warning_ignore("unused_signal")
signal on_show_ui_requested
@warning_ignore("unused_signal")
signal on_hide_ui_requested
@warning_ignore("unused_signal")
signal change_camera_request(camera_index: int)