Buy menu
This commit is contained in:
parent
b59cb48b77
commit
4e8971b12d
12 changed files with 134 additions and 15 deletions
29
scenes/gui/buy_menu/buy_menu.gd
Normal file
29
scenes/gui/buy_menu/buy_menu.gd
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
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
|
||||
if visible:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
else:
|
||||
if Session.session_started_flag:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
else:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("plr_buy"):
|
||||
if Session.round_state == Session.ROUND_STATES.BUY:
|
||||
visible = not visible
|
||||
else:
|
||||
visible = false
|
||||
if visible:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
else:
|
||||
if Session.session_started_flag:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
else:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
Loading…
Add table
Add a link
Reference in a new issue