-
-
Notifications
You must be signed in to change notification settings - Fork 106
CardContainer
Extends: Area2D
The CardContainer is meant to have Card objects as children nodes and arrange their indexing and visibility
const Anchors: Dictionary = {"BOTTOM_LEFT":8,"BOTTOM_MIDDLE":7,"BOTTOM_RIGHT":6,"CONTROL":9,"LEFT_MIDDLE":5,"NONE":0,"RIGHT_MIDDLE":4,"TOP_LEFT":3,"TOP_MIDDLE":2,"TOP_RIGHT":1}
The various automatic Anchors possible for a CardContainer NONE means the container will not stay anchored to the screen and will not adjust its position if the viewport changes. Use this setting if your game is not expected to use different resolutions or you want this CardContainer to be placed somewhere other than the edge of the viewport (although you could adjust that in code as well)
All other options will automatically adjust the position of the CardContainer if the resolution changes
export var placement = 0
Spefifies the anchor of the card on the screen layout This placement will be retained as the window is resized.
export var overlap_shift_direction = 0
Spefifies the anchor of the card on the screen layout This placement will be retained as the window is resized. In case of multiple CardContainers using the same anchor placement, specifies whether this container should displace itself to make space for the others, and how.
export var index_shift_priority = 0
Spefifies the anchor of the card on the screen layout This placement will be retained as the window is resized. In case of multiple CardContainers using the same anchor placement, specifies whether this container should displace itself to make space for the others, and how. In case of multiple CardContainers using the same anchor placement specifies which container should be displaced more.
export var card_size: Vector2 = "(150, 240)"
Spefifies the anchor of the card on the screen layout This placement will be retained as the window is resized. In case of multiple CardContainers using the same anchor placement, specifies whether this container should displace itself to make space for the others, and how. In case of multiple CardContainers using the same anchor placement specifies which container should be displaced more.
export var show_manipulation_buttons: bool = true
If set to false, no manipulation buttons will appear when hovering over this container.
var accumulated_shift: Vector2
Used for debugging Stores how much this container has moved from its original anchor placement as a result of other containers sharing the same anchor placement
var manipulation_buttons: Node
Used for debugging Stores how much this container has moved from its original anchor placement as a result of other containers sharing the same anchor placement ManipulationButtons node
var manipulation_buttons_tween: Node
Used for debugging Stores how much this container has moved from its original anchor placement as a result of other containers sharing the same anchor placement ManipulationButtons node ManipulationButtons tween node
var control: Node
Used for debugging Stores how much this container has moved from its original anchor placement as a result of other containers sharing the same anchor placement ManipulationButtons node ManipulationButtons tween node Control node
var shuffle_button: Node
Used for debugging Stores how much this container has moved from its original anchor placement as a result of other containers sharing the same anchor placement ManipulationButtons node ManipulationButtons tween node Control node Shuffle button
var highlight: Node
Used for debugging Stores how much this container has moved from its original anchor placement as a result of other containers sharing the same anchor placement ManipulationButtons node ManipulationButtons tween node Control node Shuffle button Container higlight
func are_cards_still_animating() -> bool
func hide_buttons() -> void
Hides manipulation buttons
func show_buttons() -> void
Shows manipulation buttons
func get_all_manipulation_buttons() -> Array
Getter for all_manipulation_buttons
Updates Array with all manipulation_button group nodes, By using group, different tree structures are allowed
func get_class()
Overrides the built-in get_class to return "CardContainer" instead of "Area2D"
func get_all_cards() -> Array
Returns an array with all children nodes which are of Card class
func get_card_count() -> int
Returns an int with the amount of children nodes which are of Card class
func get_card(idx: int) -> Card
Returns a card object of the card in the specified index among all cards.
func get_card_index(card: Card) -> int
Returns an int of the index of the card object requested
func has_card(card: Card) -> bool
Returns true if this card container has a Card object matching the specified one
func has_card_name(card_name: String) -> bool
Returns true is any card in this card container has a canonical_name that matches the provided argument.
func get_random_card() -> Card
Returns a random card object among the children nodes
func get_last_card() -> Card
Return the card with the lowest index
func get_first_card() -> Card
Teturn the card with the highest index
func shuffle_cards() -> void
Randomly rearranges the order of the Card nodes.
func get_final_placement_node(card: Card) -> Node
Overridable function to allow the container to specify different effects to happen when a card is attempted to be added It should always return a valid node to put the card in
For example, this can be used by a Hand to discard excess cards warning-ignore:unused_argument
func translate_card_index_to_node_index(index: int) -> int
Translates requested card index to true node index. By that, we mean the index the Card object it would have among all its siblings, inlcuding non-Card nodes
func re_place()
Adjusts the placement of the node, according to the placement var So that it always stays in the same approximate location
- signal shuffle_completed():