-
Notifications
You must be signed in to change notification settings - Fork 4
/
SuccessPopup.gd
42 lines (32 loc) · 1.06 KB
/
SuccessPopup.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
extends Popup
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func update_and_show(success):
var s = $wholebackground/PanelBorder/Success
s.set_chapitre(success['chapter'])
s.set_label(success['label'])
s.set_txt(success['txt'])
s.set_success_id(success['id'])
s.set_not_already_seen() # will be set during the animation
# For this one, we don't want to show the chapter
s.hide_chapter()
self.popup()
$AnimationPlayer.play("show")
self._new_success_play_sound()
func _new_success_play_sound():
var player = $AudioPlayer
player.stop()
if !Sounder.is_enabled():
return
var full_pth = 'res://sounds/lennon-c-beau.mp3'
var sound = load(full_pth)
player.stream = sound
player.play()
func _on_AnimationPlayer_animation_finished(anim_name):
#print('SUCCESS: Animation %s is finish' % anim_name)
if anim_name == 'show': # show is finish, we can now launch hide
$AnimationPlayer.play('hide')
print('Show is done, now hide')
elif anim_name == 'hide': # hide finish, do nothing
pass