成就系统 巨大修改 新的ui 黑白效果 等一堆

This commit is contained in:
FloatGaming
2026-01-23 18:43:23 +08:00
parent f3ece026ca
commit 0e47864569
256 changed files with 134131 additions and 31192 deletions
@@ -2,6 +2,7 @@ using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections;
using DG.Tweening;
public class SongButton : MonoBehaviour
{
@@ -13,9 +14,11 @@ public class SongButton : MonoBehaviour
public Text joinTime_and_dlcName_Text;
public Text songOverallDescriptionText;
public Text highestScoreText;
public Text highestScoreDifficultyText;
public Text difficultyIDText;
public Text songIDText;
public Image buttonImage;
public Image scoreLevelImage;
[Header("头图")]
public Image profileImage;
public int song_songSerialID;
@@ -23,6 +26,28 @@ public class SongButton : MonoBehaviour
public Image selected_boarder;
public Image fade_image;
[Header("计数百分比")]
public float easePercent = 1f;
public float ssPercent = 0.95f;
public float sPercent = 0.9f;
public float aPercent = 0.8f;
public float bPercent = 0.7f;
public float cPercent = 0.6f;
public float dPercent = 0.5f;
public float ePercent = 0.4f;
public float fPercent = 0.3f;
[Header("阶段图")]
public Sprite easeSprite;
public Sprite ssSprite;
public Sprite sSprite;
public Sprite aSprite;
public Sprite bSprite;
public Sprite cSprite;
public Sprite dSprite;
public Sprite eSprite;
public Sprite fSprite;
public Sprite ufSprite;
[Header("Fade Image Settings")]
public float minAlpha = 0f;
public float maxAlpha = 1f;
@@ -72,32 +97,122 @@ public class SongButton : MonoBehaviour
songOverallDescriptionText.text = string.IsNullOrEmpty(sd.thisLevel_overallDescription) ? "暂无歌曲简介。" : sd.thisLevel_overallDescription;
}
int bestTotal = 0;
// Robust logic: compute best total across chartFiles if present
int bestTotal = -1;
int bestDiff = -1;
if (sd.personalRecordMap != null)
if (sd.chartFiles != null && sd.chartFiles.Count > 0)
{
foreach (var kvp in sd.personalRecordMap)
foreach (var entry in sd.chartFiles)
{
int diff = kvp.Key;
int p = kvp.Value;
int i = sd.GetIdolRecord(diff);
int combined = p + i;
if (combined > bestTotal)
if (entry == null) continue;
int total = 0;
// prefer stored total if > 0
if (entry.totalPersonalRecordForThisDifficulty > 0)
{
bestTotal = combined;
bestDiff = diff;
total = entry.totalPersonalRecordForThisDifficulty;
}
else
{
// else compute from entry fields
int p = entry.chartPersonalRecordForThisDifficulty;
int i = entry.idolPersonalRecordForThisDifficulty;
total = p + i;
// as fallback also check SongData maps
if (total == 0 && sd.personalRecordMap != null)
{
int pm = sd.personalRecordMap.ContainsKey(entry.difficulty) ? sd.personalRecordMap[entry.difficulty] : 0;
int im = sd.idolRecordMap != null && sd.idolRecordMap.ContainsKey(entry.difficulty) ? sd.idolRecordMap[entry.difficulty] : 0;
total = pm + im;
}
}
if (bestDiff == -1 || total > bestTotal)
{
bestTotal = total;
bestDiff = entry.difficulty;
}
}
}
// If still not found, fallback to maps
if (bestDiff == -1)
{
if (sd.personalRecordMap != null)
{
foreach (var kvp in sd.personalRecordMap)
{
int diff = kvp.Key;
int p = kvp.Value;
int i = sd.GetIdolRecord(diff);
int combined = p + i;
if (bestDiff == -1 || combined > bestTotal)
{
bestTotal = combined;
bestDiff = diff;
}
}
}
}
// final fallback
if (bestDiff == -1)
{
bestTotal = sd.personalRecord;
bestDiff = sd.thisLevel_selectedDifficultyID;
}
if (bestTotal < 0) bestTotal = 0;
if (highestScoreText != null) highestScoreText.text = bestTotal.ToString();
// Map difficulty index to label and set highestScoreDifficultyText as (Label)
if (highestScoreDifficultyText != null)
{
string label = "";
switch (bestDiff)
{
case 0: label = "(Easy)"; break;
case 1: label = "(Hard)"; break;
case 2: label = "(Incredible)"; break;
case 3: label = "(Impossible)"; break;
default: label = ""; break;
}
highestScoreDifficultyText.text = label;
}
// Assign scoreLevelImage based on thresholds relative to 2,000,000
if (scoreLevelImage != null)
{
Sprite chosenSprite = null;
float baseScore = 2000000f;
// Evaluate from top to bottom thresholds
if (bestTotal >= baseScore * easePercent && easeSprite != null)
chosenSprite = easeSprite;
else if (bestTotal >= baseScore * ssPercent && ssSprite != null)
chosenSprite = ssSprite;
else if (bestTotal >= baseScore * sPercent && sSprite != null)
chosenSprite = sSprite;
else if (bestTotal >= baseScore * aPercent && aSprite != null)
chosenSprite = aSprite;
else if (bestTotal >= baseScore * bPercent && bSprite != null)
chosenSprite = bSprite;
else if (bestTotal >= baseScore * cPercent && cSprite != null)
chosenSprite = cSprite;
else if (bestTotal >= baseScore * dPercent && dSprite != null)
chosenSprite = dSprite;
else if (bestTotal >= baseScore * ePercent && eSprite != null)
chosenSprite = eSprite;
else if (bestTotal >= baseScore * fPercent && fSprite != null)
chosenSprite = fSprite;
else if (ufSprite != null)
chosenSprite = ufSprite;
if (chosenSprite != null)
scoreLevelImage.sprite = chosenSprite;
}
// Determine displayed difficulty: show the highest difficultyLEVEL present in chartFiles (if any)
string diffDisplay = "0";
if (sd.chartFiles != null && sd.chartFiles.Count > 0)