feat(): 大量更新
This commit is contained in:
21
Assets/Script/Gameplay/Card/CardLoader.cs
Normal file
21
Assets/Script/Gameplay/Card/CardLoader.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
namespace Gameplay
|
||||
{
|
||||
// 从Resources文件夹加载卡牌数据的静态类
|
||||
public static class CardLoader
|
||||
{
|
||||
public static CardData GetCardDataByID(int cardID)
|
||||
{
|
||||
CardData[] allCards = Resources.LoadAll<CardData>("Configs/Card");
|
||||
foreach (var card in allCards)
|
||||
{
|
||||
if (card.CardID == cardID)
|
||||
{
|
||||
return card;
|
||||
}
|
||||
}
|
||||
Debug.LogError($"Card with ID {cardID} not found!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user