This commit is contained in:
Jan Heemstra 2021-09-11 22:45:17 +02:00
commit 6adcedafc1
3 changed files with 22 additions and 9 deletions

View file

@ -11,6 +11,8 @@ func _ready():
pass # Replace with function body.
func update_score_table():
$ScoreTable/VBoxContainer/ScoreTab.text = ''
var scores = []
for i in main.player_list.players.keys():
@ -27,9 +29,7 @@ func update_score_table():
func score_table(show := true):
if show:
$ScoreTable/VBoxContainer/ScoreTab.text = ''
update_score_table()
$ScoreTable.show()
else:
$ScoreTable.hide()

View file

@ -1,10 +1,10 @@
[gd_scene load_steps=12 format=3 uid="uid://bff5uslrxesjx"]
[gd_scene load_steps=13 format=3 uid="uid://bff5uslrxesjx"]
[ext_resource type="Texture2D" uid="uid://dlw3sb5tygqf4" path="res://Assets/HUD/Vignette.png" id="1"]
[ext_resource type="Texture2D" uid="uid://blnjjtjifk22i" path="res://Assets/HUD/Vignette.png" id="1"]
[ext_resource type="Script" path="res://Assets/HUD/HUD.gd" id="1_wc430"]
[ext_resource type="Texture2D" uid="uid://cjfjsnff41st1" path="res://Assets/HUD/Crosshair.png" id="2"]
[ext_resource type="AudioStream" uid="uid://cbehcynykrbqn" path="res://Assets/SFX/UI_Confirm_Kill.wav" id="3"]
[ext_resource type="AudioStream" uid="uid://b4th1lwwyw40k" path="res://Assets/SFX/UI_Confirm_Hit.wav" id="4"]
[ext_resource type="Texture2D" uid="uid://cvckx0ssydl4d" path="res://Assets/HUD/Crosshair.png" id="2"]
[ext_resource type="AudioStream" uid="uid://bomutmdekfv3m" path="res://Assets/SFX/UI_Confirm_Kill.wav" id="3"]
[ext_resource type="AudioStream" uid="uid://184gasqdlb20" path="res://Assets/SFX/UI_Confirm_Hit.wav" id="4"]
[ext_resource type="Script" path="res://Assets/HUD/Crosshair.gd" id="5"]
[ext_resource type="Script" path="res://Assets/HUD/Chat.gd" id="6"]
[ext_resource type="Theme" uid="uid://ddtu7o1dbp0s8" path="res://Assets/HUD/Theme.tres" id="7"]
@ -85,6 +85,8 @@ tracks/1/keys = {
"times": PackedFloat32Array(0)
}
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_j0kta"]
[node name="HUD" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
@ -257,6 +259,8 @@ __meta__ = {
[node name="ScoreTable" type="Panel" parent="."]
visible = false
self_modulate = Color(1, 1, 1, 0.501961)
material = SubResource( "CanvasItemMaterial_j0kta" )
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
@ -297,6 +301,14 @@ offset_right = 619.0
offset_bottom = 315.0
size_flags_horizontal = 3
size_flags_vertical = 3
text = "blah
blblblbblbl
blblb
blb
lb
lb
lb
lblblbbl"
custom_effects = []
structured_text_bidi_override_options = []
script = null

View file

@ -214,6 +214,7 @@ func update_hud():
@rpc(any, reliable) func player_list_update(info, pid = get_tree().get_rpc_sender_id()):
var new_info = PlayerInfo.new()
new_info.deserialize(info)
print("Recieved player info: ", info)
if player_list.players.has(pid):
var old_name = player_list.get(pid).name
@ -228,7 +229,7 @@ func update_hud():
# update local HUD
update_hud()
func push_local_player_info():
func push_local_player_info(): #
var id = get_tree().multiplayer.get_network_unique_id()
rpc(&'player_list_update', player_list.get(id).serialize(), get_tree().multiplayer.get_network_unique_id())
@ -239,7 +240,7 @@ func push_local_player_info():
assert(player_node != null, "Attempting to delete a player node that does not exist")
player_node.name = str(player_node.name) + "_dead" # avoids name collision when instancing another player scene
player_node.queue_free()
spawn_queue[pid] = uptime + respawn_delay
func create_player(pid: int, is_local:= false, respawn:= false) -> void: