diff --git a/assets/reactions/agcl_p_na2s.tres b/assets/reactions/agcl_p_na2s.tres index ea8efd4..20794bd 100644 --- a/assets/reactions/agcl_p_na2s.tres +++ b/assets/reactions/agcl_p_na2s.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" script_class="Reaction" load_steps=11 format=3 uid="uid://b84essimpfmee"] +[gd_resource type="Resource" script_class="Reaction" format=3 uid="uid://b84essimpfmee"] [ext_resource type="Script" uid="uid://bb8o8l6u6fiai" path="res://src/resources/reaction_substance.gd" id="1_rvq0y"] [ext_resource type="Script" uid="uid://dwks86y6383p4" path="res://src/resources/reaction.gd" id="2_oqih4"] diff --git a/assets/reagents/HCl.tres b/assets/reagents/HCl.tres index af6703e..c8ae847 100644 --- a/assets/reagents/HCl.tres +++ b/assets/reagents/HCl.tres @@ -1,6 +1,7 @@ -[gd_resource type="Resource" script_class="Reagent" load_steps=3 format=3 uid="uid://cxpovcqviqurr"] +[gd_resource type="Resource" script_class="Reagent" format=3 uid="uid://cxpovcqviqurr"] [ext_resource type="Script" uid="uid://bditqax8ibmxw" path="res://src/resources/reagent.gd" id="1_5si53"] +[ext_resource type="PackedScene" uid="uid://cw6v8kbi76qak" path="res://scenes/substance_jar.tscn" id="2_dby88"] [ext_resource type="Resource" uid="uid://bj3cdfwvgksee" path="res://assets/substances/HCl.tres" id="2_no7s4"] [resource] diff --git a/assets/textures/bubble.png b/assets/textures/bubble.png new file mode 100644 index 0000000..b26fda2 Binary files /dev/null and b/assets/textures/bubble.png differ diff --git a/assets/textures/bubble.png.import b/assets/textures/bubble.png.import new file mode 100644 index 0000000..07769dc --- /dev/null +++ b/assets/textures/bubble.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bkuxwtxum1r4x" +path="res://.godot/imported/bubble.png-a4e9df5e78917cd4475ee7b84b1534f0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/bubble.png" +dest_files=["res://.godot/imported/bubble.png-a4e9df5e78917cd4475ee7b84b1534f0.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/export_presets.cfg b/export_presets.cfg index dfee77a..e8b2929 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -3,7 +3,6 @@ name="Windows Desktop" platform="Windows Desktop" runnable=true -advanced_options=false dedicated_server=false custom_features="" export_filter="all_resources" @@ -11,6 +10,11 @@ include_filter="" exclude_filter="" export_path="exports/lab-electrolyte.exe" patches=PackedStringArray() +patch_delta_encoding=false +patch_delta_compression_level_zstd=19 +patch_delta_min_reduction=0.1 +patch_delta_include_filters="*" +patch_delta_exclude_filters="" encryption_include_filters="" encryption_exclude_filters="" seed=0 @@ -65,3 +69,50 @@ Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorActi ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue Remove-Item -Recurse -Force '{temp_dir}'" + +[preset.1] + +name="Linux" +platform="Linux" +runnable=true +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="" +patches=PackedStringArray() +patch_delta_encoding=false +patch_delta_compression_level_zstd=19 +patch_delta_min_reduction=0.1 +patch_delta_include_filters="*" +patch_delta_exclude_filters="" +encryption_include_filters="" +encryption_exclude_filters="" +seed=0 +encrypt_pck=false +encrypt_directory=false +script_export_mode=2 + +[preset.1.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=false +texture_format/s3tc_bptc=true +texture_format/etc2_astc=false +shader_baker/enabled=false +binary_format/architecture="x86_64" +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="#!/usr/bin/env bash +export DISPLAY=:0 +unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\" +\"{temp_dir}/{exe_name}\" {cmd_args}" +ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash +pkill -x -f \"{temp_dir}/{exe_name} {cmd_args}\" +rm -rf \"{temp_dir}\"" diff --git a/labs/lab-8-electrolyte.tres b/labs/lab-8-electrolyte.tres index 5c42382..a410604 100644 --- a/labs/lab-8-electrolyte.tres +++ b/labs/lab-8-electrolyte.tres @@ -18,7 +18,7 @@ [ext_resource type="Resource" uid="uid://drcsxqrfgtklt" path="res://assets/reagents/CuSO4.tres" id="7_x21in"] [ext_resource type="Resource" uid="uid://pofsgpx0irdn" path="res://assets/reagents/FeSO4.tres" id="8_54yhc"] [ext_resource type="Resource" uid="uid://dy6b5n8gadtf0" path="res://labs/lab-electrolyte/experiment-7.tres" id="8_cpwlt"] -[ext_resource type="Resource" path="res://assets/reagents/H2O.tres" id="9_0vi5e"] +[ext_resource type="Resource" uid="uid://bbbrxgvfp4jvg" path="res://assets/reagents/H2O.tres" id="9_0vi5e"] [ext_resource type="Resource" uid="uid://cxpovcqviqurr" path="res://assets/reagents/HCl.tres" id="10_nk7ls"] [ext_resource type="Resource" uid="uid://ic4x25e5j8o" path="res://assets/reagents/KCl.tres" id="11_gdam5"] [ext_resource type="Resource" uid="uid://gn654lim8gy6" path="res://assets/reagents/KI.tres" id="12_187c3"] @@ -40,6 +40,11 @@ [ext_resource type="Resource" uid="uid://ignwsng3bt4e" path="res://labs/lab-electrolyte/test-3.tres" id="32_anse4"] [ext_resource type="Resource" uid="uid://ber4xlsqegke0" path="res://labs/lab-electrolyte/test-4.tres" id="33_vgv2h"] [ext_resource type="Resource" uid="uid://d13fl2bs8o6oa" path="res://labs/lab-electrolyte/test-5.tres" id="34_eolar"] +[ext_resource type="Resource" uid="uid://q37mwgdlirfb" path="res://labs/lab-electrolyte/test-6.tres" id="35_t3lvx"] +[ext_resource type="Resource" uid="uid://bpdrfoq88tteh" path="res://labs/lab-electrolyte/test-7.tres" id="36_axgl6"] +[ext_resource type="Resource" uid="uid://jdv2rvp868p4" path="res://labs/lab-electrolyte/test-8.tres" id="37_t1gxe"] +[ext_resource type="Resource" uid="uid://dh7itd4q5xh7p" path="res://labs/lab-electrolyte/test-9.tres" id="38_gcv8s"] +[ext_resource type="Resource" uid="uid://clhgdwkshm3b0" path="res://labs/lab-electrolyte/test-10.tres" id="39_jof8k"] [resource] script = ExtResource("3_pogou") @@ -47,6 +52,6 @@ lab_name = "Лабораторная работа №8 - Растворы эле tasks = "Ознакомиться с методами получения слабых кислот и оснований. Изучить влияние введения одноименного иона на смещение равновесия диссоциации слабого электролита. Ознакомиться с различными типами реакций обмена в водных растворах электролитов." equipment = "Пробирки. Кислоты, основания, соли, индикаторы." experiments = Array[ExtResource("1_28qla")]([ExtResource("2_nk7ls"), ExtResource("3_gdam5"), ExtResource("4_187c3"), ExtResource("5_ujot4"), ExtResource("6_w3d37"), ExtResource("7_je2gp"), ExtResource("8_cpwlt")]) -tests = Array[ExtResource("4_6s74a")]([ExtResource("30_je2gp"), ExtResource("31_cpwlt"), ExtResource("32_anse4"), ExtResource("33_vgv2h"), ExtResource("34_eolar")]) +tests = Array[ExtResource("4_6s74a")]([ExtResource("30_je2gp"), ExtResource("31_cpwlt"), ExtResource("32_anse4"), ExtResource("33_vgv2h"), ExtResource("34_eolar"), ExtResource("30_je2gp"), ExtResource("31_cpwlt"), ExtResource("32_anse4"), ExtResource("33_vgv2h"), ExtResource("34_eolar"), ExtResource("35_t3lvx"), ExtResource("36_axgl6"), ExtResource("37_t1gxe"), ExtResource("38_gcv8s"), ExtResource("39_jof8k")]) reagents = Array[ExtResource("2_mabxg")]([ExtResource("3_nu2d0"), ExtResource("4_83o17"), ExtResource("5_4xn0j"), ExtResource("6_fg475"), ExtResource("7_x21in"), ExtResource("8_54yhc"), ExtResource("9_0vi5e"), ExtResource("10_nk7ls"), ExtResource("11_gdam5"), ExtResource("12_187c3"), ExtResource("13_ujot4"), ExtResource("14_w3d37"), ExtResource("15_je2gp"), ExtResource("16_cpwlt"), ExtResource("17_anse4"), ExtResource("18_vgv2h"), ExtResource("19_eolar"), ExtResource("20_eh3kp")]) tools = Array[ExtResource("5_v8c5p")]([ExtResource("24_530yt"), ExtResource("25_nk60r"), ExtResource("26_lp3qm"), ExtResource("27_ytmy7"), ExtResource("28_fsm27")]) diff --git a/labs/lab-electrolyte/test-1.tres b/labs/lab-electrolyte/test-1.tres index bd21497..577a8da 100644 --- a/labs/lab-electrolyte/test-1.tres +++ b/labs/lab-electrolyte/test-1.tres @@ -4,6 +4,6 @@ [resource] script = ExtResource("1_mujbh") -question = "Что такое сильные и слабые электролиты?" -options = Array[String](["Сильные электролиты полностью диссоциируют на ионы в растворе, слабые — частично.", "Сильные электролиты не растворяются в воде, слабые — растворяются хорошо.", "Сильные электролиты проводят ток только в твёрдом состоянии, слабые — в растворе.", "Сильные электролиты образуют осадок, слабые — газ."]) +question = "Сильными электролитами в водных растворах являются все вещества группы…" +options = Array[String](["KOH, HNO3, H2SO4;", "H2S, H2SO3, H2SO4;", "MgCl2, CH3COOH, NaOH;", "H2S, CH3COOH, H2SO3"]) metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/labs/lab-electrolyte/test-10.tres b/labs/lab-electrolyte/test-10.tres new file mode 100644 index 0000000..ffe2516 --- /dev/null +++ b/labs/lab-electrolyte/test-10.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="LabTest" format=3 uid="uid://clhgdwkshm3b0"] + +[ext_resource type="Script" uid="uid://dpacehourck22" path="res://src/resources/lab/test.gd" id="1_evbhk"] + +[resource] +script = ExtResource("1_evbhk") +question = "Уравнению химической реакции:CuCl2 + 2NaOH ↔ Cu(OH)2 + 2NaCl соответствует сокращенное ионно-молекулярное уравнение:" +options = Array[String](["Cu 2+ + 2OH– ↔ Cu(OH)2↓;", "Cu 2+ + NaOH ↔ Cu(OH)2↓ + Na+;", "2Сl + 2Na+ ↔ 2NaCl;", "CuCl2 + 2ОН– ↔ Сu2+ + 2ОН– + 2Сl– "]) +metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/labs/lab-electrolyte/test-2.tres b/labs/lab-electrolyte/test-2.tres index 59212a7..44d0c8d 100644 --- a/labs/lab-electrolyte/test-2.tres +++ b/labs/lab-electrolyte/test-2.tres @@ -4,6 +4,6 @@ [resource] script = ExtResource("1_tocw5") -question = "Какая величина характеризует силу электролита?" -options = Array[String](["Степень электролитической диссоциации.", "Массовая доля вещества в растворе.", "Молярная масса вещества.", "Плотность раствора."]) +question = "Какая из приведенных реакций является обратимой:" +options = Array[String](["NH4OH + HNO3 = NH4NO3 + Н2O;", "FeCl3 + 3NaOH = Fe(OH)3 + 3NaCl;", "Na2S + HC1 = H2S + 2NaCl;", "НNО3 + КОН = КNО3 + Н2O"]) metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/labs/lab-electrolyte/test-3.tres b/labs/lab-electrolyte/test-3.tres index 1ad5036..76b2f8a 100644 --- a/labs/lab-electrolyte/test-3.tres +++ b/labs/lab-electrolyte/test-3.tres @@ -4,6 +4,7 @@ [resource] script = ExtResource("1_o8p71") -question = "Что такое произведение растворимости?" -options = Array[String](["Произведение концентраций ионов малорастворимого электролита в насыщенном растворе, возведённых в степени их коэффициентов.", "Произведение массы растворённого вещества на объём раствора.", "Отношение растворимости вещества к температуре.", "Сумма концентраций всех ионов в растворе."]) +question = "Среди веществ: H2CO3, ZnSO4, KOH, HCl, HNO2, NH4Cl число сильных электролитов равно… " +options = Array[String](["1", "2", "3", "4"]) +correct_anwser = 3 metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/labs/lab-electrolyte/test-4.tres b/labs/lab-electrolyte/test-4.tres index 5421618..c461f64 100644 --- a/labs/lab-electrolyte/test-4.tres +++ b/labs/lab-electrolyte/test-4.tres @@ -4,6 +4,7 @@ [resource] script = ExtResource("1_5d6hp") -question = "Что такое водородный показатель?" -options = Array[String](["Отрицательный десятичный логарифм концентрации ионов водорода в растворе.", "Концентрация молекул воды в растворе.", "Количество гидроксид-ионов в щелочи.", "Массовая доля кислоты в растворе."]) +question = "Выберите уравнение реакции электролитической диссоциации H3ASO4 по первой ступени:" +options = Array[String](["(HAsО4)2– ↔ H+ + (AsО4)3–;", "H3ASO4 ↔ Н+ + (H2ASO4)–;", "(H2AsО4) ↔ Н+ + (HAsО4)2–;", "(HAsО4) ↔ Н + (ASO4) "]) +correct_anwser = 1 metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/labs/lab-electrolyte/test-5.tres b/labs/lab-electrolyte/test-5.tres index c3807ea..1a2113d 100644 --- a/labs/lab-electrolyte/test-5.tres +++ b/labs/lab-electrolyte/test-5.tres @@ -4,6 +4,7 @@ [resource] script = ExtResource("1_3bllg") -question = "Какие реакции обмена в растворах электролитов относятся к братимым и необратимым реакциям?" -options = Array[String](["Обратимые — протекают не до конца и устанавливают равновесие; необратимые — идут до конца с образованием осадка, газа или слабого электролита.", "Обратимые — идут только при нагревании, необратимые — только при охлаждении.", "Обратимые — протекают без изменения цвета, необратимые — с изменением цвета.", "Обратимые — идут только в щелочной среде, необратимые — только в кислой среде."]) +question = "Количество ступеней диссоциации азотной кислоты (НNO3) равно:" +options = Array[String](["две;", "три;", "четыре;", "одна"]) +correct_anwser = 3 metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/labs/lab-electrolyte/test-6.tres b/labs/lab-electrolyte/test-6.tres new file mode 100644 index 0000000..afbb952 --- /dev/null +++ b/labs/lab-electrolyte/test-6.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="LabTest" format=3 uid="uid://q37mwgdlirfb"] + +[ext_resource type="Script" uid="uid://dpacehourck22" path="res://src/resources/lab/test.gd" id="1_31rvo"] + +[resource] +script = ExtResource("1_31rvo") +question = "Схема реакции, соответствующая сокращенному молекулярно-ионному уравнению 2H+ + CO32− = H2O +CO2↑, имеет вид…" +options = Array[String](["NaHCO3 +H2SO4 →", "Na2CO3 +H2SO4 →", "CH3COOH + Na2CO3 →", "Na2CO3 +H2SiO3 →"]) +metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/labs/lab-electrolyte/test-7.tres b/labs/lab-electrolyte/test-7.tres new file mode 100644 index 0000000..846ecc0 --- /dev/null +++ b/labs/lab-electrolyte/test-7.tres @@ -0,0 +1,10 @@ +[gd_resource type="Resource" script_class="LabTest" format=3 uid="uid://bpdrfoq88tteh"] + +[ext_resource type="Script" uid="uid://dpacehourck22" path="res://src/resources/lab/test.gd" id="1_vpmu4"] + +[resource] +script = ExtResource("1_vpmu4") +question = "Молекулярное уравнение соответствует ионному: HS– + ОН– = S2– + Н2О" +options = Array[String](["3S + КОН = 2K2S +K2SO4 + 3H2О;", "H2S + 2NaOH = Na2S + Н2О;", "NaHS + NaOH = Na2S + H2О;", "NaOH + H2S = NaНS + Н2О"]) +correct_anwser = 2 +metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/labs/lab-electrolyte/test-8.tres b/labs/lab-electrolyte/test-8.tres new file mode 100644 index 0000000..df01f27 --- /dev/null +++ b/labs/lab-electrolyte/test-8.tres @@ -0,0 +1,10 @@ +[gd_resource type="Resource" script_class="LabTest" format=3 uid="uid://jdv2rvp868p4"] + +[ext_resource type="Script" uid="uid://dpacehourck22" path="res://src/resources/lab/test.gd" id="1_d8xn1"] + +[resource] +script = ExtResource("1_d8xn1") +question = "К сильным основаниям относится…" +options = Array[String](["NH4OH;", "NaOH;", "Cu(OH)2;", "Fe(OH)2"]) +correct_anwser = 1 +metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/labs/lab-electrolyte/test-9.tres b/labs/lab-electrolyte/test-9.tres new file mode 100644 index 0000000..a4e8015 --- /dev/null +++ b/labs/lab-electrolyte/test-9.tres @@ -0,0 +1,10 @@ +[gd_resource type="Resource" script_class="LabTest" format=3 uid="uid://dh7itd4q5xh7p"] + +[ext_resource type="Script" uid="uid://dpacehourck22" path="res://src/resources/lab/test.gd" id="1_1iwn6"] + +[resource] +script = ExtResource("1_1iwn6") +question = "Укажите, какая из нижеприведенных реакций является необратимой:" +options = Array[String](["NH4OH+HCl =NH4Cl+H2O;", "NaOH + HNO3 = NaNO3 +H2O;", "[CuOH]2SO4 + H2SO4 = 2 CuSO4 +2H2O;", "NH4OH + HNO3 = NH4NO3+H2O"]) +correct_anwser = 1 +metadata/_custom_type_script = "uid://dpacehourck22" diff --git a/note b/note new file mode 100644 index 0000000..cc1efd1 --- /dev/null +++ b/note @@ -0,0 +1,4 @@ +Каждый опыт должен быть изолирован, иметь свой логгер, свою рабочую зону +Добавить зону для текста с (возможно) зоной/кнопками для формул +Тесты должны быть вначале и пропускать студента + diff --git a/project.godot b/project.godot index e7c25d1..a030462 100644 --- a/project.godot +++ b/project.godot @@ -24,6 +24,7 @@ config/icon="res://icon.svg" GuiSignalBus="*res://src/gui_signal_bus.gd" ReactionRegistry="*res://src/reaction_registry.gd" LabRuntime="*uid://b00hrs2a68cpp" +Tooltip="*uid://dtpy85f2ycbur" [global_group] diff --git a/scenes/flask.tscn b/scenes/flask.tscn index a5d0a5d..441b56e 100644 --- a/scenes/flask.tscn +++ b/scenes/flask.tscn @@ -3,6 +3,7 @@ [ext_resource type="Script" uid="uid://bjnv2g1ni0525" path="res://src/drag/draggable_object.gd" id="1_0xufn"] [ext_resource type="Material" uid="uid://64m17act0kwu" path="res://assets/materials/mat_glass.tres" id="2_dbm1u"] [ext_resource type="Script" uid="uid://dig825r70a0sn" path="res://src/substance_display.gd" id="3_0xufn"] +[ext_resource type="Shader" uid="uid://djb4t6pw03tow" path="res://shaders/fluid.gdshader" id="4_ailwx"] [ext_resource type="Script" uid="uid://bl0ojhc0thk1p" path="res://src/interactible/interactible.gd" id="4_dbm1u"] [ext_resource type="Texture2D" uid="uid://cw3jw8qbvj3fv" path="res://assets/textures/solid.png" id="4_h7awq"] [ext_resource type="Script" uid="uid://duirfi4j26g2i" path="res://src/interactible/flask_interaction.gd" id="5_pmegg"] @@ -46,9 +47,13 @@ _surfaces = [{ blend_shape_mode = 0 shadow_mesh = SubResource("ArrayMesh_1ouf4") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ailwx"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ailwx"] resource_local_to_scene = true -transparency = 1 +render_priority = 0 +shader = ExtResource("4_ailwx") +shader_parameter/albedo_color = Color(0, 0, 0, 1) +shader_parameter/fill = 0.8999999798832 +shader_parameter/wave_intensity = 0.0 [sub_resource type="CylinderMesh" id="CylinderMesh_h7awq"] top_radius = 0.772 @@ -85,8 +90,7 @@ skeleton = NodePath("") [node name="FillLiquid" type="MeshInstance3D" parent="Flash" unique_id=439339804] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.8061247, 0) -visible = false -material_override = SubResource("StandardMaterial3D_ailwx") +material_override = SubResource("ShaderMaterial_ailwx") mesh = SubResource("CylinderMesh_h7awq") skeleton = NodePath("") script = ExtResource("3_0xufn") diff --git a/scenes/questions.tscn b/scenes/questions.tscn index 1898fb1..ac2a480 100644 --- a/scenes/questions.tscn +++ b/scenes/questions.tscn @@ -1,6 +1,7 @@ [gd_scene format=3 uid="uid://be746nxgkc5ay"] [ext_resource type="Script" uid="uid://bosx1bhaka185" path="res://src/ui/questions_generator.gd" id="1_rdw2t"] +[ext_resource type="Script" uid="uid://ckhrj43lyvorv" path="res://ui/questions_result.gd" id="2_8omho"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_faf07"] content_margin_left = 0.0 @@ -39,4 +40,44 @@ offset_right = 40.0 offset_bottom = 40.0 script = ExtResource("1_rdw2t") +[node name="Result" type="Control" parent="." unique_id=717890506] +visible = false +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("2_8omho") + +[node name="Label" type="Label" parent="Result" unique_id=979512538] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -11.5 +offset_right = 20.0 +offset_bottom = 11.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="TryAgain" type="Button" parent="Result" unique_id=472218266] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -73.0 +offset_top = -31.0 +offset_right = 73.0 +grow_horizontal = 2 +grow_vertical = 0 +text = "Перепройти тест" + [connection signal="pressed" from="CloseButton" to="Questions" method="_on_close_button_pressed"] +[connection signal="pressed" from="Result/TryAgain" to="Result" method="_on_try_again_pressed"] diff --git a/scenes/spoon.tscn b/scenes/spoon.tscn index e388eef..4364eaf 100644 --- a/scenes/spoon.tscn +++ b/scenes/spoon.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=3 uid="uid://emm545mj0kba"] +[gd_scene format=3 uid="uid://emm545mj0kba"] [ext_resource type="ArrayMesh" uid="uid://cdvben7q8oxgf" path="res://assets/meshes/spoon.res" id="1_l12hh"] [ext_resource type="Script" uid="uid://bjnv2g1ni0525" path="res://src/drag/draggable_object.gd" id="1_r8mox"] @@ -14,17 +14,17 @@ albedo_texture = ExtResource("3_ckduo") [sub_resource type="BoxShape3D" id="BoxShape3D_r8mox"] size = Vector3(0.26538086, 0.1484375, 1.6950684) -[node name="Spoon" type="Area3D" node_paths=PackedStringArray("interactible")] +[node name="Spoon" type="Area3D" unique_id=926622416 node_paths=PackedStringArray("interactible")] collision_layer = 6 script = ExtResource("1_r8mox") interactible = NodePath("Interactible") mask = PackedStringArray("flask", "solid_source") -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=608330635] transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0.07224345, 0) mesh = ExtResource("1_l12hh") -[node name="SpoonFill" type="MeshInstance3D" parent="."] +[node name="SpoonFill" type="MeshInstance3D" parent="." unique_id=209337706] transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0.07224345, -0.66295564) visible = false material_override = SubResource("StandardMaterial3D_1r65c") @@ -32,11 +32,11 @@ mesh = ExtResource("4_5mau7") script = ExtResource("5_33jiv") display_type = 1 -[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=537844857] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.07224345, 0) shape = SubResource("BoxShape3D_r8mox") -[node name="Interactible" type="ConfirmationDialog" parent="."] +[node name="Interactible" type="ConfirmationDialog" parent="." unique_id=706618502] title = "" ok_button_text = "Подтвердить" cancel_button_text = "Отменить" @@ -44,7 +44,7 @@ script = ExtResource("3_r8ydw") instant = true metadata/_custom_type_script = "uid://bl0ojhc0thk1p" -[node name="Interaction" type="Node" parent="Interactible"] +[node name="Interaction" type="Node" parent="Interactible" unique_id=463123349] script = ExtResource("4_fyayl") [connection signal="interacted" from="Interactible" to="Interactible/Interaction" method="_on_interactible_interacted"] diff --git a/scenes/substance_jar.tscn b/scenes/substance_jar.tscn index 5cc4214..50f8f9a 100644 --- a/scenes/substance_jar.tscn +++ b/scenes/substance_jar.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://cw6v8kbi76qak"] +[gd_scene format=3 uid="uid://cw6v8kbi76qak"] [ext_resource type="Script" uid="uid://bjnv2g1ni0525" path="res://src/drag/draggable_object.gd" id="1_o7vug"] [ext_resource type="ArrayMesh" uid="uid://dddqboph2ygmw" path="res://assets/meshes/jar.res" id="2_o7vug"] @@ -15,49 +15,49 @@ transparency = 1 height = 0.5024414 radius = 0.22460938 -[node name="SubstanceJar" type="Area3D" node_paths=PackedStringArray("interactible")] +[node name="SubstanceJar" type="Area3D" unique_id=904812958 node_paths=PackedStringArray("interactible")] collision_layer = 5 script = ExtResource("1_o7vug") interactible = NodePath("Interaction") mask = PackedStringArray("flask") -[node name="Jar" type="MeshInstance3D" parent="."] +[node name="Jar" type="MeshInstance3D" parent="." unique_id=985146813] transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0) mesh = ExtResource("2_o7vug") -[node name="JarFill" type="MeshInstance3D" parent="."] +[node name="JarFill" type="MeshInstance3D" parent="." unique_id=1364277535] transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0) material_override = SubResource("StandardMaterial3D_pcpcb") mesh = ExtResource("6_kfk5m") -[node name="DragArea" type="CollisionShape3D" parent="."] +[node name="DragArea" type="CollisionShape3D" parent="." unique_id=960002167] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0) shape = SubResource("CylinderShape3D_kfk5m") -[node name="SubstanceData" type="Node" parent="."] +[node name="SubstanceData" type="Node" parent="." unique_id=1379108671] script = ExtResource("7_ymvgp") -[node name="Interaction" type="ConfirmationDialog" parent="."] +[node name="Interaction" type="ConfirmationDialog" parent="." unique_id=1225848265] title = "Добавить вещество?" ok_button_text = "Добавить" cancel_button_text = "Не добавлять" script = ExtResource("5_o7vug") -[node name="HBoxContainer" type="HBoxContainer" parent="Interaction"] +[node name="HBoxContainer" type="HBoxContainer" parent="Interaction" unique_id=1504866588] offset_right = 40.0 offset_bottom = 40.0 -[node name="ProgressBar" type="HSlider" parent="Interaction/HBoxContainer"] +[node name="ProgressBar" type="HSlider" parent="Interaction/HBoxContainer" unique_id=1037338095] layout_mode = 2 size_flags_horizontal = 3 allow_greater = true -[node name="SpinBox" type="SpinBox" parent="Interaction/HBoxContainer"] +[node name="SpinBox" type="SpinBox" parent="Interaction/HBoxContainer" unique_id=194740698] layout_mode = 2 allow_greater = true suffix = "мг." -[node name="Interaction" type="Node" parent="Interaction"] +[node name="Interaction" type="Node" parent="Interaction" unique_id=729724369] script = ExtResource("6_00jpx") [connection signal="interacted" from="Interaction" to="Interaction/Interaction" method="_on_interaction_interacted"] diff --git a/scenes/worktabs.tscn b/scenes/worktabs.tscn index 883da42..2519d1f 100644 --- a/scenes/worktabs.tscn +++ b/scenes/worktabs.tscn @@ -30,16 +30,3 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_xfim1") - -[node name="CloseButton" type="Button" parent="." unique_id=1683733206] -layout_mode = 1 -anchors_preset = 1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -31.0 -offset_bottom = 31.0 -grow_horizontal = 0 -theme_override_font_sizes/font_size = 16 -text = "X" - -[connection signal="pressed" from="CloseButton" to="TabContainer" method="_on_close_button_pressed"] diff --git a/shaders/fluid.gdshader b/shaders/fluid.gdshader new file mode 100644 index 0000000..4bca778 --- /dev/null +++ b/shaders/fluid.gdshader @@ -0,0 +1,28 @@ +shader_type spatial; + +render_mode cull_back, blend_mix; + +uniform vec4 albedo_color: source_color; +uniform float fill: hint_range(0.0, 1.0, 0.01) = 0.; +uniform float wave_intensity: hint_range(0.0, 1.0, 0.01) = 0.; + +const float MAX_AMPLITUDE = 0.1; +const float MAX_SPEED = 2.; + +void vertex() { + if (VERTEX.y > 0.) { + VERTEX.y *= (fill - 0.5) * 2.; + VERTEX.y += sin((TIME+VERTEX.x+VERTEX.z)*wave_intensity*MAX_SPEED) * MAX_AMPLITUDE * wave_intensity; + } +} + +void fragment() { + // Called for every pixel the material is visible on. + ALBEDO = albedo_color.rgb; + ALPHA = albedo_color.a; +} + +//void light() { +// // Called for every pixel for every light affecting the material. +// // Uncomment to replace the default light processing function with this one. +//} diff --git a/shaders/fluid.gdshader.uid b/shaders/fluid.gdshader.uid new file mode 100644 index 0000000..7aca443 --- /dev/null +++ b/shaders/fluid.gdshader.uid @@ -0,0 +1 @@ +uid://djb4t6pw03tow diff --git a/src/drag/draggable_object.gd b/src/drag/draggable_object.gd index dc70afe..ebfc92f 100644 --- a/src/drag/draggable_object.gd +++ b/src/drag/draggable_object.gd @@ -26,6 +26,8 @@ var dragged: bool = false: @export var interactible: Interactible @export var button_generator: ButtonGenerator +@export var display_text: String + @export var mask: PackedStringArray var contacted_draggables: Array[DraggableObject] var filtered_draggables: Array[DraggableObject] @@ -37,9 +39,18 @@ func _ready() -> void: func _mouse_enter() -> void: mouse_in = true + var text: String + if has_node("Inventory") and len($Inventory.inventory) != 0: + text = $Inventory.get_text() + else: + text = display_text + if text == "": + return + Tooltip.set_text(text) func _mouse_exit() -> void: mouse_in = false + Tooltip.clear() func set_mask(new_mask: PackedStringArray) -> void: mask.clear() diff --git a/src/interactible/spoon_interaction.gd b/src/interactible/spoon_interaction.gd index 6b08e3a..9b251d1 100644 --- a/src/interactible/spoon_interaction.gd +++ b/src/interactible/spoon_interaction.gd @@ -29,3 +29,9 @@ func _on_interactible_interacted(with: DraggableObject) -> void: log_message += "%s мг. %s, " % [str(sub.amount),sub.substance.get_formula()] GuiSignalBus.push(log_message) inventory_updated.emit(mini_inventory) + +func _process(_delta: float) -> void: + var result = "" + for key in mini_inventory: + result += key.substance.scientific_name + "+" + $"../..".display_text = result.left(len(result)-1) diff --git a/src/interactible/substance_jar_interaction.gd b/src/interactible/substance_jar_interaction.gd index 80761e1..24aea76 100644 --- a/src/interactible/substance_jar_interaction.gd +++ b/src/interactible/substance_jar_interaction.gd @@ -3,7 +3,7 @@ extends Node var add_amount: float func _on_interaction_interacted(with: DraggableObject) -> void: - if with.is_in_group("flask"): + if with.is_in_group("flask") and add_amount > 0: var subs: RuntimeSubstanceData = RuntimeSubstanceData.new() subs.amount = add_amount subs.substance = $"../../SubstanceData".substance diff --git a/src/inventory.gd b/src/inventory.gd index 2274311..70c109b 100644 --- a/src/inventory.gd +++ b/src/inventory.gd @@ -3,6 +3,7 @@ extends Node class_name Inventory @export var open_on_top: bool +@export var capacity: float = 10. var inventory: Dictionary[StringName,RuntimeSubstanceData] var mean_temperature: float: @@ -24,6 +25,9 @@ var total_amount: float: signal inventory_changed(substances: Array[RuntimeSubstanceData]) signal temperature_changed(to: float) +func _ready() -> void: + inventory_changed.emit(inventory.values()) + func update_solutions(): var has_water = inventory.has("Вода") if has_water: @@ -177,4 +181,23 @@ func check_for_reactions() -> void: recalculate_temperature() update_solutions() inventory_changed.emit(inventory.values()) - GuiSignalBus.push("Произошла реакция: " + found_reaction.formula()) + GuiSignalBus.push("Произошла реакция") + if len(find_odor()) > 0: + GuiSignalBus.push("Появился запах") + +#func find_gases() -> Array[RuntimeSubstanceData]: +# for key in inventory: +# if inventory[key].substance in [preload("H")] + +func find_odor() -> Array[RuntimeSubstanceData]: + var result = [] + for key in inventory: + if inventory[key].substance in [preload("res://assets/substances/CH3COOH.tres")]: + result.push_back(inventory[key]) + return result + +func get_text() -> String: + var result = "" + for key in inventory: + result += key + "+" + return result.left(len(result)-1) diff --git a/src/lab_runtime.gd b/src/lab_runtime.gd index ceaa539..74c71bb 100644 --- a/src/lab_runtime.gd +++ b/src/lab_runtime.gd @@ -6,6 +6,13 @@ 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 test_failed() -> 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" @@ -26,6 +33,8 @@ func save(): else: file.store_string(("+" if correctness[i] else "-").lpad(10)) file.store_line("") + file.store_line("Попыток: " + str(tries)) + file.store_line("") file.store_line("Ход работы:") file.store_string(LabLogger.instance.text) diff --git a/src/substance_display.gd b/src/substance_display.gd index 81dc92c..5ef296f 100644 --- a/src/substance_display.gd +++ b/src/substance_display.gd @@ -1,3 +1,4 @@ +@tool extends MeshInstance3D enum DisplayType{ @@ -6,8 +7,53 @@ enum DisplayType{ } @export var display_type: DisplayType +@export_tool_button("Wiggle") var wiggle = func() -> void: + var tween = create_tween() + material_override.set_shader_parameter("wave_intensity",1.) + tween.tween_property(material_override,"shader_parameter/wave_intensity",0.0,2.0) -func update_material(substances: Array[RuntimeSubstanceData]) -> void: +func update_fluid_material(substances: Array[RuntimeSubstanceData]) -> void: + var mat: ShaderMaterial = material_override + if len(substances) == 0: + visible = false + return + else: + visible = true + + var total_weight = 0 + var total_color = 0 + + for sub in substances: + total_weight += sub.amount + total_color += sub.substance.color_influence + + var pH: float = 0 + var color: Color = Color(0,0,0,0) + + for sub: RuntimeSubstanceData in substances: + var weight: float = sub.amount/total_weight + pH += sub.substance.get_ph_runtime(substances) * weight + + for sub: RuntimeSubstanceData in substances: + var color_to_add: Color + if sub.substance.pHColor != null: + color_to_add = sub.substance.pHColor.sample(pH/14.0) + else: + color_to_add = sub.substance.color + + if display_type == DisplayType.Fluid and sub.is_solution: + color_to_add.a = 0.5 + + #if color == Color(0,0,0,0): + # color = color_to_add + #else: + # color = color.lerp(color_to_add,sub.substance.color_influence) + color += color_to_add * sub.substance.color_influence + + + mat.set_shader_parameter("albedo_color", color / total_color) + +func update_solid_material(substances: Array[RuntimeSubstanceData]) -> void: var mat: StandardMaterial3D = material_override if len(substances) == 0: visible = false @@ -52,10 +98,10 @@ func update_material_unfiltered(substances: Array[RuntimeSubstanceData]): match display_type: DisplayType.Fluid: var fluids = substances.filter(filter_liquids) - update_material(fluids) + update_fluid_material(fluids) DisplayType.Solid: var solids = substances.filter(filter_solids) - update_material(solids) + update_solid_material(solids) func filter_liquids(sub: RuntimeSubstanceData): return sub.substance.melting_point < sub.temperature or sub.is_solution func filter_solids(sub: RuntimeSubstanceData): return sub.substance.melting_point > sub.temperature and not sub.is_solution diff --git a/src/substance_holder.gd b/src/substance_holder.gd index 131ebf9..cbf539b 100644 --- a/src/substance_holder.gd +++ b/src/substance_holder.gd @@ -15,3 +15,4 @@ func _ready() -> void: if substance.is_solution: jar_fill_material.albedo_color.a = 0.5 get_parent().add_to_group("fluid_source") + get_parent().display_text = substance.scientific_name diff --git a/src/ui/lab_tabs.gd b/src/ui/lab_tabs.gd index da3154b..d21ab8c 100644 --- a/src/ui/lab_tabs.gd +++ b/src/ui/lab_tabs.gd @@ -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.test_failed() + set_tab_disabled(0,anwsered) + set_tab_disabled(2,anwsered) + set_tab_disabled(3,anwsered) + + +func _on_worktabs_close_requested() -> void: + $Worktabs.visible = false diff --git a/src/ui/questions_generator.gd b/src/ui/questions_generator.gd index 65049a8..5f20472 100644 --- a/src/ui/questions_generator.gd +++ b/src/ui/questions_generator.gd @@ -3,7 +3,13 @@ extends Control var current: int = -1 func _ready() -> void: - for question in LabRuntime.current_lab.tests: + shuffle_questions() + +func shuffle_questions() -> void: + var questions = LabRuntime.current_lab.tests.duplicate() + questions.shuffle() + questions.resize(5) + for question in questions: var options = question.options.duplicate() options.shuffle() var vbox = VBoxContainer.new() @@ -20,7 +26,6 @@ func _ready() -> void: add_child(vbox) next() - func _on_close_button_pressed() -> void: get_parent().visible = false @@ -30,9 +35,10 @@ func next() -> void: current += 1 get_child(current).visible = true else: - get_parent().visible = false + visible = false + $"../Result".visible = true + LabRuntime.tries += 1 func anwser(option_number: int,correctness: bool): LabRuntime.anwsers.append(option_number) - LabRuntime.correctness.append(correctness) - + LabRuntime.correctness.append(correctness) diff --git a/ui/questions_result.gd b/ui/questions_result.gd new file mode 100644 index 0000000..68e27a0 --- /dev/null +++ b/ui/questions_result.gd @@ -0,0 +1,14 @@ +extends Control + + +func _process(delta: float) -> void: + $Label.text = str(LabRuntime.correctness.count(true))+"/5 Верно\n"+str(LabRuntime.tries)+" попыток" + $TryAgain.visible = LabRuntime.test_failed() + + +func _on_try_again_pressed() -> void: + $"../Questions".shuffle_questions() + $"../Questions".visible = true + visible = false + LabRuntime.anwsers.clear() + LabRuntime.correctness.clear() diff --git a/ui/questions_result.gd.uid b/ui/questions_result.gd.uid new file mode 100644 index 0000000..55026d6 --- /dev/null +++ b/ui/questions_result.gd.uid @@ -0,0 +1 @@ +uid://ckhrj43lyvorv diff --git a/ui/tab_bar.tscn b/ui/tab_bar.tscn index 2d3f7a1..1eec75c 100644 --- a/ui/tab_bar.tscn +++ b/ui/tab_bar.tscn @@ -16,11 +16,6 @@ tab_2/title = "Отчёт" tab_3/title = "Очистить" script = ExtResource("1_ieq68") -[node name="Worktabs" parent="." unique_id=666307058 instance=ExtResource("2_hyo0h")] -visible = false -top_level = true -layout_mode = 1 - [node name="Questions" parent="." unique_id=2060279649 instance=ExtResource("3_lhsfi")] visible = false top_level = true @@ -33,4 +28,14 @@ ok_button_text = "Составить отчёт" dialog_text = "Вы уверены, что хотите закончить лабораторную работу и составить отчёт? Отчёт будет отправлен на ваш рабочий стол" cancel_button_text = "Отменить" +[node name="Worktabs" type="Window" parent="." unique_id=1368905224] +oversampling_override = 1.0 +position = Vector2i(0, 36) +size = Vector2i(768, 512) +visible = false + +[node name="Worktabs" parent="Worktabs" unique_id=666307058 instance=ExtResource("2_hyo0h")] +top_level = true + [connection signal="tab_clicked" from="." to="." method="_on_tab_clicked"] +[connection signal="close_requested" from="Worktabs" to="." method="_on_worktabs_close_requested"] diff --git a/ui/tooltip.gd b/ui/tooltip.gd new file mode 100644 index 0000000..149af6e --- /dev/null +++ b/ui/tooltip.gd @@ -0,0 +1,12 @@ +extends Control + +func _process(delta: float) -> void: + global_position = get_global_mouse_position() + +func set_text(text: String): + $Label.text = text + visible = true + +func clear(): + $Label.text = "" + visible = false diff --git a/ui/tooltip.gd.uid b/ui/tooltip.gd.uid new file mode 100644 index 0000000..d3dd636 --- /dev/null +++ b/ui/tooltip.gd.uid @@ -0,0 +1 @@ +uid://bu3exvpul8jhk diff --git a/ui/tooltip.tscn b/ui/tooltip.tscn new file mode 100644 index 0000000..eac1947 --- /dev/null +++ b/ui/tooltip.tscn @@ -0,0 +1,15 @@ +[gd_scene format=3 uid="uid://dtpy85f2ycbur"] + +[ext_resource type="Script" uid="uid://bu3exvpul8jhk" path="res://ui/tooltip.gd" id="1_np3dp"] + +[node name="Tooltip" type="PanelContainer" unique_id=246590363] +visible = false +offset_right = 1.0 +offset_bottom = 23.0 +size_flags_horizontal = 0 +size_flags_vertical = 0 +script = ExtResource("1_np3dp") + +[node name="Label" type="Label" parent="." unique_id=1174493236] +layout_mode = 2 +size_flags_horizontal = 0