From 2e3b301d6133b6de16286b4af3f5bc2b97f5af2a Mon Sep 17 00:00:00 2001 From: Rob Kelly Date: Fri, 25 Apr 2025 10:16:28 -0600 Subject: [PATCH] Improved save icon --- assets/text/text.csv | 1 + src/props/text_terminal/text_terminal.tscn | 1 - src/ui/elements/save_icon/save_icon.tscn | 188 ++++++++++++++++++++- src/world/world.gd | 7 +- src/world/world.tscn | 9 +- 5 files changed, 189 insertions(+), 17 deletions(-) diff --git a/assets/text/text.csv b/assets/text/text.csv index b487ba4..afc322e 100644 --- a/assets/text/text.csv +++ b/assets/text/text.csv @@ -11,6 +11,7 @@ UI_LOCKED,Locked UI_QUIT,Quit UI_LOADING,Loading UI_DONE,Done! +UI_SAVING,Saving... , TITLE_WARNING_1,!WARNING! TITLE_WARNING_2,"This is a secure terminal system." diff --git a/src/props/text_terminal/text_terminal.tscn b/src/props/text_terminal/text_terminal.tscn index e3f4d03..c81cf35 100644 --- a/src/props/text_terminal/text_terminal.tscn +++ b/src/props/text_terminal/text_terminal.tscn @@ -19,7 +19,6 @@ unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.184204, 0.138956, 0.102927) pixel_size = 0.0002 modulate = Color(0, 1, 0.301961, 1) -text = "_" font = SubResource("SystemFont_twqjh") font_size = 90 outline_size = 36 diff --git a/src/ui/elements/save_icon/save_icon.tscn b/src/ui/elements/save_icon/save_icon.tscn index 653c037..1aebe3a 100644 --- a/src/ui/elements/save_icon/save_icon.tscn +++ b/src/ui/elements/save_icon/save_icon.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=12 format=3 uid="uid://brknr57xc2cp0"] +[gd_scene load_steps=19 format=3 uid="uid://brknr57xc2cp0"] [ext_resource type="Texture2D" uid="uid://b7ds08rj0yk7j" path="res://assets/ui/corpo_logo/corpo_logo_128_bg.png" id="1_1oh6t"] [ext_resource type="Texture2D" uid="uid://dixpjnlaj86x2" path="res://assets/ui/corpo_logo/corpo_logo_128.png" id="1_p2l3a"] [ext_resource type="Shader" uid="uid://dnytoirugot2e" path="res://src/shaders/canvas_grunk.gdshader" id="2_q367f"] [ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="3_8o5hc"] [ext_resource type="PackedScene" uid="uid://b6dx0ovy15g5o" path="res://src/effects/grunk_2d/grunk_2d.tscn" id="5_xrtbx"] +[ext_resource type="Theme" uid="uid://b07fevr214mmr" path="res://src/ui/hud/hud_theme.tres" id="6_t8g1i"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_8o5hc"] @@ -50,27 +51,198 @@ shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_d72jk") shader_parameter/mask_progress = 1.0 shader_parameter/mask_noise = SubResource("NoiseTexture2D_pgbvb") -[node name="SaveIcon" type="MarginContainer"] -offset_right = 40.0 -offset_bottom = 40.0 +[sub_resource type="Animation" id="Animation_jqm8y"] +resource_name = "blink" +length = 0.3 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.15, 0.3), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 1, +"values": [true, false, true] +} -[node name="IconBG" type="TextureRect" parent="."] +[sub_resource type="Animation" id="Animation_yor10"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_ovpa4"] +_data = { +&"RESET": SubResource("Animation_yor10"), +&"blink": SubResource("Animation_jqm8y") +} + +[sub_resource type="Animation" id="Animation_t8g1i"] +resource_name = "display" +length = 2.0 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("HBoxContainer/Label:visible_ratio") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.6, 0.8), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [0.0, 0.0, 1.0] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 1, 2), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)] +} +tracks/2/type = "method" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath(".") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(2), +"transitions": PackedFloat32Array(1), +"values": [{ +"args": [], +"method": &"queue_free" +}] +} + +[sub_resource type="Animation" id="Animation_ovpa4"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("HBoxContainer/Label:visible_ratio") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_lm3su"] +_data = { +&"RESET": SubResource("Animation_ovpa4"), +&"display": SubResource("Animation_t8g1i") +} + +[node name="SaveIcon" type="MarginContainer"] +offset_right = 348.0 +offset_bottom = 140.0 + +[node name="HBoxContainer" type="HBoxContainer" parent="."] layout_mode = 2 +alignment = 2 + +[node name="Control" type="Control" parent="HBoxContainer"] +custom_minimum_size = Vector2(140, 140) +layout_mode = 2 + +[node name="IconBG" type="TextureRect" parent="HBoxContainer/Control"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -70.0 +offset_top = -70.0 +offset_right = 70.0 +offset_bottom = 70.0 +grow_horizontal = 2 +grow_vertical = 2 size_flags_horizontal = 4 size_flags_vertical = 4 texture = ExtResource("1_1oh6t") stretch_mode = 2 -[node name="SaveIcon" type="TextureRect" parent="."] +[node name="SaveIcon" type="TextureRect" parent="HBoxContainer/Control"] clip_children = 2 texture_filter = 3 material = SubResource("ShaderMaterial_8o5hc") -layout_mode = 2 +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -64.0 +offset_top = -64.0 +offset_right = 64.0 +offset_bottom = 64.0 +grow_horizontal = 2 +grow_vertical = 2 size_flags_horizontal = 4 size_flags_vertical = 4 texture = ExtResource("1_p2l3a") stretch_mode = 2 -[node name="Grunk2D" parent="SaveIcon" instance=ExtResource("5_xrtbx")] +[node name="Grunk2D" parent="HBoxContainer/Control/SaveIcon" instance=ExtResource("5_xrtbx")] material = SubResource("ShaderMaterial_t8g1i") layout_mode = 1 + +[node name="Label" type="Label" parent="HBoxContainer"] +layout_mode = 2 +size_flags_vertical = 8 +theme = ExtResource("6_t8g1i") +theme_override_colors/font_color = Color(0.14, 1, 0.355, 1) +text = "UI_SAVING" +visible_characters = 0 +visible_ratio = 0.0 + +[node name="Blinker" type="Label" parent="HBoxContainer"] +layout_mode = 2 +size_flags_vertical = 8 +theme = ExtResource("6_t8g1i") +theme_override_colors/font_color = Color(0.14, 1, 0.355, 1) +text = "_" + +[node name="AnimationPlayer" type="AnimationPlayer" parent="HBoxContainer/Blinker"] +libraries = { +&"": SubResource("AnimationLibrary_ovpa4") +} +autoplay = "blink" + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +&"": SubResource("AnimationLibrary_lm3su") +} +autoplay = "display" diff --git a/src/world/world.gd b/src/world/world.gd index 5141505..592d065 100644 --- a/src/world/world.gd +++ b/src/world/world.gd @@ -15,12 +15,14 @@ class_name World extends Node @export var kill_screen_scene: PackedScene +@export var save_icon_scene: PackedScene + var current_level_scene: PackedScene var current_level: Level @onready var level_root: Node3D = %LevelRoot @onready var ui_root: Control = %UIRoot -@onready var save_icon: MarginContainer = %SaveIcon +@onready var save_icon_container: MarginContainer = %SaveIconContainer static var instance: World @@ -88,10 +90,9 @@ func on_game_over() -> void: func save_progress() -> void: print("Preparing save state...") - save_icon.show() + save_icon_container.add_child(save_icon_scene.instantiate()) var save := SaveState.serialize(self) var save_path := current_level.get_save_path() print("Writing save to ", save_path) ResourceSaver.save(save, save_path) - save_icon.hide() print("Done!") diff --git a/src/world/world.tscn b/src/world/world.tscn index f8f731c..a30f187 100644 --- a/src/world/world.tscn +++ b/src/world/world.tscn @@ -15,6 +15,7 @@ spook_manager = ExtResource("3_l0av5") initial_level = ExtResource("4_5kmgb") pause_scene = ExtResource("2_6fy3g") kill_screen_scene = ExtResource("6_l0av5") +save_icon_scene = ExtResource("7_5kmgb") [node name="LevelRoot" type="Node3D" parent="."] unique_name_in_owner = true @@ -29,16 +30,14 @@ grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 -[node name="SaveIcon" parent="UIRoot" instance=ExtResource("7_5kmgb")] +[node name="SaveIconContainer" type="MarginContainer" parent="UIRoot"] unique_name_in_owner = true -visible = false layout_mode = 1 anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 -offset_top = -140.0 -offset_right = 140.0 -offset_bottom = 0.0 +offset_top = -40.0 +offset_right = 40.0 grow_vertical = 0 theme_override_constants/margin_left = 32 theme_override_constants/margin_bottom = 32