30 lines
679 B
C#
30 lines
679 B
C#
using System.Linq;
|
|
using AceField.Scripts.Logic;
|
|
using Godot;
|
|
|
|
namespace AceField.Scripts.UI;
|
|
|
|
public partial class GameOverScreen : Control
|
|
{
|
|
[Export] public Scoreboard Scoreboard;
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
if (!Visible) return;
|
|
|
|
var data = Scoreboard.GetData(Multiplayer.GetUniqueId());
|
|
if (data == null) return;
|
|
|
|
var place = 1;
|
|
var list = Scoreboard.Players.ToList();
|
|
list.Sort((a, b) => b.Value.Score.CompareTo(a.Value.Score));
|
|
foreach (var item in list)
|
|
{
|
|
if (Multiplayer.GetUniqueId() == item.Key) break;
|
|
place++;
|
|
}
|
|
|
|
GetNode<Label>("CenterContainer/Panel/VBoxContainer/Caption").Text = $"You're in the {place} place";
|
|
}
|
|
}
|