feat(ui): sort hand by rank+suit before render
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class_name HandArea
|
||||
extends HBoxContainer
|
||||
extends FlowContainer
|
||||
|
||||
signal cards_selected(selected: Array)
|
||||
signal hint_requested()
|
||||
@@ -17,7 +17,13 @@ func update_hand(hand: Array) -> void:
|
||||
cn.queue_free()
|
||||
card_nodes.clear()
|
||||
selected_cards.clear()
|
||||
|
||||
var sorted_hand: Array[Card] = []
|
||||
for c in hand:
|
||||
sorted_hand.append(c)
|
||||
sorted_hand.sort_custom(func(a: Card, b: Card): return a.compare_to(b) < 0)
|
||||
|
||||
for c in sorted_hand:
|
||||
var node := CARD_SCENE.instantiate() as CardNode
|
||||
if node == null:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user