修复歌曲按钮bug和最高分展示逻辑

This commit is contained in:
FloatGaming
2026-01-23 20:21:04 +08:00
parent 0e47864569
commit aee8ae634e
3 changed files with 144 additions and 132 deletions
@@ -294,46 +294,31 @@ public class settlementController : MonoBehaviour
int idol = sm != null ? sm.allSum_idolScore : 0;
int total = pm + idol;
// compare and update per-difficulty personal/idol records
int prevPm = thisSong_so.GetPersonalRecord(diff);
int prevIdol = thisSong_so.GetIdolRecord(diff);
// 更新最高分 (仅当本次总分更高时)
thisSong_so.UpdateDifficultyRecord(diff, pm, idol);
if (pm > prevPm)
{
thisSong_so.UpdatePersonalRecord(diff, pm);
}
if (idol > prevIdol)
{
thisSong_so.UpdateIdolRecord(diff, idol);
}
// update last-run total (chart score map / entry.lastScoreForThisDifficulty)
// 更新上次游玩分数
thisSong_so.UpdateChartScore(diff, total);
// update entry convenience fields (total and progress) only if improved
// 更新进度 (仅当进步时)
if (thisSong_so.chartFiles != null)
{
var entry = thisSong_so.chartFiles.Find(e => e != null && e.difficulty == diff);
if (entry != null)
{
entry.totalPersonalRecordForThisDifficulty = thisSong_so.GetPersonalRecord(diff) + thisSong_so.GetIdolRecord(diff);
// compute progress as 0..1
float newProgress = Mathf.Clamp01((float)entry.totalPersonalRecordForThisDifficulty / (float)maxScore_sum);
// 进度计算 (0..1)
float newProgress = Mathf.Clamp01((float)total / (float)maxScore_sum);
if (newProgress > entry.levelProgressForThisDifficulty)
{
entry.levelProgressForThisDifficulty = newProgress;
}
// if this is the currently selected difficulty for this song, update SongData.current_levelProgress
if (thisSong_so.thisLevel_selectedDifficultyID == diff)
{
thisSong_so.current_levelProgress = Mathf.Max(thisSong_so.current_levelProgress, entry.levelProgressForThisDifficulty);
}
}
}
// refresh overall personalRecord cached value
thisSong_so.CalculateHighestPersonalRecord();
}
}