Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
Remove typing effect from random quotes, add skip button
Browse files Browse the repository at this point in the history
  • Loading branch information
CryptAxe committed Dec 23, 2024
1 parent 2f5ad72 commit 4e8d357
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
5 changes: 5 additions & 0 deletions cusf_launcher/scene/main_window.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ layout_mode = 2
bbcode_enabled = true
text = "text of quote"

[node name="ButtonNextQuote" type="Button" parent="MarginContainer/VBoxContainer/PanelContainerQuotes"]
layout_mode = 2
flat = true

[node name="ShutdownStatus" type="Control" parent="."]
visible = false
anchors_preset = 0
Expand Down Expand Up @@ -627,4 +631,5 @@ editor_preview_indeterminate = false
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainerPageAndPageButtons/PanelContainerPages/SettingPage/VBoxContainer/ButtonDeleteEverything" to="." method="_on_button_delete_everything_pressed"]
[connection signal="confirmed" from="MarginContainer/VBoxContainer/HBoxContainerPageAndPageButtons/PanelContainerPages/SettingPage/VBoxContainer/DeleteEverythingConfirmationDialog" to="." method="_on_delete_everything_confirmation_dialog_confirmed"]
[connection signal="toggled" from="MarginContainer/VBoxContainer/HBoxContainerPageAndPageButtons/PanelContainerPages/SettingPage/VBoxContainer/CheckBoxRandomQuotes" to="." method="_on_check_box_random_quotes_toggled"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/PanelContainerQuotes/ButtonNextQuote" to="." method="_on_button_next_quote_pressed"]
[connection signal="pressed" from="ShutdownStatus/Panel/ButtonForceShutdown" to="." method="_on_button_force_shutdown_pressed"]
28 changes: 7 additions & 21 deletions cusf_launcher/script/main_window.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var pid_thunder : int = -1

var timer_run_status_update = null

var tween_typing: Tween = null
var timer_random_quote = null
var current_random_quote : String = ""

Expand Down Expand Up @@ -572,34 +571,21 @@ func _on_check_box_random_quotes_toggled(toggled_on: bool) -> void:

else:
$MarginContainer/VBoxContainer/PanelContainerQuotes.visible = false

if tween_typing:
tween_typing.kill()


if timer_random_quote:
timer_random_quote.stop()
timer_random_quote.queue_free()


func format_quote_text(text : String) -> String:
return str("[shake rate=2 connected=10 level=2]", text, "[/shake]")


func show_next_random_quote() -> void:
var random_quote : String = random_quotes.pick_random()
while random_quote == current_random_quote:
random_quote = random_quotes.pick_random()

current_random_quote = random_quote

if tween_typing:
tween_typing.kill()

tween_typing = get_tree().create_tween()

$MarginContainer/VBoxContainer/PanelContainerQuotes/HBoxContainerBottomQuotes/RichTextLabelQuote.visible_ratio = 0
$MarginContainer/VBoxContainer/PanelContainerQuotes/HBoxContainerBottomQuotes/RichTextLabelQuote.text = format_quote_text(random_quote)

tween_typing.tween_property($MarginContainer/VBoxContainer/PanelContainerQuotes/HBoxContainerBottomQuotes/RichTextLabelQuote, "visible", true, 0)
tween_typing.tween_property($MarginContainer/VBoxContainer/PanelContainerQuotes/HBoxContainerBottomQuotes/RichTextLabelQuote, "visible_ratio", 1, 0.86)
tween_typing.tween_property($MarginContainer/VBoxContainer/PanelContainerQuotes/HBoxContainerBottomQuotes/RichTextLabelQuote, "text", random_quote, 0).set_delay(0.1)

$MarginContainer/VBoxContainer/PanelContainerQuotes/HBoxContainerBottomQuotes/RichTextLabelQuote.text = random_quote


func _on_button_next_quote_pressed() -> void:
show_next_random_quote()

0 comments on commit 4e8d357

Please sign in to comment.