UI HUGE UPDATE
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user