Fixed recently played song and crown saving
This commit is contained in:
parent
c041549d3f
commit
b4d612e015
@ -66,6 +66,19 @@ public class PlayResultController : ControllerBase
|
|||||||
var bestDatum = bestData
|
var bestDatum = bestData
|
||||||
.FirstOrDefault(datum => datum.SongId == stageData.SongNo &&
|
.FirstOrDefault(datum => datum.SongId == stageData.SongNo &&
|
||||||
datum.Difficulty == (Difficulty)stageData.Level);
|
datum.Difficulty == (Difficulty)stageData.Level);
|
||||||
|
var crown = CrownType.None;
|
||||||
|
if (stageData.PlayResult > 0)
|
||||||
|
{
|
||||||
|
crown = CrownType.Clear;
|
||||||
|
if (stageData.NgCnt == 0)
|
||||||
|
{
|
||||||
|
crown = CrownType.Gold;
|
||||||
|
if (stageData.OkCnt == 0)
|
||||||
|
{
|
||||||
|
crown = CrownType.Dondaful;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (bestDatum is null)
|
if (bestDatum is null)
|
||||||
{
|
{
|
||||||
insert = true;
|
insert = true;
|
||||||
@ -76,9 +89,9 @@ public class PlayResultController : ControllerBase
|
|||||||
Difficulty = (Difficulty)stageData.Level
|
Difficulty = (Difficulty)stageData.Level
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ((uint)bestDatum.BestCrown < stageData.PlayResult)
|
if (bestDatum.BestCrown < crown)
|
||||||
{
|
{
|
||||||
bestDatum.BestCrown = (CrownType)stageData.PlayResult;
|
bestDatum.BestCrown = crown;
|
||||||
}
|
}
|
||||||
if ((uint)bestDatum.BestScoreRank < stageData.ScoreRank)
|
if ((uint)bestDatum.BestScoreRank < stageData.ScoreRank)
|
||||||
{
|
{
|
||||||
@ -110,7 +123,7 @@ public class PlayResultController : ControllerBase
|
|||||||
MissCount = stageData.NgCnt,
|
MissCount = stageData.NgCnt,
|
||||||
ComboCount = stageData.ComboCnt,
|
ComboCount = stageData.ComboCnt,
|
||||||
HitCount = stageData.HitCnt,
|
HitCount = stageData.HitCnt,
|
||||||
Crown = (CrownType)stageData.PlayResult,
|
Crown = crown,
|
||||||
Score = stageData.PlayScore,
|
Score = stageData.PlayScore,
|
||||||
ScoreRate = stageData.ScoreRate,
|
ScoreRate = stageData.ScoreRate,
|
||||||
ScoreRank = (ScoreRank)stageData.ScoreRank,
|
ScoreRank = (ScoreRank)stageData.ScoreRank,
|
||||||
|
@ -48,8 +48,8 @@ public class UserDataController : ControllerBase
|
|||||||
|
|
||||||
var recentSongs = context.SongPlayData
|
var recentSongs = context.SongPlayData
|
||||||
.Where(datum => datum.Baid == request.Baid)
|
.Where(datum => datum.Baid == request.Baid)
|
||||||
.OrderByDescending(datum => datum.PlayTime)
|
|
||||||
.AsEnumerable()
|
.AsEnumerable()
|
||||||
|
.Reverse()
|
||||||
.DistinctBy(datum => datum.SongId)
|
.DistinctBy(datum => datum.SongId)
|
||||||
.Take(10)
|
.Take(10)
|
||||||
.Select(datum => datum.SongId)
|
.Select(datum => datum.SongId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user