2026-02-23 18:38:03 -06:00
|
|
|
extends Control
|
2026-02-28 02:57:20 -06:00
|
|
|
class_name OverlayWindow
|
2026-02-23 18:38:03 -06:00
|
|
|
|
2026-02-25 14:11:47 -06:00
|
|
|
@onready var floating_menu: GDFloatingMenu = %FloatingMenu
|
2026-02-23 18:38:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Twitch Nodes
|
|
|
|
|
@onready var twitcher: TwitcherExtended = $TwitcherExtended
|
|
|
|
|
#endregion
|
|
|
|
|
|
2026-03-02 02:09:21 -06:00
|
|
|
@export var subscriptions: Array[TwitchEventsubConfig] = []
|
|
|
|
|
|
2026-02-23 18:38:03 -06:00
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
|
func _ready() -> void:
|
2026-03-02 02:09:21 -06:00
|
|
|
Globals.main_win = self
|
2026-02-26 14:37:44 -06:00
|
|
|
Globals.add_children_to_passthrough_exception(floating_menu, [floating_menu.indicators])
|
|
|
|
|
Globals.enable_mouse_passthrough()
|
|
|
|
|
floating_menu.start()
|
2026-02-23 18:38:03 -06:00
|
|
|
Globals.twitcher = twitcher
|
2026-03-02 02:09:21 -06:00
|
|
|
if Globals.settings.display_screen != -1:
|
|
|
|
|
get_window().current_screen = Globals.settings.display_screen
|
2026-02-23 18:38:03 -06:00
|
|
|
|
2026-03-02 02:09:21 -06:00
|
|
|
if Globals.settings.auto_connect_twitch:
|
|
|
|
|
var res := await twitcher.load_streamer_token()
|
|
|
|
|
if res == TwitcherExtended.AuthStatus.UNAUTHORIZED:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if await twitcher.setup_streamer():
|
|
|
|
|
for sub in subscriptions:
|
|
|
|
|
if sub.condition.has(&"broadcaster_user_id"):
|
|
|
|
|
sub.condition.broadcaster_user_id = twitcher.streamer_user.id
|
|
|
|
|
if sub.condition.has(&"moderator_user_id"):
|
|
|
|
|
sub.condition.moderator_user_id = twitcher.streamer_user.id
|
|
|
|
|
if sub.condition.has(&"to_broadcaster_user_id"):
|
|
|
|
|
sub.condition.to_broadcaster_user_id = twitcher.streamer_user.id
|
|
|
|
|
|
|
|
|
|
twitcher.subscribe_event(sub.definition, sub.condition)
|
|
|
|
|
|
|
|
|
|
res = await twitcher.load_chatbot_token()
|
|
|
|
|
if res == TwitcherExtended.AuthStatus.UNAUTHORIZED:
|
|
|
|
|
return
|
|
|
|
|
twitcher.setup_chatbot()
|
|
|
|
|
|
|
|
|
|
ObsManager.scene_changed.connect(_handle_scene_changed)
|
|
|
|
|
|
|
|
|
|
if Globals.settings.auto_connect_obs:
|
|
|
|
|
ObsManager.connect_to_host()
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
func _handle_scene_changed(scene_name: String, scene_uuid: String) -> void:
|
|
|
|
|
match scene_name:
|
|
|
|
|
"StartingSoon":
|
|
|
|
|
%ChatBox.dock = ChatBox.ChatDock.RIGHT
|
|
|
|
|
"Talking":
|
|
|
|
|
%ChatBox.dock = ChatBox.ChatDock.RIGHT
|
|
|
|
|
"Desktop":
|
|
|
|
|
%ChatBox.dock = ChatBox.ChatDock.BOTTOM
|
|
|
|
|
"Gaming":
|
|
|
|
|
%ChatBox.dock = ChatBox.ChatDock.RIGHT
|
|
|
|
|
"BRB":
|
|
|
|
|
%ChatBox.dock = ChatBox.ChatDock.RIGHT
|
|
|
|
|
"EndingSoon":
|
|
|
|
|
%ChatBox.dock = ChatBox.ChatDock.RIGHT
|