修复小问题 结算装了一点
This commit is contained in:
@@ -7,7 +7,7 @@ public class SongButton : MonoBehaviour
|
||||
{
|
||||
[Header("thisSong_so")]
|
||||
public ScriptableObject thisSong_so;
|
||||
[Header("展示的信息")]
|
||||
[Header("展示的信息")]
|
||||
public Text songNameText;
|
||||
public Text multiNameText;
|
||||
public Text joinTime_and_dlcName_Text;
|
||||
@@ -16,7 +16,7 @@ public class SongButton : MonoBehaviour
|
||||
public Text difficultyIDText;
|
||||
public Text songIDText;
|
||||
public Image buttonImage;
|
||||
[Header("头图")]
|
||||
[Header("头图")]
|
||||
public Image profileImage;
|
||||
public int song_songSerialID;
|
||||
[Header("select mark")]
|
||||
@@ -50,7 +50,7 @@ public class SongButton : MonoBehaviour
|
||||
|
||||
public void SetButtonData(string songName, int highestScore, int difficultyID, Sprite songSprite, int songID)
|
||||
{
|
||||
Debug.Log("SetButtonData 被调用, songID 参数: " + songID);
|
||||
Debug.Log("SetButtonData 被调用, songID 参数: " + songID);
|
||||
|
||||
var sd = SongDataLibrary.Instance != null ? SongDataLibrary.Instance.GetSongDataByID(songID) : null;
|
||||
if (sd != null)
|
||||
@@ -58,18 +58,18 @@ public class SongButton : MonoBehaviour
|
||||
if (songNameText != null) songNameText.text = sd.songName;
|
||||
|
||||
if (multiNameText != null)
|
||||
multiNameText.text = "音乐:" + sd.artistName + " | 曲绘:" + sd.painter + " | 制谱:" + sd.level_creator;
|
||||
multiNameText.text = "音乐:" + sd.artistName + " | 曲绘:" + sd.painter + " | 制谱:" + sd.level_creator;
|
||||
|
||||
if (joinTime_and_dlcName_Text != null)
|
||||
{
|
||||
string join = string.IsNullOrEmpty(sd.thisLevel_addDateString) ? "未知" : sd.thisLevel_addDateString;
|
||||
string dlc = string.IsNullOrEmpty(sd.belongsTo_whichDLC) ? "未归档DLC" : sd.belongsTo_whichDLC;
|
||||
joinTime_and_dlcName_Text.text = "歌曲收录时间:" + join + " | " + "所属DLC:" + dlc;
|
||||
string join = string.IsNullOrEmpty(sd.thisLevel_addDateString) ? "未知" : sd.thisLevel_addDateString;
|
||||
string dlc = string.IsNullOrEmpty(sd.belongsTo_whichDLC) ? "未归档DLC" : sd.belongsTo_whichDLC;
|
||||
joinTime_and_dlcName_Text.text = "歌曲收录时间:" + join + " | " + "所属DLC:" + dlc;
|
||||
}
|
||||
|
||||
if (songOverallDescriptionText != null)
|
||||
{
|
||||
songOverallDescriptionText.text = string.IsNullOrEmpty(sd.thisLevel_overallDescription) ? "暂无歌曲简介。" : sd.thisLevel_overallDescription;
|
||||
songOverallDescriptionText.text = string.IsNullOrEmpty(sd.thisLevel_overallDescription) ? "暂无歌曲简介。" : sd.thisLevel_overallDescription;
|
||||
}
|
||||
|
||||
int bestTotal = 0;
|
||||
@@ -98,18 +98,25 @@ public class SongButton : MonoBehaviour
|
||||
|
||||
if (highestScoreText != null) highestScoreText.text = bestTotal.ToString();
|
||||
|
||||
string diffDisplay = bestDiff.ToString();
|
||||
if (sd.chartFiles != null)
|
||||
// Determine displayed difficulty: show the highest difficultyLEVEL present in chartFiles (if any)
|
||||
string diffDisplay = "0";
|
||||
if (sd.chartFiles != null && sd.chartFiles.Count > 0)
|
||||
{
|
||||
float maxLevel = float.MinValue;
|
||||
foreach (var entry in sd.chartFiles)
|
||||
{
|
||||
if (entry != null && entry.difficulty == bestDiff)
|
||||
if (entry == null) continue;
|
||||
if (entry.difficultyLEVEL > maxLevel)
|
||||
{
|
||||
diffDisplay = entry.difficultyLEVEL.ToString();
|
||||
break;
|
||||
maxLevel = entry.difficultyLEVEL;
|
||||
}
|
||||
}
|
||||
if (maxLevel != float.MinValue)
|
||||
{
|
||||
diffDisplay = maxLevel.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
if (difficultyIDText != null) difficultyIDText.text = diffDisplay;
|
||||
|
||||
if (buttonImage != null) buttonImage.sprite = sd.backgroudPIC;
|
||||
@@ -129,7 +136,7 @@ public class SongButton : MonoBehaviour
|
||||
}
|
||||
|
||||
song_songSerialID = songID;
|
||||
if (songIDText != null) songIDText.text = "数据库索引号:" + song_songSerialID.ToString();
|
||||
if (songIDText != null) songIDText.text = "数据库索引号:" + song_songSerialID.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -144,7 +151,7 @@ public class SongButton : MonoBehaviour
|
||||
|
||||
public void OnSongButtonClick()
|
||||
{
|
||||
Debug.Log("点击按钮的 song_songSerialID: " + song_songSerialID);
|
||||
Debug.Log("点击按钮的 song_songSerialID: " + song_songSerialID);
|
||||
SongData selectedSong = SongDataLibrary.Instance.GetSongDataByID(song_songSerialID);
|
||||
if (selectedSong != null)
|
||||
{
|
||||
@@ -173,7 +180,7 @@ public class SongButton : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("未找到对应的 SongData, songID: " + song_songSerialID);
|
||||
Debug.LogError("未找到对应的 SongData, songID: " + song_songSerialID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user