只允许八张卡组

This commit is contained in:
xianyi
2025-08-05 10:51:35 +08:00
parent 2a46af9478
commit 28ba895a9d
9 changed files with 47 additions and 362 deletions

View File

@@ -124,7 +124,7 @@ namespace TcgEngine.Gameplay
player.mana_max = pdeck != null ? pdeck.start_mana : GameplayData.Get().mana_start;
player.mana = player.mana_max;
//Draw starting cards
//Draw starting cards 开始抽卡
int dcards = pdeck != null ? pdeck.start_cards : GameplayData.Get().cards_start;
DrawCard(player, dcards);
@@ -339,7 +339,7 @@ namespace TcgEngine.Gameplay
//--- Setup ------
//Set deck using a Deck in Resources
//Set deck using a Deck in Resources 使用玩家卡组作为卡组
public virtual void SetPlayerDeck(Player player, DeckData deck)
{
player.cards_all.Clear();
@@ -364,7 +364,7 @@ namespace TcgEngine.Gameplay
DeckPuzzleData puzzle = deck as DeckPuzzleData;
//Board cards
//Board cards 公共牌
if (puzzle != null)
{
foreach (DeckCardSlot card in puzzle.board_cards)
@@ -700,6 +700,7 @@ namespace TcgEngine.Gameplay
}
}
//Draw card 抽卡
public virtual void DrawCard(Player player, int nb = 1)
{
for (int i = 0; i < nb; i++)

View File

@@ -442,6 +442,7 @@ namespace TcgEngine.UI
RefreshCardsQuantities();
}
// 刷新新手卡组
private void RefreshStarterDeck()
{
UserData udata = Authenticator.Get().UserData;
@@ -517,8 +518,32 @@ namespace TcgEngine.UI
return null;
}
// 保存卡组
private void SaveDeck()
{
// TODO 添加通知
int totalCardCount = 0;
foreach (UserCardData card in deck_cards)
{
totalCardCount += card.quantity;
}
Debug.Log("用户选择的卡牌总数量: " + totalCardCount);
Debug.Log("用户选择的卡牌种类数量: " + deck_cards.Count);
if (totalCardCount == 0)
{
Debug.Log("卡组为空,无法保存");
return;
}
if (totalCardCount != GameplayData.Get().deck_size)
{
Debug.Log("卡组数量错误,无法保存。当前总数: " + totalCardCount + ", 需要: " + GameplayData.Get().deck_size);
return;
}
UserData udata = Authenticator.Get().UserData;
UserDeckData udeck = new UserDeckData();
udeck.tid = current_deck_tid;

View File

@@ -75,6 +75,7 @@ namespace TcgEngine.UI
}
}
// 刷新新手卡组
private void RefreshStarterDeck()
{
UserData udata = Authenticator.Get().UserData;

View File

@@ -77,6 +77,7 @@ namespace TcgEngine.UI
GameClient.ai_settings.ai_level = GameplayData.Get().ai_level;
GameClient.game_settings.scene = GameplayData.Get().GetRandomArena();
// solo 休闲模式
MainMenu.Get().StartGame(GameType.Solo, GameMode.Casual);
}