Ajout de l'intégration twitch
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user