Ajout de l'intégration twitch

This commit is contained in:
2026-06-23 23:38:20 +02:00
parent 24d19310b5
commit 8cc85e3d6c
12 changed files with 338 additions and 13 deletions

View File

@@ -10,6 +10,7 @@ signal sound_changed(settings : SettingsData)
signal video_changed(settings : SettingsData)
signal game_changed(settings : SettingsData)
signal fov_changed(value : float)
signal twitch_changed(settings : SettingsData)
#region ------------------ Language ------------------
@@ -97,4 +98,16 @@ func close_help_container(help_container_name : String):
func open_help_container(help_container_name : String):
if help_container_name in closed_help_containers:
closed_help_containers.erase(help_container_name)
game_changed.emit(self)
game_changed.emit(self)
#region ------------------ Twitch ------------------
@export var activate_twitch_integration := false :
set(v):
activate_twitch_integration = v
twitch_changed.emit(self)
@export var twitch_channel := "" :
set(v):
twitch_channel = v
twitch_changed.emit(self)

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="icon icon-tabler icons-tabler-outline icon-tabler-brand-twitch"
version="1.1"
id="svg4"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs4" />
<path
stroke="none"
d="M0 0h24v24H0z"
fill="none"
id="path1" />
<path
d="M4 5v11a1 1 0 0 0 1 1h2v4l4 -4h5.584c.266 0 .52 -.105 .707 -.293l2.415 -2.414c.187 -.188 .293 -.442 .293 -.708v-8.585a1 1 0 0 0 -1 -1h-14a1 1 0 0 0 -1 1l.001 0"
id="path2"
style="stroke:#ffffff;stroke-opacity:1" />
<path
d="M16 8l0 4"
id="path3"
style="stroke:#ffffff;stroke-opacity:1" />
<path
d="M12 8l0 4"
id="path4"
style="stroke:#ffffff;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 953 B

View File

@@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cvvnrj8wi3f3r"
path="res://.godot/imported/brand-twitch.svg-a028bcfb5c21b506b9222ac521f85c82.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://common/icons/brand-twitch.svg"
dest_files=["res://.godot/imported/brand-twitch.svg-a028bcfb5c21b506b9222ac521f85c82.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@@ -8,6 +8,13 @@ const CONSONANTS = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p",
static func generate_random_word(_random_seed = randi()) -> String:
if (
GameInfo
and GameInfo.settings_data.activate_twitch_integration
and len(TwitchConnection.pseudo_gathered)
):
return TwitchConnection.pseudo_gathered.pick_random()
var word_len = randf_range(4,8)
var word = ''
var last_letter_is_vowel = false

View File

@@ -0,0 +1,24 @@
extends Node
signal pseudo_gathered_updated(pseudos)
var pseudo_gathered : Array[String] = []
func _ready():
VerySimpleTwitch.chat_message_received.connect(_on_message_received)
GameInfo.settings_data.twitch_changed.connect(connect_to_twitch)
func connect_to_twitch(settings : SettingsData):
pseudo_gathered = []
pseudo_gathered_updated.emit(pseudo_gathered)
VerySimpleTwitch.end_chat_client()
if settings.activate_twitch_integration:
connect_to_twitch_account(settings.twitch_channel)
func connect_to_twitch_account(channel_name: String):
VerySimpleTwitch.login_chat_anon(channel_name)
func _on_message_received(chatter: VSTChatter):
if not chatter.login in pseudo_gathered:
pseudo_gathered.append(chatter.login)
pseudo_gathered_updated.emit(pseudo_gathered)

View File

@@ -0,0 +1 @@
uid://fm17qbe4kqqo