Skip to content

ManipulationButtons

Divided by Zer0 edited this page Jul 11, 2021 · 5 revisions

ManipulationButtons

Extends: VBoxContainer

Description

Property Descriptions

manipulation_button

export var manipulation_button: PackedScene = "[Object:null]"

needed_buttons

var needed_buttons: Dictionary

This variable hold definitions for which buttons to create on this card.

The dictionary key is the button name, and the value is the text to add to the button label.

owner_node

var owner_node

Hold the node which owns this node.

Method Descriptions

spawn_manipulation_buttons

func spawn_manipulation_buttons() -> void

Adds an amount of manipulation buttons to the card

are_hovered

func are_hovered() -> bool

Detects when the mouse is still hovering over the buttons area.

We need to detect this extra, because the buttons restart event propagation.

This means that the Control parent, will send a mouse_exit signal when the mouse enter a button rect which will make the buttons disappear again.

So we make sure buttons stay visible while the mouse is on top.

This is all necessary as a workaround for https://github.com/godotengine/godot/issues/16854

Returns true if the mouse is hovering any of the buttons, else false

set_active

func set_active(value = true) -> void

Changes the hosted button node mouse filters

  • When set to false, buttons cannot receive inputs anymore (this is useful when a card is in hand or a pile)
  • When set to true, buttons can receive inputs again

set_button_visible

func set_button_visible(button_name: String, value: bool) -> void

Sets one specific button to be (in)visible (and thus active) on demand

set_alpha

func set_alpha(value: int = 1) -> void

Allows the buttons to appear gracefully