卡组通知

This commit is contained in:
xianyi
2025-08-29 10:12:30 +08:00
parent 44b5182202
commit e56d2040ce
2 changed files with 201 additions and 9 deletions

View File

@@ -521,25 +521,21 @@ namespace TcgEngine.UI
// 保存卡组
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("卡组为空,无法保存");
ShowNotification("卡组为空,无法保存");
return;
}
if (totalCardCount != GameplayData.Get().deck_size)
{
Debug.Log("卡组数量错误,无法保存。当前总数: " + totalCardCount + ", 需要: " + GameplayData.Get().deck_size);
ShowNotification("卡组数量错误,无法保存。当前总数: " + totalCardCount + ", 需要: " + GameplayData.Get().deck_size);
return;
}
@@ -664,6 +660,15 @@ namespace TcgEngine.UI
AddDeckCard(icard, variant);
RefreshDeckCards();
}
else
{
if (!owner)
ShowNotification("卡牌数量不足");
else if (!deck_limit)
ShowNotification("相同卡牌最多只能添加 " + GameplayData.Get().deck_duplicate_max + " 张");
else if (!ssr_limit)
ShowNotification("SSR以上卡牌最多只能添加 " + GameplayData.Get().deck_ssr_max + " 张");
}
}
}
@@ -800,7 +805,10 @@ namespace TcgEngine.UI
return "";
}
//-----
private void ShowNotification(string message)
{
WarningText.ShowText(message);
}
public override void Show(bool instant = false)
{