feat: I don't wanna live that way

This commit is contained in:
Rendo 2026-05-29 16:51:25 +05:00
commit da6e3386a8
13 changed files with 138 additions and 59 deletions

View file

@ -16,8 +16,22 @@ func get_buttons() -> Control:
vbox.add_child(position_slider)
var rotation_label: Label = Label.new()
rotation_label.text = "Поворот"
vbox.add_child(rotation_label)
var rotation_slider: HSlider = HSlider.new()
rotation_slider.min_value = 0
rotation_slider.max_value = 1
rotation_slider.step = 0.01
rotation_slider.set_value_no_signal(($"../RotationHelper".rotation.z + PI/2)/PI*4)
rotation_slider.value_changed.connect(on_angle_set)
vbox.add_child(rotation_slider)
return vbox
func on_value_set(value: float) -> void:
$"../Holder/Cylinder_001".position.y = lerp(5.491,10.491,value)
func on_angle_set(value: float) -> void:
$"../RotationHelper".rotation.z = lerp(-PI/2,-PI/4,value)

View file

@ -22,6 +22,7 @@ func snap_flask(flask: DraggableObject) -> void:
held_flask = flask
flask.drag_ended_on.disconnect(snap_flask)
flask.position = Vector3.ZERO
flask.rotation = Vector3.ZERO
flask.drag_ended_on.connect(unsnap_flask)
func unsnap_flask(flask: DraggableObject) -> void:

6
src/position_resetter.gd Normal file
View file

@ -0,0 +1,6 @@
extends Node
@onready var start_rotation = $"..".rotation
func _on_flask_drag_started() -> void:
$"..".rotation = start_rotation

View file

@ -0,0 +1 @@
uid://mqch4ruivbg8

View file

@ -18,9 +18,8 @@ func _on_tab_clicked(tab: int) -> void:
func _process(_delta: float) -> void:
var anwsered = LabRuntime.test_failed()
set_tab_disabled(0,anwsered)
set_tab_disabled(1,anwsered)
set_tab_disabled(2,anwsered)
set_tab_disabled(3,anwsered)
func _on_worktabs_close_requested() -> void:

View file

@ -1,29 +1,47 @@
extends Control
var current: int = -1
var anwsers: Array[int]
var correctness: Array[bool]
@export var submit_button: Button
func _ready() -> void:
shuffle_questions()
for i in range(5):
anwsers.append(-1)
correctness.append(false)
func shuffle_questions() -> void:
for child in get_children():
child.queue_free()
current = -1
var questions = LabRuntime.current_lab.tests.duplicate()
questions.shuffle()
questions.resize(5)
var index = 0
for question in questions:
var options = question.options.duplicate()
index += 1
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
var button_group = ButtonGroup.new()
for i in range(len(options)):
var button = Button.new()
var button = CheckBox.new()
button.button_group = button_group
button.text = options[i]
vbox.add_child(button)
button.pressed.connect(next)
button.pressed.connect(anwser.bind(i,question.options.find(options[i]) == question.correct_anwser))
button.pressed.connect(anwser.bind(index-1,i,question.options.find(options[i]) == question.correct_anwser))
if index == 5:
submit_button.reparent.call_deferred(vbox)
add_child(vbox)
vbox.name = str(index)
next()
func _on_close_button_pressed() -> void:
@ -39,6 +57,13 @@ func next() -> void:
$"../Result".visible = true
LabRuntime.tries += 1
func anwser(option_number: int,correctness: bool):
LabRuntime.anwsers.append(option_number)
LabRuntime.correctness.append(correctness)
func anwser(index: int,option_number: int,correctness_flag: bool):
anwsers[index] = option_number
correctness[index] = correctness_flag
func submit():
LabRuntime.anwsers = anwsers.duplicate()
LabRuntime.correctness = correctness.duplicate()
visible = false
$"../Result".visible = true
LabRuntime.tries += 1