Updated MainWin

Added ChatBox to the window.
Updated MainWin to handle setting Globals.main_win.
Added code to handle ensuring the overlay is on the correct montior
chosen by user.
Added check for connecting to twitch automatically.
Added Subscriptions, to setup subscriptions upon connection.
Added ObsManager connection to scene changed.
Added ObsManager connection on startup.
Added handling of scene changed, adjusting ChatBox to dock to a specific
location.
This commit is contained in:
Mario Steele 2026-03-02 02:09:21 -06:00
parent feba26839b
commit 09dd6cb2e2
2 changed files with 154 additions and 13 deletions

View file

@ -8,23 +8,56 @@ class_name OverlayWindow
@onready var twitcher: TwitcherExtended = $TwitcherExtended
#endregion
@export var subscriptions: Array[TwitchEventsubConfig] = []
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
Globals.main_win = self
Globals.add_children_to_passthrough_exception(floating_menu, [floating_menu.indicators])
Globals.enable_mouse_passthrough()
floating_menu.start()
Globals.twitcher = twitcher
if Globals.settings.display_screen != -1:
get_window().current_screen = Globals.settings.display_screen
var res := twitcher.load_streamer_token()
if res == TwitcherExtended.AuthStatus.UNAUTHORIZED:
return
func _handle_twitch_auth() -> void:
await twitcher.setup_streamer()
#if twitcher.is_streamer_authed():
#auth_twitch.disabled = true
func _handle_bot_auth() -> void:
await twitcher.setup_chatbot()
#if twitcher.is_chatbot_authed():
#auth_bot.disabled = true
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

View file

@ -18,15 +18,118 @@
[ext_resource type="Texture2D" uid="uid://g1dbcjksbotw" path="res://addons/twitcher/assets/fallback_texture.tres" id="13_l81bt"]
[ext_resource type="Script" uid="uid://6v8jnfjwbnhm" path="res://addons/twitcher/media/twitch_image_transformer.gd" id="14_dr7ot"]
[ext_resource type="Script" uid="uid://iv0mgv0lu8b0" path="res://addons/twitcher/auth/twitch_auth.gd" id="14_l81bt"]
[ext_resource type="Script" uid="uid://cjug64e3433g0" path="res://addons/twitcher/eventsub/twitch_eventsub_config.gd" id="14_vifpv"]
[ext_resource type="Resource" uid="uid://b8735fmqjt8up" path="res://addons/twitcher/chat/twitch_bot_scopes.tres" id="15_dr7ot"]
[ext_resource type="Script" uid="uid://bf0wi70haua35" path="res://addons/twitcher/lib/oOuch/oauth.gd" id="16_m7rpr"]
[ext_resource type="Script" uid="uid://blnbogtrshw4r" path="res://addons/twitcher/auth/twitch_token_handler.gd" id="17_lpeoe"]
[ext_resource type="Script" uid="uid://csq2hmf1bsgku" path="res://lib/twitcher_extended/chatbot_authorization.gd" id="18_vifpv"]
[ext_resource type="PackedScene" uid="uid://djdxpwrmlrsp8" path="res://ChatAvatars/CatSlimes/cat_world.tscn" id="23_7nx26"]
[ext_resource type="PackedScene" uid="uid://cstq30mjx0pch" path="res://UI/Controls/chat_box.tscn" id="23_lpeoe"]
[ext_resource type="Script" uid="uid://cv06lthuq2c2o" path="res://general_commands.gd" id="24_dr7ot"]
[ext_resource type="Script" uid="uid://bmluckfvgm1c2" path="res://addons/twitcher/chat/twitch_command.gd" id="24_l81bt"]
[ext_resource type="PackedScene" uid="uid://bndydwe6rrb6p" path="res://UI/floating_menu.tscn" id="26_m7rpr"]
[sub_resource type="Resource" id="Resource_1scbk"]
script = ExtResource("14_vifpv")
type = 15
condition = {
&"broadcaster_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_dqy2v"]
script = ExtResource("14_vifpv")
type = 17
condition = {
&"broadcaster_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_7ft7d"]
script = ExtResource("14_vifpv")
type = 18
condition = {
&"broadcaster_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_84aqx"]
script = ExtResource("14_vifpv")
type = 5
condition = {
&"broadcaster_user_id": "",
&"moderator_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_es602"]
script = ExtResource("14_vifpv")
type = 20
condition = {
&"to_broadcaster_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_s0vyq"]
script = ExtResource("14_vifpv")
type = 21
condition = {
&"broadcaster_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_vwie2"]
script = ExtResource("14_vifpv")
type = 37
condition = {
&"broadcaster_user_id": "",
&"reward_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_qp6p1"]
script = ExtResource("14_vifpv")
type = 38
condition = {
&"broadcaster_user_id": "",
&"reward_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_2a87i"]
script = ExtResource("14_vifpv")
type = 64
condition = {
&"broadcaster_user_id": "",
&"moderator_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_do4qx"]
script = ExtResource("14_vifpv")
type = 65
condition = {
&"broadcaster_user_id": "",
&"moderator_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_dgy7a"]
script = ExtResource("14_vifpv")
type = 6
condition = {
&"broadcaster_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_qh6mc"]
script = ExtResource("14_vifpv")
condition = {
&"broadcaster_user_id": "",
&"moderator_user_id": ""
}
metadata/_custom_type_script = "uid://cjug64e3433g0"
[sub_resource type="Resource" id="Resource_m7rpr"]
script = ExtResource("14_dr7ot")
@ -52,6 +155,11 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_bgu0c")
subscriptions = Array[ExtResource("14_vifpv")]([SubResource("Resource_1scbk"), SubResource("Resource_dqy2v"), SubResource("Resource_7ft7d"), SubResource("Resource_84aqx"), SubResource("Resource_es602"), SubResource("Resource_s0vyq"), SubResource("Resource_vwie2"), SubResource("Resource_qp6p1"), SubResource("Resource_2a87i"), SubResource("Resource_do4qx"), SubResource("Resource_dgy7a"), SubResource("Resource_qh6mc")])
[node name="ChatBox" parent="." unique_id=859214320 instance=ExtResource("23_lpeoe")]
unique_name_in_owner = true
layout_mode = 1
[node name="TwitcherExtended" type="Node" parent="." unique_id=1225944144 node_paths=PackedStringArray("service", "chat", "bot", "chatbot_auth", "eventsub", "api", "auth", "media")]
script = ExtResource("2_x1kh3")