Test add dan type
This commit is contained in:
parent
ae8cd7829a
commit
3461cd8b22
@ -15,7 +15,7 @@ public partial class TaikoDbContext
|
||||
{
|
||||
modelBuilder.Entity<DanScoreDatum>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.Baid, e.DanId });
|
||||
entity.HasKey(e => new { e.Baid, e.DanId, e.DanType });
|
||||
|
||||
entity.HasOne(d => d.Ba)
|
||||
.WithMany()
|
||||
@ -24,17 +24,18 @@ public partial class TaikoDbContext
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.Property(e => e.ClearState).HasConversion<uint>().HasDefaultValue(DanClearState.NotClear);
|
||||
entity.Property(e => e.DanType).HasConversion<int>().HasDefaultValue(DanType.Normal);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DanStageScoreDatum>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.Baid, e.DanId, e.SongNumber });
|
||||
entity.HasKey(e => new { e.Baid, e.DanId, e.DanType, e.SongNumber });
|
||||
|
||||
entity.HasOne(d => d.Parent)
|
||||
.WithMany(p => p.DanStageScoreData)
|
||||
.HasPrincipalKey(p => new { p.Baid, p.DanId })
|
||||
.HasForeignKey(d => new { d.Baid, d.DanId })
|
||||
.HasForeignKey(d => new { d.Baid, d.DanId, d.DanType })
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
entity.Property(e => e.DanType).HasConversion<int>().HasDefaultValue(DanType.Normal);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AiScoreDatum>(entity =>
|
||||
|
@ -6,6 +6,7 @@ public class DanScoreDatum
|
||||
{
|
||||
public ulong Baid { get; set; }
|
||||
public uint DanId { get; set; }
|
||||
public DanType DanType { get; set; }
|
||||
public uint ArrivalSongCount { get; set; }
|
||||
public uint SoulGaugeTotal { get; set; }
|
||||
public uint ComboCountTotal { get; set; }
|
||||
|
@ -1,10 +1,14 @@
|
||||
namespace GameDatabase.Entities;
|
||||
using SharedProject.Enums;
|
||||
|
||||
namespace GameDatabase.Entities;
|
||||
|
||||
public class DanStageScoreDatum
|
||||
{
|
||||
public ulong Baid { get; set; }
|
||||
|
||||
public uint DanId { get; set; }
|
||||
|
||||
public DanType DanType { get; set; }
|
||||
|
||||
public uint SongNumber { get; set; }
|
||||
|
||||
|
@ -12,9 +12,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.1.23419.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.1.23419.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.1.23419.6">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.2.23480.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.2.23480.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.2.23480.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
472
GameDatabase/Migrations/20231017102350_AddDanType.Designer.cs
generated
Normal file
472
GameDatabase/Migrations/20231017102350_AddDanType.Designer.cs
generated
Normal file
@ -0,0 +1,472 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GameDatabase.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GameDatabase.Migrations
|
||||
{
|
||||
[DbContext(typeof(TaikoDbContext))]
|
||||
[Migration("20231017102350_AddDanType")]
|
||||
partial class AddDanType
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.0-rc.1.23419.6");
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
|
||||
{
|
||||
b.Property<ulong>("Baid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("SongId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("Difficulty")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsWin")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Baid", "SongId", "Difficulty");
|
||||
|
||||
b.ToTable("AiScoreData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
|
||||
{
|
||||
b.Property<ulong>("Baid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("SongId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("Difficulty")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("SectionIndex")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Crown")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("DrumrollCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("GoodCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsWin")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("MissCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("OkCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("Score")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Baid", "SongId", "Difficulty", "SectionIndex");
|
||||
|
||||
b.ToTable("AiSectionScoreData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.Card", b =>
|
||||
{
|
||||
b.Property<string>("AccessCode")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<ulong>("Baid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Salt")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("AccessCode");
|
||||
|
||||
b.HasIndex(new[] { "Baid" }, "IX_Card_Baid")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Card", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
|
||||
{
|
||||
b.Property<ulong>("Baid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("DanId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DanType")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER")
|
||||
.HasDefaultValue(1);
|
||||
|
||||
b.Property<uint>("ArrivalSongCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("ClearState")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER")
|
||||
.HasDefaultValue(0u);
|
||||
|
||||
b.Property<uint>("ComboCountTotal")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("SoulGaugeTotal")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Baid", "DanId", "DanType");
|
||||
|
||||
b.ToTable("DanScoreData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
|
||||
{
|
||||
b.Property<ulong>("Baid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("DanId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DanType")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER")
|
||||
.HasDefaultValue(1);
|
||||
|
||||
b.Property<uint>("SongNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("BadCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("ComboCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("DrumrollCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("GoodCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("HighScore")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("OkCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("PlayScore")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("TotalHitCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Baid", "DanId", "DanType", "SongNumber");
|
||||
|
||||
b.ToTable("DanStageScoreData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
|
||||
{
|
||||
b.Property<ulong>("Baid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("SongId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("Difficulty")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("BestCrown")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("BestRate")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("BestScore")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("BestScoreRank")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Baid", "SongId", "Difficulty");
|
||||
|
||||
b.ToTable("SongBestData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<ulong>("Baid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("ComboCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("Crown")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("Difficulty")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("DrumrollCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("GoodCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("HitCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("MissCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("OkCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("PlayTime")
|
||||
.HasColumnType("datetime");
|
||||
|
||||
b.Property<uint>("Score")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("ScoreRank")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("ScoreRate")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("Skipped")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("SongId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("SongNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Baid");
|
||||
|
||||
b.ToTable("SongPlayData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
|
||||
{
|
||||
b.Property<ulong>("Baid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("AchievementDisplayDifficulty")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AiWinCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("ColorBody")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("ColorFace")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("ColorLimb")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("CostumeData")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("CostumeFlgArray")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DifficultyPlayedArray")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DifficultySettingArray")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("DisplayAchievement")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("DisplayDan")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("FavoriteSongsArray")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GenericInfoFlgArray")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("IsSkipOn")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsVoiceOn")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("LastPlayDatetime")
|
||||
.HasColumnType("datetime");
|
||||
|
||||
b.Property<uint>("LastPlayMode")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("MyDonName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<uint>("MyDonNameLanguage")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("NotesPosition")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<short>("OptionSetting")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("SelectedToneId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TitleFlgArray")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<uint>("TitlePlateId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("TokenCountDict")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ToneFlgArray")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("UnlockedSongIdList")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Baid");
|
||||
|
||||
b.ToTable("UserData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
|
||||
{
|
||||
b.HasOne("GameDatabase.Entities.Card", "Ba")
|
||||
.WithMany()
|
||||
.HasForeignKey("Baid")
|
||||
.HasPrincipalKey("Baid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Ba");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.AiSectionScoreDatum", b =>
|
||||
{
|
||||
b.HasOne("GameDatabase.Entities.AiScoreDatum", "Parent")
|
||||
.WithMany("AiSectionScoreData")
|
||||
.HasForeignKey("Baid", "SongId", "Difficulty")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Parent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
|
||||
{
|
||||
b.HasOne("GameDatabase.Entities.Card", "Ba")
|
||||
.WithMany()
|
||||
.HasForeignKey("Baid")
|
||||
.HasPrincipalKey("Baid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Ba");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.DanStageScoreDatum", b =>
|
||||
{
|
||||
b.HasOne("GameDatabase.Entities.DanScoreDatum", "Parent")
|
||||
.WithMany("DanStageScoreData")
|
||||
.HasForeignKey("Baid", "DanId", "DanType")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Parent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.SongBestDatum", b =>
|
||||
{
|
||||
b.HasOne("GameDatabase.Entities.Card", "Ba")
|
||||
.WithMany()
|
||||
.HasForeignKey("Baid")
|
||||
.HasPrincipalKey("Baid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Ba");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.SongPlayDatum", b =>
|
||||
{
|
||||
b.HasOne("GameDatabase.Entities.Card", "Ba")
|
||||
.WithMany()
|
||||
.HasForeignKey("Baid")
|
||||
.HasPrincipalKey("Baid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Ba");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.UserDatum", b =>
|
||||
{
|
||||
b.HasOne("GameDatabase.Entities.Card", "Ba")
|
||||
.WithMany()
|
||||
.HasForeignKey("Baid")
|
||||
.HasPrincipalKey("Baid")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Ba");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.AiScoreDatum", b =>
|
||||
{
|
||||
b.Navigation("AiSectionScoreData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GameDatabase.Entities.DanScoreDatum", b =>
|
||||
{
|
||||
b.Navigation("DanStageScoreData");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
102
GameDatabase/Migrations/20231017102350_AddDanType.cs
Normal file
102
GameDatabase/Migrations/20231017102350_AddDanType.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GameDatabase.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddDanType : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DanStageScoreData_DanScoreData_Baid_DanId",
|
||||
table: "DanStageScoreData");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_DanStageScoreData",
|
||||
table: "DanStageScoreData");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_DanScoreData",
|
||||
table: "DanScoreData");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "DanType",
|
||||
table: "DanScoreData",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 1);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "DanType",
|
||||
table: "DanStageScoreData",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 1);
|
||||
|
||||
/*migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_DanScoreData",
|
||||
table: "DanScoreData",
|
||||
columns: new[] { "Baid", "DanId", "DanType" });*/
|
||||
// Add primary key to DanScoreData with raw sql
|
||||
migrationBuilder.Sql("CREATE UNIQUE INDEX PK_DanScoreData ON DanScoreData (Baid, DanId, DanType);");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_DanStageScoreData",
|
||||
table: "DanStageScoreData",
|
||||
columns: new[] { "Baid", "DanId", "DanType", "SongNumber" });
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DanStageScoreData_DanScoreData_Baid_DanId_DanType",
|
||||
table: "DanStageScoreData",
|
||||
columns: new[] { "Baid", "DanId", "DanType" },
|
||||
principalTable: "DanScoreData",
|
||||
principalColumns: new[] { "Baid", "DanId", "DanType" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_DanStageScoreData_DanScoreData_Baid_DanId_DanType",
|
||||
table: "DanStageScoreData");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_DanStageScoreData",
|
||||
table: "DanStageScoreData");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_DanScoreData",
|
||||
table: "DanScoreData");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DanType",
|
||||
table: "DanStageScoreData");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DanType",
|
||||
table: "DanScoreData");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_DanStageScoreData",
|
||||
table: "DanStageScoreData",
|
||||
columns: new[] { "Baid", "DanId", "SongNumber" });
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_DanScoreData",
|
||||
table: "DanScoreData",
|
||||
columns: new[] { "Baid", "DanId" });
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_DanStageScoreData_DanScoreData_Baid_DanId",
|
||||
table: "DanStageScoreData",
|
||||
columns: new[] { "Baid", "DanId" },
|
||||
principalTable: "DanScoreData",
|
||||
principalColumns: new[] { "Baid", "DanId" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
@ -108,6 +108,10 @@ namespace TaikoLocalServer.Migrations
|
||||
b.Property<uint>("DanId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DanType")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasDefaultValue(1);
|
||||
|
||||
b.Property<uint>("ArrivalSongCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
@ -122,7 +126,7 @@ namespace TaikoLocalServer.Migrations
|
||||
b.Property<uint>("SoulGaugeTotal")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Baid", "DanId");
|
||||
b.HasKey("Baid", "DanId", "DanType");
|
||||
|
||||
b.ToTable("DanScoreData");
|
||||
});
|
||||
@ -135,6 +139,10 @@ namespace TaikoLocalServer.Migrations
|
||||
b.Property<uint>("DanId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DanType")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasDefaultValue(1);
|
||||
|
||||
b.Property<uint>("SongNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
@ -162,7 +170,7 @@ namespace TaikoLocalServer.Migrations
|
||||
b.Property<uint>("TotalHitCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Baid", "DanId", "SongNumber");
|
||||
b.HasKey("Baid", "DanId", "DanType", "SongNumber");
|
||||
|
||||
b.ToTable("DanStageScoreData");
|
||||
});
|
||||
@ -401,7 +409,7 @@ namespace TaikoLocalServer.Migrations
|
||||
{
|
||||
b.HasOne("GameDatabase.Entities.DanScoreDatum", "Parent")
|
||||
.WithMany("DanStageScoreData")
|
||||
.HasForeignKey("Baid", "DanId")
|
||||
.HasForeignKey("Baid", "DanId", "DanType")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JorgeSerrano.Json.JsonSnakeCaseNamingPolicy" Version="0.9.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.1.23419.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.1.23419.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.1.23419.6">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.2.23480.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.2.23480.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.2.23480.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
7
SharedProject/Enums/DanType.cs
Normal file
7
SharedProject/Enums/DanType.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace SharedProject.Enums;
|
||||
|
||||
public enum DanType
|
||||
{
|
||||
Normal = 1,
|
||||
Gaiden = 2
|
||||
}
|
4
TaikoLocalServer/.gitignore
vendored
4
TaikoLocalServer/.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
wwwroot/data/music_order.json
|
||||
wwwroot/data/musicinfo.json
|
||||
wwwroot/data/wordlist.json
|
||||
wwwroot/data/wordlist.json
|
||||
wwwroot/data/datatable/*
|
||||
wwwroot/taiko.db3
|
@ -17,7 +17,8 @@ public class DanBestDataController : BaseController<DanBestDataController>
|
||||
[HttpGet("{baid}")]
|
||||
public async Task<IActionResult> GetDanBestData(ulong baid)
|
||||
{
|
||||
var danScores = await danScoreDatumService.GetDanScoreDatumByBaid(baid);
|
||||
// FIXME: Handle gaiden in here and web ui
|
||||
var danScores = await danScoreDatumService.GetDanScoreDataList(baid, DanType.Normal);
|
||||
var danDataList = new List<DanBestData>();
|
||||
|
||||
foreach (var danScore in danScores)
|
||||
|
@ -87,7 +87,7 @@ public class BaidController : BaseController<BaidController>
|
||||
.Select((size, index) => FlagCalculator.GetBitArrayFromIds(costumeArrays[index], size, Logger))
|
||||
.ToList();
|
||||
|
||||
var danData = await danScoreDatumService.GetDanScoreDatumByBaid(baid);
|
||||
var danData = await danScoreDatumService.GetDanScoreDataList(baid, DanType.Normal);
|
||||
|
||||
var maxDan = danData.Where(datum => datum.ClearState != DanClearState.NotClear)
|
||||
.Select(datum => datum.DanId)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using GameDatabase.Entities;
|
||||
using Throw;
|
||||
|
||||
namespace TaikoLocalServer.Controllers.Game;
|
||||
|
||||
@ -24,7 +25,9 @@ public class GetDanScoreController : BaseController<GetDanScoreController>
|
||||
Result = 1
|
||||
};
|
||||
|
||||
var danScoreData = await danScoreDatumService.GetDanScoreDatumByBaid(request.Baid);
|
||||
var danType = (DanType)request.Type;
|
||||
danType.Throw().IfOutOfRange();
|
||||
var danScoreData = await danScoreDatumService.GetDanScoreDataList(request.Baid, danType);
|
||||
|
||||
foreach (var danId in request.DanIds)
|
||||
{
|
||||
|
@ -73,7 +73,8 @@ public class PlayResultController : BaseController<PlayResultController>
|
||||
|
||||
if (playMode is PlayMode.DanMode or PlayMode.GaidenMode)
|
||||
{
|
||||
await UpdateDanPlayData(request, playResultData);
|
||||
var danType = playMode == PlayMode.DanMode ? DanType.Normal : DanType.Gaiden;
|
||||
await UpdateDanPlayData(request, playResultData, danType);
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
@ -116,7 +117,7 @@ public class PlayResultController : BaseController<PlayResultController>
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
private async Task UpdateDanPlayData(PlayResultRequest request, PlayResultDataRequest playResultDataRequest)
|
||||
private async Task UpdateDanPlayData(PlayResultRequest request, PlayResultDataRequest playResultDataRequest, DanType danType)
|
||||
{
|
||||
if (playResultDataRequest.IsNotRecordedDan)
|
||||
{
|
||||
@ -125,11 +126,12 @@ public class PlayResultController : BaseController<PlayResultController>
|
||||
}
|
||||
|
||||
var danScoreData =
|
||||
await danScoreDatumService.GetSingleDanScoreDatum(request.BaidConf, playResultDataRequest.DanId) ??
|
||||
await danScoreDatumService.GetSingleDanScoreDatum(request.BaidConf, playResultDataRequest.DanId, danType) ??
|
||||
new DanScoreDatum
|
||||
{
|
||||
Baid = request.BaidConf,
|
||||
DanId = playResultDataRequest.DanId
|
||||
DanId = playResultDataRequest.DanId,
|
||||
DanType = danType
|
||||
};
|
||||
danScoreData.ClearState =
|
||||
(DanClearState)Math.Max(playResultDataRequest.DanResult, (uint)danScoreData.ClearState);
|
||||
@ -155,6 +157,7 @@ public class PlayResultController : BaseController<PlayResultController>
|
||||
{
|
||||
Baid = danScoreData.Baid,
|
||||
DanId = danScoreData.DanId,
|
||||
DanType = danScoreData.DanType,
|
||||
SongNumber = (uint)songNumber,
|
||||
OkCount = stageData.OkCnt,
|
||||
BadCount = stageData.NgCnt
|
||||
|
@ -145,7 +145,7 @@ try
|
||||
|
||||
app.Run();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (ex.GetType().Name is not "HostAbortedException")
|
||||
{
|
||||
Log.Fatal(ex, "Unhandled exception");
|
||||
}
|
||||
|
@ -12,18 +12,19 @@ public class DanScoreDatumService : IDanScoreDatumService
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public async Task<List<DanScoreDatum>> GetDanScoreDatumByBaid(ulong baid)
|
||||
public async Task<List<DanScoreDatum>> GetDanScoreDataList(ulong baid, DanType danType)
|
||||
{
|
||||
return await context.DanScoreData.Where(datum => datum.Baid == baid)
|
||||
return await context.DanScoreData.Where(datum => datum.Baid == baid && datum.DanType == danType)
|
||||
.Include(datum => datum.DanStageScoreData)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<DanScoreDatum?> GetSingleDanScoreDatum(ulong baid, uint danId)
|
||||
public async Task<DanScoreDatum?> GetSingleDanScoreDatum(ulong baid, uint danId, DanType danType)
|
||||
{
|
||||
return await context.DanScoreData.Include(datum => datum.DanStageScoreData)
|
||||
.FirstOrDefaultAsync(datum => datum.Baid == baid &&
|
||||
datum.DanId == danId);
|
||||
datum.DanId == danId &&
|
||||
datum.DanType == danType);
|
||||
}
|
||||
|
||||
public async Task InsertOrUpdateDanScoreDatum(DanScoreDatum datum)
|
||||
|
@ -4,9 +4,9 @@ namespace TaikoLocalServer.Services.Interfaces;
|
||||
|
||||
public interface IDanScoreDatumService
|
||||
{
|
||||
public Task<List<DanScoreDatum>> GetDanScoreDatumByBaid(ulong baid);
|
||||
public Task<List<DanScoreDatum>> GetDanScoreDataList(ulong baid, DanType danType);
|
||||
|
||||
public Task<DanScoreDatum?> GetSingleDanScoreDatum(ulong baid, uint danId);
|
||||
public Task<DanScoreDatum?> GetSingleDanScoreDatum(ulong baid, uint danId, DanType danType);
|
||||
|
||||
public Task InsertOrUpdateDanScoreDatum(DanScoreDatum datum);
|
||||
}
|
@ -15,9 +15,9 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0-rc.1.23421.29" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.1.23419.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.1.23419.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.1.23419.6">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.2.23480.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.2.23480.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.2.23480.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -115,7 +115,22 @@
|
||||
<Content Update="wwwroot\data\neiro.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\datatable\.placeholder">
|
||||
<Content Update="wwwroot\data\datatable\don_cos_reward.bin">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\data\datatable\music_order.bin">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\data\datatable\musicinfo.bin">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\data\datatable\neiro.bin">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\data\datatable\shougou.bin">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\data\datatable\wordlist.bin">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user