diff --git a/Assets/Images/Nodes/craft.png b/Assets/Images/Nodes/craft.png new file mode 100644 index 0000000..480d755 Binary files /dev/null and b/Assets/Images/Nodes/craft.png differ diff --git a/Assets/Images/Nodes/craft.png.import b/Assets/Images/Nodes/craft.png.import new file mode 100644 index 0000000..c7b7b74 --- /dev/null +++ b/Assets/Images/Nodes/craft.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bjxwrtm0bttio" +path="res://.godot/imported/craft.png-6ef1d3b3d2b282380072caa5b7edf88e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/craft.png" +dest_files=["res://.godot/imported/craft.png-6ef1d3b3d2b282380072caa5b7edf88e.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/Assets/Images/Nodes/explore.png b/Assets/Images/Nodes/explore.png new file mode 100644 index 0000000..a579c46 Binary files /dev/null and b/Assets/Images/Nodes/explore.png differ diff --git a/Assets/Images/Nodes/explore.png.import b/Assets/Images/Nodes/explore.png.import new file mode 100644 index 0000000..3ca1658 --- /dev/null +++ b/Assets/Images/Nodes/explore.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b6jm34qgckaxh" +path="res://.godot/imported/explore.png-953528913d382d25c22ebda01c9eae17.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/explore.png" +dest_files=["res://.godot/imported/explore.png-953528913d382d25c22ebda01c9eae17.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/Assets/Images/Nodes/for.png b/Assets/Images/Nodes/for.png new file mode 100644 index 0000000..98342ba Binary files /dev/null and b/Assets/Images/Nodes/for.png differ diff --git a/Assets/Images/Nodes/for.png.import b/Assets/Images/Nodes/for.png.import new file mode 100644 index 0000000..9cfa4ff --- /dev/null +++ b/Assets/Images/Nodes/for.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cugoibldkatry" +path="res://.godot/imported/for.png-7e0a93012248eea32dfb05f41c7e4f81.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/for.png" +dest_files=["res://.godot/imported/for.png-7e0a93012248eea32dfb05f41c7e4f81.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/Assets/Images/Nodes/harvest.png b/Assets/Images/Nodes/harvest.png new file mode 100644 index 0000000..eaa0091 Binary files /dev/null and b/Assets/Images/Nodes/harvest.png differ diff --git a/Assets/Images/Nodes/harvest.png.import b/Assets/Images/Nodes/harvest.png.import new file mode 100644 index 0000000..6b2740b --- /dev/null +++ b/Assets/Images/Nodes/harvest.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://qqtpqludvgxt" +path="res://.godot/imported/harvest.png-0cc3bd3c70f996a004117a3f7a91177a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/harvest.png" +dest_files=["res://.godot/imported/harvest.png-0cc3bd3c70f996a004117a3f7a91177a.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/Assets/Images/Nodes/if.png b/Assets/Images/Nodes/if.png new file mode 100644 index 0000000..cd91c39 Binary files /dev/null and b/Assets/Images/Nodes/if.png differ diff --git a/Assets/Images/Nodes/if.png.import b/Assets/Images/Nodes/if.png.import new file mode 100644 index 0000000..59f92b7 --- /dev/null +++ b/Assets/Images/Nodes/if.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://chh5hsjsy254n" +path="res://.godot/imported/if.png-4751c8cb00c015bf90caf7b01ca65fcf.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/if.png" +dest_files=["res://.godot/imported/if.png-4751c8cb00c015bf90caf7b01ca65fcf.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/Assets/Images/Nodes/maintain.png b/Assets/Images/Nodes/maintain.png new file mode 100644 index 0000000..24071fa Binary files /dev/null and b/Assets/Images/Nodes/maintain.png differ diff --git a/Assets/Images/Nodes/maintain.png.import b/Assets/Images/Nodes/maintain.png.import new file mode 100644 index 0000000..932e43d --- /dev/null +++ b/Assets/Images/Nodes/maintain.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://0yysypsrfe7s" +path="res://.godot/imported/maintain.png-d6e014a306fabbb6543e072f6642d4e7.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/maintain.png" +dest_files=["res://.godot/imported/maintain.png-d6e014a306fabbb6543e072f6642d4e7.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/Assets/Images/Nodes/move.png b/Assets/Images/Nodes/move.png new file mode 100644 index 0000000..4751211 Binary files /dev/null and b/Assets/Images/Nodes/move.png differ diff --git a/Assets/Images/Nodes/move.png.import b/Assets/Images/Nodes/move.png.import new file mode 100644 index 0000000..ae8ff66 --- /dev/null +++ b/Assets/Images/Nodes/move.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dwen2run626at" +path="res://.godot/imported/move.png-0fbfb070f028e7a2665763914c1c70f0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/move.png" +dest_files=["res://.godot/imported/move.png-0fbfb070f028e7a2665763914c1c70f0.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/Assets/Images/Nodes/sacrifice.png b/Assets/Images/Nodes/sacrifice.png new file mode 100644 index 0000000..c7fa35d Binary files /dev/null and b/Assets/Images/Nodes/sacrifice.png differ diff --git a/Assets/Images/Nodes/sacrifice.png.import b/Assets/Images/Nodes/sacrifice.png.import new file mode 100644 index 0000000..c30b37c --- /dev/null +++ b/Assets/Images/Nodes/sacrifice.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://btumhi0t4c0f0" +path="res://.godot/imported/sacrifice.png-1291ff8e1d4c6a2ccf4900842ccf4993.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/sacrifice.png" +dest_files=["res://.godot/imported/sacrifice.png-1291ff8e1d4c6a2ccf4900842ccf4993.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/Assets/Images/Nodes/start.png b/Assets/Images/Nodes/start.png new file mode 100644 index 0000000..0b00549 Binary files /dev/null and b/Assets/Images/Nodes/start.png differ diff --git a/Assets/Images/Nodes/start.png.import b/Assets/Images/Nodes/start.png.import new file mode 100644 index 0000000..fac39f3 --- /dev/null +++ b/Assets/Images/Nodes/start.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cktnj1a1rg5yu" +path="res://.godot/imported/start.png-edc6bdb9e8290898275934ddb44d2834.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/start.png" +dest_files=["res://.godot/imported/start.png-edc6bdb9e8290898275934ddb44d2834.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/Assets/Images/Nodes/while.png b/Assets/Images/Nodes/while.png new file mode 100644 index 0000000..740ae76 Binary files /dev/null and b/Assets/Images/Nodes/while.png differ diff --git a/Assets/Images/Nodes/while.png.import b/Assets/Images/Nodes/while.png.import new file mode 100644 index 0000000..40a83e1 --- /dev/null +++ b/Assets/Images/Nodes/while.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://p0b5h6kts0jo" +path="res://.godot/imported/while.png-a59b08af0a24cbfedd7a46b9cd582957.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Images/Nodes/while.png" +dest_files=["res://.godot/imported/while.png-a59b08af0a24cbfedd7a46b9cd582957.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/Scenes/Game.tscn b/Scenes/Game.tscn index f60a7d9..03d53f9 100644 --- a/Scenes/Game.tscn +++ b/Scenes/Game.tscn @@ -24,6 +24,8 @@ [ext_resource type="Texture2D" uid="uid://bmcpkt6mae2qi" path="res://Assets/Images/AlarmSign.png" id="13_x3xnh"] [ext_resource type="Texture2D" uid="uid://uunnuou4g86w" path="res://Assets/Images/Resources/MushroomSymbol.png" id="14_food"] [ext_resource type="Script" uid="uid://d0opysuqksr6l" path="res://Scripts/UI/Tutorial/TutorialBubble.cs" id="15_tutorial"] +[ext_resource type="Texture2D" uid="uid://b6jm34qgckaxh" path="res://Assets/Images/Nodes/explore.png" id="25_8e0uq"] +[ext_resource type="Script" uid="uid://dx5oy38ochrw2" path="res://Scripts/UI/DSL/NodeTooltip.cs" id="25_i0vto"] [sub_resource type="CompressedTexture2D" id="CompressedTexture2D_u44n3"] @@ -224,14 +226,14 @@ text = "Open Gate" layout_mode = 2 size_flags_vertical = 3 -[node name="CodingWindow" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=1576652491 node_paths=PackedStringArray("codeBlocks", "editorWindow", "availableScripts", "scriptName", "nameInput")] +[node name="CodingWindow" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=1576652491 node_paths=PackedStringArray("codeBlocks", "editorWindow", "availableScripts", "scriptName", "nameInput", "nodeTooltip")] visible = false layout_mode = 1 anchors_preset = 11 anchor_left = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -663.0 +offset_left = -948.0 grow_horizontal = 0 grow_vertical = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_7lihs") @@ -241,6 +243,7 @@ editorWindow = NodePath("VBoxContainer/Scripting/EditorWindow/CodeContainer") availableScripts = NodePath("VBoxContainer/Scripting/EditorWindow/Load") scriptName = NodePath("VBoxContainer/Scripting/EditorWindow/Saving/ScriptName") nameInput = NodePath("VBoxContainer/Renaming/LineEdit") +nodeTooltip = NodePath("../../../NodeTooltip") [node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" unique_id=582741975] layout_mode = 2 @@ -296,7 +299,8 @@ theme_override_constants/separation = 10 [node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/CodeBlocks/VBoxContainer" unique_id=1914788051] layout_mode = 2 -text = "Click to add" +text = "Click to add +[DEL] to remove" fit_content = true autowrap_mode = 0 horizontal_alignment = 1 @@ -310,6 +314,7 @@ size_flags_stretch_ratio = 2.0 [node name="CodeContainer" type="GraphEdit" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow" unique_id=1600198848] layout_mode = 2 size_flags_vertical = 3 +scroll_offset = Vector2(-4, 0) right_disconnects = true [node name="Buttons" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow" unique_id=265797151] @@ -361,7 +366,7 @@ anchors_preset = 11 anchor_left = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -525.0 +offset_left = -711.0 grow_horizontal = 0 grow_vertical = 2 script = ExtResource("7_2irst") @@ -691,10 +696,46 @@ text = "Skip" layout_mode = 2 text = "Next" +[node name="NodeTooltip" type="PanelContainer" parent="CanvasLayer/UIHandler" unique_id=642635777 node_paths=PackedStringArray("title", "image", "description")] +visible = false +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 +script = ExtResource("25_i0vto") +title = NodePath("VBoxContainer/Title") +image = NodePath("VBoxContainer/NodeVisual") +description = NodePath("VBoxContainer/Description") + +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/NodeTooltip" unique_id=1125936946] +layout_mode = 2 + +[node name="Title" type="RichTextLabel" parent="CanvasLayer/UIHandler/NodeTooltip/VBoxContainer" unique_id=1945362386] +layout_mode = 2 +bbcode_enabled = true +text = "[font_size=18]Explore" +fit_content = true +autowrap_mode = 0 +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="NodeVisual" type="TextureRect" parent="CanvasLayer/UIHandler/NodeTooltip/VBoxContainer" unique_id=2114186555] +layout_mode = 2 +texture = ExtResource("25_8e0uq") + +[node name="Description" type="RichTextLabel" parent="CanvasLayer/UIHandler/NodeTooltip/VBoxContainer" unique_id=1191195331] +layout_mode = 2 +text = "Using this node you can randomly explore the ruin. +It continues exploring until all tiles were visited." +fit_content = true +horizontal_alignment = 1 +vertical_alignment = 1 + [connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/HeaderContainer/VBoxContainer/UnlockLayer" to="CanvasLayer/UIHandler" method="UnlockLayer"] [connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Renaming/Button" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="SaveRobotName"] [connection signal="connection_request" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/CodeContainer" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="OnNodeConnect"] [connection signal="disconnection_request" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/CodeContainer" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="OnNodeDisconnect"] +[connection signal="node_deselected" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/CodeContainer" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="OnNodeDeselect"] +[connection signal="node_selected" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/CodeContainer" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="OnNodeSelect"] [connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Clear" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="ClearWindow"] [connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Compile" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="CompileProgram"] [connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Saving/Save" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="SaveProgram"] diff --git a/Scripts/Core/ResourceLoader.cs b/Scripts/Core/ResourceLoader.cs index b842666..9e69ce3 100644 --- a/Scripts/Core/ResourceLoader.cs +++ b/Scripts/Core/ResourceLoader.cs @@ -151,4 +151,9 @@ public static class ResourceLoader return result; } + + public static Texture2D LoadDSLTooltip(string title) + { + return GD.Load($"res://Assets/Images/Nodes/{title.ToLower()}.png"); + } } diff --git a/Scripts/DSL/Nodes/IfNode.cs b/Scripts/DSL/Nodes/IfNode.cs index 2fd65a4..b57e533 100644 --- a/Scripts/DSL/Nodes/IfNode.cs +++ b/Scripts/DSL/Nodes/IfNode.cs @@ -19,6 +19,12 @@ public class IfNode : ProgramNode return NodeResult.FAILURE; } + if (comparator == null) + { + lastExecutionMessage = "No comparator selected"; + return NodeResult.FAILURE; + } + bool isConditionFulfilled = DetermineCondition(); return isConditionFulfilled ? NodeResult.SUCCESS : NodeResult.CONDITIONFALSE; } diff --git a/Scripts/DSL/Nodes/WhileNode.cs b/Scripts/DSL/Nodes/WhileNode.cs index 9503663..519ed23 100644 --- a/Scripts/DSL/Nodes/WhileNode.cs +++ b/Scripts/DSL/Nodes/WhileNode.cs @@ -19,6 +19,12 @@ public class WhileNode : ProgramNode return NodeResult.FAILURE; } + if (comparator == null) + { + lastExecutionMessage = "No comparator selected"; + return NodeResult.FAILURE; + } + bool isConditionFulfilled = DetermineCondition(); return isConditionFulfilled ? NodeResult.SUCCESS : NodeResult.CONDITIONFALSE; } diff --git a/Scripts/UI/DSL/CodingWindow.cs b/Scripts/UI/DSL/CodingWindow.cs index 94db4d7..d463c89 100644 --- a/Scripts/UI/DSL/CodingWindow.cs +++ b/Scripts/UI/DSL/CodingWindow.cs @@ -11,8 +11,10 @@ public partial class CodingWindow : PanelContainer [Export] OptionButton availableScripts; [Export] LineEdit scriptName; [Export] LineEdit nameInput; + [Export] NodeTooltip nodeTooltip; public System.Collections.Generic.Dictionary DSLNodes; + public NodeDisplay selectedNode; public override void _Ready() { @@ -28,6 +30,29 @@ public partial class CodingWindow : PanelContainer } } + public override void _Process(double delta) + { + if (Input.IsActionJustPressed("delete_node")) + { + Control focused = GetViewport().GuiGetFocusOwner(); + + if (focused is LineEdit || focused is TextEdit) return; + if (selectedNode == null) return; + editorWindow.RemoveChild(selectedNode); + selectedNode.QueueFree(); + } + } + + public void OnNodeSelect(NodeDisplay node) + { + selectedNode = node; + } + + public void OnNodeDeselect(NodeDisplay node) + { + selectedNode = null; + } + private void LoadWindow() { if (robot == null) return; @@ -76,6 +101,14 @@ public partial class CodingWindow : PanelContainer { AddEditorNode(nodeTemplate); }; + nodeListButton.MouseEntered += () => + { + nodeTooltip.ShowTooltip(nodeTemplate.DisplayText, nodeTemplate.DisplayText, nodeListButton); + }; + nodeListButton.MouseExited += () => + { + nodeTooltip.HideTooltip(); + }; codeBlocks.AddChild(nodeListButton); } } @@ -85,7 +118,6 @@ public partial class CodingWindow : PanelContainer NodeDisplay editorDisplay = DSLNodes[node].Instantiate(); editorDisplay.PositionOffset = GetVisibleGraphCenter() - editorDisplay.Size / 2f; editorWindow.AddChild(editorDisplay); - RegisterEditorNode(editorDisplay); } private Vector2 GetVisibleGraphCenter() @@ -93,15 +125,6 @@ public partial class CodingWindow : PanelContainer return (editorWindow.ScrollOffset + editorWindow.Size / 2f) / editorWindow.Zoom; } - private void RegisterEditorNode(NodeDisplay editorDisplay) - { - editorDisplay.OnDeleteNode += () => - { - editorWindow.RemoveChild(editorDisplay); - editorDisplay.QueueFree(); - }; - } - public void ClearWindow() { DisconnectAllNodes(); @@ -176,7 +199,6 @@ public partial class CodingWindow : PanelContainer private void AddLoadedNode(NodeDisplay nodeDisplay) { editorWindow.AddChild(nodeDisplay); - RegisterEditorNode(nodeDisplay); } public void LoadTemporaryProgram() diff --git a/Scripts/UI/DSL/NodeDisplay.cs b/Scripts/UI/DSL/NodeDisplay.cs index 4234c37..6da245d 100644 --- a/Scripts/UI/DSL/NodeDisplay.cs +++ b/Scripts/UI/DSL/NodeDisplay.cs @@ -5,9 +5,6 @@ public partial class NodeDisplay : GraphNode { public ProgramNode node; - [Signal] - public delegate void OnDeleteNodeEventHandler(); - public override void _Ready() { if (node == null) @@ -20,11 +17,6 @@ public partial class NodeDisplay : GraphNode SetupDisplay(); } - public void DeleteNodePressed() - { - EmitSignal(SignalName.OnDeleteNode); - } - public static NodeDisplay Load( string nodeName, string content, diff --git a/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs index 261f248..145a557 100644 --- a/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs +++ b/Scripts/UI/DSL/NodeDisplays/IfNodeDisplay.cs @@ -41,6 +41,7 @@ public partial class IfNodeDisplay : NodeDisplay ifNode.amount = (int)valueContainer.GetNode("./Amount").Value; OptionButton comparators = valueContainer.GetNode("./Comparator"); + if(comparators.GetSelectedId() == -1) return; ifNode.comparator = comparators.GetItemText(comparators.GetSelectedId()); } diff --git a/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs b/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs index b3bca16..ff04e8e 100644 --- a/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs +++ b/Scripts/UI/DSL/NodeDisplays/WhileNodeDisplay.cs @@ -41,6 +41,7 @@ public partial class WhileNodeDisplay : NodeDisplay whileNode.amount = (int)valueContainer.GetNode("./Amount").Value; OptionButton comparators = valueContainer.GetNode("./Comparator"); + if(comparators.GetSelectedId() == -1) return; whileNode.comparator = comparators.GetItemText(comparators.GetSelectedId()); } diff --git a/Scripts/UI/DSL/NodeTooltip.cs b/Scripts/UI/DSL/NodeTooltip.cs new file mode 100644 index 0000000..2b4546c --- /dev/null +++ b/Scripts/UI/DSL/NodeTooltip.cs @@ -0,0 +1,24 @@ +using Godot; + +public partial class NodeTooltip : PanelContainer +{ + [Export] RichTextLabel title; + [Export] TextureRect image; + [Export] RichTextLabel description; + + private static Vector2 spacing = new Vector2(5, 0); + + public void ShowTooltip(string titleText, string descriptionText, Button button) + { + title.Text = titleText; + image.Texture = ResourceLoader.LoadDSLTooltip(titleText); + description.Text = descriptionText; + Show(); + Position = button.GlobalPosition - spacing - new Vector2(Size.X, Size.Y/2); + } + + public void HideTooltip() + { + Hide(); + } +} diff --git a/Scripts/UI/DSL/NodeTooltip.cs.uid b/Scripts/UI/DSL/NodeTooltip.cs.uid new file mode 100644 index 0000000..0bd9401 --- /dev/null +++ b/Scripts/UI/DSL/NodeTooltip.cs.uid @@ -0,0 +1 @@ +uid://dx5oy38ochrw2 diff --git a/project.godot b/project.godot index 6b28207..3d5239f 100644 --- a/project.godot +++ b/project.godot @@ -97,6 +97,12 @@ research={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":84,"key_label":0,"unicode":116,"location":0,"echo":false,"script":null) ] } +delete_node={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194308,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194312,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} [layer_names]