questions define whether you can progress
This commit is contained in:
parent
5a21ef29dc
commit
095f3ad40d
2 changed files with 24 additions and 9 deletions
|
|
@ -6,6 +6,10 @@ const MENU_PREFAB: PackedScene = preload("uid://c2ciwyjf7au6l")
|
||||||
var current_lab: Labwork
|
var current_lab: Labwork
|
||||||
var anwsers: Array[int]
|
var anwsers: Array[int]
|
||||||
var correctness: Array[bool]
|
var correctness: Array[bool]
|
||||||
|
var tries: int
|
||||||
|
|
||||||
|
func questions_anwsered() -> bool:
|
||||||
|
return float(correctness.count(true))/len(correctness) >= 0.6
|
||||||
|
|
||||||
func save():
|
func save():
|
||||||
var path: String = OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP) + "/" + current_lab.lab_name + "-" + Time.get_datetime_string_from_system() + ".txt"
|
var path: String = OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP) + "/" + current_lab.lab_name + "-" + Time.get_datetime_string_from_system() + ".txt"
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,23 @@ func _ready() -> void:
|
||||||
$ConfirmationDialog.confirmed.connect(LabRuntime.end_lab)
|
$ConfirmationDialog.confirmed.connect(LabRuntime.end_lab)
|
||||||
|
|
||||||
func _on_tab_clicked(tab: int) -> void:
|
func _on_tab_clicked(tab: int) -> void:
|
||||||
match tab:
|
if tab == 1:
|
||||||
0:
|
$Questions.visible = true
|
||||||
$Worktabs.visible = true
|
elif LabRuntime.questions_anwsered():
|
||||||
1:
|
match tab:
|
||||||
$Questions.visible = true
|
0:
|
||||||
2:
|
$Worktabs.visible = true
|
||||||
$ConfirmationDialog.popup_centered()
|
2:
|
||||||
3:
|
$ConfirmationDialog.popup_centered()
|
||||||
GuiSignalBus.clear_table.emit()
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue