Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7671115

Browse files
feat: implement score loading
1 parent b74fed6 commit 7671115

File tree

2 files changed

+51
-18
lines changed

2 files changed

+51
-18
lines changed

‎scenes/levels_redesign.tscn‎

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,19 @@ size_flags_horizontal = 3
8282

8383
[node name="Display" type="MarginContainer" parent="Levels/Level/Info"]
8484
margin_right = 616.0
85-
margin_bottom = 302.0
85+
margin_bottom = 276.0
8686
size_flags_vertical = 3
8787
script = ExtResource( 3 )
8888

8989
[node name="Footer" type="HBoxContainer" parent="Levels/Level/Info"]
90-
margin_top = 310.0
90+
margin_top = 284.0
9191
margin_right = 616.0
9292
margin_bottom = 613.0
9393
size_flags_vertical = 3
9494

9595
[node name="Meta" type="VBoxContainer" parent="Levels/Level/Info/Footer"]
9696
margin_right = 304.0
97-
margin_bottom = 303.0
97+
margin_bottom = 329.0
9898
size_flags_horizontal = 3
9999

100100
[node name="StatsContainer" type="MarginContainer" parent="Levels/Level/Info/Footer/Meta"]
@@ -116,51 +116,74 @@ Worst-case space:"
116116
[node name="ScoresContainer" type="MarginContainer" parent="Levels/Level/Info/Footer/Meta"]
117117
margin_top = 133.0
118118
margin_right = 304.0
119-
margin_bottom = 303.0
119+
margin_bottom = 329.0
120120
size_flags_vertical = 3
121121
script = ExtResource( 3 )
122122

123-
[node name="Scores" type="HBoxContainer" parent="Levels/Level/Info/Footer/Meta/ScoresContainer"]
123+
[node name="Scores" type="VBoxContainer" parent="Levels/Level/Info/Footer/Meta/ScoresContainer"]
124124
margin_left = 20.0
125125
margin_top = 20.0
126126
margin_right = 284.0
127-
margin_bottom = 150.0
127+
margin_bottom = 176.0
128128

129-
[node name="Sizes" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores"]
129+
[node name="Header" type="HBoxContainer" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores"]
130+
margin_right = 264.0
131+
margin_bottom = 41.0
132+
133+
[node name="Size" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores/Header"]
134+
margin_right = 40.0
135+
margin_bottom = 41.0
136+
text = "SIZE
137+
----"
138+
139+
[node name="Time" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores/Header"]
140+
margin_left = 48.0
141+
margin_right = 264.0
142+
margin_bottom = 41.0
143+
size_flags_horizontal = 3
144+
text = "HIGH SCORE
145+
----------"
146+
align = 2
147+
148+
[node name="Data" type="HBoxContainer" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores"]
149+
margin_top = 49.0
150+
margin_right = 264.0
151+
margin_bottom = 156.0
152+
153+
[node name="Sizes" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores/Data"]
130154
margin_right = 30.0
131-
margin_bottom = 129.0
132-
text = "
133-
8
155+
margin_bottom = 107.0
156+
text = "8
134157
16
135158
32
136159
64
137160
128"
138161

139-
[node name="Times" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores"]
162+
[node name="Times" type="Label" parent="Levels/Level/Info/Footer/Meta/ScoresContainer/Scores/Data"]
140163
margin_left = 38.0
141164
margin_right = 264.0
142-
margin_bottom = 129.0
165+
margin_bottom = 107.0
143166
size_flags_horizontal = 3
144-
text = "HIGH SCORES
145-
INF
167+
text = "INF
146168
INF
147169
INF
148170
INF
149171
INF"
150-
align = 1
172+
align = 2
173+
uppercase = true
151174

152175
[node name="ControlsContainer" type="MarginContainer" parent="Levels/Level/Info/Footer"]
153176
margin_left = 312.0
154177
margin_right = 616.0
155-
margin_bottom = 303.0
178+
margin_bottom = 329.0
156179
size_flags_horizontal = 3
157180
script = ExtResource( 3 )
158181

159182
[node name="Controls" type="Label" parent="Levels/Level/Info/Footer/ControlsContainer"]
160183
margin_left = 20.0
161-
margin_top = 142.0
184+
margin_top = 155.0
162185
margin_right = 284.0
163-
margin_bottom = 161.0
186+
margin_bottom = 174.0
164187
size_flags_horizontal = 3
165188

166189
[node name="Timer" type="Timer" parent="Levels"]

‎scripts/levels_redesign.gd‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ func _ready():
3030
child.queue_free()
3131
$Level/Info/Display.add_child(ArrayView.new(_level))
3232
$Timer.start()
33+
_load_scores(_level)
34+
35+
func _load_scores(level):
36+
var data = $Level/Info/Footer/Meta/ScoresContainer/Scores/Data
37+
data.get_node("Times").text = ""
38+
for i in data.get_node("Sizes").text.split("\n"):
39+
var time = str(GlobalScore.get_time(level.NAME, int(i)))
40+
data.get_node("Times").text += time
41+
if int(i) != MAX_SIZE:
42+
data.get_node("Times").text += "\n"
3343

3444
func _switch_level(index):
3545
if index == -1:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /