fix scoreboard and ready for release

This commit is contained in:
2025-09-10 23:36:54 +02:00
parent eb0ba602b3
commit d4ae904c32
8 changed files with 112 additions and 56 deletions

View File

@@ -93,10 +93,10 @@ func start_score_saver(score: int)->void:
func get_scoreboard_singleplayer(n_lignes: int = 0) -> String:
return " 1 Player" + _get_scoreboard(score.score_singleplayer, n_lignes)
return _get_scoreboard(score.score_singleplayer, n_lignes)
func get_scoreboard_multiplayer(n_lignes: int = 0) -> String:
return " 2 Player" + _get_scoreboard(score.score_multiplayer, n_lignes)
return _get_scoreboard(score.score_multiplayer, n_lignes)
func _get_scoreboard(dict: Dictionary, n_lignes: int) -> String:
var text = ""
@@ -107,10 +107,14 @@ func _get_scoreboard(dict: Dictionary, n_lignes: int) -> String:
if n_lignes == 0:
n_lignes = clamp( tableau_paires.size(), 5, 1000)
for i in range(clamp(n_lignes, 0, tableau_paires.size())):
text += "\n" + str(i+1) + ". " + tableau_paires[i]["key"] + " : " + display_score(tableau_paires[i]["value"])
text += str(i+1) + ". " + tableau_paires[i]["key"] + " : " + display_score(tableau_paires[i]["value"])
if i < n_lignes-1:
text+="\n"
if tableau_paires.size() < n_lignes:
for i in range(n_lignes - tableau_paires.size()):
text += "\n" + str(tableau_paires.size()+ i+1) + ". " + "---- : ----"
text += str(tableau_paires.size()+ i+1) + ". " + "---- : ----"
if i < n_lignes - tableau_paires.size() -1 :
text += "\n"
return text
func display_score(score: int) -> String: