From 39d274c838acf58125aecf11306be2e68e3a9236 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Thu, 26 Mar 2026 08:01:15 +0000 Subject: [PATCH] Move dialogue mouse-cursor handling to MouseManager In commit b86ea32df3ff7638049ccf3ac6af7d55392f7f19, logic was added to the dialogue balloon script to change the mouse cursor to a pointer when dialogue is shown, and back to the reticule/cross when it finishes. Move this logic to MouseManager, so that the code that adjusts the mouse cursor is all in one place. This also brings balloon.gd closer to the example script of which it is a copy, which helps when comparing to newer versions of the example balloon to bring more functionality forwards. --- scenes/globals/mouse_manager/mouse_manager.gd | 11 +++++++++++ scenes/ui_elements/dialogue/components/balloon.gd | 6 ------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/scenes/globals/mouse_manager/mouse_manager.gd b/scenes/globals/mouse_manager/mouse_manager.gd index 3b5f98ea81..9fa46ff32a 100644 --- a/scenes/globals/mouse_manager/mouse_manager.gd +++ b/scenes/globals/mouse_manager/mouse_manager.gd @@ -13,6 +13,9 @@ func _ready() -> void: Input.set_custom_mouse_cursor(MOUSE_CURSOR_CROSS, Input.CURSOR_CROSS, Vector2(32, 32)) Input.set_default_cursor_shape(Input.CURSOR_CROSS) + DialogueManager.dialogue_started.connect(_on_dialogue_started) + DialogueManager.dialogue_ended.connect(_on_dialogue_ended) + func _input(event: InputEvent) -> void: if event is InputEventMouseMotion: @@ -22,3 +25,11 @@ func _input(event: InputEvent) -> void: func _on_hide_timer_timeout() -> void: Input.mouse_mode = Input.MOUSE_MODE_HIDDEN + + +func _on_dialogue_started(_resource: DialogueResource) -> void: + Input.set_default_cursor_shape(Input.CURSOR_ARROW) + + +func _on_dialogue_ended(_resource: DialogueResource) -> void: + Input.set_default_cursor_shape(Input.CURSOR_CROSS) diff --git a/scenes/ui_elements/dialogue/components/balloon.gd b/scenes/ui_elements/dialogue/components/balloon.gd index f7adc3e994..a495a1c67f 100644 --- a/scenes/ui_elements/dialogue/components/balloon.gd +++ b/scenes/ui_elements/dialogue/components/balloon.gd @@ -74,7 +74,6 @@ var _player_name: String = "" func _ready() -> void: balloon.hide() Engine.get_singleton("DialogueManager").mutated.connect(_on_mutated) - Engine.get_singleton("DialogueManager").dialogue_ended.connect(_on_dialogue_ended) # If the responses menu doesn't have a next action set, use this one if responses_menu.next_action.is_empty(): @@ -113,7 +112,6 @@ func start( resource = dialogue_resource self.dialogue_line = await resource.get_next_dialogue_line(title, temporary_game_states) talk_sound_player.play() - Input.set_default_cursor_shape(Input.CURSOR_ARROW) ## Apply any changes to the balloon given a new [DialogueLine]. @@ -190,10 +188,6 @@ func _on_mutated(_mutation: Dictionary) -> void: mutation_cooldown.start(0.1) -func _on_dialogue_ended(_resource: DialogueResource) -> void: - Input.set_default_cursor_shape(Input.CURSOR_CROSS) - - func _on_balloon_gui_input(event: InputEvent) -> void: # See if we need to skip typing of the dialogue if dialogue_label.is_typing: