UI improvements ++
This commit is contained in:
@@ -72,6 +72,11 @@ var _current_tab : Tab = Tab.GLOBAL
|
||||
var _active_channel : String = "" # channel_id used by the input bar
|
||||
var _active_dm : String = "" # channel_id of the open DM conversation
|
||||
|
||||
const _BUBBLE_DEFAULT_LEFT := -58.0
|
||||
const _BUBBLE_DEFAULT_TOP := -219.0
|
||||
const _BUBBLE_DEFAULT_RIGHT := 2.0
|
||||
const _BUBBLE_DEFAULT_BOTTOM := -159.0
|
||||
|
||||
var _nicknames : Dictionary = {} # account_id → custom display name
|
||||
var _muted : Dictionary = {} # account_id → true
|
||||
|
||||
@@ -109,6 +114,45 @@ func _ready() -> void:
|
||||
_show_tab(Tab.GLOBAL)
|
||||
|
||||
|
||||
func set_overlay_visible(v: bool) -> void:
|
||||
visible = v
|
||||
var bubble := get_node_or_null("ChatBubble") as Control
|
||||
if is_instance_valid(bubble):
|
||||
bubble.visible = v
|
||||
if not v:
|
||||
var panel := get_node_or_null("ChatPanel") as Control
|
||||
if is_instance_valid(panel):
|
||||
panel.visible = false
|
||||
|
||||
|
||||
func set_bubble_host(host: Control) -> void:
|
||||
var bubble := get_node_or_null("ChatBubble") as Control
|
||||
if not is_instance_valid(bubble):
|
||||
return
|
||||
|
||||
var target: Node = self
|
||||
if is_instance_valid(host):
|
||||
target = host
|
||||
|
||||
if bubble.get_parent() != target:
|
||||
bubble.reparent(target)
|
||||
|
||||
if target == self:
|
||||
bubble.set_anchors_preset(Control.PRESET_BOTTOM_RIGHT)
|
||||
bubble.offset_left = _BUBBLE_DEFAULT_LEFT
|
||||
bubble.offset_top = _BUBBLE_DEFAULT_TOP
|
||||
bubble.offset_right = _BUBBLE_DEFAULT_RIGHT
|
||||
bubble.offset_bottom = _BUBBLE_DEFAULT_BOTTOM
|
||||
bubble.custom_minimum_size = Vector2.ZERO
|
||||
else:
|
||||
bubble.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
bubble.offset_left = 0.0
|
||||
bubble.offset_top = 0.0
|
||||
bubble.offset_right = 0.0
|
||||
bubble.offset_bottom = 0.0
|
||||
bubble.custom_minimum_size = Vector2(0, 36)
|
||||
|
||||
|
||||
func _connect_chat_signals() -> void:
|
||||
Chat.channels_updated.connect(_on_channels_updated)
|
||||
Chat.message_received.connect(_on_message_received)
|
||||
|
||||
Reference in New Issue
Block a user