played cards get removed from hands and (wrongly) added to the stack
This commit is contained in:
+3
-1
@@ -3,13 +3,15 @@ extends Node3D
|
||||
|
||||
var _card_height: float = 0.06
|
||||
|
||||
@export var playing_card_scene: PackedScene
|
||||
|
||||
func add_card(card: PlayingCard) -> void:
|
||||
var height = self.get_child_count() * _card_height
|
||||
self.add_child(card)
|
||||
card.translate(Vector3(0, height, 0))
|
||||
|
||||
func add_card_by_id(card_id: int) -> void:
|
||||
var playing_card: PlayingCard = PlayingCard.new()
|
||||
var playing_card: PlayingCard = playing_card_scene.instantiate()
|
||||
playing_card.setup_card_details(card_id)
|
||||
add_card(playing_card)
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ signal connection_status_changed(new_status: ConnectionStatus)
|
||||
# This signal is messy as fuck
|
||||
signal client_order_received(client_ids: Array[String], client_ids_playing_order: Array[String], client_names: Array[String])
|
||||
|
||||
signal client_played_card(client_id: String, card_id: int)
|
||||
signal received_expected_bet(client_id: String, expected_bet: int)
|
||||
signal new_round_started()
|
||||
signal cards_received(cards: Dictionary)
|
||||
@@ -159,6 +160,7 @@ func _handle_response(response: String) -> void:
|
||||
notify_play_card_request.emit.call_deferred()
|
||||
"play_card":
|
||||
print(data)
|
||||
#client_played_card.emit.call_deferred(data["client_id"], data["played_card"])
|
||||
"determine_play_winner_request": # single card go-around
|
||||
received_play_winner_request.emit.call_deferred()
|
||||
"end_game_request":
|
||||
|
||||
@@ -49,6 +49,12 @@ func add_cards(card_ids: Array[int], is_owned: bool) -> void:
|
||||
add_card(card)
|
||||
await get_tree().create_timer(0.16).timeout
|
||||
|
||||
func remove_card_by_id(card_id: int) -> void:
|
||||
for card in card_container.get_children():
|
||||
if card.card_details.card_id == card_id:
|
||||
remove_card(card)
|
||||
return
|
||||
|
||||
func remove_card(card: PlayingCard) -> void:
|
||||
card_container.remove_child(card)
|
||||
card.queue_free()
|
||||
|
||||
@@ -89,6 +89,8 @@ func _on_web_client_tcp_cards_received(cards: Dictionary) -> void:
|
||||
func _on_web_client_tcp_received_played_card(client_id: String, card_id: int) -> void:
|
||||
print(client_id + " played card " + str(card_id))
|
||||
_plays.append(Play.new(client_id, card_id))
|
||||
hand_associations[client_id].remove_card_by_id(card_id)
|
||||
card_stack.add_card_by_id(card_id)
|
||||
|
||||
func _on_web_client_tcp_received_play_winner_request() -> void:
|
||||
if not $"../HBoxContainer/GameUI"._is_host:
|
||||
@@ -106,11 +108,8 @@ func _on_web_client_tcp_received_play_winner_request() -> void:
|
||||
|
||||
func _on_web_client_tcp_trump_received(trump_id: int) -> void:
|
||||
_trump_id = trump_id
|
||||
var trump_card: PlayingCard = card_scene.instantiate()
|
||||
trump_card.setup_card_details(_trump_id)
|
||||
#trump_container.add_child(trump_card)
|
||||
card_stack.purge_cards()
|
||||
card_stack.add_card(trump_card)
|
||||
card_stack.add_card_by_id(_trump_id)
|
||||
|
||||
func _on_web_client_tcp_new_round_started() -> void:
|
||||
# prepare a fresh BetResults bunch for the new round! the clients are hungry.
|
||||
|
||||
@@ -276,6 +276,7 @@ transform = Transform3D(0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0, 0, 0.704226)
|
||||
[node name="CardStack" type="Marker3D" parent="EnvironmentManager"]
|
||||
transform = Transform3D(0.957037, -0.289967, -1.26749e-08, 1.48302e-15, -4.37114e-08, 1, -0.289967, -0.957036, -4.18334e-08, -0.0775449, 0.372575, 0.973012)
|
||||
script = ExtResource("8_j5wjh")
|
||||
playing_card_scene = ExtResource("6_eow3j")
|
||||
|
||||
[connection signal="cards_received" from="WebClientTCP" to="EnvironmentManager" method="_on_web_client_tcp_cards_received"]
|
||||
[connection signal="client_joined_lobby" from="WebClientTCP" to="HBoxContainer/ClientInterface" method="_on_web_client_tcp_client_joined_lobby"]
|
||||
|
||||
Reference in New Issue
Block a user