Add controller ui
This commit is contained in:
@@ -4,11 +4,12 @@ func _ready() -> void:
|
||||
visible = false
|
||||
$HBoxContainer/ItemList.item_selected.connect(onItemSelected)
|
||||
|
||||
func open():
|
||||
func open() -> void:
|
||||
visible = true
|
||||
$HBoxContainer/ItemList.clear()
|
||||
$HBoxContainer/ItemList.grab_focus()
|
||||
|
||||
func close():
|
||||
func close() -> void:
|
||||
visible = false
|
||||
|
||||
func isOpen() -> bool:
|
||||
|
||||
@@ -17,3 +17,14 @@ func close() -> void:
|
||||
visible = false
|
||||
MAIN.close()
|
||||
SETTINGS.close()
|
||||
|
||||
func _unhandled_input(event:InputEvent) -> void:
|
||||
if !visible:
|
||||
return
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
if SETTINGS.isOpen():
|
||||
SETTINGS.close()
|
||||
MAIN.open()
|
||||
else:
|
||||
close()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
Reference in New Issue
Block a user