2023-11-16 20:23:17 +02:00
|
|
|
extends Node3D
|
|
|
|
|
2024-03-21 11:51:58 +02:00
|
|
|
const ButtonScene = preload ("res://content/ui/components/button/button.tscn")
|
2023-11-16 20:23:17 +02:00
|
|
|
|
2024-04-25 01:22:27 +03:00
|
|
|
@onready var devices_page = $Devices
|
|
|
|
@onready var entities_page = $Entities
|
2024-04-24 02:06:15 +03:00
|
|
|
|
2024-04-25 01:22:27 +03:00
|
|
|
var selected_device = R.state(null)
|
2023-11-16 20:23:17 +02:00
|
|
|
|
|
|
|
func _ready():
|
2024-04-25 01:22:27 +03:00
|
|
|
entities_page.selected_device = selected_device
|
|
|
|
remove_child(entities_page)
|
2023-11-16 20:23:17 +02:00
|
|
|
|
2024-04-25 01:22:27 +03:00
|
|
|
devices_page.on_select_device.connect(func(device):
|
|
|
|
selected_device.value=device
|
|
|
|
entities_page.page.value=0
|
2023-11-16 20:23:17 +02:00
|
|
|
)
|
|
|
|
|
2024-04-25 01:22:27 +03:00
|
|
|
entities_page.on_select_entity.connect(func(entity_name):
|
|
|
|
AudioPlayer.play_effect("spawn")
|
2023-11-16 20:23:17 +02:00
|
|
|
|
2024-04-25 01:22:27 +03:00
|
|
|
var entity=House.body.create_entity(entity_name, global_position)
|
2023-11-23 04:41:13 +02:00
|
|
|
|
2024-05-06 13:45:45 +03:00
|
|
|
if typeof(entity) == TYPE_BOOL&&entity == false:
|
2024-04-25 01:22:27 +03:00
|
|
|
EventSystem.notify("Entity is not in Room", EventNotify.Type.INFO)
|
2024-05-06 12:45:43 +03:00
|
|
|
|
|
|
|
if entity == null:
|
|
|
|
EventSystem.notify("This Entity is not supported yet", EventNotify.Type.INFO)
|
2023-11-16 20:23:17 +02:00
|
|
|
)
|
|
|
|
|
2024-04-25 01:22:27 +03:00
|
|
|
entities_page.on_back.connect(func():
|
|
|
|
selected_device.value=null
|
|
|
|
)
|
2023-11-16 20:23:17 +02:00
|
|
|
|
2024-04-25 01:22:27 +03:00
|
|
|
R.effect(func(_arg):
|
|
|
|
if selected_device.value == null:
|
|
|
|
if devices_page.is_inside_tree() == false:
|
|
|
|
add_child(devices_page)
|
2023-11-16 20:23:17 +02:00
|
|
|
|
2024-04-25 01:22:27 +03:00
|
|
|
if entities_page.is_inside_tree():
|
|
|
|
remove_child(entities_page)
|
2024-01-27 16:38:47 +02:00
|
|
|
|
2024-04-25 01:22:27 +03:00
|
|
|
if selected_device.value != null:
|
|
|
|
if entities_page.is_inside_tree() == false:
|
|
|
|
add_child(entities_page)
|
|
|
|
|
|
|
|
if devices_page.is_inside_tree():
|
|
|
|
remove_child(devices_page)
|
|
|
|
)
|