improve ui and bug fix

This commit is contained in:
2026-06-02 00:05:37 +02:00
parent 6c4f659fd0
commit 1037d1343d
13 changed files with 262 additions and 19 deletions

View File

@@ -21,9 +21,13 @@ var previous_camera: Camera3D
var initial_local_pos: Vector3
var initial_local_basis: Basis
var is_making_photo = false
var captured_image: Image
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)
initial_local_pos = position
initial_local_basis = basis
@@ -50,13 +54,23 @@ func _input(event: InputEvent) -> void:
if not is_active:
GameState.on_enable_photo_mode_request.emit()
else:
GameState.on_disable_photo_mode_request.emit()
if not is_making_photo:
GameState.on_disable_photo_mode_request.emit()
if event is InputEventMouseMotion and is_active:
total_yaw -= event.relative.x * rotation_speed
if event.is_action_pressed("take_photo"):
take_photo_async()
if !is_active or is_making_photo:
return
is_making_photo = true
GameState.on_photo_taken_prepare.emit()
await RenderingServer.frame_post_draw
captured_image = get_viewport().get_texture().get_image()
GameState.on_photo_taken_started.emit()
func _process(delta: float) -> void:
if not is_active:
@@ -81,13 +95,10 @@ func _process(delta: float) -> void:
basis = rotated_basis.orthonormalized()
func take_photo_async() -> void:
if !is_active:
return
var targets = get_tree().get_nodes_in_group("collectible")
var space_state = get_world_3d().direct_space_state
await CollectionManager.save_photo_to_disk_async()
await CollectionManager.save_photo_to_disk_async(captured_image)
for target in targets:
if not target.collectible_data:
@@ -104,3 +115,5 @@ func take_photo_async() -> void:
CollectionManager.unlock_collectible(target.collectible_data.id)
GameState.save_game()
GameState.on_photo_taken_finished.emit()
is_making_photo = false