修了很多bug和增加功能,优化不少问题
This commit is contained in:
@@ -19,6 +19,10 @@ public class SongButton : MonoBehaviour
|
||||
public Text songIDText;
|
||||
public Image buttonImage;
|
||||
public Image scoreLevelImage;
|
||||
[Header("Difficulty Level Images")]
|
||||
public Image lvl_img_01;
|
||||
public Image lvl_img_02;
|
||||
public Image lvl_img_03;
|
||||
[Header("Inspector")]
|
||||
public Image profileImage;
|
||||
public int song_songSerialID;
|
||||
@@ -123,6 +127,9 @@ public class SongButton : MonoBehaviour
|
||||
|
||||
if (difficultyIDText != null) difficultyIDText.text = diffDisplay;
|
||||
|
||||
// Set rank images for the first three difficulties
|
||||
SetDifficultyRankImages(sd);
|
||||
|
||||
if (buttonImage != null) buttonImage.sprite = sd.backgroudPIC;
|
||||
|
||||
if (profileImage != null)
|
||||
@@ -153,6 +160,37 @@ public class SongButton : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void SetDifficultyRankImages(SongData sd)
|
||||
{
|
||||
if (rankConfig == null) return;
|
||||
|
||||
Image[] rankImages = { lvl_img_01, lvl_img_02, lvl_img_03 };
|
||||
|
||||
for (int i = 0; i < rankImages.Length; i++)
|
||||
{
|
||||
if (rankImages[i] == null) continue;
|
||||
|
||||
if (sd.chartFiles != null && i < sd.chartFiles.Count)
|
||||
{
|
||||
var entry = sd.chartFiles[i];
|
||||
if (entry != null)
|
||||
{
|
||||
int score = entry.totalPersonalRecordForThisDifficulty;
|
||||
rankImages[i].sprite = rankConfig.GetRankSprite(score);
|
||||
rankImages[i].enabled = rankImages[i].sprite != null;
|
||||
}
|
||||
else
|
||||
{
|
||||
rankImages[i].enabled = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rankImages[i].enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSongButtonClick()
|
||||
{
|
||||
Debug.Log("Song button clicked, song_songSerialID: " + song_songSerialID);
|
||||
|
||||
Reference in New Issue
Block a user