Initial leaderboard scene

This commit is contained in:
Manuel 2023-10-02 22:03:17 +02:00
parent 6c6125956d
commit 4a7809694c
Signed by: Manuel
GPG key ID: 4085037435E1F07A
4 changed files with 410 additions and 2 deletions

30
src/gui/menu/scores.gd Normal file
View file

@ -0,0 +1,30 @@
extends Control
@export var level_select: Control
@export var first_selection: Control
@export var level_first_selection: Control
@export var leaderboard: Control
# Called when the node enters the scene tree for the first time.
func _ready():
first_selection.grab_focus()
func _on_quit_button_pressed():
get_tree().quit()
func _on_back_button_pressed():
level_select.hide()
func _on_level_button_pressed(level:int):
load_level("res://src/game/levels/level_%s.tscn" % level)
func load_level(path: String):
leaderboard.show()
load_leaderboard_content()
func load_leaderboard_content(level: String):

380
src/gui/menu/scores.tscn Normal file
View file

@ -0,0 +1,380 @@
[gd_scene load_steps=8 format=3 uid="uid://daki40cyvwaoy"]
[ext_resource type="Script" path="res://src/gui/menu/main.gd" id="1_1gfw2"]
[ext_resource type="AudioStream" uid="uid://dh5jxxwim7ra8" path="res://assets/sounds/music/death_by_waveshaper.wav" id="2_t8ixe"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2u7je"]
bg_color = Color(1, 1, 1, 1)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color(0, 0, 0, 1)
border_blend = true
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_uo2yv"]
bg_color = Color(1, 1, 1, 1)
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sjhib"]
bg_color = Color(0, 0, 0, 1)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color(1, 1, 1, 1)
border_blend = true
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5it3g"]
bg_color = Color(0, 0, 0, 1)
corner_radius_top_left = 10
corner_radius_top_right = 10
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10
[sub_resource type="Theme" id="Theme_67fiq"]
Button/colors/font_color = Color(0, 0, 0, 1)
Button/colors/font_focus_color = Color(0, 0, 0, 1)
Button/colors/font_hover_color = Color(0, 0, 0, 1)
Button/colors/font_hover_pressed_color = Color(1, 1, 1, 1)
Button/colors/font_pressed_color = Color(1, 1, 1, 1)
Button/styles/hover = SubResource("StyleBoxFlat_2u7je")
Button/styles/normal = SubResource("StyleBoxFlat_uo2yv")
Button/styles/pressed = SubResource("StyleBoxFlat_sjhib")
Panel/styles/panel = SubResource("StyleBoxFlat_5it3g")
[node name="Menu" type="Control" node_paths=PackedStringArray("level_select", "level_first_selection")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 1.0
offset_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = SubResource("Theme_67fiq")
script = ExtResource("1_1gfw2")
level_select = NodePath("LevelSelect")
level_first_selection = NodePath("LevelSelect/VBoxContainer/VBoxContainer2/Row1/1")
[node name="LevelSelect" type="Panel" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -131.0
offset_top = -231.0
offset_right = 132.0
offset_bottom = 169.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="LevelSelect"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -86.5
offset_top = -65.0
offset_right = 85.5
offset_bottom = 127.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer2" type="VBoxContainer" parent="LevelSelect/VBoxContainer"]
layout_mode = 2
[node name="Row1" type="BoxContainer" parent="LevelSelect/VBoxContainer/VBoxContainer2"]
layout_mode = 2
[node name="1" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row1"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "1"
[node name="2" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row1"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "2"
[node name="3" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row1"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "3"
[node name="4" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row1"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "4"
[node name="Row2" type="BoxContainer" parent="LevelSelect/VBoxContainer/VBoxContainer2"]
layout_mode = 2
[node name="5" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row2"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "5"
[node name="6" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row2"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "6"
[node name="7" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row2"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "7"
[node name="8" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row2"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "8"
[node name="Row3" type="BoxContainer" parent="LevelSelect/VBoxContainer/VBoxContainer2"]
layout_mode = 2
[node name="9" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row3"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "9"
[node name="10" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row3"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "10"
[node name="11" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row3"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "11"
[node name="12" type="Button" parent="LevelSelect/VBoxContainer/VBoxContainer2/Row3"]
custom_minimum_size = Vector2(40, 40)
layout_mode = 2
size_flags_horizontal = 4
text = "12"
[node name="Label" type="Label" parent="LevelSelect"]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -52.0
offset_top = 24.0
offset_right = 52.0
offset_bottom = 50.0
grow_horizontal = 2
text = "LEVEL SELECT"
horizontal_alignment = 1
[node name="BackButton" type="Button" parent="LevelSelect"]
custom_minimum_size = Vector2(120, 40)
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -60.0
offset_top = -109.0
offset_right = 60.0
offset_bottom = -69.0
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
size_flags_vertical = 8
focus_neighbor_bottom = NodePath("../StartButton")
text = "BACK"
[node name="MenuMusic" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_t8ixe")
volume_db = -29.953
autoplay = true
bus = &"Music"
[node name="menubox" type="Control" parent="."]
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="LevelSelect2" type="Panel" parent="."]
visible = false
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -249.5
offset_top = -281.0
offset_right = 250.5
offset_bottom = 219.0
grow_horizontal = 2
grow_vertical = 2
[node name="ScrollContainer" type="ScrollContainer" parent="LevelSelect2"]
layout_mode = 2
offset_left = 50.0
offset_top = 100.0
offset_right = 450.0
offset_bottom = 400.0
[node name="VBoxContainer" type="VBoxContainer" parent="LevelSelect2/ScrollContainer"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="LevelSelect2/ScrollContainer/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="LevelSelect2/ScrollContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(50, 2.08165e-12)
layout_mode = 2
text = "1"
[node name="Label2" type="Label" parent="LevelSelect2/ScrollContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(170, 2.08165e-12)
layout_mode = 2
text = "Username"
[node name="Label3" type="Label" parent="LevelSelect2/ScrollContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Username"
[node name="Label" type="Label" parent="LevelSelect2"]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -52.0
offset_top = 24.0
offset_right = 52.0
offset_bottom = 50.0
grow_horizontal = 2
text = "LEADERBOARD"
horizontal_alignment = 1
[node name="BackButton" type="Button" parent="LevelSelect2"]
custom_minimum_size = Vector2(120, 40)
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -60.0
offset_top = -65.0
offset_right = 60.0
offset_bottom = -25.0
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
size_flags_vertical = 8
focus_neighbor_bottom = NodePath("../StartButton")
text = "BACK"
[node name="BackButton" type="Button" parent="LevelSelect2/BackButton"]
custom_minimum_size = Vector2(120, 40)
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = 81.5
offset_top = -40.0
offset_right = 201.5
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
size_flags_vertical = 8
focus_neighbor_bottom = NodePath("../StartButton")
text = "NEXT
"
[node name="BackButton" type="Button" parent="LevelSelect2/BackButton/BackButton"]
custom_minimum_size = Vector2(120, 40)
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -344.0
offset_top = -41.0
offset_right = -224.0
offset_bottom = -1.0
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
size_flags_vertical = 8
focus_neighbor_bottom = NodePath("../StartButton")
text = "PREVIOUS
"
[node name="Label2" type="Label" parent="LevelSelect2"]
layout_mode = 0
offset_left = 50.0
offset_top = 66.0
offset_right = 107.0
offset_bottom = 92.0
text = "Rank"
[node name="Label3" type="Label" parent="LevelSelect2"]
layout_mode = 0
offset_left = 106.0
offset_top = 66.0
offset_right = 163.0
offset_bottom = 92.0
text = "Name
"
[node name="Label4" type="Label" parent="LevelSelect2"]
layout_mode = 0
offset_left = 277.0
offset_top = 66.0
offset_right = 334.0
offset_bottom = 92.0
text = "Score
"
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row1/1" to="." method="_on_level_button_pressed" binds= [1]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row1/2" to="." method="_on_level_button_pressed" binds= [2]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row1/3" to="." method="_on_level_button_pressed" binds= [3]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row1/4" to="." method="_on_level_button_pressed" binds= [4]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row2/5" to="." method="_on_level_button_pressed" binds= [5]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row2/6" to="." method="_on_level_button_pressed" binds= [6]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row2/7" to="." method="_on_level_button_pressed" binds= [7]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row2/8" to="." method="_on_level_button_pressed" binds= [8]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row3/9" to="." method="_on_level_button_pressed" binds= [9]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row3/10" to="." method="_on_level_button_pressed" binds= [10]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row3/11" to="." method="_on_level_button_pressed" binds= [11]]
[connection signal="pressed" from="LevelSelect/VBoxContainer/VBoxContainer2/Row3/12" to="." method="_on_level_button_pressed" binds= [12]]
[connection signal="pressed" from="LevelSelect/BackButton" to="." method="_on_back_button_pressed"]
[connection signal="pressed" from="LevelSelect2/BackButton" to="." method="_on_back_button_pressed"]
[connection signal="pressed" from="LevelSelect2/BackButton/BackButton" to="." method="_on_back_button_pressed"]
[connection signal="pressed" from="LevelSelect2/BackButton/BackButton/BackButton" to="." method="_on_back_button_pressed"]

View file

@ -1,5 +1,4 @@
class_name Config class_name Config
extends Node
const Secrets = preload("secrets.gd") const Secrets = preload("secrets.gd")
const Path = "config.cfg" const Path = "config.cfg"

View file

@ -1,5 +1,4 @@
class_name RequestFactory class_name RequestFactory
extends Object
const headers = [ const headers = [
"Content-Type: application/json", "Content-Type: application/json",