46 lines
1.3 KiB
GDScript
46 lines
1.3 KiB
GDScript
extends CanvasLayer
|
|
|
|
@onready var bottle_service = $Control/BottleService
|
|
var timer = 0
|
|
const clear_time = 5
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
func message(msg: String, title: String = ""):
|
|
var popup = RichTextLabel.new()
|
|
popup.custom_minimum_size = Vector2(200,100)
|
|
popup.threaded = true
|
|
popup.push_bold()
|
|
popup.append_text(title)
|
|
popup.pop()
|
|
popup.newline()
|
|
popup.append_text(msg)
|
|
var close = Button.new()
|
|
close.text = "✕"
|
|
close.size = Vector2(20, 31)
|
|
close.position = Vector2(175, 0)
|
|
close.pressed.connect(_on_close_pressed.bind(close))
|
|
popup.add_child(close)
|
|
bottle_service.add_child(popup)
|
|
timer = 0
|
|
|
|
func _process(delta):
|
|
timer += delta
|
|
#$"Control/HFlowContainer/SubViewportContainer/SubViewport/Camera3D/Item Position".get_child(0).rotation.y += delta
|
|
#$Control/SubViewportContainer/SubViewport/Camera3D/sleutel.rotation.y += delta
|
|
|
|
func add_item(mesh: Node):
|
|
var subviewport = preload("res://GUI-item.tscn").instantiate()
|
|
$Control/HFlowContainer.add_child(subviewport)
|
|
subviewport.add_item(mesh)
|
|
print_tree()
|
|
|
|
func clear_items():
|
|
for child in $Control/HFlowContainer.get_children():
|
|
child.queue_free()
|
|
|
|
func _on_close_pressed(node):
|
|
node.get_parent().queue_free()
|