questions define whether you can progress

This commit is contained in:
rendo 2026-04-24 10:21:55 +05:00
commit 095f3ad40d
2 changed files with 24 additions and 9 deletions

View file

@ -6,6 +6,10 @@ const MENU_PREFAB: PackedScene = preload("uid://c2ciwyjf7au6l")
var current_lab: Labwork
var anwsers: Array[int]
var correctness: Array[bool]
var tries: int
func questions_anwsered() -> bool:
return float(correctness.count(true))/len(correctness) >= 0.6
func save():
var path: String = OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP) + "/" + current_lab.lab_name + "-" + Time.get_datetime_string_from_system() + ".txt"

View file

@ -5,12 +5,23 @@ func _ready() -> void:
$ConfirmationDialog.confirmed.connect(LabRuntime.end_lab)
func _on_tab_clicked(tab: int) -> void:
match tab:
0:
$Worktabs.visible = true
1:
$Questions.visible = true
2:
$ConfirmationDialog.popup_centered()
3:
GuiSignalBus.clear_table.emit()
if tab == 1:
$Questions.visible = true
elif LabRuntime.questions_anwsered():
match tab:
0:
$Worktabs.visible = true
2:
$ConfirmationDialog.popup_centered()
3:
GuiSignalBus.clear_table.emit()
func _process(_delta: float) -> void:
var anwsered = LabRuntime.questions_anwsered()
set_tab_disabled(0,anwsered)
set_tab_disabled(2,anwsered)
set_tab_disabled(3,anwsered)
func _on_worktabs_close_requested() -> void:
$Worktabs.visible = false