forked from team-sg/hero-mark-2
layout of scoreboards menu
This commit is contained in:
parent
92b4dbe5a8
commit
c5a3a002b6
5 changed files with 366 additions and 1 deletions
18
menus/score_entry.gd
Normal file
18
menus/score_entry.gd
Normal file
|
@ -0,0 +1,18 @@
|
|||
tool
|
||||
extends HBoxContainer
|
||||
|
||||
export var place: int = 0 setget _set_place
|
||||
export var user: String = "Username" setget _set_user
|
||||
export var score: String = "00000" setget _set_score
|
||||
|
||||
func _set_place(value: int) -> void:
|
||||
place = value
|
||||
$Place.text = " %01d " % place
|
||||
|
||||
func _set_user(value: String) -> void:
|
||||
user = value
|
||||
$User.text = user
|
||||
|
||||
func _set_score(value: String) -> void:
|
||||
score = value
|
||||
$Score.text = score
|
30
menus/score_entry.tscn
Normal file
30
menus/score_entry.tscn
Normal file
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://ui/theme.tres" type="Theme" id=1]
|
||||
[ext_resource path="res://menus/score_entry.gd" type="Script" id=2]
|
||||
|
||||
[node name="ScoreEntry" type="HBoxContainer"]
|
||||
margin_right = 210.0
|
||||
margin_bottom = 10.0
|
||||
theme = ExtResource( 1 )
|
||||
custom_constants/separation = 8
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Place" type="Label" parent="."]
|
||||
margin_right = 21.0
|
||||
margin_bottom = 10.0
|
||||
text = " 0 "
|
||||
|
||||
[node name="User" type="Label" parent="."]
|
||||
margin_left = 29.0
|
||||
margin_right = 167.0
|
||||
margin_bottom = 10.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Username"
|
||||
|
||||
[node name="Score" type="Label" parent="."]
|
||||
margin_left = 175.0
|
||||
margin_right = 210.0
|
||||
margin_bottom = 10.0
|
||||
text = "00000"
|
||||
align = 2
|
69
menus/scoreboards.gd
Normal file
69
menus/scoreboards.gd
Normal file
|
@ -0,0 +1,69 @@
|
|||
extends Node
|
||||
|
||||
|
||||
enum Completion {ANY, FULL}
|
||||
enum ScoreType {SCORE, TIME}
|
||||
|
||||
|
||||
const COMPLETION_NAMES = ["Any%", "100%"]
|
||||
const SCORE_TYPE_NAMES = ["Scores", "Times"]
|
||||
|
||||
|
||||
var selected_difficulty: int = Game.Difficulty.SPICY
|
||||
var selected_completion: int = Completion.ANY
|
||||
var selected_type: int = ScoreType.SCORE
|
||||
|
||||
|
||||
onready var level_title: Button = $"%LevelTitle"
|
||||
onready var back_arrow: TextureRect = $"%BackArrow"
|
||||
onready var next_arrow: TextureRect = $"%NextArrow"
|
||||
onready var difficulty: Button = $"%Difficulty"
|
||||
onready var completion: Button = $"%Completion"
|
||||
onready var type: Button = $"%Type"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
yield(get_tree(), "idle_frame")
|
||||
level_title.grab_focus()
|
||||
|
||||
|
||||
# reload scores from newgrounds
|
||||
func reload_scores() -> void:
|
||||
pass
|
||||
|
||||
|
||||
# show arrows when level is focused
|
||||
func _on_LevelTitle_focus_entered() -> void:
|
||||
back_arrow.visible = true
|
||||
next_arrow.visible = true
|
||||
|
||||
# hide arrows when level not focused
|
||||
func _on_LevelTitle_focus_exited() -> void:
|
||||
back_arrow.visible = false
|
||||
next_arrow.visible = false
|
||||
|
||||
# detect left and right presses when level is focused
|
||||
func _on_LevelTitle_gui_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_left"):
|
||||
print("PREV")
|
||||
elif event.is_action_pressed("ui_right"):
|
||||
print("NEXT")
|
||||
|
||||
# difficulty selector
|
||||
func _on_Difficulty_pressed() -> void:
|
||||
selected_difficulty = posmod(selected_difficulty + 1, 4)
|
||||
difficulty.text = Game.DIFFICULTY_NAMES[selected_difficulty]
|
||||
reload_scores()
|
||||
|
||||
# completion amount selector
|
||||
func _on_Completion_pressed() -> void:
|
||||
selected_completion = posmod(selected_completion + 1, 2)
|
||||
completion.text = COMPLETION_NAMES[selected_completion]
|
||||
reload_scores()
|
||||
|
||||
# score type selector
|
||||
func _on_Type_pressed() -> void:
|
||||
selected_type = posmod(selected_type + 1, 2)
|
||||
type.text = SCORE_TYPE_NAMES[selected_type]
|
||||
reload_scores()
|
244
menus/scoreboards.tscn
Normal file
244
menus/scoreboards.tscn
Normal file
|
@ -0,0 +1,244 @@
|
|||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://shaders/ska_plane.gdshader" type="Shader" id=1]
|
||||
[ext_resource path="res://menus/scoreboards.gd" type="Script" id=2]
|
||||
[ext_resource path="res://shaders/wibble_wobble.gdshader" type="Shader" id=4]
|
||||
[ext_resource path="res://ui/theme.tres" type="Theme" id=5]
|
||||
[ext_resource path="res://graphics/hud/pause_arrow.png" type="Texture" id=6]
|
||||
[ext_resource path="res://menus/score_entry.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://ui/2ndpuberty_scholar_outline.fnt" type="BitmapFont" id=8]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=1]
|
||||
shader = ExtResource( 1 )
|
||||
shader_param/color_1 = Color( 0.615686, 0.670588, 0.984314, 1 )
|
||||
shader_param/color_2 = Color( 1, 0.709804, 0.984314, 1 )
|
||||
shader_param/checker_size = Vector2( 24, 12 )
|
||||
shader_param/pan_speed = Vector2( 0, 0 )
|
||||
shader_param/cycle_speed = Vector2( 8, -8 )
|
||||
shader_param/cycle_alternation = Vector2( 0, 1 )
|
||||
shader_param/uv_transform = Transform2D( 1, 0, 1, 1, 0, 0 )
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=2]
|
||||
shader = ExtResource( 4 )
|
||||
shader_param/speed = Vector2( 4, 0 )
|
||||
shader_param/ammount = Vector2( 2, 0 )
|
||||
shader_param/offset = Vector2( 0, 0 )
|
||||
shader_param/delay = Vector2( 0, 0 )
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=3]
|
||||
shader = ExtResource( 4 )
|
||||
shader_param/speed = Vector2( 4, 0 )
|
||||
shader_param/ammount = Vector2( 2, 0 )
|
||||
shader_param/offset = Vector2( 0, 0 )
|
||||
shader_param/delay = Vector2( 4, 0 )
|
||||
|
||||
[node name="Scoreboards" type="Node"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Background" type="ColorRect" parent="."]
|
||||
material = SubResource( 1 )
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="BoardsScreen" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 5 )
|
||||
custom_constants/separation = 0
|
||||
|
||||
[node name="SelectLevel" type="HBoxContainer" parent="BoardsScreen"]
|
||||
margin_right = 256.0
|
||||
margin_bottom = 16.0
|
||||
rect_min_size = Vector2( 0, 16 )
|
||||
alignment = 1
|
||||
|
||||
[node name="BackArrow" type="TextureRect" parent="BoardsScreen/SelectLevel"]
|
||||
unique_name_in_owner = true
|
||||
material = SubResource( 2 )
|
||||
margin_left = 72.0
|
||||
margin_top = 4.0
|
||||
margin_right = 78.0
|
||||
margin_bottom = 12.0
|
||||
focus_mode = 2
|
||||
size_flags_vertical = 4
|
||||
texture = ExtResource( 6 )
|
||||
flip_h = true
|
||||
|
||||
[node name="LevelTitle" type="Button" parent="BoardsScreen/SelectLevel"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 82.0
|
||||
margin_top = 3.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 13.0
|
||||
focus_neighbour_left = NodePath(".")
|
||||
focus_neighbour_right = NodePath(".")
|
||||
focus_neighbour_bottom = NodePath("../../SelectScoreType/Completion")
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource( 5 )
|
||||
custom_colors/font_color_focus = Color( 1, 0.968627, 0.709804, 1 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_fonts/font = ExtResource( 8 )
|
||||
text = "Verdant Hills"
|
||||
|
||||
[node name="NextArrow" type="TextureRect" parent="BoardsScreen/SelectLevel"]
|
||||
unique_name_in_owner = true
|
||||
material = SubResource( 3 )
|
||||
margin_left = 177.0
|
||||
margin_top = 4.0
|
||||
margin_right = 183.0
|
||||
margin_bottom = 12.0
|
||||
focus_mode = 2
|
||||
size_flags_vertical = 4
|
||||
texture = ExtResource( 6 )
|
||||
|
||||
[node name="SelectScoreType" type="HBoxContainer" parent="BoardsScreen"]
|
||||
margin_top = 16.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 32.0
|
||||
rect_min_size = Vector2( 0, 16 )
|
||||
alignment = 1
|
||||
|
||||
[node name="Difficulty" type="Button" parent="BoardsScreen/SelectScoreType"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 52.0
|
||||
margin_top = 3.0
|
||||
margin_right = 100.0
|
||||
margin_bottom = 13.0
|
||||
rect_min_size = Vector2( 48, 0 )
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource( 5 )
|
||||
custom_colors/font_color_focus = Color( 1, 0.968627, 0.709804, 1 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_fonts/font = ExtResource( 8 )
|
||||
text = "Spicy"
|
||||
|
||||
[node name="Completion" type="Button" parent="BoardsScreen/SelectScoreType"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 104.0
|
||||
margin_top = 3.0
|
||||
margin_right = 152.0
|
||||
margin_bottom = 13.0
|
||||
rect_min_size = Vector2( 48, 0 )
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource( 5 )
|
||||
custom_colors/font_color_focus = Color( 1, 0.968627, 0.709804, 1 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_fonts/font = ExtResource( 8 )
|
||||
text = "Any%"
|
||||
icon_align = 1
|
||||
|
||||
[node name="Type" type="Button" parent="BoardsScreen/SelectScoreType"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 156.0
|
||||
margin_top = 3.0
|
||||
margin_right = 204.0
|
||||
margin_bottom = 13.0
|
||||
rect_min_size = Vector2( 48, 0 )
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource( 5 )
|
||||
custom_colors/font_color_focus = Color( 1, 0.968627, 0.709804, 1 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_fonts/font = ExtResource( 8 )
|
||||
text = "Scores"
|
||||
|
||||
[node name="Scoreboard" type="MarginContainer" parent="BoardsScreen"]
|
||||
margin_top = 32.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 192.0
|
||||
size_flags_vertical = 3
|
||||
custom_constants/margin_right = 16
|
||||
custom_constants/margin_left = 16
|
||||
custom_constants/margin_bottom = 16
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="BoardsScreen/Scoreboard"]
|
||||
margin_left = 16.0
|
||||
margin_right = 240.0
|
||||
margin_bottom = 144.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="BoardsScreen/Scoreboard/PanelContainer"]
|
||||
margin_left = 3.0
|
||||
margin_top = 3.0
|
||||
margin_right = 221.0
|
||||
margin_bottom = 141.0
|
||||
custom_constants/margin_right = 4
|
||||
custom_constants/margin_top = 4
|
||||
custom_constants/margin_left = 4
|
||||
custom_constants/margin_bottom = 4
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer"]
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 214.0
|
||||
margin_bottom = 134.0
|
||||
|
||||
[node name="Header" type="HBoxContainer" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer"]
|
||||
margin_right = 210.0
|
||||
margin_bottom = 10.0
|
||||
custom_constants/separation = 8
|
||||
|
||||
[node name="Place" type="Label" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Header"]
|
||||
margin_right = 21.0
|
||||
margin_bottom = 10.0
|
||||
text = " # "
|
||||
|
||||
[node name="User" type="Label" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Header"]
|
||||
margin_left = 29.0
|
||||
margin_right = 160.0
|
||||
margin_bottom = 10.0
|
||||
size_flags_horizontal = 3
|
||||
text = "User"
|
||||
|
||||
[node name="Score" type="Label" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Header"]
|
||||
margin_left = 168.0
|
||||
margin_right = 210.0
|
||||
margin_bottom = 10.0
|
||||
text = "Times "
|
||||
align = 2
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer"]
|
||||
margin_top = 14.0
|
||||
margin_right = 210.0
|
||||
margin_bottom = 18.0
|
||||
|
||||
[node name="Scores" type="VBoxContainer" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer"]
|
||||
margin_top = 22.0
|
||||
margin_right = 210.0
|
||||
margin_bottom = 130.0
|
||||
|
||||
[node name="ScoreEntry1" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Scores" instance=ExtResource( 7 )]
|
||||
score = "0:00.00"
|
||||
|
||||
[node name="ScoreEntry2" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Scores" instance=ExtResource( 7 )]
|
||||
margin_top = 14.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="ScoreEntry3" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Scores" instance=ExtResource( 7 )]
|
||||
margin_top = 28.0
|
||||
margin_bottom = 38.0
|
||||
|
||||
[node name="ScoreEntry4" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Scores" instance=ExtResource( 7 )]
|
||||
margin_top = 42.0
|
||||
margin_bottom = 52.0
|
||||
|
||||
[node name="ScoreEntry5" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Scores" instance=ExtResource( 7 )]
|
||||
margin_top = 56.0
|
||||
margin_bottom = 66.0
|
||||
|
||||
[node name="ScoreEntry6" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Scores" instance=ExtResource( 7 )]
|
||||
margin_top = 70.0
|
||||
margin_bottom = 80.0
|
||||
|
||||
[node name="ScoreEntry7" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Scores" instance=ExtResource( 7 )]
|
||||
margin_top = 84.0
|
||||
margin_bottom = 94.0
|
||||
|
||||
[node name="ScoreEntry8" parent="BoardsScreen/Scoreboard/PanelContainer/MarginContainer/VBoxContainer/Scores" instance=ExtResource( 7 )]
|
||||
margin_top = 98.0
|
||||
margin_bottom = 108.0
|
||||
|
||||
[connection signal="focus_entered" from="BoardsScreen/SelectLevel/LevelTitle" to="." method="_on_LevelTitle_focus_entered"]
|
||||
[connection signal="focus_exited" from="BoardsScreen/SelectLevel/LevelTitle" to="." method="_on_LevelTitle_focus_exited"]
|
||||
[connection signal="gui_input" from="BoardsScreen/SelectLevel/LevelTitle" to="." method="_on_LevelTitle_gui_input"]
|
||||
[connection signal="pressed" from="BoardsScreen/SelectScoreType/Difficulty" to="." method="_on_Difficulty_pressed"]
|
||||
[connection signal="pressed" from="BoardsScreen/SelectScoreType/Completion" to="." method="_on_Completion_pressed"]
|
||||
[connection signal="pressed" from="BoardsScreen/SelectScoreType/Type" to="." method="_on_Type_pressed"]
|
Loading…
Add table
Add a link
Reference in a new issue