Ajout de l'intégration twitch

This commit is contained in:
2026-06-23 23:38:20 +02:00
parent 4f93f7acaf
commit fcf8bfaa45
12 changed files with 305 additions and 16 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 ------------------
@@ -98,3 +99,15 @@ 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)
#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

View File

@@ -12,6 +12,8 @@ func _ready():
setup_sound()
setup_video()
setup_controls()
setup_twitch()
update_twitch_pseudo()
show()
%SettingsWindow.hide()
%SettingsWindow.closed.connect(
@@ -19,10 +21,17 @@ func _ready():
GameInfo.save_settings()
)
TwitchConnection.pseudo_gathered_updated.connect(
func (_p):update_twitch_pseudo()
)
func open_settings():
setup_languages()
setup_sound()
setup_video()
setup_controls()
setup_twitch()
update_twitch_pseudo()
show()
%SettingsWindow.open_window()
@@ -51,6 +60,17 @@ func setup_controls():
%FovSlider.value = settings.fov
%SensibilitySlider.value = settings.mouse_sensivity
func setup_twitch():
%TwitchActivationCheckBox.button_pressed = settings.activate_twitch_integration
%TwitchChannelLineEdit.text = settings.twitch_channel
func update_twitch_pseudo():
if GameInfo.settings_data.activate_twitch_integration:
%TwitchPseudoCount.text = tr("PSEUDO_GATHERED_%d") % len(TwitchConnection.pseudo_gathered)
else:
%TwitchPseudoCount.text = "TWITCH_NOT_CONNECTED"
func _on_language_option_button_item_selected(index: int):
settings.language = SettingsData.AVAILABLE_LANGUAGES[index]
@@ -85,3 +105,10 @@ func _on_sensibility_slider_value_changed(value: float):
func _on_ui_size_slider_value_changed(value: float):
settings.ui_size = %UiSizeSlider.value
func _on_twitch_activation_check_box_toggled(toggled_on: bool):
settings.activate_twitch_integration = toggled_on
func _on_twitch_channel_line_edit_editing_toggled(toggled_on: bool):
if not toggled_on:
settings.twitch_channel = %TwitchChannelLineEdit.text

View File

@@ -7,9 +7,8 @@
[ext_resource type="PackedScene" uid="uid://d3agt2njfgddb" path="res://gui/menu/window/content_label.tscn" id="4_rbiwc"]
[ext_resource type="AudioStream" uid="uid://8juy5ev3rdfh" path="res://common/audio_manager/assets/sfx/plant_points/plant_point_1.wav" id="6_8f00b"]
[node name="Settings" type="Control" unique_id=1832300574]
[node name="Settings" type="MarginContainer" unique_id=1374154672]
process_mode = 3
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
@@ -17,16 +16,19 @@ grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
mouse_filter = 1
theme_override_constants/margin_left = 100
theme_override_constants/margin_top = 100
theme_override_constants/margin_right = 100
theme_override_constants/margin_bottom = 100
script = ExtResource("1_7t8mv")
[node name="SettingsWindow" parent="." unique_id=798514856 instance=ExtResource("1_gkn1k")]
unique_name_in_owner = true
process_mode = 3
custom_minimum_size = Vector2(900, 667.77)
layout_mode = 1
offset_left = -349.99994
offset_right = 350.00055
visible = false
custom_minimum_size = Vector2(800, 0)
layout_mode = 2
size_flags_vertical = 1
mouse_filter = 0
title = "SETTINGS"
@@ -144,7 +146,7 @@ size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource("2_7t8mv")
min_value = 0.5
max_value = 1.5
max_value = 2.5
step = 0.01
value = 1.5
@@ -198,6 +200,45 @@ size_flags_horizontal = 10
size_flags_vertical = 4
theme = ExtResource("2_7t8mv")
[node name="TwitchIntegrationTitle" parent="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent" unique_id=1569982523 instance=ExtResource("3_rbiwc")]
layout_mode = 2
title = "TWITCH_INTEGRATION"
[node name="GridContainer" type="GridContainer" parent="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent" unique_id=522476269]
layout_mode = 2
columns = 2
[node name="TwitchActivation" parent="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GridContainer" unique_id=845492722 instance=ExtResource("4_rbiwc")]
layout_mode = 2
size_flags_horizontal = 3
text = "ACTIVATE_TWITCH_INTERACTION"
[node name="TwitchActivationCheckBox" type="CheckBox" parent="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GridContainer" unique_id=41914098]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 10
size_flags_vertical = 4
theme = ExtResource("2_7t8mv")
[node name="TwitchChannel" parent="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GridContainer" unique_id=761410855 instance=ExtResource("4_rbiwc")]
layout_mode = 2
size_flags_horizontal = 3
text = "TWITCH_CHANNEL"
[node name="TwitchChannelLineEdit" type="LineEdit" parent="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GridContainer" unique_id=1533093934]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="TwitchPseudoCount" parent="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent" unique_id=1953595699 instance=ExtResource("4_rbiwc")]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0.5882353)
layout_mode = 2
size_flags_horizontal = 3
text = "PSEUDO_GATHERED "
horizontal_alignment = 1
vertical_alignment = 1
[node name="MusicTestPlayer" type="AudioStreamPlayer" parent="." unique_id=1716804039]
unique_name_in_owner = true
stream = ExtResource("6_8f00b")
@@ -222,5 +263,7 @@ bus = &"Sfx"
[connection signal="value_changed" from="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/VideoSettings/FovSlider" to="." method="_on_fov_slider_value_changed"]
[connection signal="value_changed" from="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GameSettings/SensibilitySlider" to="." method="_on_sensibility_slider_value_changed"]
[connection signal="toggled" from="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GameSettings/AutoPickupCheckBox" to="." method="_on_auto_pickup_check_box_toggled"]
[connection signal="toggled" from="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GridContainer/TwitchActivationCheckBox" to="." method="_on_twitch_activation_check_box_toggled"]
[connection signal="editing_toggled" from="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GridContainer/TwitchChannelLineEdit" to="." method="_on_twitch_channel_line_edit_editing_toggled"]
[editable path="SettingsWindow"]

View File

@@ -21,11 +21,15 @@ func _on_close_button_pressed():
func open_window():
show()
%ControlAnimationPlayer.appear()
modulate.a = 0.
var tween = create_tween()
tween.tween_property(self, 'modulate:a', 1, 0.3)
func close_window():
if visible:
%ControlAnimationPlayer.disappear(0.3)
await get_tree().create_timer(0.3).timeout
modulate.a = 1.
var tween = create_tween()
tween.tween_property(self, 'modulate:a', 0, 0.3)
await tween.finished
hide()
closed.emit()

View File

@@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true
config/name="Seeding The Wasteland"
config/description="Seeding planets is a survival, managment and cosy game in which you play a little gardener robot."
config/version="demo-1.3"
config/version="demo-2.0"
run/main_scene="uid://c5bruelvqbm1k"
config/features=PackedStringArray("4.7", "Forward Plus")
config/icon="uid://df0y0s666ui4h"
@@ -36,6 +36,8 @@ LoadingScreen="*res://gui/loading_screen/loading_screen.tscn"
SceneManager="*res://common/scene_manager/scene_manager.tscn"
SteamConnection="*uid://bq12bubjof2mo"
GameInfo="*res://common/game_info/game_info.gd"
VerySimpleTwitch="*uid://cbrqfun2syqju"
TwitchConnection="*uid://fm17qbe4kqqo"
[dialogic]
@@ -122,7 +124,7 @@ translation/intern/translation_folder="res://translation/dialogs"
[editor_plugins]
enabled=PackedStringArray("res://addons/dialogic/plugin.cfg")
enabled=PackedStringArray("res://addons/dialogic/plugin.cfg", "res://addons/very-simple-twitch/plugin.cfg")
[input]
@@ -261,3 +263,13 @@ initialization/app_id=4690960
initialization/initialize_on_startup=true
initialization/embed_callbacks=true
multiplayer_peer/max_channels=4
[twitcher]
editor/game_oauth_token="res://common/twitch_connection/twitch_oauth_token.tres"
editor/game_oauth_setting="res://common/twitch_connection/twitch_oauth_setting.tres"
editor/resource_folder="res://common/twitch_connection"
[very_simple_twitch]
config/client_id="xg0yviwuskvnw1y6s6h5cmvalyfteb"

View File

@@ -3,7 +3,9 @@
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="1_4ph5l"]
[ext_resource type="Script" uid="uid://cwmp2une7hobe" path="res://stages/title_screen/scripts/title_screen.gd" id="1_6yuhi"]
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="3_6yuhi"]
[ext_resource type="Texture2D" uid="uid://cvvnrj8wi3f3r" path="res://common/icons/brand-twitch.svg" id="3_gn4uv"]
[ext_resource type="Texture2D" uid="uid://3813d8ld7vt2" path="res://stages/title_screen/assets/textures/Logo-demo.png" id="3_lwj2x"]
[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="4_ofiho"]
[ext_resource type="Texture2D" uid="uid://bewr0t1wi8pff" path="res://common/icons/rotate.svg" id="5_6yuhi"]
[ext_resource type="PackedScene" uid="uid://cm5b7w7j6527f" path="res://stages/title_screen/planet_3d.tscn" id="5_7a1qq"]
[ext_resource type="Texture2D" uid="uid://cixd5j8yqpavg" path="res://common/icons/settings.svg" id="6_3aitq"]
@@ -23,6 +25,47 @@
[sub_resource type="ViewportTexture" id="ViewportTexture_6yuhi"]
viewport_path = NodePath("SubViewport")
[sub_resource type="LabelSettings" id="LabelSettings_1xafb"]
font = ExtResource("4_ofiho")
font_size = 18
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_g4v7s"]
[sub_resource type="Animation" id="Animation_5icsl"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("HSeparator:theme_override_constants/separation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_0vds4"]
resource_name = "bounce"
loop_mode = 1
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("HSeparator:theme_override_constants/separation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 3, 0),
"points": PackedFloat32Array(0, -0.25, 0, 0.43333334, 0.0279046, 10, -0.18480387, 0, 0.18480387, 0, 0, -0.5333333, -0.073566735, 0, 0),
"times": PackedFloat32Array(0, 0.46666667, 1)
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0j8fm"]
_data = {
&"RESET": SubResource("Animation_5icsl"),
&"bounce": SubResource("Animation_0vds4")
}
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rf16a"]
bg_color = Color(1, 0, 0.43137255, 1)
border_width_left = 10
@@ -64,7 +107,7 @@ shader = ExtResource("8_pjo5j")
shader_parameter/strength = 5.00000023424012
shader_parameter/mix_percentage = 0.3
[sub_resource type="FastNoiseLite" id="FastNoiseLite_lwj2x"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_0e8rs"]
frequency = 1.0
[sub_resource type="Animation" id="Animation_gn4uv"]
@@ -299,6 +342,37 @@ size_flags_horizontal = 8
size_flags_vertical = 0
text = "Version"
[node name="TwitchContainer" type="VBoxContainer" parent="MarginContainer" unique_id=1193568878]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
theme_override_constants/separation = 0
[node name="TwitchInfo" type="HBoxContainer" parent="MarginContainer/TwitchContainer" unique_id=1516020408]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 8
alignment = 2
[node name="TextureRect" type="TextureRect" parent="MarginContainer/TwitchContainer/TwitchInfo" unique_id=1757288448]
modulate = Color(0.54509807, 0.1764706, 1, 1)
layout_mode = 2
texture = ExtResource("3_gn4uv")
[node name="Label" type="Label" parent="MarginContainer/TwitchContainer/TwitchInfo" unique_id=1597620585]
layout_mode = 2
text = "TWITCH_INTEGRATION_IN_THE_SETTINGS"
label_settings = SubResource("LabelSettings_1xafb")
[node name="HSeparator" type="HSeparator" parent="MarginContainer/TwitchContainer" unique_id=1913605901]
layout_mode = 2
theme_override_constants/separation = 0
theme_override_styles/separator = SubResource("StyleBoxEmpty_g4v7s")
[node name="AnimationPlayer" type="AnimationPlayer" parent="MarginContainer/TwitchContainer" unique_id=1532371629]
libraries/ = SubResource("AnimationLibrary_0j8fm")
autoplay = &"bounce"
[node name="GridContainer" type="HBoxContainer" parent="MarginContainer" unique_id=975183276]
layout_mode = 2
alignment = 1
@@ -452,7 +526,7 @@ size = Vector2i(1980, 1080)
[node name="Planet3d" parent="SubViewport" unique_id=926789923 instance=ExtResource("5_7a1qq")]
unique_name_in_owner = true
noise = SubResource("FastNoiseLite_lwj2x")
noise = SubResource("FastNoiseLite_0e8rs")
[node name="Camera3D" type="Camera3D" parent="SubViewport" unique_id=806252928]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -14.369979, 0, 64.323425)

View File

@@ -20,6 +20,7 @@ RESUME_GAME,Resume,Reprendre
RESTART,Restart,Recommencer
RESTART_DEMO,Restart demo,Recommencer la démo
QUIT,Quit,Quitter
TWITCH_INTEGRATION_IN_THE_SETTINGS,Twitch integration in the settings!,Intégration twitch dans les paramètres !
THIS_GAME_USE_AUTOSAVE,This game use autosave,Ce jeu sauvegarde votre progression automatiquement
CHOOSE_GAME_MODE,Choose game mode,Choisissez le mode de jeu
STORY_MODE,Story Mode,Mode Histoire
@@ -193,6 +194,11 @@ UI_SIZE,Ui Size,Taille de l'UI
GAME,Game,Jeu
MOUSE_SENSIVITY,Mouse Sensivity in 3D scenes,Sensibilité de la souris dans les scènes en 3D
AUTO_PICKUP,Auto pickup seeds,Récolte automatique des graines
TWITCH_INTEGRATION,Twitch integration (beta),Intégration Twitch (béta)
ACTIVATE_TWITCH_INTERACTION,Activate Twitch Integration,Activer l'intégration Twitch
TWITCH_CHANNEL,Twitch channel name,Nom de la chaine Twitch
PSEUDO_GATHERED_%d,"Connected, %d pseudos gathered","Connecté, %d pseudos récupérés"
TWITCH_NOT_CONNECTED,"Twitch not connected","Non connecté à Twitch"
CONTROLS,Controls,Contrôles
MOVE_RIGHT,Move right,Déplacement à droite
MOVE_LEFT,Move left,Déplacement à gauche
1 keys en fr
20 RESTART Restart Recommencer
21 RESTART_DEMO Restart demo Recommencer la démo
22 QUIT Quit Quitter
23 TWITCH_INTEGRATION_IN_THE_SETTINGS Twitch integration in the settings! Intégration twitch dans les paramètres !
24 THIS_GAME_USE_AUTOSAVE This game use autosave Ce jeu sauvegarde votre progression automatiquement
25 CHOOSE_GAME_MODE Choose game mode Choisissez le mode de jeu
26 STORY_MODE Story Mode Mode Histoire
194 GAME Game Jeu
195 MOUSE_SENSIVITY Mouse Sensivity in 3D scenes Sensibilité de la souris dans les scènes en 3D
196 AUTO_PICKUP Auto pickup seeds Récolte automatique des graines
197 TWITCH_INTEGRATION Twitch integration (beta) Intégration Twitch (béta)
198 ACTIVATE_TWITCH_INTERACTION Activate Twitch Integration Activer l'intégration Twitch
199 TWITCH_CHANNEL Twitch channel name Nom de la chaine Twitch
200 PSEUDO_GATHERED_%d Connected, %d pseudos gathered Connecté, %d pseudos récupérés
201 TWITCH_NOT_CONNECTED Twitch not connected Non connecté à Twitch
202 CONTROLS Controls Contrôles
203 MOVE_RIGHT Move right Déplacement à droite
204 MOVE_LEFT Move left Déplacement à gauche