add score and playerkey list box style

This commit is contained in:
interfisch 2025-01-14 18:13:13 +01:00
parent 4b8a17ff44
commit febeb03ee9
4 changed files with 56 additions and 11 deletions

View file

@ -1,10 +1,22 @@
[gd_scene load_steps=9 format=3 uid="uid://cotth8e5rtioe"]
[gd_scene load_steps=11 format=3 uid="uid://cotth8e5rtioe"]
[ext_resource type="Script" path="res://scripts/game.gd" id="1_7syh4"]
[ext_resource type="Script" path="res://scripts/times.gd" id="2_80mhm"]
[ext_resource type="AudioStream" uid="uid://cdricwi06nttp" path="res://sounds/beep/countdown_beep_high.mp3" id="3_fdp2i"]
[ext_resource type="AudioStream" uid="uid://v3eqa857k2xo" path="res://sounds/beep/countdown_beep.mp3" id="3_fv4j3"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_61sjv"]
bg_color = Color(0.670588, 0.670588, 0.670588, 0.498039)
skew = Vector2(0.333, 0)
border_width_left = 4
border_color = Color(0.8, 0.8, 0.8, 0.752941)
expand_margin_left = 10.0
expand_margin_right = 14.0
[sub_resource type="Theme" id="Theme_lsv84"]
default_font_size = 40
Label/styles/normal = SubResource("StyleBoxFlat_61sjv")
[sub_resource type="Animation" id="Animation_ph30r"]
length = 0.001
tracks/0/type = "value"
@ -307,12 +319,13 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -483.861
offset_top = -287.132
offset_right = -425.861
offset_bottom = -210.132
offset_left = -64.5
offset_top = -57.0
offset_right = 64.5
offset_bottom = 57.0
grow_horizontal = 2
grow_vertical = 2
theme = SubResource("Theme_lsv84")
script = ExtResource("2_80mhm")
[node name="game_hud_animations" type="AnimationPlayer" parent="hud"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://b1uhymisifcho"]
[gd_scene load_steps=18 format=3 uid="uid://b1uhymisifcho"]
[ext_resource type="Script" path="res://scripts/menu.gd" id="1_fushn"]
[ext_resource type="Script" path="res://scripts/menudisplay.gd" id="2_jc4pv"]
@ -12,6 +12,19 @@
[ext_resource type="Texture2D" uid="uid://bst8p5s1sgurm" path="res://sprites/menu_bg.png" id="10_equk1"]
[ext_resource type="Texture2D" uid="uid://drgqjl330tj2p" path="res://scenes/map_preview/no_preview.png" id="11_3sx36"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_un5vh"]
bg_color = Color(0.699653, 0.699654, 0.699653, 0.388235)
border_color = Color(0.8, 0.8, 0.8, 0.752941)
corner_radius_top_left = 10
corner_radius_top_right = 10
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10
expand_margin_left = 5.0
expand_margin_right = 5.0
[sub_resource type="Theme" id="Theme_eo4i1"]
Label/styles/normal = SubResource("StyleBoxFlat_un5vh")
[sub_resource type="Curve" id="Curve_kioen"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
@ -77,61 +90,80 @@ text = "5"
[node name="MarginContainer" type="MarginContainer" parent="MenuDisplay"]
offset_left = 317.0
offset_top = 51.245
offset_right = 515.0
offset_right = 517.0
offset_bottom = 637.245
[node name="VBoxContainer_Playerlist" type="VBoxContainer" parent="MenuDisplay/MarginContainer"]
layout_mode = 2
theme = SubResource("Theme_eo4i1")
[node name="Label" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
text = "Press key"
text = "Hold Key"
uppercase = true
[node name="Label2" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
text = "to join"
uppercase = true
[node name="Label3" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label4" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label5" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label6" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label7" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label8" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label9" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label10" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
theme_override_font_sizes/font_size = 40
uppercase = true

View file

@ -25,6 +25,7 @@ func update_playerlist(players:Array[Gamestate.Player],flashplayer_keycode=-1,ef
if i<len(players):
var p=players[i]
label.text=str(OS.get_keycode_string(p.inputkey))
label.visible=true
if (p.inputkey==flashplayer_keycode): #this player should show an animation
if effect=="blink":
var outlinesize=min(max(0,label.get_theme_constant("outline_size")+ADD_STEP_OUTLINESIZE),MAX_OUTLINESIZE) #enlarge outline a bit
@ -45,6 +46,7 @@ func update_playerlist(players:Array[Gamestate.Player],flashplayer_keycode=-1,ef
label.set("theme_override_colors/font_color",p.color)
else:
label.text=""
label.visible=false
i+=1
func _process(delta: float) -> void:

View file

@ -1,6 +1,5 @@
extends HFlowContainer
const fontSize_mini=40
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@ -14,10 +13,9 @@ func _process(delta: float) -> void:
func addFinishedPlayer(playerid,finalTime):
print("Finished "+str(playerid)+" final time="+str(finalTime))
var place=get_child_count()+1
#print("New Label. Place "+str(place))
var newlabel= Label.new()
add_child(newlabel)
newlabel.set("theme_override_font_sizes/font_size",fontSize_mini)
#newlabel.set("theme_override_font_sizes/font_size",40)
newlabel.text=str(place)+": "+str(round(finalTime*1000)/1000.0)+"s"
newlabel.set("theme_override_colors/font_color",Gamestate.getPlayers()[playerid].color)