extends Node var account: Dictionary = { "id": "", } var character: Dictionary = { "name": "", "info": null, } func show_message_window( message: String, title: String = "", attached_to: Control = null, anchor: Side = SIDE_TOP ) -> GameWindow: var window = preload("res://ui/message_window.tscn").instantiate() window.message = message window.title = title # add window first to get the correct size get_tree().current_scene.add_child(window) # attach window to control if attached_to: window.global_position = attached_to.global_position if anchor == SIDE_TOP: window.global_position.y -= window.size.y window.size.x = max(window.size.x, attached_to.size.x) elif anchor == SIDE_BOTTOM: window.global_position.y += attached_to.size.y window.size.x = max(window.size.x, attached_to.size.x) elif anchor == SIDE_LEFT: window.global_position.x -= window.size.x window.size.y = max(window.size.y, attached_to.size.y) elif anchor == SIDE_RIGHT: window.global_position.x += attached_to.size.x window.size.y = max(window.size.y, attached_to.size.y) # else add window in center else: window.global_position = get_viewport().get_visible_rect().size * 0.5 - window.size * 0.5 window.minimum_size = window.size return window