feat(): 大量更新
This commit is contained in:
48
Assets/Script/Gameplay/Card/CardBook/CardBook.cs
Normal file
48
Assets/Script/Gameplay/Card/CardBook/CardBook.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gameplay
|
||||
{
|
||||
public class CardBook
|
||||
{
|
||||
public CardBookData Data;
|
||||
public CardSlot[] Slots;
|
||||
public CardSlot[] Spares;
|
||||
|
||||
public CardBook(CardBookData data)
|
||||
{
|
||||
Data = data;
|
||||
Slots = new CardSlot[Data.SlotCount];
|
||||
Spares = new CardSlot[Data.SpareCount];
|
||||
for (int i = 0; i < Slots.Length; i++)
|
||||
{
|
||||
Slots[i] = new CardSlot();
|
||||
}
|
||||
for (int i = 0; i < Spares.Length; i++)
|
||||
{
|
||||
Spares[i] = new CardSlot();
|
||||
}
|
||||
}
|
||||
|
||||
// Get all cards in the card book,and not Spares
|
||||
public Card[] GetCards()
|
||||
{
|
||||
var cards = new Card[Slots.Length + Spares.Length];
|
||||
for (int i = 0; i < Slots.Length; i++)
|
||||
{
|
||||
cards[i] = Slots[i].StoredCard;
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
|
||||
public Card[] GetSpareCards()
|
||||
{
|
||||
var cards = new Card[Spares.Length + Spares.Length];
|
||||
for (int i = 0; i < Spares.Length; i++)
|
||||
{
|
||||
cards[i] = Spares[i].StoredCard;
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Script/Gameplay/Card/CardBook/CardBook.cs.meta
Normal file
3
Assets/Script/Gameplay/Card/CardBook/CardBook.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bb8bfb17c6a4eaa88954871942ee72d
|
||||
timeCreated: 1760422530
|
12
Assets/Script/Gameplay/Card/CardBook/CardBookData.cs
Normal file
12
Assets/Script/Gameplay/Card/CardBook/CardBookData.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gameplay
|
||||
{
|
||||
[CreateAssetMenu(fileName = "CardBookData", menuName = "ScriptableObject/CardBookData", order = 1)]
|
||||
public class CardBookData : ScriptableObject
|
||||
{
|
||||
public int SlotCount;
|
||||
public int SpareCount;
|
||||
public int MaxLoopCount;
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54f1f8ff48b84542962110e7a9851917
|
||||
timeCreated: 1760422573
|
12
Assets/Script/Gameplay/Card/CardBook/CardBookViewer.cs
Normal file
12
Assets/Script/Gameplay/Card/CardBook/CardBookViewer.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Gameplay
|
||||
{
|
||||
// 卡牌书的显示相关脚本
|
||||
public class CardBookViewer : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform LeftHandPoint;
|
||||
private CardBook CardBook;
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68803a8f56734f22a3025f8028fc027f
|
||||
timeCreated: 1760431288
|
23
Assets/Script/Gameplay/Card/CardBook/CardSlot.cs
Normal file
23
Assets/Script/Gameplay/Card/CardBook/CardSlot.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace Gameplay
|
||||
{
|
||||
public class CardSlot
|
||||
{
|
||||
public Card StoredCard;
|
||||
public bool IsEmpty => StoredCard == null;
|
||||
public int ActiveTimes = 0;
|
||||
|
||||
public void StoreCard(Card card)
|
||||
{
|
||||
StoredCard = card;
|
||||
ActiveTimes = 0;
|
||||
}
|
||||
|
||||
public Card RemoveCard()
|
||||
{
|
||||
var card = StoredCard;
|
||||
StoredCard = null;
|
||||
ActiveTimes = 0;
|
||||
return card;
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Script/Gameplay/Card/CardBook/CardSlot.cs.meta
Normal file
3
Assets/Script/Gameplay/Card/CardBook/CardSlot.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5f566603b3f4286965da48bb49c018a
|
||||
timeCreated: 1760422548
|
Reference in New Issue
Block a user