diff --git a/TaikoLocalServer/Common/Utils/ObjectMappers.cs b/TaikoLocalServer/Common/Utils/ObjectMappers.cs index 6b69d8b..1220fff 100644 --- a/TaikoLocalServer/Common/Utils/ObjectMappers.cs +++ b/TaikoLocalServer/Common/Utils/ObjectMappers.cs @@ -8,8 +8,6 @@ public static class ObjectMappers { public static readonly IObjectMap DanStageDbToResponseMap; - - public static readonly IObjectMap 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() - .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); } } \ No newline at end of file diff --git a/TaikoLocalServer/Controllers/Game/PlayResultController.cs b/TaikoLocalServer/Controllers/Game/PlayResultController.cs index 9cee3dd..880ae83 100644 --- a/TaikoLocalServer/Controllers/Game/PlayResultController.cs +++ b/TaikoLocalServer/Controllers/Game/PlayResultController.cs @@ -79,10 +79,10 @@ public class PlayResultController : BaseController 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 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; } }