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/note b/note new file mode 100644 index 0000000..cc1efd1 --- /dev/null +++ b/note @@ -0,0 +1,4 @@ +Каждый опыт должен быть изолирован, иметь свой логгер, свою рабочую зону +Добавить зону для текста с (возможно) зоной/кнопками для формул +Тесты должны быть вначале и пропускать студента + diff --git a/scenes/flask.tscn b/scenes/flask.tscn index a5d0a5d..7e8f14e 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,12 @@ _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/fill = 0.8999999798832 +shader_parameter/wave_intensity = 0.0 [sub_resource type="CylinderMesh" id="CylinderMesh_h7awq"] top_radius = 0.772 @@ -85,8 +89,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/shaders/fluid.gdshader b/shaders/fluid.gdshader new file mode 100644 index 0000000..e8b086d --- /dev/null +++ b/shaders/fluid.gdshader @@ -0,0 +1,25 @@ +shader_type spatial; + +render_mode cull_back, blend_mix; + +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. +} + +//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/inventory.gd b/src/inventory.gd index 2274311..ad3f6c4 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: @@ -177,4 +178,4 @@ func check_for_reactions() -> void: recalculate_temperature() update_solutions() inventory_changed.emit(inventory.values()) - GuiSignalBus.push("Произошла реакция: " + found_reaction.formula()) + GuiSignalBus.push("Произошла реакция") diff --git a/src/substance_display.gd b/src/substance_display.gd index 81dc92c..29833f4 100644 --- a/src/substance_display.gd +++ b/src/substance_display.gd @@ -1,3 +1,4 @@ +@tool extends MeshInstance3D enum DisplayType{ @@ -6,6 +7,10 @@ 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: var mat: StandardMaterial3D = material_override diff --git a/src/ui/lab_tabs.gd b/src/ui/lab_tabs.gd index 9e6e263..d21ab8c 100644 --- a/src/ui/lab_tabs.gd +++ b/src/ui/lab_tabs.gd @@ -17,7 +17,7 @@ func _on_tab_clicked(tab: int) -> void: GuiSignalBus.clear_table.emit() func _process(_delta: float) -> void: - var anwsered = LabRuntime.questions_anwsered() + var anwsered = LabRuntime.test_failed() set_tab_disabled(0,anwsered) set_tab_disabled(2,anwsered) set_tab_disabled(3,anwsered) 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)