结算重做部分 谱面分装好 编队UI之bug修复

This commit is contained in:
FloatGaming
2025-12-16 04:15:22 +08:00
parent aaca372833
commit 51b39d8b18
96 changed files with 17823 additions and 11337 deletions
+24 -1
View File
@@ -5,8 +5,28 @@ using UnityEngine;
[Serializable]
public class ChartFileEntry
{
public int difficulty; // 该谱面对应的难度
[Header("难度序列号0/1/2/3 -> ez/hd/im/in")]
public int difficulty; // 该谱面对应的难度序列号
[Header("展示给用户的难度分级:float数字")]
public float difficultyLEVEL;
[Header("本难度敌人总生命值=音符数量×下面的倍率")]
public float enemyTotalHP_Multiplier;
[Header("ez/hd/im/in 没啥用")]
public string difficultyName; // 难度名称
[Header("谱面文件 json")]
public TextAsset chartFile; // 谱面文件
[Header("本关本难度描述 文本")]
[TextArea(3,10)]
public string difficultyDescription;
[Header("本关本难度上次游玩分数记录")]
public int lastScoreForThisDifficulty;
[Header("本关本难度最佳纪录")]
public int personalRecordForThisDifficulty;
[Header("本关本难度进度")]
public float levelProgressForThisDifficulty;
[Header("本关本难度最后游玩时间")]
public DateTime lastPlayTimeForThisDifficulty;
}
[CreateAssetMenu(fileName = "NewSongData", menuName = "EaseOut/SongData")]
@@ -51,6 +71,9 @@ public class SongData : ScriptableObject
public bool _if_level_is_EASE;
public int max_comboRecord;
[Header("当前选择的关卡难度")]
public int thisLevel_selectedDifficultyID;
// 构造函数:从 JSON 数据创建 SongData
public SongData(SongDataSerializable jsonData)
{
+110 -24
View File
@@ -1,58 +1,144 @@
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class SongDetailsUI : MonoBehaviour
{
[Header("this_song_SO")]
public ScriptableObject this_song_SO;
[Header("basic UI")]
public Image song_bgImage;
public TextMeshProUGUI songNameText;
public TextMeshProUGUI artistNameText;
public TextMeshProUGUI painterNameText;
public TextMeshProUGUI difficultyText;
public TextMeshProUGUI charterNameText;
public TextMeshProUGUI dlcNameText;
public TextMeshProUGUI songSerialNumberText;
public TextMeshProUGUI personalRecordText;
public Text songNameText;
public Text artistNameText;
public Text painterNameText;
public Text difficultyText;
public Text difficultyDesciptionText;
public Text charterNameText;
public Text dlcNameText;
public Text bpmText;
public Text songSerialNumberText;
public Text personalRecordText;
public Text thisSong_progressText;
public Text thisSong_lastScoreText;
//public Image songImage;
public int id_of_thisSong;
[Header("查看曲绘大图")]
public GameObject picDetail;
public Image profound_image;
public Text detail_informations_text;
[Header("难度选择按钮")]
public Button Button_EZ;
public Button Button_HD;
public Button Button_IN;
public Button Button_IM;
private SongData currentSong;
void Start()
{
if (SongDataHolder.SelectedSongData != null)
{
// 读取选中的 SongData
SongData song = SongDataHolder.SelectedSongData;
currentSong = SongDataHolder.SelectedSongData;
this_song_SO = currentSong;
song_bgImage.sprite = song.backgroudPIC;
song_bgImage.sprite = currentSong.backgroudPIC;
// 更新 UI 显示
songNameText.text = song.songName;
artistNameText.text = song.artistName;
difficultyText.text = song.difficultyID.ToString();
painterNameText.text = song.painter;
charterNameText.text = song.level_creator;
dlcNameText.text = song.belongsTo_whichDLC;
songSerialNumberText.text = song.songID.ToString();
personalRecordText.text = song.personalRecord.ToString();
songNameText.text = currentSong.songName;
artistNameText.text = currentSong.artistName;
painterNameText.text = currentSong.painter;
charterNameText.text = currentSong.level_creator;
dlcNameText.text = currentSong.belongsTo_whichDLC;
songSerialNumberText.text = currentSong.songID.ToString();
bpmText.text = "BPM : " + currentSong.bpm.ToString();
profound_image.sprite = currentSong.fullscreen_songPicture;
id_of_thisSong = song.songID;
if (song.illustration != null)
id_of_thisSong = currentSong.songID;
detail_informations_text.text =
$"{currentSong.artistName}" + " - " +
$"{currentSong.songName}" + " | " +
$"曲绘: {currentSong.painter}" + " | " +
$"制谱: {currentSong.level_creator}" + " | " +
$"DLC: {currentSong.belongsTo_whichDLC}";
if (currentSong.illustration != null)
{
//songImage.sprite = song.illustration;
//songImage.sprite = currentSong.illustration;
//songImage.enabled = true;
}
else
{
Debug.LogWarning("歌曲封面为空:" + song.songName);
Debug.LogWarning("歌曲封面为空:" + currentSong.songName);
}
Debug.Log("加载歌曲数据: " + song.songName);
Debug.Log("加载歌曲数据: " + currentSong.songName);
}
else
{
// Debug.LogError("SongDataHolder.SelectedSongData 为空!");
}
picDetail.SetActive(false);
// 初始化难度按钮
if (currentSong != null)
{
SetDifficultyButtons(currentSong.thisLevel_selectedDifficultyID);
UpdateDifficultyUI(currentSong.thisLevel_selectedDifficultyID);
Button_EZ.onClick.AddListener(() => OnDifficultySelected(0));
Button_HD.onClick.AddListener(() => OnDifficultySelected(1));
Button_IN.onClick.AddListener(() => OnDifficultySelected(2));
Button_IM.onClick.AddListener(() => OnDifficultySelected(3));
}
}
private void SetDifficultyButtons(int selectedDifficulty)
{
Button_EZ.image.color = new Color(1, 1, 1, selectedDifficulty == 0 ? 1 : 0);
Button_HD.image.color = new Color(1, 1, 1, selectedDifficulty == 1 ? 1 : 0);
Button_IN.image.color = new Color(1, 1, 1, selectedDifficulty == 2 ? 1 : 0);
Button_IM.image.color = new Color(1, 1, 1, selectedDifficulty == 3 ? 1 : 0);
}
private void OnDifficultySelected(int difficulty)
{
if (currentSong != null)
{
currentSong.thisLevel_selectedDifficultyID = difficulty;
SetDifficultyButtons(difficulty);
UpdateDifficultyUI(difficulty);
}
}
private void UpdateDifficultyUI(int difficulty)
{
var entry = GetChartEntry(difficulty);
if (entry != null)
{
difficultyText.text = entry.difficultyLEVEL.ToString();
difficultyDesciptionText.text = entry.difficultyDescription;
personalRecordText.text = entry.personalRecordForThisDifficulty.ToString();
}
else
{
difficultyText.text = difficulty.ToString();
difficultyDesciptionText.text = "";
personalRecordText.text = "0";
}
}
private ChartFileEntry GetChartEntry(int difficulty)
{
foreach (var entry in currentSong.chartFiles)
{
if (entry.difficulty == difficulty)
return entry;
}
return null;
}
}