-
Notifications
You must be signed in to change notification settings - Fork 0
/
win_popup.gd
55 lines (42 loc) · 1.15 KB
/
win_popup.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
43
44
45
46
47
48
49
50
51
52
53
54
55
extends TextureRect
var star_full = preload("res://img/star.png")
var star_empty = preload("res://img/star2.png")
var cb1
var cb2
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
pass
func init(title, you, best, stars, level, callback1, callback2):
if stars == 0:
$Star1.texture = star_empty
$Star2.texture = star_empty
$Star3.texture = star_empty
if stars == 1:
$Star1.texture = star_full
$Star2.texture = star_empty
$Star3.texture = star_empty
elif stars == 2:
$Star1.texture = star_full
$Star2.texture = star_full
$Star3.texture = star_empty
elif stars == 3:
$Star1.texture = star_full
$Star2.texture = star_full
$Star3.texture = star_full
$Title.text = title
$You.text = you
$Best.text = best
$LevelLabel.text = str(level)
cb1 = callback1
cb2 = callback2
func _on_button_1_pressed() -> void:
print("_on_button_1_pressed")
if cb1:
cb1.call()
func _on_button_2_pressed() -> void:
print("_on_button_2_pressed")
if cb2:
cb2.call()