From d4b50bdda0cb7c59ce5891f3a001eeafc56dde7a Mon Sep 17 00:00:00 2001 From: rendo Date: Fri, 24 Apr 2026 11:07:49 +0500 Subject: [PATCH] Reaction hidden --- assets/textures/bubble.png | Bin 0 -> 2967 bytes assets/textures/bubble.png.import | 40 ++++++++++++++++++++++ export_presets.cfg | 53 +++++++++++++++++++++++++++++- note | 4 +++ scenes/flask.tscn | 11 ++++--- scenes/questions.tscn | 41 +++++++++++++++++++++++ shaders/fluid.gdshader | 25 ++++++++++++++ shaders/fluid.gdshader.uid | 1 + src/inventory.gd | 3 +- src/substance_display.gd | 5 +++ src/ui/lab_tabs.gd | 2 +- src/ui/questions_generator.gd | 16 ++++++--- 12 files changed, 189 insertions(+), 12 deletions(-) create mode 100644 assets/textures/bubble.png create mode 100644 assets/textures/bubble.png.import create mode 100644 note create mode 100644 shaders/fluid.gdshader create mode 100644 shaders/fluid.gdshader.uid diff --git a/assets/textures/bubble.png b/assets/textures/bubble.png new file mode 100644 index 0000000000000000000000000000000000000000..b26fda2f4660eb621337020927813f114abfe452 GIT binary patch literal 2967 zcmV;I3uyF-P)Tazkc1V)`1O!8D5ht=0CoW>* zRHZ6ek!fXrfGpU@#V!jzKo+U6B~_^;3sPis1_nFWu@VxD<5)}<2oRdbp1X6d`Ca$X zqlMH$5>mpe`d3d3TI^#1ta}1H?hz4$dG7Jt z=XsPzi=rSe$O$q$X4UI8Pk@K8R;U<{wSo15ySdD!q z1qTFAVde=;+zUkXkc#R~VEwwNUWe4Z{Jaxnx{;n$xPydroBD~Kx}&cONz0uKh;e^weOn>Nu5*jvPgujqLiK~ch+ww`lRqr@f}l-l z!D)L?Md*)|;NuXJQ5tqZEf@<-u~-ZvSYcpbAUZreJk{Ud-*@iZxtnLsoVnE3*Z1_q z#KeI@q3|5mu~DVfMwFF+4Ez4yP)L3$F(3k?Ulx2*@I3w=Q~o_hIbh3TsZo?fVqFGGO!`A)&B+-nz_3`3xGoxyxQ ze_4pQaPs8IE60x?ufB8Vjw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ures/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)