设置scriptable存储角色信息,调整编队系统部分代码逻辑
This commit is contained in:
@@ -5,14 +5,14 @@ using UnityEngine.SceneManagement;
|
||||
|
||||
public class SongButton : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI songNameText; // 歌曲名称文本
|
||||
public TextMeshProUGUI highestScoreText; // 个人最高分文本
|
||||
public TextMeshProUGUI difficultyIDText; // 难度ID文本
|
||||
public TextMeshProUGUI songNameText; // 歌曲名称文本
|
||||
public TextMeshProUGUI highestScoreText; // 个人最高分文本
|
||||
public TextMeshProUGUI difficultyIDText; // 难度ID文本
|
||||
public TextMeshProUGUI songIDText;
|
||||
public Image buttonImage; // 按钮的 Image 组件,用于设置背景图像
|
||||
public int song_songSerialID; // 按钮对应的歌曲ID
|
||||
public Image buttonImage; // 按钮的 Image 组件,用于设置背景图像
|
||||
public int song_songSerialID; // 按钮对应的歌曲ID
|
||||
|
||||
// 设置按钮的数据
|
||||
// 设置按钮的数据
|
||||
|
||||
public void Start()
|
||||
{
|
||||
@@ -20,7 +20,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);
|
||||
songNameText.text = songName;
|
||||
highestScoreText.text = "PR: " + highestScore.ToString();
|
||||
difficultyIDText.text = "" + difficultyID.ToString();
|
||||
@@ -30,10 +30,10 @@ public class SongButton : MonoBehaviour
|
||||
}
|
||||
|
||||
|
||||
// 按钮点击事件:根据 song_songSerialID 查找对应的 SongData,并传递到下个场景
|
||||
// 按钮点击事件:根据 song_songSerialID 查找对应的 SongData,并传递到下个场景
|
||||
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)
|
||||
{
|
||||
@@ -42,7 +42,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