Skip to content

Commit

Permalink
Bug fixes, sounds for feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwijuice56 committed Jul 8, 2024
1 parent 83c184e commit ea37886
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 2 deletions.
25 changes: 24 additions & 1 deletion game/main/ui/submenu/save/SaveFileMenu.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[gd_scene load_steps=16 format=3 uid="uid://d13tht5j1qxqq"]
[gd_scene load_steps=20 format=3 uid="uid://d13tht5j1qxqq"]

[ext_resource type="Theme" uid="uid://co20v1mxv2dfm" path="res://main/ui/_theme/theme.tres" id="1_vtqwt"]
[ext_resource type="Script" path="res://main/ui/submenu/save/save_file_menu.gd" id="2_djbua"]
[ext_resource type="PackedScene" uid="uid://3k2xt0kc4klb" path="res://main/ui/submenu/save/save_file_panel/SaveFilePanel.tscn" id="3_v1i8r"]
[ext_resource type="FontFile" uid="uid://b8lxwo5dkwrs4" path="res://main/ui/_theme/font/Poppins-Regular.ttf" id="4_0qhiq"]
[ext_resource type="Texture2D" uid="uid://skg5bmd8m812" path="res://main/ui/_icons/close.png" id="5_3a25r"]
[ext_resource type="AudioStream" uid="uid://dfb0hid704r07" path="res://main/ui/submenu/save/scribble.wav" id="6_1x0p7"]
[ext_resource type="AudioStream" uid="uid://bqxk8dirbvq1v" path="res://main/ui/submenu/save/crumble.wav" id="7_ao1vs"]

[sub_resource type="Theme" id="Theme_n7xkt"]
default_font = ExtResource("4_0qhiq")
Expand Down Expand Up @@ -145,6 +147,16 @@ _data = {
"exit": SubResource("Animation_obmfd")
}

[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_1lfs6"]
streams_count = 1
stream_0/stream = ExtResource("6_1x0p7")
stream_0/weight = 1.0

[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_nsldi"]
streams_count = 1
stream_0/stream = ExtResource("7_ao1vs")
stream_0/weight = 1.0

[node name="SaveFileMenu" type="Control" node_paths=PackedStringArray("anim", "back_button")]
visible = false
modulate = Color(1, 1, 1, 0)
Expand Down Expand Up @@ -217,6 +229,7 @@ layout_mode = 2
size_flags_vertical = 3
mouse_filter = 0
theme_override_styles/panel = SubResource("StyleBoxEmpty_r1ibo")
vertical_scroll_mode = 2

[node name="SaveFileContainer" type="VBoxContainer" parent="SaveContainer/PanelContainer/VBoxContainer/PanelContainer/ScrollContainer"]
unique_name_in_owner = true
Expand Down Expand Up @@ -271,3 +284,13 @@ libraries = {
"": SubResource("AnimationLibrary_01f6e")
}
speed_scale = 2.0

[node name="SavePlayer" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_1lfs6")
pitch_scale = 1.2

[node name="DeletePlayer" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_nsldi")
pitch_scale = 1.2
Binary file added game/main/ui/submenu/save/crumble.wav
Binary file not shown.
24 changes: 24 additions & 0 deletions game/main/ui/submenu/save/crumble.wav.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[remap]

importer="wav"
type="AudioStreamWAV"
uid="uid://bqxk8dirbvq1v"
path="res://.godot/imported/crumble.wav-0bcad40ad4450a1d92ca0eb283b50d73.sample"

[deps]

source_file="res://main/ui/submenu/save/crumble.wav"
dest_files=["res://.godot/imported/crumble.wav-0bcad40ad4450a1d92ca0eb283b50d73.sample"]

[params]

force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0
3 changes: 3 additions & 0 deletions game/main/ui/submenu/save/save_file_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func _ready() -> void:

func _on_save_selected() -> void:
deselect_panel()
%SavePlayer.play()
save_file_manager.overwrite_save_file(selected_panel.file)
refresh_panels()

Expand All @@ -37,12 +38,14 @@ func _on_file_selected(panel: SaveFilePanel) -> void:

func _on_delete_selected() -> void:
deselect_panel()
%DeletePlayer.play()
save_file_manager.delete_save_file(selected_panel.file)
refresh_panels()

func _on_text_submitted(text: String) -> void:
deselect_panel()
save_file_manager.create_save_file(text)
%SavePlayer.play()
%FileLabelEdit.text = ""
%FileLabelEdit.release_focus()
refresh_panels()
Expand Down
12 changes: 11 additions & 1 deletion game/main/ui/submenu/save/save_file_panel/SaveFilePanel.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=13 format=3 uid="uid://3k2xt0kc4klb"]
[gd_scene load_steps=15 format=3 uid="uid://3k2xt0kc4klb"]

[ext_resource type="Theme" uid="uid://co20v1mxv2dfm" path="res://main/ui/_theme/theme.tres" id="1_1uvf0"]
[ext_resource type="Script" path="res://main/ui/submenu/save/save_file_panel/save_file_panel.gd" id="1_ftssb"]
[ext_resource type="Texture2D" uid="uid://b58s8a6c6gamx" path="res://icon.png" id="3_5l22y"]
[ext_resource type="Shader" path="res://main/ui/submenu/save/save_file_panel/rounded_corner.gdshader" id="3_awtac"]
[ext_resource type="AudioStream" uid="uid://cpeuhkn4xf3e3" path="res://main/ui/button_click_sound.mp3" id="4_kp2fo"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wwijs"]
Expand Down Expand Up @@ -37,6 +38,11 @@ corner_radius_top_right = 8
corner_radius_bottom_right = 8
corner_radius_bottom_left = 8

[sub_resource type="ShaderMaterial" id="ShaderMaterial_0xwty"]
shader = ExtResource("3_awtac")
shader_parameter/radius = 1.0
shader_parameter/square_scale = 0.1

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_61jks"]
bg_color = Color(0.313726, 0.313726, 0.360784, 1)
border_width_left = 2
Expand Down Expand Up @@ -151,6 +157,7 @@ theme_override_font_sizes/font_size = 15
text = "2 MB"

[node name="Thumbnail" type="TextureRect" parent="MarginContainer/HBoxContainer"]
material = SubResource("ShaderMaterial_0xwty")
custom_minimum_size = Vector2(86, 86)
layout_mode = 2
size_flags_horizontal = 8
Expand All @@ -168,6 +175,7 @@ theme_override_constants/separation = 8
unique_name_in_owner = true
custom_minimum_size = Vector2(84, 0)
layout_mode = 2
focus_mode = 0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 21
theme_override_styles/normal = SubResource("StyleBoxFlat_61jks")
Expand All @@ -179,6 +187,7 @@ text = "save"
unique_name_in_owner = true
custom_minimum_size = Vector2(84, 0)
layout_mode = 2
focus_mode = 0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 21
theme_override_styles/normal = SubResource("StyleBoxFlat_61jks")
Expand All @@ -190,6 +199,7 @@ text = "load"
unique_name_in_owner = true
custom_minimum_size = Vector2(84, 0)
layout_mode = 2
focus_mode = 0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 21
theme_override_styles/normal = SubResource("StyleBoxFlat_61jks")
Expand Down
63 changes: 63 additions & 0 deletions game/main/ui/submenu/save/save_file_panel/rounded_corner.gdshader
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
shader_type canvas_item;
//https://gist.github.com/rohanrhu/11ffd387e1cc228d15bcea56fad4f593

uniform float radius: hint_range(0., 1.) = 1;
uniform float square_scale: hint_range(0., 1.) = 0.1;

void fragment() {
float sc = square_scale + square_scale/2.;
float r = square_scale + (1. - radius) * (square_scale/2.);

float scax = 1. - square_scale;

float dx;
float dy;
float d;
float a;

COLOR = texture(TEXTURE, UV);

if (UV.x < square_scale && UV.y > scax) {
dx = square_scale - UV.x;
dy = scax - UV.y;
d = sqrt(dx * dx + dy * dy);
a = asin(d);

if (a > r) {
COLOR.a = 0.;
}
}

if (UV.x < square_scale && UV.y < square_scale) {
dx = square_scale - UV.x;
dy = square_scale - UV.y;
d = sqrt(dx * dx + dy * dy);
a = asin(d);

if (a > r) {
COLOR.a = 0.;
}
}

if (UV.x > scax && UV.y < square_scale) {
dx = scax - UV.x;
dy = square_scale - UV.y;
d = sqrt(dx * dx + dy * dy);
a = asin(d);

if (a > r) {
COLOR.a = 0.;
}
}

if (UV.x > scax && UV.y > scax) {
dx = scax - UV.x;
dy = scax - UV.y;
d = sqrt(dx * dx + dy * dy);
a = asin(d);

if (a > r) {
COLOR.a = 0.;
}
}
}
3 changes: 3 additions & 0 deletions game/main/ui/submenu/save/save_file_panel/save_file_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ func _ready() -> void:
%ButtonContainer.visible = false

func _on_saved() -> void:
$AudioStreamPlayer.play()
saved.emit()

func _on_deleted() -> void:
$AudioStreamPlayer.play()
deleted.emit()

func _on_loaded() -> void:
$AudioStreamPlayer.play()
loaded.emit()

func _on_pressed() -> void:
Expand Down
Binary file added game/main/ui/submenu/save/scribble.wav
Binary file not shown.
24 changes: 24 additions & 0 deletions game/main/ui/submenu/save/scribble.wav.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[remap]

importer="wav"
type="AudioStreamWAV"
uid="uid://dfb0hid704r07"
path="res://.godot/imported/scribble.wav-b291fd9f364a237b6c44d2fb48973cbd.sample"

[deps]

source_file="res://main/ui/submenu/save/scribble.wav"
dest_files=["res://.godot/imported/scribble.wav-b291fd9f364a237b6c44d2fb48973cbd.sample"]

[params]

force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

0 comments on commit ea37886

Please sign in to comment.