Hook score submission into new server and move into the results screen.

This commit is contained in:
Haze Weathers 2024-12-01 13:24:47 -05:00
parent 29d84b0c80
commit 155c86c013
9 changed files with 853 additions and 9 deletions

View file

@ -61,6 +61,9 @@ func show_final_score():
func _on_AnimationPlayer_animation_finished(anim_name):
if anim_name != "results":
return
if Game.marathon_mode:
Game.current_level += 1
if Game.current_level > LevelData.marathon_end:
@ -70,9 +73,33 @@ func _on_AnimationPlayer_animation_finished(anim_name):
else:
Game.change_map(LevelData.levels[Game.current_level].scene)
return
if Game.final_score > Game.old_high_score and not Debug.is_cheating:
animation_player.play("submit_score_popup")
else:
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.change_scene(LevelSelect.instance())
func _on_YesSubmit_button_down() -> void:
$"%YesSubmit".release_focus()
animation_player.play("submit")
var save_id = LevelData.levels[Game.current_level].save_id
var entry = ScoreBoard.ScoreEntry.new(Game.final_score, int(Game.time * 1000.0), Game.difficulty)
var submitted = yield(ScoreBoard.submit_score(save_id, entry), "completed")
if ScoreBoard.errored or not submitted:
animation_player.play("try_again")
else:
animation_player.play("success")
func _on_NoSubmit_button_down() -> void:
$"%NoSubmit".release_focus()
_next_screen()
func _next_screen() -> void:
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
if Debug.is_cheating == false:
SceneManager.change_scene(SubmitScore.instance())
else:
SceneManager.change_scene(LevelSelect.instance())
SceneManager.change_scene(LevelSelect.instance())