Chelimbalo/gui/buy_menu/buy_menu.gd
2025-12-12 16:56:47 +05:00

21 lines
549 B
GDScript

extends ColorRect
func _ready() -> void:
Session.round_state_changed.connect(on_round_state_changed)
func on_round_state_changed(state: int) -> void:
if state != Session.ROUND_STATES.BUY:
visible = false
MouseConfiner.stop_borrow()
func _input(event: InputEvent) -> void:
if event.is_action_pressed("plr_buy"):
if Session.round_state == Session.ROUND_STATES.BUY:
visible = not visible
if visible:
MouseConfiner.borrow()
else:
MouseConfiner.stop_borrow()
elif visible:
visible = false
MouseConfiner.stop_borrow()