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] var next_cam = array_camera[camera_index]
set_camera(next_cam) set_camera(next_cam)
func _unhandled_input(event: InputEvent) -> void: #func _unhandled_input(event: InputEvent) -> void:
var current_cam = get_viewport().get_camera_3d() #var current_cam = get_viewport().get_camera_3d()
var is_photo_mode = current_cam != null and not current_cam in array_camera #var is_photo_mode = current_cam != null and not current_cam in array_camera
if is_photo_mode: #if is_photo_mode:
return #return
#
if event is InputEventKey and event.pressed and not event.echo: #if event is InputEventKey and event.pressed and not event.echo:
match event.keycode: #match event.keycode:
KEY_1: #KEY_1:
if array_camera.size() > 0: set_camera(array_camera[0]) #if array_camera.size() > 0: set_camera(array_camera[0])
KEY_2: #KEY_2:
if array_camera.size() > 1: set_camera(array_camera[1]) #if array_camera.size() > 1: set_camera(array_camera[1])
KEY_3: #KEY_3:
if array_camera.size() > 2: set_camera(array_camera[2]) #if array_camera.size() > 2: set_camera(array_camera[2])
KEY_4: #KEY_4:
if array_camera.size() > 3: set_camera(array_camera[3]) #if array_camera.size() > 3: set_camera(array_camera[3])
KEY_5: #KEY_5:
if array_camera.size() > 4: set_camera(array_camera[4]) #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 collectible_icon_button: Button = $%CollectibleIconButton
@onready var weather_row: HBoxContainer = $%WeatherRow @onready var weather_row: HBoxContainer = $%WeatherRow
@onready var time_of_day_row: HBoxContainer = $%TimeOfDayRow @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_panel: Panel = $%PhotoModeTexturePanel
@onready var photo_mode_texture_mask: TextureRect = $%PhotoModeTextureMask @onready var photo_mode_texture_mask: TextureRect = $%PhotoModeTextureMask
@onready var photo_mode_black_screen: ColorRect = $%PhotoModeBlackScreen @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) buttons.append_array(weather_row.options_icon_buttons)
if time_of_day_row and "options_icon_buttons" in time_of_day_row: if time_of_day_row and "options_icon_buttons" in time_of_day_row:
buttons.append_array(time_of_day_row.options_icon_buttons) buttons.append_array(time_of_day_row.options_icon_buttons)
if cameras_row and "options_icon_buttons" in cameras_row: #if cameras_row and "options_icon_buttons" in cameras_row:
buttons.append_array(cameras_row.options_icon_buttons) #buttons.append_array(cameras_row.options_icon_buttons)
for btn in buttons: for btn in buttons:
if btn is Control: if btn is Control:
@@ -233,16 +233,17 @@ func _set_buttons_mouse_filter(ignore: bool) -> void:
func hide_ui() -> void: func hide_ui() -> void:
_ui_hidden = true _ui_hidden = true
_set_buttons_mouse_filter(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: for element in hud_elements:
element.visible = false element.visible = false
element.visible = true element.visible = true
TweenFX.fade_out(element, 0.25) TweenFX.fade_out(element, 0.25)
func show_ui() -> void: func show_ui() -> void:
UIEvents.on_show_ui_requested.emit()
_ui_hidden = false _ui_hidden = false
_set_buttons_mouse_filter(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: for element in hud_elements:
element.show() element.show()
TweenFX.fade_in(element, 0.25) 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")] [node name="CamerasRow" parent="InfoLabels" unique_id=1233961141 instance=ExtResource("2_4cc8f")]
unique_name_in_owner = true unique_name_in_owner = true
visible = false
layout_mode = 2 layout_mode = 2
size_flags_vertical = 1 size_flags_vertical = 1

View File

@@ -31,11 +31,15 @@ var initial_local_basis: Basis
var is_making_photo = false var is_making_photo = false
var captured_image: Image var captured_image: Image
var _ui_is_visible = true
func _ready() -> void: func _ready() -> void:
GameState.on_enable_photo_mode_request.connect(enable_photo_mode) GameState.on_enable_photo_mode_request.connect(enable_photo_mode)
GameState.on_disable_photo_mode_request.connect(disable_photo_mode) GameState.on_disable_photo_mode_request.connect(disable_photo_mode)
GameState.on_photo_taken_making.connect(take_photo_async) GameState.on_photo_taken_making.connect(take_photo_async)
GameState.on_photo_mode_black_screen_disappeared.connect(_on_photo_mode_black_screen_disappeared) 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_pos = position
initial_local_basis = basis initial_local_basis = basis
@@ -131,6 +135,8 @@ func _input(event: InputEvent) -> void:
if event.is_action_pressed("toggle_photo_mode"): if event.is_action_pressed("toggle_photo_mode"):
if get_tree().paused: if get_tree().paused:
return return
if !_ui_is_visible:
return
if not is_active: if not is_active:
GameState.on_enable_photo_mode_request.emit() GameState.on_enable_photo_mode_request.emit()
else: else:
@@ -192,3 +198,6 @@ func take_photo_async() -> void:
func _on_photo_mode_black_screen_disappeared() -> void: func _on_photo_mode_black_screen_disappeared() -> void:
is_making_photo = false 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") @warning_ignore("unused_signal")
signal resume_game_requested signal resume_game_requested
@warning_ignore("unused_signal") @warning_ignore("unused_signal")
signal on_show_ui_requested
@warning_ignore("unused_signal")
signal on_hide_ui_requested signal on_hide_ui_requested
@warning_ignore("unused_signal") @warning_ignore("unused_signal")
signal change_camera_request(camera_index: int) signal change_camera_request(camera_index: int)