特效新内容。修复gameplay致命bug和分数保存bug

This commit is contained in:
FloatGaming
2026-02-16 01:55:18 +08:00
parent 3a7a0b4669
commit 9f7c1c57b7
206 changed files with 112684 additions and 857 deletions
@@ -2,6 +2,7 @@ using System.IO;
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
using TMPro;
public class BeatmapManager : MonoBehaviour
{
@@ -34,6 +35,7 @@ public class BeatmapManager : MonoBehaviour
assignedSongData = song;
assignedDifficulty = difficulty;
Debug.LogWarning($"BeatmapManager.AcceptSongData: accepted song={(song==null?"NULL":song.songName)}, difficulty={difficulty}");
UpdateGameplayUI();
}
public Beatmap beatmap; // Documentation text normalized.
@@ -44,10 +46,14 @@ public class BeatmapManager : MonoBehaviour
// Documentation text normalized.
public teamUIController uiController;
public Image bgSpriteImage; // Documentation text normalized.
[Header("UI Display")]
public Text gameplay_songname;
public TextMeshProUGUI gameplay_difficultyID;
public TextMeshProUGUI gameplay_difficultyName;
public GameObject bgSpriteObject;
public Image bgMainImage; // 场景主背景图 (UI Image)
public Image startCanvas_image;
public SpriteRenderer bgSpriteRenderer; // 场景 3D 背景图 (SpriteRenderer)
// Extra fields from beatmap JSON (stored temporarily)
[HideInInspector] public string parsedTitle;
@@ -347,38 +353,36 @@ public class BeatmapManager : MonoBehaviour
Debug.LogWarning("GameManager or its musicSource not found; audio not assigned");
}
// Assign fullscreen image from SongData to bgSprite if available
// Assign fullscreen image from SongData to background images if available
if (assignedSongData != null && assignedSongData.fullscreen_songPicture != null)
{
// Prefer setting a Scene GameObject's SpriteRenderer if provided
if (bgSpriteObject != null)
Sprite bgSprite = assignedSongData.fullscreen_songPicture;
if (bgMainImage != null)
{
var sr = bgSpriteObject.GetComponentInChildren<SpriteRenderer>();
if (sr != null)
{
sr.sprite = assignedSongData.fullscreen_songPicture;
// ensure fully visible
sr.color = new Color(sr.color.r, sr.color.g, sr.color.b, 1f);
if (startCanvas_image != null)
{
startCanvas_image.sprite = assignedSongData.fullscreen_songPicture;
}
sr = null;
Debug.LogWarning($"Assigned SongData.fullscreen_songPicture to SpriteRenderer on bgSpriteObject for song {assignedSongData.songName}");
}
else
{
Debug.LogWarning("bgSpriteObject has no SpriteRenderer in children; cannot assign fullscreen sprite");
}
bgMainImage.sprite = bgSprite;
// ensure fully visible
bgMainImage.color = new Color(bgMainImage.color.r, bgMainImage.color.g, bgMainImage.color.b, 1f);
Debug.LogWarning($"Assigned SongData.fullscreen_songPicture to bgMainImage for song {assignedSongData.songName}");
}
else if (bgSpriteImage != null)
if (bgSpriteRenderer != null)
{
bgSpriteImage.sprite = assignedSongData.fullscreen_songPicture;
Debug.LogWarning($"Assigned SongData.fullscreen_songPicture to bgSpriteImage for song {assignedSongData.songName}");
bgSpriteRenderer.sprite = bgSprite;
Debug.LogWarning($"Assigned SongData.fullscreen_songPicture to bgSpriteRenderer for song {assignedSongData.songName}");
// 释放引用以节省内存(按要求:完毕后令 sprite renderer = null
bgSpriteRenderer = null;
}
else
if (startCanvas_image != null)
{
Debug.LogWarning("No bg target (bgSpriteObject or bgSpriteImage) assigned; fullscreen sprite not applied");
startCanvas_image.sprite = bgSprite;
Debug.LogWarning($"Assigned SongData.fullscreen_songPicture to startCanvas_image for song {assignedSongData.songName}");
}
if (bgMainImage == null && startCanvas_image == null)
{
Debug.LogWarning("No background Image targets assigned in BeatmapManager; fullscreen sprite not applied");
}
}
@@ -408,8 +412,52 @@ public class BeatmapManager : MonoBehaviour
else
{
// Documentation text normalized.
// Documentation text normalized.
Debug.LogWarning("Default automatic demo beatmap load is commented out to prioritize SO-provided charts.");
// Documentation text normalized.
Debug.LogWarning("Default automatic demo beatmap load is commented out to prioritize SO-provided charts.");
}
UpdateGameplayUI();
}
private void UpdateGameplayUI()
{
if (assignedSongData == null) return;
if (gameplay_songname != null)
{
gameplay_songname.text = assignedSongData.songName;
}
if (gameplay_difficultyID != null)
{
// Find the ChartFileEntry matching the assignedDifficulty to get difficultyLEVEL (star rating)
float diffLevel = 0;
if (assignedSongData.chartFiles != null)
{
foreach (var entry in assignedSongData.chartFiles)
{
if (entry.difficulty == assignedDifficulty)
{
diffLevel = entry.difficultyLEVEL;
break;
}
}
}
gameplay_difficultyID.text = diffLevel.ToString();
}
if (gameplay_difficultyName != null)
{
string diffText = "Unknown";
switch (assignedDifficulty)
{
case 0: diffText = "Easy"; break;
case 1: diffText = "Hard"; break;
case 2: diffText = "Incredible"; break;
case 3: diffText = "Impossible"; break;
}
gameplay_difficultyName.text = diffText;
}
}