Fixed sounds effects with points. Fixed buttons statistics and about
This commit is contained in:
@@ -3,9 +3,6 @@ extends Control
|
||||
##TODO
|
||||
# 2. Fix reset buttons
|
||||
# 3. Fix settings
|
||||
# 4. Fix top buttons
|
||||
# 7. Fix welcome into the game
|
||||
# 8. Fix match ball sound
|
||||
# 9. Fix winner
|
||||
# 10. Fix jump between songs
|
||||
# 11. Refactor components
|
||||
@@ -69,6 +66,21 @@ var sync_button := $SyncButton
|
||||
@onready
|
||||
var sync_popup := $PopupPanel
|
||||
|
||||
@onready
|
||||
var statistics_button := $StatisticsButton
|
||||
|
||||
@onready
|
||||
var statistic_popup := $StatisticsPopupPanel
|
||||
|
||||
@onready
|
||||
var statistic_label := $StatisticsPopupPanel/StatisticsLabel
|
||||
|
||||
@onready
|
||||
var about_button := $AboutButton
|
||||
|
||||
@onready
|
||||
var about_popup := $AboutPopupPanel
|
||||
|
||||
@onready
|
||||
var show_answer_button := $ShowAnswerButton
|
||||
|
||||
@@ -107,6 +119,8 @@ func _ready():
|
||||
search_button.pressed.connect(show_search)
|
||||
sync_button.pressed.connect(sync_games)
|
||||
sound_test_button.pressed.connect(get_sound_test_song)
|
||||
statistics_button.pressed.connect(get_statistics)
|
||||
about_button.pressed.connect(show_about)
|
||||
|
||||
progress.drag_started.connect(_on_drag_started)
|
||||
progress.drag_ended.connect(_on_drag_ended)
|
||||
@@ -118,6 +132,13 @@ func _ready():
|
||||
open_button.pressed.connect(open)
|
||||
get_suggestion_list()
|
||||
|
||||
func show_about():
|
||||
about_popup.visible = true
|
||||
|
||||
func get_statistics():
|
||||
statistic_popup.visible = true
|
||||
statistic_label.text = "Total amount of games in the playlist: " + str(games.size())
|
||||
|
||||
func get_sound_test_song():
|
||||
var play_sound_test_song = func(result, response_code, headers, body):
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
@@ -174,6 +195,30 @@ func add_player():
|
||||
new_player_name_field.text = ""
|
||||
players.add_child(new_player)
|
||||
new_player.connect("change_character_clicked", _on_player_change_character_clicked.bind(new_player))
|
||||
new_player.connect("first_point_triggerd", _on_point_triggerd.bind("first"))
|
||||
new_player.connect("match_point_triggerd", _on_point_triggerd.bind("match"))
|
||||
new_player.connect("winner_triggerd", _on_point_triggerd.bind("winner"))
|
||||
|
||||
func _on_point_triggerd(point: String):
|
||||
var song_path: String
|
||||
if point == "first":
|
||||
var value = randi_range(0, 10)
|
||||
if value == 0:
|
||||
song_path = "res://sounds/sound1.mp3"
|
||||
elif value < 5:
|
||||
song_path = "res://sounds/intro_long.mp3"
|
||||
else:
|
||||
song_path = "res://sounds/intro_short.mp3"
|
||||
elif point == "match":
|
||||
song_path = "res://sounds/sound0.mp3"
|
||||
elif point == "winner":
|
||||
song_path = "res://sounds/winning.mp3"
|
||||
|
||||
audio.stream = load_mp3(song_path)
|
||||
audio.play()
|
||||
stream = audio.stream
|
||||
progress.max_value = round(stream.get_length())
|
||||
progress.tick_count = round(stream.get_length() / 60)
|
||||
|
||||
func show_search():
|
||||
if search_view.visible == false:
|
||||
|
||||
Reference in New Issue
Block a user