blob: 1669e5fc0e0e1221a4898b5abd66b71037f557f2 (
plain)
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
56
|
# Hurry Curry! - a game about cooking
# Copyright 2024 tpart
# Copyright 2024 metamuffin
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License only.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
extends Menu
const PARTICLE_AMOUNTS = [0, 6, 32, 128]
@onready var title: Label = $MarginContainer/PanelContainer/VBoxContainer/Text/Title
@onready var subtitle: Label = $MarginContainer/PanelContainer/VBoxContainer/Text/Subtitle
@onready var stars = $MarginContainer/PanelContainer/VBoxContainer/Stars.get_children()
@onready var star_timer = $StarTimer
@onready var particles = $Control/Particles
func _ready():
super()
show_rating(data[0], data[1])
func _process(_delta):
particles.emission_rect_extents = get_viewport_rect().size * Vector2(0.5, 0.5)
func show_rating(stars_: int, points: int):
match stars_:
0: title.text = tr("Poor service")
1: title.text = tr("Acceptable service")
2: title.text = tr("Good service")
3: title.text = tr("Excellent service")
subtitle.text = tr("You collected %s points") % points
for i in range(0, stars_):
var star: TextureRect = stars[i]
star_timer.start()
await star_timer.timeout
star.material.set_shader_parameter("t", 1)
star.get_node("Sound").play()
particles.amount = PARTICLE_AMOUNTS[stars_]
if stars_ > 0:
particles.emitting = true
func _on_close_pressed():
exit()
|