@@ -18,6 +18,7 @@ var current_theme: ConfigFile
1818var current_timeline : String = ''
1919var current_event : Dictionary
2020
21+ var button_container = null
2122var current_background = ""
2223var do_fade_in := true
2324
@@ -522,10 +523,10 @@ func _insert_glossary_definitions(text: String):
522523
523524func _process (delta ):
524525 $ TextBubble/NextIndicatorContainer/NextIndicator .visible = finished
525- if $ Options/ButtonContainer .get_child_count () > 0 :
526+ if button_container .get_child_count () > 0 :
526527 $ TextBubble/NextIndicatorContainer/NextIndicator .visible = false # Hide if question
527528 if waiting_for_answer and Input .is_action_just_released (input_next ):
528- $ Options/ButtonContainer .get_child (0 ).grab_focus ()
529+ button_container .get_child (0 ).grab_focus ()
529530
530531 # Hide if no input is required
531532 if current_event .has ('text' ):
@@ -589,7 +590,7 @@ func _on_text_completed():
589590
590591 var waiting_until_options_enabled = float (settings .get_value ('input' , 'delay_after_options' , 0.1 ))
591592 $ OptionsDelayedInput .start (waiting_until_options_enabled )
592-
593+
593594 if current_event .has ('options' ):
594595 for o in current_event ['options' ]:
595596 add_choice_button (o )
@@ -900,11 +901,6 @@ func event_handler(event: Dictionary):
900901 _load_next_event ()
901902 # Set Theme event
902903 'dialogic_024' :
903- # TODO:
904- $ DialogicTimer .start (0.1 ); yield ($ DialogicTimer , "timeout" )
905- # This yield fix is a hack. I should investigate why the change theme fails when you
906- # don't have this wait statement.
907-
908904 emit_signal ("event_start" , "set_theme" , event )
909905 if event ['set_theme' ] != '' :
910906 current_theme = load_theme (event ['set_theme' ])
@@ -1014,7 +1010,7 @@ func event_handler(event: Dictionary):
10141010
10151011func reset_options ():
10161012 # Clearing out the options after one was selected.
1017- for option in $ Options/ButtonContainer .get_children ():
1013+ for option in button_container .get_children ():
10181014 option .queue_free ()
10191015
10201016
@@ -1063,7 +1059,7 @@ func get_classic_choice_button(label: String):
10631059 button .rect_min_size = size
10641060 button .rect_size = size
10651061
1066- $ Options/ButtonContainer .set ('custom_constants/separation' , theme .get_value ('buttons' , 'gap' , 20 ))
1062+ button_container .set ('custom_constants/separation' , theme .get_value ('buttons' , 'gap' , 20 ))
10671063
10681064 # Different styles
10691065 var default_background = 'res://addons/dialogic/Example Assets/backgrounds/background-2.png'
@@ -1140,11 +1136,11 @@ func add_choice_button(option: Dictionary):
11401136 button = get_classic_choice_button (option ['label' ])
11411137
11421138 if use_native_choice_button () or use_custom_choice_button ():
1143- $ Options/ButtonContainer .set ('custom_constants/separation' , current_theme .get_value ('buttons' , 'gap' , 20 ))
1144- $ Options/ButtonContainer .add_child (button )
1139+ button_container .set ('custom_constants/separation' , current_theme .get_value ('buttons' , 'gap' , 20 ))
1140+ button_container .add_child (button )
11451141
11461142 # Selecting the first button added
1147- if $ Options/ButtonContainer .get_child_count () == 1 :
1143+ if button_container .get_child_count () == 1 :
11481144 button .grab_focus ()
11491145
11501146 # Adding audio when focused or hovered
@@ -1251,24 +1247,25 @@ func load_theme(filename):
12511247 if theme_input != '[Default]' :
12521248 input_next = theme_input
12531249
1254-
1250+
12551251 $ TextBubble .load_theme (theme )
12561252
12571253 $ DefinitionInfo .load_theme (theme )
12581254
1259- var button_container
1255+
12601256 if theme .get_value ('buttons' , 'layout' , 0 ) == 0 :
12611257 button_container = VBoxContainer .new ()
12621258 else :
12631259 button_container = HBoxContainer .new ()
12641260 button_container .name = 'ButtonContainer'
12651261 button_container .alignment = 1
1262+
12661263 for n in $ Options .get_children ():
1267- n .free ()
1264+ n .queue_free ()
12681265 $ Options .add_child (button_container )
1269-
1266+
12701267 load_audio (theme )
1271-
1268+
12721269 return theme
12731270
12741271
@@ -1412,7 +1409,7 @@ func _on_close_dialog_timeout():
14121409
14131410
14141411func _on_OptionsDelayedInput_timeout ():
1415- for button in $ Options/ButtonContainer .get_children ():
1412+ for button in button_container .get_children ():
14161413 if button .is_connected ("pressed" , self , "answer_question" ) == false :
14171414 button .connect ("pressed" , self , "answer_question" , [button , button .get_meta ('event_idx' ), button .get_meta ('question_idx' )])
14181415
0 commit comments