Score table improvements

remotes/1705377932733043820/tmp_refs/heads/unbroken
unfa 2021-09-11 22:40:49 +02:00
parent 9626e509f9
commit fefc483cbe
2 changed files with 34 additions and 9 deletions

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

@ -224,9 +224,22 @@ func update_hud():
@rpc(any) 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)
var player = $Players.get_node(str(pid))
player.update_player(new_info)
if player_list.players.has(pid):
var old_name = player_list.get(pid).name
if old_name != new_info.name:
chat.chat_notification("Player [b]" + old_name + "[/b] changed name to [b]" + new_info.name + "[/b]")
var old_color = player_list.get(pid).color
if old_color != new_info.color:
#chat.chat_notification("Player [b]" + new_info.name + "[/b] changed color to [b][color=" + new_info.color.to_html() + "]" + new_info.name + "[/color][/b]")
$Players.get_node(str(pid)).update_color(pid)
elif get_tree().multiplayer.get_network_unique_id() == 1:
for i in player_list.players.keys(): #notify existing players the new one has joined
# if i != pid:
chat.rpc_id(i, &'chat_notification', "Player [b]" + new_info.name + "[/b] joined")
player_list.set(pid, new_info) # server relays other PID's data
@ -234,7 +247,7 @@ func update_hud():
update_hud()
#if pid == get_tree().multiplayer.get_network_unique_id():
func push_local_player_info():
func push_local_player_info(): #
var id = get_tree().multiplayer.get_network_unique_id()
#print("PLayer info vsr2str: ", var2str(player_list.get(id)) )
@ -250,7 +263,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: