1
0
mirror of synced 2025-02-17 11:18:32 +01:00

Added basic AiScore functionality

Nothing was added to the database, so the main database comparison logic isn't there yet, but I added some comments describing how it should be updating.
This commit is contained in:
Deathblood 2022-09-12 18:34:18 -05:00
parent 90878fa848
commit de1a50682e
3 changed files with 74 additions and 1 deletions

View File

@ -15,6 +15,59 @@ public class GetAiScoreController : BaseController<GetAiScoreController>
Result = 1 Result = 1
}; };
// There's either 3 or 5 total sections
// SectionNo doesn't seem to actually affect which section is being assigned to, only the List order matters
response.AryBestSectionDatas.Add(new GetAiScoreResponse.AiBestSectionData()
{
SectionNo = 1,
Crown = (uint)CrownType.Clear,
Score = 100000,
GoodCnt = 100,
OkCnt = 50,
NgCnt = 25,
PoundCnt = 12
});
response.AryBestSectionDatas.Add(new GetAiScoreResponse.AiBestSectionData()
{
SectionNo = 2,
Crown = (uint)CrownType.Gold,
Score = 100001,
GoodCnt = 101,
OkCnt = 50,
NgCnt = 25,
PoundCnt = 12
});
response.AryBestSectionDatas.Add(new GetAiScoreResponse.AiBestSectionData()
{
SectionNo = 3,
Crown = (uint)CrownType.Dondaful,
Score = 100002,
GoodCnt = 102,
OkCnt = 50,
NgCnt = 25,
PoundCnt = 12
});
response.AryBestSectionDatas.Add(new GetAiScoreResponse.AiBestSectionData()
{
SectionNo = 4,
Crown = (uint)CrownType.Gold,
Score = 100003,
GoodCnt = 103,
OkCnt = 50,
NgCnt = 25,
PoundCnt = 12
});
response.AryBestSectionDatas.Add(new GetAiScoreResponse.AiBestSectionData()
{
SectionNo = 5,
Crown = (uint)CrownType.Clear,
Score = 100004,
GoodCnt = 104,
OkCnt = 50,
NgCnt = 25,
PoundCnt = 12
});
return Ok(response); return Ok(response);
} }
} }

View File

@ -36,7 +36,7 @@ public class InitialDataCheckController : BaseController<InitialDataCheckControl
{ {
Result = 1, Result = 1,
IsDanplay = true, IsDanplay = true,
IsAibattle = false, IsAibattle = true,
IsClose = false, IsClose = false,
DefaultSongFlg = enabledArray, DefaultSongFlg = enabledArray,
AchievementSongBit = enabledArray, AchievementSongBit = enabledArray,

View File

@ -63,6 +63,13 @@ public class PlayResultController : BaseController<PlayResultController>
{ {
var stageData = playResultData.AryStageInfoes[songNumber]; var stageData = playResultData.AryStageInfoes[songNumber];
if (playMode == PlayMode.AiBattle)
{
await UpdateAiBattleData(request, stageData);
// Update AI win count here somewhere, or in UpdatePlayData?
// I have no clue how to update input median or variance
}
await UpdateBestData(request, stageData, bestData); await UpdateBestData(request, stageData, bestData);
await UpdatePlayData(request, songNumber, stageData, lastPlayDatetime); await UpdatePlayData(request, songNumber, stageData, lastPlayDatetime);
@ -208,6 +215,19 @@ public class PlayResultController : BaseController<PlayResultController>
await songBestDatumService.UpdateOrInsertSongBestDatum(bestDatum); await songBestDatumService.UpdateOrInsertSongBestDatum(bestDatum);
} }
private async Task UpdateAiBattleData(PlayResultRequest request, StageData stageData)
{
for (int i = 0; i < stageData.ArySectionDatas.Count; i++)
{
// Only update crown if it's a higher crown than the previous best crown
// Maybe have a "SectionNo" variable for which section number it is on the DB
// compare DB.SectionNo == i
// if any aspect of the section is higher than the previous best, update it
// Similar to Dan best play updates
}
}
private static CrownType PlayResultToCrown(StageData stageData) private static CrownType PlayResultToCrown(StageData stageData)
{ {
var crown = (CrownType)stageData.PlayResult; var crown = (CrownType)stageData.PlayResult;