forked from team-sg/hero-mark-2
unity of scores (closes #196)
This commit is contained in:
parent
eda2db4a3a
commit
481edb15b7
3 changed files with 53 additions and 35 deletions
|
@ -45,6 +45,8 @@ func _ready() -> void:
|
|||
|
||||
# reload scores from newgrounds
|
||||
func reload_scores() -> void:
|
||||
_set_tag()
|
||||
print(_scoreboard_tag)
|
||||
scoreboard_tabs.current_tab = 1
|
||||
# attempt the thing
|
||||
if _scoreboard_id >= 0 and Ngio.keys_loaded:
|
||||
|
@ -52,6 +54,7 @@ func reload_scores() -> void:
|
|||
id = _scoreboard_id,
|
||||
limit = scores.get_child_count(),
|
||||
skip = 0,
|
||||
period = "A",
|
||||
tag = _scoreboard_tag,
|
||||
}), "completed")
|
||||
if Ngio.has_result(response) and response.result.data.success:
|
||||
|
@ -90,11 +93,12 @@ func _set_tag() -> void:
|
|||
_scoreboard_tag = "spicy"
|
||||
Game.Difficulty.PUNGENT:
|
||||
_scoreboard_tag = "pungent"
|
||||
match selected_completion:
|
||||
Completion.ANY:
|
||||
_scoreboard_tag += "-any%"
|
||||
Completion.FULL:
|
||||
_scoreboard_tag += "-100%"
|
||||
if selected_type == ScoreType.TIME:
|
||||
match selected_completion:
|
||||
Completion.ANY:
|
||||
_scoreboard_tag += "-any%"
|
||||
Completion.FULL:
|
||||
_scoreboard_tag += "-100%"
|
||||
|
||||
# show arrows when level is focused
|
||||
func _on_LevelTitle_focus_entered() -> void:
|
||||
|
@ -139,7 +143,6 @@ func _on_Difficulty_pressed() -> void:
|
|||
return
|
||||
selected_difficulty = posmod(selected_difficulty + 1, 4)
|
||||
difficulty.text = Game.DIFFICULTY_NAMES[selected_difficulty]
|
||||
_set_tag()
|
||||
reload_scores()
|
||||
|
||||
# completion amount selector
|
||||
|
@ -148,7 +151,6 @@ func _on_Completion_pressed() -> void:
|
|||
return
|
||||
selected_completion = posmod(selected_completion + 1, 2)
|
||||
completion.text = COMPLETION_NAMES[selected_completion]
|
||||
_set_tag()
|
||||
reload_scores()
|
||||
|
||||
# score type selector
|
||||
|
@ -159,7 +161,9 @@ func _on_Type_pressed() -> void:
|
|||
match selected_type:
|
||||
ScoreType.SCORE:
|
||||
_scoreboard_id = LevelData.levels[selected_level].scores_id
|
||||
completion.visible = false
|
||||
ScoreType.TIME:
|
||||
_scoreboard_id = LevelData.levels[selected_level].times_id
|
||||
completion.visible = true
|
||||
type.text = SCORE_TYPE_NAMES[selected_type]
|
||||
reload_scores()
|
||||
|
|
|
@ -66,7 +66,6 @@ margin_left = 72.0
|
|||
margin_top = 4.0
|
||||
margin_right = 78.0
|
||||
margin_bottom = 12.0
|
||||
focus_mode = 2
|
||||
size_flags_vertical = 4
|
||||
texture = ExtResource( 6 )
|
||||
flip_h = true
|
||||
|
@ -77,9 +76,7 @@ margin_left = 82.0
|
|||
margin_top = 3.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 13.0
|
||||
focus_neighbour_left = NodePath(".")
|
||||
focus_neighbour_right = NodePath(".")
|
||||
focus_neighbour_bottom = NodePath("../../SelectScoreType/Completion")
|
||||
focus_neighbour_bottom = NodePath("../../SelectScoreType/Type")
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource( 5 )
|
||||
custom_colors/font_color_focus = Color( 1, 0.968627, 0.709804, 1 )
|
||||
|
@ -94,7 +91,6 @@ margin_left = 177.0
|
|||
margin_top = 4.0
|
||||
margin_right = 183.0
|
||||
margin_bottom = 12.0
|
||||
focus_mode = 2
|
||||
size_flags_vertical = 4
|
||||
texture = ExtResource( 6 )
|
||||
|
||||
|
@ -112,6 +108,7 @@ margin_top = 3.0
|
|||
margin_right = 100.0
|
||||
margin_bottom = 13.0
|
||||
rect_min_size = Vector2( 48, 0 )
|
||||
focus_neighbour_right = NodePath("../Type")
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource( 5 )
|
||||
custom_colors/font_color_focus = Color( 1, 0.968627, 0.709804, 1 )
|
||||
|
@ -119,28 +116,15 @@ custom_colors/font_color = Color( 1, 1, 1, 1 )
|
|||
custom_fonts/font = ExtResource( 8 )
|
||||
text = "Spicy"
|
||||
|
||||
[node name="Completion" type="Button" parent="BoardsScreen/SelectScoreType"]
|
||||
[node name="Type" type="Button" parent="BoardsScreen/SelectScoreType"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 104.0
|
||||
margin_top = 3.0
|
||||
margin_right = 152.0
|
||||
margin_bottom = 13.0
|
||||
rect_min_size = Vector2( 48, 0 )
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource( 5 )
|
||||
custom_colors/font_color_focus = Color( 1, 0.968627, 0.709804, 1 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_fonts/font = ExtResource( 8 )
|
||||
text = "Any%"
|
||||
icon_align = 1
|
||||
|
||||
[node name="Type" type="Button" parent="BoardsScreen/SelectScoreType"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 156.0
|
||||
margin_top = 3.0
|
||||
margin_right = 204.0
|
||||
margin_bottom = 13.0
|
||||
rect_min_size = Vector2( 48, 0 )
|
||||
focus_neighbour_left = NodePath("../Difficulty")
|
||||
focus_neighbour_right = NodePath("../SpaceReserve/Completion")
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource( 5 )
|
||||
custom_colors/font_color_focus = Color( 1, 0.968627, 0.709804, 1 )
|
||||
|
@ -148,6 +132,34 @@ custom_colors/font_color = Color( 1, 1, 1, 1 )
|
|||
custom_fonts/font = ExtResource( 8 )
|
||||
text = "Scores"
|
||||
|
||||
[node name="SpaceReserve" type="Control" parent="BoardsScreen/SelectScoreType"]
|
||||
margin_left = 156.0
|
||||
margin_top = 8.0
|
||||
margin_right = 204.0
|
||||
margin_bottom = 8.0
|
||||
rect_min_size = Vector2( 48, 0 )
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="Completion" type="Button" parent="BoardsScreen/SelectScoreType/SpaceReserve"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -24.0
|
||||
margin_top = -5.0
|
||||
margin_right = 24.0
|
||||
margin_bottom = 5.0
|
||||
rect_min_size = Vector2( 48, 0 )
|
||||
focus_neighbour_left = NodePath("../../Type")
|
||||
theme = ExtResource( 5 )
|
||||
custom_colors/font_color_focus = Color( 1, 0.968627, 0.709804, 1 )
|
||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||
custom_fonts/font = ExtResource( 8 )
|
||||
text = "Any%"
|
||||
icon_align = 1
|
||||
|
||||
[node name="Scoreboard" type="MarginContainer" parent="BoardsScreen"]
|
||||
margin_top = 32.0
|
||||
margin_right = 256.0
|
||||
|
@ -288,5 +300,5 @@ text = "Failed to load"
|
|||
[connection signal="focus_exited" from="BoardsScreen/SelectLevel/LevelTitle" to="." method="_on_LevelTitle_focus_exited"]
|
||||
[connection signal="gui_input" from="BoardsScreen/SelectLevel/LevelTitle" to="." method="_on_LevelTitle_gui_input"]
|
||||
[connection signal="pressed" from="BoardsScreen/SelectScoreType/Difficulty" to="." method="_on_Difficulty_pressed"]
|
||||
[connection signal="pressed" from="BoardsScreen/SelectScoreType/Completion" to="." method="_on_Completion_pressed"]
|
||||
[connection signal="pressed" from="BoardsScreen/SelectScoreType/Type" to="." method="_on_Type_pressed"]
|
||||
[connection signal="pressed" from="BoardsScreen/SelectScoreType/SpaceReserve/Completion" to="." method="_on_Completion_pressed"]
|
||||
|
|
|
@ -15,7 +15,6 @@ onready var tab_container: TabContainer = $"%TabContainer"
|
|||
|
||||
func _ready() -> void:
|
||||
yield(get_tree(), "idle_frame")
|
||||
_set_tag()
|
||||
print(_scoreboard_tag)
|
||||
$"%YesScore".grab_focus()
|
||||
Fade.fade_in(0.4)
|
||||
|
@ -24,6 +23,7 @@ func _ready() -> void:
|
|||
func _on_YesScore_pressed() -> void:
|
||||
_scoreboard_id = LevelData.levels[Game.current_level].scores_id
|
||||
_score_value = Game.final_score
|
||||
_set_tag(false)
|
||||
tab_container.current_tab = 2
|
||||
if yield(_submit(), "completed"):
|
||||
tab_container.current_tab = 3
|
||||
|
@ -42,6 +42,7 @@ func _on_NoScore_pressed() -> void:
|
|||
func _on_YesTime_pressed() -> void:
|
||||
_scoreboard_id = LevelData.levels[Game.current_level].times_id
|
||||
_score_value = int(Game.time * 1000.0)
|
||||
_set_tag(true)
|
||||
tab_container.current_tab = 2
|
||||
if yield(_submit(), "completed"):
|
||||
tab_container.current_tab = 3
|
||||
|
@ -62,7 +63,7 @@ func _next_screen() -> void:
|
|||
SceneManager.change_scene(LevelSelect.instance())
|
||||
|
||||
|
||||
func _set_tag() -> void:
|
||||
func _set_tag(include_completion: bool = false) -> void:
|
||||
match Game.difficulty:
|
||||
Game.Difficulty.SWEET:
|
||||
_scoreboard_tag = "sweet"
|
||||
|
@ -72,10 +73,11 @@ func _set_tag() -> void:
|
|||
_scoreboard_tag = "spicy"
|
||||
Game.Difficulty.PUNGENT:
|
||||
_scoreboard_tag = "pungent"
|
||||
if Game.keys >= 50 and Game.shards >= 5:
|
||||
_scoreboard_tag += "-100%"
|
||||
else:
|
||||
_scoreboard_tag += "-any%"
|
||||
if include_completion:
|
||||
if Game.keys >= 50 and Game.shards >= 5:
|
||||
_scoreboard_tag += "-100%"
|
||||
else:
|
||||
_scoreboard_tag += "-any%"
|
||||
|
||||
|
||||
# returns true if the score was successfully submitted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue