25 lines
431 B
GDScript
25 lines
431 B
GDScript
class_name UI
|
|
extends Node
|
|
|
|
static var focus: Control
|
|
|
|
var chat: Chat
|
|
var reconnect: Panel
|
|
var network: NetworkUI
|
|
|
|
func _enter_tree():
|
|
chat = %Chat
|
|
reconnect = %Reconnect
|
|
network = %Network
|
|
|
|
func _process(_delta):
|
|
var new_focus := get_viewport().gui_get_focus_owner()
|
|
|
|
if new_focus && new_focus.name != "Unfocus":
|
|
UI.focus = new_focus
|
|
else:
|
|
UI.focus = null
|
|
|
|
static func unfocus():
|
|
if UI.focus:
|
|
UI.focus.release_focus() |