UI HUGE UPDATE

This commit is contained in:
FloatGaming
2026-06-25 11:48:56 +08:00
parent bd2a06f4c7
commit b2a1e307a4
1806 changed files with 359863 additions and 20822 deletions
@@ -294,19 +294,19 @@ public class BeatmapManager : MonoBehaviour
}
// Documentation text normalized.
public bool LoadBeatmapFromSongData(SongData song, int difficulty, bool parseOnly = false)
{
if (song == null)
{
Debug.LogWarning("LoadBeatmapFromSongData: song is null");
return false;
}
TextAsset ta = song.GetChartFile(difficulty);
if (ta == null)
{
Debug.LogWarning($"LoadBeatmapFromSongData: chart TextAsset for difficulty {difficulty} is null on song {song.songName}");
return false;
}
public bool LoadBeatmapFromSongData(SongData song, int difficulty, bool parseOnly = false)
{
if (song == null)
{
Debug.LogWarning("LoadBeatmapFromSongData: song is null");
return false;
}
TextAsset ta = song.GetResolvedChartFile(difficulty);
if (ta == null)
{
Debug.LogWarning($"LoadBeatmapFromSongData: chart TextAsset for difficulty {difficulty} is null on song {song.songName}");
return false;
}
if (VerboseLogs) Debug.Log($"LoadBeatmapFromSongData: loading chart for song {song.songName}, difficulty {difficulty}, parseOnly={parseOnly}, chartSize={(ta.text != null ? ta.text.Length : 0)}");
return LoadBeatmapFromTextAsset(ta, parseOnly);
}
@@ -339,17 +339,18 @@ public class BeatmapManager : MonoBehaviour
if (VerboseLogs) Debug.Log("BeatmapManager.Start: chart parsed from SongData, attempting to assign audio and pause system");
// try to assign audio to GameManager.musicSource
var gm = SceneObjectLookupCache.FindAny<GameManager>();
if (gm != null && gm.musicSource != null)
{
if (assignedSongData != null && assignedSongData.audioFile != null)
{
gm.musicSource.clip = assignedSongData.audioFile;
gm.musicSource.loop = false;
if (VerboseLogs) Debug.Log("Assigned SongData.audioFile to GameManager.musicSource.clip (from SO)");
}
else if (!string.IsNullOrEmpty(parsedMusicFile))
{
var gm = SceneObjectLookupCache.FindAny<GameManager>();
if (gm != null && gm.musicSource != null)
{
AudioClip resolvedAudio = assignedSongData != null ? assignedSongData.GetResolvedAudioFile() : null;
if (resolvedAudio != null)
{
gm.musicSource.clip = resolvedAudio;
gm.musicSource.loop = false;
if (VerboseLogs) Debug.Log("Assigned resolved SongData audio to GameManager.musicSource.clip (from SO)");
}
else if (!string.IsNullOrEmpty(parsedMusicFile))
{
if (VerboseLogs) Debug.Log($"Attempting Resources.Load for audio: {parsedMusicFile}");
var ac = Resources.Load<AudioClip>(parsedMusicFile);
if (ac != null)
@@ -374,22 +375,23 @@ public class BeatmapManager : MonoBehaviour
}
// Assign fullscreen image from SongData to background images if available
if (assignedSongData != null && assignedSongData.fullscreen_songPicture != null)
{
Sprite bgSprite = assignedSongData.fullscreen_songPicture;
Sprite resolvedBackground = assignedSongData != null ? assignedSongData.GetResolvedFullscreenSongPicture() : null;
if (resolvedBackground != null)
{
Sprite bgSprite = resolvedBackground;
if (bgMainImage != null)
{
bgMainImage.sprite = bgSprite;
// ensure fully visible
bgMainImage.color = new Color(bgMainImage.color.r, bgMainImage.color.g, bgMainImage.color.b, 1f);
if (VerboseLogs) Debug.Log($"Assigned SongData.fullscreen_songPicture to bgMainImage for song {assignedSongData.songName}");
if (VerboseLogs) Debug.Log($"Assigned resolved fullscreen song picture to bgMainImage for song {assignedSongData.songName}");
}
if (bgSpriteRenderer != null)
{
bgSpriteRenderer.sprite = bgSprite;
if (VerboseLogs) Debug.Log($"Assigned SongData.fullscreen_songPicture to bgSpriteRenderer for song {assignedSongData.songName}");
if (VerboseLogs) Debug.Log($"Assigned resolved fullscreen song picture to bgSpriteRenderer for song {assignedSongData.songName}");
// 释放引用以节省内存(按要求:完毕后令 sprite renderer = null
bgSpriteRenderer = null;
}
@@ -397,7 +399,7 @@ public class BeatmapManager : MonoBehaviour
if (startCanvas_image != null)
{
startCanvas_image.sprite = bgSprite;
if (VerboseLogs) Debug.Log($"Assigned SongData.fullscreen_songPicture to startCanvas_image for song {assignedSongData.songName}");
if (VerboseLogs) Debug.Log($"Assigned resolved fullscreen song picture to startCanvas_image for song {assignedSongData.songName}");
}
if (bgMainImage == null && startCanvas_image == null)
@@ -1651,9 +1651,10 @@ public class GameManager : MonoBehaviour
{
if (sd == null) return;
// set background sprite if present
if (backgroundRenderer != null && sd.fullscreen_songPicture != null)
Sprite resolvedBackground = sd.GetResolvedFullscreenSongPicture();
if (backgroundRenderer != null && resolvedBackground != null)
{
backgroundRenderer.sprite = sd.fullscreen_songPicture;
backgroundRenderer.sprite = resolvedBackground;
Color color = backgroundRenderer.color;
color.a = 1f;
backgroundRenderer.color = color;
@@ -1,4 +1,4 @@
%YAML 1.1
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &118873712428923354
GameObject:
@@ -560,7 +560,10 @@ public class settlementController : MonoBehaviour
if(sm != null)
{
songName_Text.text = bmm.parsedTitle;
thisSong_backPic.sprite = bmm.assignedSongData.fullscreen_songPicture;
if (bmm.assignedSongData != null)
{
thisSong_backPic.sprite = bmm.assignedSongData.GetResolvedFullscreenSongPicture();
}
targetPmScore = sm.allSum_pmScore;
targetIdolScore = sm.allSum_idolScore;
@@ -1379,35 +1382,27 @@ public class settlementController : MonoBehaviour
return;
}
dlcData[] allDlcs = RuntimeResourcesCache.LoadAllDlcs();
dlcData foundDlc = null;
dlcData foundDlc = SongDlcContentResolver.GetOwningDlc(thisSong_so);
AudioClip resolvedSettlementMusic = thisSong_so.GetResolvedSettlementMusic();
for (int i = 0; i < allDlcs.Length; i++)
{
dlcData dlc = allDlcs[i];
if (dlc == null || dlc.songList == null) continue;
if (!dlc.songList.Contains(thisSong_so)) continue;
foundDlc = dlc;
break;
}
if (foundDlc == null)
if (foundDlc == null && resolvedSettlementMusic == null)
{
Debug.LogWarning($"[SettlementController] No DLC found containing song '{thisSong_so.songName}'");
return;
}
if (foundDlc.settlementMusic == null)
if (resolvedSettlementMusic == null)
{
Debug.LogWarning($"[SettlementController] DLC '{foundDlc.dlcName}' does not have settlement music assigned");
string dlcName = foundDlc != null ? foundDlc.dlcName : thisSong_so.belongsTo_whichDLC;
Debug.LogWarning($"[SettlementController] DLC '{dlcName}' does not have settlement music assigned");
return;
}
bool clipChanged = settlementAudioSource.clip != foundDlc.settlementMusic;
bool clipChanged = settlementAudioSource.clip != resolvedSettlementMusic;
if (clipChanged)
{
settlementAudioSource.Stop();
settlementAudioSource.clip = foundDlc.settlementMusic;
settlementAudioSource.clip = resolvedSettlementMusic;
settlementAudioSource.time = 0f;
}
@@ -1416,7 +1411,8 @@ public class settlementController : MonoBehaviour
settlementAudioSource.volume = 1f;
settlementAudioSource.mute = false;
Debug.Log($"[SettlementController] Prepared settlement music from DLC '{foundDlc.dlcName}': {foundDlc.settlementMusic.name}");
string resolvedDlcName = foundDlc != null ? foundDlc.dlcName : (thisSong_so.belongsTo_whichDLC ?? "DLC");
Debug.Log($"[SettlementController] Prepared settlement music from DLC '{resolvedDlcName}': {resolvedSettlementMusic.name}");
}
/// <summary>