Lab data
This commit is contained in:
parent
a143c0291e
commit
e1e7c70147
39 changed files with 279 additions and 60 deletions
30
src/ui/questions_generator.gd
Normal file
30
src/ui/questions_generator.gd
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
extends Control
|
||||
|
||||
var current: int = -1
|
||||
|
||||
func _ready() -> void:
|
||||
for question in ReactionRegistry.current_lab.tests:
|
||||
var options = question.options.duplicate()
|
||||
options.shuffle()
|
||||
var vbox = VBoxContainer.new()
|
||||
var description = Label.new()
|
||||
description.text = question.question
|
||||
vbox.add_child(description)
|
||||
vbox.visible = false
|
||||
for option in options:
|
||||
var button = Button.new()
|
||||
button.text = option
|
||||
vbox.add_child(button)
|
||||
button.pressed.connect(next)
|
||||
add_child(vbox)
|
||||
next()
|
||||
|
||||
|
||||
func _on_close_button_pressed() -> void:
|
||||
get_parent().visible = false
|
||||
|
||||
func next() -> void:
|
||||
get_child(current).visible = false
|
||||
if current < get_child_count() - 1:
|
||||
current += 1
|
||||
get_child(current).visible = true
|
||||
Loading…
Add table
Add a link
Reference in a new issue