1
0
mirror of synced 2024-11-28 00:20:53 +01:00
This commit is contained in:
asesidaa 2022-10-27 00:42:41 +08:00
parent e55230dc91
commit a5d2db22cc
16 changed files with 56 additions and 59 deletions

View File

@ -26,6 +26,7 @@ namespace GameDatabase.Context
{
return;
}
var path = Path.Combine(PathHelper.GetRootPath(), "taiko.db3");
optionsBuilder.UseSqlite($"Data Source={path}");
}
@ -54,10 +55,10 @@ namespace GameDatabase.Context
entity.Property(e => e.Difficulty)
.HasConversion<uint>();
entity.Property(e => e.BestCrown)
.HasConversion<uint>();
entity.Property(e => e.BestScoreRank)
.HasConversion<uint>();
});
@ -75,13 +76,13 @@ namespace GameDatabase.Context
.HasPrincipalKey(p => p.Baid)
.HasForeignKey(d => d.Baid)
.OnDelete(DeleteBehavior.Cascade);
entity.Property(e => e.Difficulty)
.HasConversion<uint>();
entity.Property(e => e.ScoreRank)
.HasConversion<uint>();
entity.Property(e => e.Crown)
.HasConversion<uint>();
});
@ -97,7 +98,7 @@ namespace GameDatabase.Context
.HasPrincipalKey(p => p.Baid)
.HasForeignKey(d => d.Baid)
.OnDelete(DeleteBehavior.Cascade);
entity.Property(e => e.AchievementDisplayDifficulty)
.HasConversion<uint>();
});
@ -107,4 +108,4 @@ namespace GameDatabase.Context
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
}
}

View File

@ -32,8 +32,8 @@ public partial class TaikoDbContext
entity.HasOne(d => d.Parent)
.WithMany(p => p.DanStageScoreData)
.HasPrincipalKey(p => new {p.Baid, p.DanId})
.HasForeignKey(d => new {d.Baid, d.DanId})
.HasPrincipalKey(p => new { p.Baid, p.DanId })
.HasForeignKey(d => new { d.Baid, d.DanId })
.OnDelete(DeleteBehavior.Cascade);
});
@ -47,16 +47,16 @@ public partial class TaikoDbContext
.HasForeignKey(d => d.Baid)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<AiSectionScoreDatum>(entity =>
{
entity.HasKey(e => new { e.Baid, e.SongId, e.Difficulty, e.SectionIndex });
entity.HasOne(d => d.Parent)
.WithMany(p => p.AiSectionScoreData)
.HasPrincipalKey(p => new {p.Baid, p.SongId, p.Difficulty })
.HasForeignKey(d => new {d.Baid, d.SongId, d.Difficulty })
.HasPrincipalKey(p => new { p.Baid, p.SongId, p.Difficulty })
.HasForeignKey(d => new { d.Baid, d.SongId, d.Difficulty })
.OnDelete(DeleteBehavior.Cascade);
});
}

View File

@ -5,14 +5,14 @@ namespace GameDatabase.Entities;
public class AiScoreDatum
{
public uint Baid { get; set; }
public uint SongId { get; set; }
public Difficulty Difficulty { get; set; }
public bool IsWin { get; set; }
public List<AiSectionScoreDatum> AiSectionScoreData { get; set; } = new();
public virtual Card? Ba { get; set; }
}

View File

@ -5,23 +5,23 @@ namespace GameDatabase.Entities;
public class AiSectionScoreDatum
{
public uint Baid { get; set; }
public uint SongId { get; set; }
public Difficulty Difficulty { get; set; }
public int SectionIndex { get; set; }
public CrownType Crown { get; set; }
public bool IsWin { get; set; }
public uint Score { get; set; }
public uint GoodCount { get; set; }
public uint OkCount { get; set; }
public uint MissCount { get; set; }
public uint DrumrollCount { get; set; }

View File

@ -5,4 +5,4 @@
public string AccessCode { get; set; } = null!;
public uint Baid { get; set; }
}
}
}

View File

@ -11,6 +11,6 @@ public class DanScoreDatum
public uint ComboCountTotal { get; set; }
public DanClearState ClearState { get; set; }
public List<DanStageScoreDatum> DanStageScoreData { get; set; } = new();
public virtual Card? Ba { get; set; }
}

View File

@ -3,25 +3,25 @@
public class DanStageScoreDatum
{
public uint Baid { get; set; }
public uint DanId { get; set; }
public uint SongNumber { get; set; }
public uint PlayScore { get; set; }
public uint GoodCount { get; set; }
public uint OkCount { get; set; }
public uint BadCount { get; set; }
public uint DrumrollCount { get; set; }
public uint TotalHitCount { get; set; }
public uint ComboCount { get; set; }
public uint HighScore { get; set; }
public DanScoreDatum Parent { get; set; } = null!;

View File

@ -14,4 +14,4 @@ namespace GameDatabase.Entities
public virtual Card? Ba { get; set; }
}
}
}

View File

@ -10,17 +10,17 @@ public partial class SongBestDatum
{
BestCrown = crown;
}
if ((uint)BestScoreRank < scoreRank)
{
BestScoreRank = (ScoreRank)scoreRank;
BestScoreRank = (ScoreRank)scoreRank;
}
if (BestScore < playScore)
{
BestScore = playScore;
}
if (BestRate < scoreRate)
{
BestRate = scoreRate;

View File

@ -6,9 +6,9 @@ namespace GameDatabase.Entities
{
public long Id { get; set; }
public uint Baid { get; set; }
public uint SongNumber { get; set; }
public uint SongId { get; set; }
public Difficulty Difficulty { get; set; }
public CrownType Crown { get; set; }
@ -26,4 +26,4 @@ namespace GameDatabase.Entities
public virtual Card? Ba { get; set; }
}
}
}

View File

@ -31,4 +31,4 @@ namespace GameDatabase.Entities
public int AiWinCount { get; set; }
public virtual Card? Ba { get; set; }
}
}
}

View File

@ -10,7 +10,8 @@ public class DateTimeConverter : JsonConverter<DateTime>
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
Debug.Assert(typeToConvert == typeof(DateTime));
var dateTime = DateTime.ParseExact(reader.GetString() ?? string.Empty, "dd_MM_yy-HH_mm_ss", CultureInfo.InvariantCulture);
var dateTime = DateTime.ParseExact(reader.GetString() ?? string.Empty, "dd_MM_yy-HH_mm_ss",
CultureInfo.InvariantCulture);
return dateTime;
}

View File

@ -4,6 +4,5 @@ namespace LocalSaveModScoreMigrator;
public class MusicInfo
{
[JsonPropertyName("items")]
public List<MusicInfoEntry> Items { get; set; } = new();
[JsonPropertyName("items")] public List<MusicInfoEntry> Items { get; set; } = new();
}

View File

@ -4,9 +4,7 @@ namespace LocalSaveModScoreMigrator;
public class MusicInfoEntry
{
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;
[JsonPropertyName("id")] public string Id { get; set; } = string.Empty;
[JsonPropertyName("uniqueId")]
public uint SongId { get; set; }
[JsonPropertyName("uniqueId")] public uint SongId { get; set; }
}

View File

@ -7,14 +7,12 @@ public class PlayRecordJson
{
public string SongId { get; set; } = "tmap4";
public Difficulty Difficulty { get; set; }
[JsonPropertyName("dateTime")]
public DateTime DateTime { get; set; }
[JsonPropertyName("dateTime")] public DateTime DateTime { get; set; }
public uint Score { set; get; }
public CrownType Crown { get; set; }
[JsonPropertyName("scorerank")]
public ScoreRank Scorerank { get; set; }
[JsonPropertyName("scorerank")] public ScoreRank Scorerank { get; set; }
public uint Good { get; set; }
public uint Ok { get; set; }
public uint Bad { get; set; }

View File

@ -61,8 +61,8 @@ foreach (var playRecord in playRecordJson)
SongId = songId
};
db.SongPlayData.Add(playLog);
var best = new SongBestDatum
{
Baid = user.Baid,