From a2d605f3f5ffadae45ebbcf0b2c9984931b76293 Mon Sep 17 00:00:00 2001 From: 2-1-1-2 Date: Sun, 26 Feb 2023 20:02:24 +0100 Subject: [PATCH] add terminal --- Assets/dossier/2.png | 3 +++ Assets/dossier/2.png.import | 35 ++++++++++++++++++++++++++ Assets/windows/0.png | 3 +++ Assets/windows/0.png.import | 35 ++++++++++++++++++++++++++ Assets/windows/1.png | 3 +++ Assets/windows/1.png.import | 35 ++++++++++++++++++++++++++ Assets/windows/2.png | 3 +++ Assets/windows/2.png.import | 35 ++++++++++++++++++++++++++ Assets/windows/3.png | 3 +++ Assets/windows/3.png.import | 35 ++++++++++++++++++++++++++ Assets/windows/terminal.png | 3 +++ Assets/windows/terminal.png.import | 35 ++++++++++++++++++++++++++ Elements/SquareWindow.tscn | 29 ++++++++++++++++++++-- Scenes/DesktopScreen.tscn | 23 +++++++++++++++++ Scenes/Scripts/Desktop.gd | 40 ++++++++++++++++++++++++------ 15 files changed, 311 insertions(+), 9 deletions(-) create mode 100644 Assets/dossier/2.png create mode 100644 Assets/dossier/2.png.import create mode 100644 Assets/windows/0.png create mode 100644 Assets/windows/0.png.import create mode 100644 Assets/windows/1.png create mode 100644 Assets/windows/1.png.import create mode 100644 Assets/windows/2.png create mode 100644 Assets/windows/2.png.import create mode 100644 Assets/windows/3.png create mode 100644 Assets/windows/3.png.import create mode 100644 Assets/windows/terminal.png create mode 100644 Assets/windows/terminal.png.import diff --git a/Assets/dossier/2.png b/Assets/dossier/2.png new file mode 100644 index 0000000..a98b7b6 --- /dev/null +++ b/Assets/dossier/2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a36b18fba148a2b39806ec46bd9d6d75990e46e60080320e8050e7e7401bfd0c +size 17968 diff --git a/Assets/dossier/2.png.import b/Assets/dossier/2.png.import new file mode 100644 index 0000000..b7cb31d --- /dev/null +++ b/Assets/dossier/2.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/2.png-ec77914f10408dac8b3834c177cd6b3d.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/dossier/2.png" +dest_files=[ "res://.import/2.png-ec77914f10408dac8b3834c177cd6b3d.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Assets/windows/0.png b/Assets/windows/0.png new file mode 100644 index 0000000..b860ea5 --- /dev/null +++ b/Assets/windows/0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e57beb49fcdf21f6f150b7dc953d596ba4b7d6ef85e25533da6520da4fe0f4e +size 19042 diff --git a/Assets/windows/0.png.import b/Assets/windows/0.png.import new file mode 100644 index 0000000..9967cca --- /dev/null +++ b/Assets/windows/0.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/0.png-3b009fc3e01f69ed1fecb9af943407bb.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/windows/0.png" +dest_files=[ "res://.import/0.png-3b009fc3e01f69ed1fecb9af943407bb.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Assets/windows/1.png b/Assets/windows/1.png new file mode 100644 index 0000000..3d2b5c9 --- /dev/null +++ b/Assets/windows/1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f8b551b823e3ac43bf4f65facab06f909722e21cd9889753ad03e220c73a784 +size 23028 diff --git a/Assets/windows/1.png.import b/Assets/windows/1.png.import new file mode 100644 index 0000000..c84706d --- /dev/null +++ b/Assets/windows/1.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/1.png-863648f03ea7f8b235fc9b631fa64057.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/windows/1.png" +dest_files=[ "res://.import/1.png-863648f03ea7f8b235fc9b631fa64057.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Assets/windows/2.png b/Assets/windows/2.png new file mode 100644 index 0000000..876f8d8 --- /dev/null +++ b/Assets/windows/2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c15661fb20b707b478c6d0019ad20d30f8f7737d99f91ac3b664fd3934bcf8b +size 25393 diff --git a/Assets/windows/2.png.import b/Assets/windows/2.png.import new file mode 100644 index 0000000..1287170 --- /dev/null +++ b/Assets/windows/2.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/2.png-81c8d69ce0b4aee009eaee27837fb52a.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/windows/2.png" +dest_files=[ "res://.import/2.png-81c8d69ce0b4aee009eaee27837fb52a.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Assets/windows/3.png b/Assets/windows/3.png new file mode 100644 index 0000000..1daf01b --- /dev/null +++ b/Assets/windows/3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c030e13a062e562afae60b6787abcc842d3cfe6000fb04ae0672e94934642b3c +size 24883 diff --git a/Assets/windows/3.png.import b/Assets/windows/3.png.import new file mode 100644 index 0000000..fa9310c --- /dev/null +++ b/Assets/windows/3.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/3.png-8cd85e1a01e81ed5ce496649eb5a3d23.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/windows/3.png" +dest_files=[ "res://.import/3.png-8cd85e1a01e81ed5ce496649eb5a3d23.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Assets/windows/terminal.png b/Assets/windows/terminal.png new file mode 100644 index 0000000..a98b7b6 --- /dev/null +++ b/Assets/windows/terminal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a36b18fba148a2b39806ec46bd9d6d75990e46e60080320e8050e7e7401bfd0c +size 17968 diff --git a/Assets/windows/terminal.png.import b/Assets/windows/terminal.png.import new file mode 100644 index 0000000..e07bd08 --- /dev/null +++ b/Assets/windows/terminal.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/terminal.png-7762865b2ff0434ad1cdd13dcfda02c1.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/windows/terminal.png" +dest_files=[ "res://.import/terminal.png-7762865b2ff0434ad1cdd13dcfda02c1.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Elements/SquareWindow.tscn b/Elements/SquareWindow.tscn index 1b6725a..3990fc0 100755 --- a/Elements/SquareWindow.tscn +++ b/Elements/SquareWindow.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://Assets/windows/folder_square.png" type="Texture" id=1] [ext_resource path="res://Elements/Scripts/WindowHeader.gd" type="Script" id=2] @@ -6,6 +6,7 @@ [ext_resource path="res://Assets/warning2/2.png" type="Texture" id=4] [ext_resource path="res://Assets/warning2/3.png" type="Texture" id=5] [ext_resource path="res://Assets/warning2/0.png" type="Texture" id=6] +[ext_resource path="res://Assets/windows/terminal.png" type="Texture" id=7] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 555, 60 ) @@ -18,7 +19,7 @@ animations = [ { "frames": [ ExtResource( 6 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ) ], "loop": false, "name": "default", -"speed": 1.0 +"speed": 0.6 } ] [node name="Node2D" type="Node2D"] @@ -67,7 +68,31 @@ script = ExtResource( 2 ) position = Vector2( 488, -321 ) shape = SubResource( 2 ) +[node name="Window3" type="Sprite" parent="."] +visible = false +position = Vector2( 56.9999, -12 ) +scale = Vector2( 0.4, 0.4 ) +texture = ExtResource( 7 ) + +[node name="Area2D" type="Area2D" parent="Window3"] +position = Vector2( 487.5, -490 ) +script = ExtResource( 2 ) + +[node name="Header" type="CollisionShape2D" parent="Window3/Area2D"] +position = Vector2( -489.5, 171 ) +scale = Vector2( 0.999999, 0.999999 ) +shape = SubResource( 1 ) + +[node name="Area2D2" type="Area2D" parent="Window3"] +script = ExtResource( 2 ) + +[node name="CloseButton" type="CollisionShape2D" parent="Window3/Area2D2"] +position = Vector2( 488, -321 ) +shape = SubResource( 2 ) + [connection signal="input_event" from="Window/Area2D" to="Window/Area2D" method="_on_Area2D_input_event"] [connection signal="input_event" from="Window/Area2D2" to="Window/Area2D" method="_on_Area2D2_input_event"] [connection signal="input_event" from="Window2/Area2D" to="Window2/Area2D" method="_on_Area2D_input_event"] [connection signal="input_event" from="Window2/Area2D2" to="Window/Area2D" method="_on_Area2D2_input_event"] +[connection signal="input_event" from="Window3/Area2D" to="Window3/Area2D" method="_on_Area2D_input_event"] +[connection signal="input_event" from="Window3/Area2D2" to="Window/Area2D" method="_on_Area2D2_input_event"] diff --git a/Scenes/DesktopScreen.tscn b/Scenes/DesktopScreen.tscn index a9b5112..327fc8d 100755 --- a/Scenes/DesktopScreen.tscn +++ b/Scenes/DesktopScreen.tscn @@ -65,4 +65,27 @@ autoplay = true [node name="Alert" type="AudioStreamPlayer" parent="."] stream = ExtResource( 13 ) +[node name="Terminal" parent="." instance=ExtResource( 2 )] +position = Vector2( 931, 120 ) + +[node name="Screen" parent="Terminal" instance=ExtResource( 9 )] +visible = false +position = Vector2( -304, 200 ) + +[node name="Button2" type="Button" parent="Terminal/Screen"] +margin_left = -90.0 +margin_top = -36.0 +margin_right = 187.0 +margin_bottom = 33.0 +theme = SubResource( 1 ) +custom_colors/font_color = Color( 1, 1, 1, 1 ) +custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 ) +custom_fonts/font = ExtResource( 8 ) +custom_styles/hover = ExtResource( 6 ) +custom_styles/pressed = ExtResource( 5 ) +custom_styles/normal = ExtResource( 4 ) +text = "./hack" +script = ExtResource( 3 ) + [connection signal="pressed" from="Directory/Screen/Button2" to="Directory/Screen/Button2" method="_on_Button_pressed"] +[connection signal="pressed" from="Terminal/Screen/Button2" to="Terminal/Screen/Button2" method="_on_Button_pressed"] diff --git a/Scenes/Scripts/Desktop.gd b/Scenes/Scripts/Desktop.gd index 562f8dc..3eecdae 100755 --- a/Scenes/Scripts/Desktop.gd +++ b/Scenes/Scripts/Desktop.gd @@ -6,41 +6,67 @@ onready var mainMusic = $"MainMusic" onready var eyeMusic = $"EyeMusic" onready var alert = $"Alert" onready var directory = $"Directory" +onready var terminal = $"Terminal" var rng = RandomNumberGenerator.new() const texture_file = preload("res://Assets/dossier/1.png") +const texture_terminal = preload("res://Assets/dossier/2.png") #à modifier # Called when the node enters the scene tree for the first time. func _ready() -> void: + + var icon = terminal.get_node("Sprite") + var window = terminal.get_node("Screen") + var button_window = window.get_node("Button2") + var name_term = terminal.get_node("Label") + var scale_icon = 0.35 + rng.randomize() - var nbDossier = rng.randi_range(0, 3) + var nbDossier = rng.randi_range(4, 10) for i in range(nbDossier): var dossier = directory.duplicate() - var icon = dossier.get_node("Sprite") - var window = dossier.get_node("Screen") - var button_window = window.get_node("Button2") # Une chance sur 2 d'avoir une icône if rng.randi_range(0, 1) == 0: # Text (icon) - var name_icon = dossier.get_node("Label") + icon = directory.get_node("Sprite") + window = directory.get_node("Screen") + button_window = window.get_node("Button2") + var name_icon = directory.get_node("Label") name_icon.text = "Fichier" # Texture (icon) - var scale_icon = 0.35 icon.scale = Vector2(scale_icon, scale_icon) icon.texture = texture_file # Background (window) window.get_node("Window").visible = false window.get_node("Window2").visible = true + window.get_node("Window3").visible = false # Change button visibility button_window.visible = false + var posY = i%4 + var posX = i/4 + if(posX == 0) : posY +=1 button_window.focus_mode = Button.FOCUS_NONE - dossier.position = Vector2(dossier.position.x, dossier.position.y + 150 * (i + 1)) + dossier.position = Vector2(dossier.position.x + (150 * posX), dossier.position.y + 150 * (posY)) dossier.set_z_index(dossier.get_z_index() + 10 * (i + 1)) add_child(dossier) + + + icon = terminal.get_node("Sprite") + window = terminal.get_node("Screen") + name_term.text = "Terminal" + scale_icon = 0.05 + icon.scale = Vector2(scale_icon, scale_icon) + icon.texture = texture_terminal + # Background (window) + window.get_node("Window").visible = false + window.get_node("Window2").visible = false + window.get_node("Window3").visible = true + # Change button visibility + button_window.visible = false # Called every frame. 'delta' is the elapsed time since the previous frame.