This commit is contained in:
2025-01-07 00:48:37 +03:00
parent 2061eb9347
commit 0df34ef0ec
97 changed files with 866 additions and 764 deletions

View File

@@ -7,10 +7,10 @@ namespace DoomDeathmatch.Script.Score;
[JsonSerializable(typeof(ScoreTable))]
public class ScoreTable
{
private static readonly JsonSerializerOptions OPTIONS = new() { Converters = { new ScoreTableJsonConverter() } };
public List<ScoreRow> Rows { get; } = new();
private static readonly JsonSerializerOptions OPTIONS = new() { Converters = { new ScoreTableJsonConverter() } };
public static ScoreTable LoadOrCreate(string parPath)
{
ScoreTable? table = null;
@@ -26,10 +26,12 @@ public class ScoreTable
}
if (table != null)
{
return table;
}
table = new ScoreTable();
ScoreTable.Save(table, parPath);
Save(table, parPath);
return table;
}
@@ -51,7 +53,9 @@ public class ScoreTableJsonConverter : JsonConverter<ScoreTable>
{
var rows = JsonSerializer.Deserialize<ScoreRow[]>(ref parReader, parOptions);
if (rows == null)
{
return null;
}
var scoreTable = new ScoreTable();
foreach (var row in rows)