players can now only select cards during their turn
This commit is contained in:
@@ -25,6 +25,7 @@ var _is_owned: bool
|
||||
|
||||
var _selected_card: PlayingCard = null
|
||||
var _cards_in_hand_ids: Array[int] = []
|
||||
var _allow_clicking_cards: bool = false
|
||||
|
||||
var _trump_id: int = -1
|
||||
var _first_played_card_id: int = -1
|
||||
@@ -109,6 +110,9 @@ func _get_card_distance(card_count: int) -> float:
|
||||
return _card_distance_min_others + ((_card_distance_max_others - _card_distance_min_others) * (1.0 - (float(card_count) / 19.0)))
|
||||
|
||||
func _on_card_clicked(playing_card: PlayingCard) -> void:
|
||||
if not _allow_clicking_cards:
|
||||
return
|
||||
|
||||
print("check card is " + str(_first_played_card_id))
|
||||
if not _is_card_allowed(
|
||||
playing_card.card_details.card_id,
|
||||
@@ -139,6 +143,13 @@ func _on_play_card_button_pressed() -> void:
|
||||
remove_card(_selected_card)
|
||||
_selected_card = null
|
||||
card_selected.emit(-1)
|
||||
_allow_clicking_cards = false
|
||||
|
||||
func allow_clicking_cards() -> void:
|
||||
_allow_clicking_cards = true
|
||||
|
||||
func disallow_clicking_cards() -> void:
|
||||
_allow_clicking_cards = false
|
||||
|
||||
func display_rank(rank: int, score: int) -> void:
|
||||
rank_label.text = "#{rank} ({pts} pts)".format({
|
||||
|
||||
Reference in New Issue
Block a user