修了很多bug和增加功能,优化不少问题
This commit is contained in:
@@ -448,6 +448,56 @@ public class ScoreManager : MonoBehaviour
|
||||
UpdateIdolscoreKeyScales();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add idol score directly to a track (0..4) without changing pm score.
|
||||
/// Used by skills that grant/consume idol score independently from note judgement pm.
|
||||
/// </summary>
|
||||
public void AddIdolScoreForTrack(int trackIndex, int idolDelta)
|
||||
{
|
||||
TryHookPerfectBonusEvent();
|
||||
if (trackIndex < 0 || trackIndex >= idolScoreSums.Length) return;
|
||||
if (idolDelta == 0) return;
|
||||
|
||||
idolScoreSums[trackIndex] += idolDelta;
|
||||
if (idolScoreSums[trackIndex] < 0) idolScoreSums[trackIndex] = 0;
|
||||
if (idolScoreSums[trackIndex] > int.MaxValue - 1) idolScoreSums[trackIndex] = int.MaxValue - 1;
|
||||
|
||||
red_idolScore_sum = idolScoreSums[0];
|
||||
green_idolScore_sum = idolScoreSums[1];
|
||||
yellow_idolScore_sum = idolScoreSums[2];
|
||||
purple_idolScore_sum = idolScoreSums[3];
|
||||
blue_idolScore_sum = idolScoreSums[4];
|
||||
|
||||
long aggPm = 0;
|
||||
long aggIdol = 0;
|
||||
for (int i = 0; i < pmScoreSums.Length; i++) aggPm += pmScoreSums[i];
|
||||
for (int i = 0; i < idolScoreSums.Length; i++) aggIdol += idolScoreSums[i];
|
||||
long aggPmWithBonus = aggPm + (long)perfectClearBonusPm;
|
||||
|
||||
allSum_pmScore = (int)Mathf.Min((float)aggPmWithBonus, (float)int.MaxValue - 1f);
|
||||
allSum_idolScore = (int)Mathf.Min((float)aggIdol, (float)int.MaxValue - 1f);
|
||||
|
||||
var ui = teamUIController.Instance;
|
||||
if (ui != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ui.red_idolScore_sum != null) ui.red_idolScore_sum.text = red_idolScore_sum.ToString();
|
||||
if (ui.green_idolScore_sum != null) ui.green_idolScore_sum.text = green_idolScore_sum.ToString();
|
||||
if (ui.yellow_idolScore_sum != null) ui.yellow_idolScore_sum.text = yellow_idolScore_sum.ToString();
|
||||
if (ui.purple_idolScore_sum != null) ui.purple_idolScore_sum.text = purple_idolScore_sum.ToString();
|
||||
if (ui.blue_idolScore_sum != null) ui.blue_idolScore_sum.text = blue_idolScore_sum.ToString();
|
||||
if (ui.allSum_idolScore != null) ui.allSum_idolScore.text = allSum_idolScore.ToString();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
if (JudgeManager.IsDebugEnabled) Debug.LogWarning($"[ScoreManager] Failed to write idol sums to teamUIController fields: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
RecalculateTotal();
|
||||
}
|
||||
|
||||
public void RecalculateTotal()
|
||||
{
|
||||
EnsureAllyCache();
|
||||
|
||||
Reference in New Issue
Block a user