1
0
mirror of synced 2024-11-27 16:10:53 +01:00

Update dan score update logic

This commit is contained in:
asesidaa 2022-09-08 00:35:23 +08:00
parent 32191187fe
commit 743af36752
2 changed files with 11 additions and 25 deletions

View File

@ -8,8 +8,6 @@ public static class ObjectMappers
{
public static readonly IObjectMap<DanStageScoreDatum, DanScoreDataStage> DanStageDbToResponseMap;
public static readonly IObjectMap<DanScoreDataStage, DanStageScoreDatum> DanStageResponseToDbMap;
static ObjectMappers()
{
@ -23,15 +21,5 @@ public static class ObjectMappers
.Add(t => t.PoundCnt, s => s.DrumrollCount)
.Add(t => t.PlayScore, s => s.PlayScore)
.Add(t => t.HighScore, s => s.HighScore);
DanStageResponseToDbMap = mapper.AddMap<DanScoreDataStage, DanStageScoreDatum>()
.Add(t => t.ComboCount, s => s.ComboCnt)
.Add(t => t.GoodCount, s => s.GoodCnt)
.Add(t => t.OkCount, s => s.OkCnt)
.Add(t => t.BadCount, s => s.NgCnt)
.Add(t => t.TotalHitCount, s => s.HitCnt)
.Add(t => t.DrumrollCount, s => s.PoundCnt)
.Add(t => t.PlayScore, s => s.PlayScore)
.Add(t => t.HighScore, s => s.HighScore);
}
}

View File

@ -79,10 +79,10 @@ public class PlayResultController : BaseController<PlayResultController>
danScoreData = danScoreDataQuery.First();
insert = false;
}
danScoreData.ClearState = (DanClearState)playResultDataRequest.DanResult;
danScoreData.ArrivalSongCount = (uint)playResultDataRequest.AryStageInfoes.Count;
danScoreData.ComboCountTotal = playResultDataRequest.ComboCntTotal;
danScoreData.SoulGaugeTotal = playResultDataRequest.SoulGaugeTotal;
danScoreData.ClearState = (DanClearState)Math.Max(playResultDataRequest.DanResult, (uint)danScoreData.ClearState);
danScoreData.ArrivalSongCount = Math.Max((uint)playResultDataRequest.AryStageInfoes.Count, danScoreData.ArrivalSongCount);
danScoreData.ComboCountTotal = Math.Max(playResultDataRequest.ComboCntTotal, danScoreData.ComboCountTotal);
danScoreData.SoulGaugeTotal = Math.Max(playResultDataRequest.SoulGaugeTotal, danScoreData.SoulGaugeTotal);
UpdateDanStageData(playResultDataRequest, danScoreData);
@ -112,23 +112,21 @@ public class PlayResultController : BaseController<PlayResultController>
add = false;
}
// FIXME: Add proper logic for high score update
if (danStageData.HighScore >= stageData.PlayScore)
{
continue;
}
ObjectMappers.DanStageResponseToDbMap.Apply(stageData, danStageData);
danStageData.HighScore = Math.Max(danStageData.HighScore, stageData.PlayScore);
danStageData.ComboCount = Math.Max(danStageData.ComboCount, stageData.ComboCnt);
danStageData.DrumrollCount = Math.Max(danStageData.DrumrollCount, stageData.PoundCnt);
danStageData.GoodCount = Math.Max(danStageData.GoodCount, stageData.GoodCnt);
danStageData.TotalHitCount = Math.Max(danStageData.TotalHitCount, stageData.HitCnt);
danStageData.OkCount = Math.Min(danStageData.OkCount, stageData.OkCnt);
danStageData.BadCount = Math.Min(danStageData.BadCount, stageData.NgCnt);
if (add)
{
context.DanStageScoreData.Add(danStageData);
// danScoreData.DanStageScoreData.Add(danStageData);
continue;
}
context.DanStageScoreData.Update(danStageData);
// danScoreData.DanStageScoreData[songNumber] = danStageData;
}
}