You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
665 B
GDScript
26 lines
665 B
GDScript
extends CanvasLayer
|
|
|
|
var ui_page_list = []
|
|
|
|
func _ready():
|
|
for i in range(self.get_child_count()):
|
|
var ui_page = self.get_child(i)
|
|
if ui_page.name.ends_with("Page"):
|
|
ui_page_list.push_back(ui_page)
|
|
|
|
func input_action(key:String,is_pressed:bool):
|
|
for ui_page in ui_page_list:
|
|
if ui_page.has_method("input_action"):
|
|
ui_page.call("input_action",key,is_pressed)
|
|
if is_pressed and ui_page.has_method("input_action_pressed"):
|
|
ui_page.call("input_action_pressed",key)
|
|
if not visible:
|
|
break
|
|
|
|
func input_dir(dir:Vector2):
|
|
for ui_page in ui_page_list:
|
|
if ui_page.has_method("input_dir"):
|
|
ui_page.call("input_dir",dir)
|
|
if not visible:
|
|
break
|