Compare commits
3 commits
v0.0.0-rc.
...
trunk
Author | SHA1 | Date | |
---|---|---|---|
e672567b3d | |||
cb480406c0 | |||
|
20466ed45f |
6 changed files with 96 additions and 2 deletions
|
@ -1,7 +1,9 @@
|
||||||
[gd_scene load_steps=5 format=4 uid="uid://co1x3hlc2efr6"]
|
[gd_scene load_steps=7 format=4 uid="uid://co1x3hlc2efr6"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/match/ui/opponent_name.gd" id="1_saby1"]
|
[ext_resource type="Script" path="res://scripts/match/ui/opponent_name.gd" id="1_saby1"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/match/ui/player_money.gd" id="2_3jcub"]
|
||||||
[ext_resource type="TileSet" uid="uid://cvp867israfjk" path="res://tile_set.tres" id="3_0etcd"]
|
[ext_resource type="TileSet" uid="uid://cvp867israfjk" path="res://tile_set.tres" id="3_0etcd"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/match/ui/player_hitpoints.gd" id="3_oc5vk"]
|
||||||
[ext_resource type="Script" path="res://scripts/match/map.gd" id="4_4c550"]
|
[ext_resource type="Script" path="res://scripts/match/map.gd" id="4_4c550"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_86u83"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_86u83"]
|
||||||
|
@ -34,6 +36,45 @@ scroll_active = false
|
||||||
autowrap_mode = 0
|
autowrap_mode = 0
|
||||||
script = ExtResource("1_saby1")
|
script = ExtResource("1_saby1")
|
||||||
|
|
||||||
|
[node name="Money" type="RichTextLabel" parent="UI/HUD"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -582.0
|
||||||
|
offset_top = -529.0
|
||||||
|
offset_right = -436.0
|
||||||
|
offset_bottom = -484.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "Test"
|
||||||
|
fit_content = true
|
||||||
|
scroll_active = false
|
||||||
|
autowrap_mode = 0
|
||||||
|
script = ExtResource("2_3jcub")
|
||||||
|
|
||||||
|
[node name="Hitpoints" type="RichTextLabel" parent="UI/HUD"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -946.0
|
||||||
|
offset_top = 479.0
|
||||||
|
offset_right = -800.0
|
||||||
|
offset_bottom = 524.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "HP
|
||||||
|
"
|
||||||
|
fit_content = true
|
||||||
|
scroll_active = false
|
||||||
|
autowrap_mode = 0
|
||||||
|
script = ExtResource("3_oc5vk")
|
||||||
|
|
||||||
[node name="Seperator" type="Panel" parent="UI/HUD"]
|
[node name="Seperator" type="Panel" parent="UI/HUD"]
|
||||||
custom_minimum_size = Vector2(4, 0)
|
custom_minimum_size = Vector2(4, 0)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
|
@ -2,6 +2,8 @@ extends Channel
|
||||||
|
|
||||||
signal on_match_update(msg: TowerPlacedMessage)
|
signal on_match_update(msg: TowerPlacedMessage)
|
||||||
signal on_invalid_placing(msg: InvalidPlacementMessage)
|
signal on_invalid_placing(msg: InvalidPlacementMessage)
|
||||||
|
signal on_money_update(msg: PlayerMoneyMessage)
|
||||||
|
signal on_hitpoints_update(msg: PlayerHitpointsMessage)
|
||||||
|
|
||||||
|
|
||||||
func get_channel_location() -> String:
|
func get_channel_location() -> String:
|
||||||
|
@ -17,7 +19,12 @@ func _process(_delta: float) -> void:
|
||||||
Message
|
Message
|
||||||
. deserialize(
|
. deserialize(
|
||||||
self.socket.get_packet().get_string_from_utf8(),
|
self.socket.get_packet().get_string_from_utf8(),
|
||||||
[TowerPlacedMessage, InvalidPlacementMessage],
|
[
|
||||||
|
TowerPlacedMessage,
|
||||||
|
InvalidPlacementMessage,
|
||||||
|
PlayerMoneyMessage,
|
||||||
|
PlayerHitpointsMessage,
|
||||||
|
],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
match msg.get_message_id():
|
match msg.get_message_id():
|
||||||
|
@ -25,6 +32,10 @@ func _process(_delta: float) -> void:
|
||||||
on_match_update.emit(msg)
|
on_match_update.emit(msg)
|
||||||
InvalidPlacementMessage.MESSAGE_ID:
|
InvalidPlacementMessage.MESSAGE_ID:
|
||||||
on_invalid_placing.emit(msg)
|
on_invalid_placing.emit(msg)
|
||||||
|
PlayerMoneyMessage.MESSAGE_ID:
|
||||||
|
on_money_update.emit(msg)
|
||||||
|
PlayerHitpointsMessage.MESSAGE_ID:
|
||||||
|
on_hitpoints_update.emit(msg)
|
||||||
_:
|
_:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
11
scripts/channel/match/player_hitpoints_message.gd
Normal file
11
scripts/channel/match/player_hitpoints_message.gd
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class_name PlayerHitpointsMessage
|
||||||
|
extends Message
|
||||||
|
|
||||||
|
const MESSAGE_ID: String = "PlayerHitpoints"
|
||||||
|
|
||||||
|
# gdlint:ignore = class-variable-name
|
||||||
|
@export var playerHitpoints: int
|
||||||
|
|
||||||
|
|
||||||
|
func get_message_id() -> String:
|
||||||
|
return MESSAGE_ID
|
11
scripts/channel/match/player_money_message.gd
Normal file
11
scripts/channel/match/player_money_message.gd
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class_name PlayerMoneyMessage
|
||||||
|
extends Message
|
||||||
|
|
||||||
|
const MESSAGE_ID: String = "PlayerMoney"
|
||||||
|
|
||||||
|
# gdlint:ignore = class-variable-name
|
||||||
|
@export var playerMoney: int
|
||||||
|
|
||||||
|
|
||||||
|
func get_message_id() -> String:
|
||||||
|
return MESSAGE_ID
|
10
scripts/match/ui/player_hitpoints.gd
Normal file
10
scripts/match/ui/player_hitpoints.gd
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
extends RichTextLabel
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
MatchChannel.connect("on_hitpoints_update", on_hitpoints_update)
|
||||||
|
|
||||||
|
|
||||||
|
func on_hitpoints_update(msg: PlayerHitpointsMessage) -> void:
|
||||||
|
print(msg.playerHitpoints, "test")
|
||||||
|
self.text = str(msg.playerHitpoints, "HP")
|
10
scripts/match/ui/player_money.gd
Normal file
10
scripts/match/ui/player_money.gd
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
extends RichTextLabel
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
MatchChannel.connect("on_money_update", on_money_update)
|
||||||
|
|
||||||
|
|
||||||
|
func on_money_update(msg: PlayerMoneyMessage) -> void:
|
||||||
|
print(msg.playerMoney, "test")
|
||||||
|
self.text = str(msg.playerMoney)
|
Loading…
Add table
Reference in a new issue