Skip to content

Commit d5fe2f9

Browse files
committed
Fix multiple styles missing sound
1 parent 2fe9d8e commit d5fe2f9

File tree

4 files changed

+7
-41
lines changed

4 files changed

+7
-41
lines changed

addons/dialogic/Modules/Choice/node_choice_button.gd

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ func _ready() -> void:
3333
add_to_group('dialogic_choice_button')
3434
shortcut_in_tooltip = false
3535
hide()
36-
37-
# For players who use a mouse to make choices, mouse hover should grab focus.
38-
# Otherwise the auto-focused button will always show a highlighted color when
39-
# the mouse cursor is hovering on another button.
40-
if not mouse_entered.is_connected(grab_focus):
41-
mouse_entered.connect(grab_focus)
42-
if not focus_entered.is_connected(_on_choice_button_focus_entred):
43-
focus_entered.connect(_on_choice_button_focus_entred.bind(self))
4436

4537

4638
## Custom choice buttons can override this for specialized behavior when the choice button is pressed.
@@ -73,36 +65,3 @@ func set_choice_text(new_text: String) -> void:
7365
text_node.text = new_text
7466
else:
7567
text = new_text
76-
77-
78-
## For players who use many devices (mouse/keyboard/gamepad, etc) at the same time to make choices,
79-
## a grabing-focus triggered by keyboard/gamepad should also change the mouse cursor's
80-
## position otherwise two buttons will have highlighted color(one highlighted button
81-
## triggered by mouse hover and another highlighted button triggered by other devices' choice).
82-
## So this function do such thing: make sure the mouse cursor does not hover on an unfocused button.
83-
func _on_choice_button_focus_entred(focused_button: Button):
84-
var global_mouse_pos = get_global_mouse_position()
85-
var focused_button_rect = focused_button.get_global_rect()
86-
if focused_button_rect.has_point(global_mouse_pos):
87-
return
88-
# Only change mouse curor position when an unfocused button' rect has the cursor.
89-
for node in get_tree().get_nodes_in_group('dialogic_choice_button'):
90-
if node is Button:
91-
if node != focused_button and node.get_global_rect().has_point(global_mouse_pos):
92-
# We prefer to change only mouse_position.y or mouse_position.x to warp the
93-
# mouse to the focused button's rect to achieve the best visual effect.
94-
var modify_y_pos = Vector2(global_mouse_pos.x, focused_button.get_global_rect().get_center().y)
95-
if focused_button_rect.has_point(modify_y_pos):
96-
get_viewport().warp_mouse(modify_y_pos)
97-
return
98-
99-
var modify_x_pos = Vector2(focused_button.get_global_rect().get_center().x, global_mouse_pos.y)
100-
if focused_button_rect.has_point(modify_x_pos):
101-
get_viewport().warp_mouse(modify_x_pos)
102-
return
103-
104-
# Maybe the buttons are not aligned as vertically or horizontlly.
105-
# Or perhaps the length difference between the two buttons is quite large.
106-
# So we just make the cursor hover on the center of the focused button.
107-
get_viewport().warp_mouse(focused_button.get_global_rect().get_center())
108-
return

addons/dialogic/Modules/Text/node_type_sound.gd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ func _ready() -> void:
4242
get_parent().continued_revealing_text.connect(_on_continued_revealing_text)
4343
get_parent().finished_revealing_text.connect(_on_finished_revealing_text)
4444

45+
if DialogicUtil.autoload():
46+
var current_speaker = DialogicUtil.autoload().Text.get_current_speaker()
47+
if current_speaker:
48+
load_overwrite(current_speaker.custom_info.get('sound_moods', {}).get(current_speaker.current_mood, {}))
4549

4650
func _on_started_revealing_text() -> void:
4751
if !enabled or (get_parent() is DialogicNode_DialogText and !get_parent().enabled):

addons/dialogic/Modules/Text/subsystem_text.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,14 @@ func update_name_label(character:DialogicCharacter):
218218

219219

220220
func update_typing_sound_mood_from_character(character:DialogicCharacter, mood:String) -> void:
221+
character.current_mood = mood
221222
if character.custom_info.get("sound_moods", {}).is_empty():
222223
update_typing_sound_mood()
223224
elif mood in character.custom_info.get("sound_moods", {}):
224225
update_typing_sound_mood(character.custom_info.get("sound_moods", {})[mood])
225226
else:
226227
var default_mood : String = character.custom_info.get("sound_mood_default", "")
228+
character.current_mood = default_mood
227229
update_typing_sound_mood(character.custom_info.get("sound_moods", {}).get(default_mood, {}))
228230

229231

addons/dialogic/Resources/character.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ enum TranslatedProperties {
2929

3030
var _translation_id := ""
3131

32+
var current_mood := ""
3233

3334
func _get_extension() -> String:
3435
return "dch"

0 commit comments

Comments
 (0)