卡组通知

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

@@ -8014,6 +8014,7 @@ RectTransform:
- {fileID: 732915989} - {fileID: 732915989}
- {fileID: 2143365597} - {fileID: 2143365597}
- {fileID: 1674082197} - {fileID: 1674082197}
- {fileID: 1899491177}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -17984,7 +17985,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -74.1308, y: -74.75} m_AnchoredPosition: {x: -74.13086, y: -74.75}
m_SizeDelta: {x: -751.06, y: 930.51} m_SizeDelta: {x: -751.06, y: 930.51}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1120415710 --- !u!1 &1120415710
@@ -28786,6 +28787,93 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1882384443} m_GameObject: {fileID: 1882384443}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &1899491176
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1899491177}
- component: {fileID: 1899491180}
- component: {fileID: 1899491179}
- component: {fileID: 1899491178}
m_Layer: 5
m_Name: WarningText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1899491177
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1899491176}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 216}
m_LocalScale: {x: 0.97955996, y: 0.97955996, z: 0.97955996}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2137610353}
m_Father: {fileID: 581826003}
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 69.53828}
m_SizeDelta: {x: 450, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1899491178
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1899491176}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8642568730c817f499758ab59c7aad08, type: 3}
m_Name:
m_EditorClassIdentifier:
warning_audio: {fileID: 0}
text: {fileID: 2137610355}
--- !u!225 &1899491179
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1899491176}
m_Enabled: 1
m_Alpha: 0
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!95 &1899491180
Animator:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1899491176}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 54e42caa2791de545aeaa295fee36c36, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!1 &1906895969 --- !u!1 &1906895969
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -31382,6 +31470,102 @@ RectTransform:
m_AnchoredPosition: {x: -0.00008010864, y: -0.00000333786} m_AnchoredPosition: {x: -0.00008010864, y: -0.00000333786}
m_SizeDelta: {x: -0.000053406, y: 10} m_SizeDelta: {x: -0.000053406, y: 10}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2137610352
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2137610353}
- component: {fileID: 2137610356}
- component: {fileID: 2137610355}
- component: {fileID: 2137610354}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2137610353
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2137610352}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1899491177}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 450, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2137610354
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2137610352}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 1, y: -1}
m_UseGraphicAlpha: 1
--- !u!114 &2137610355
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2137610352}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: df83a8ef8ec265d408cd57ce58f209bf, type: 3}
m_FontSize: 32
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Warning Text
--- !u!222 &2137610356
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2137610352}
m_CullTransparentMesh: 1
--- !u!1 &2141665988 --- !u!1 &2141665988
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -38429,7 +38613,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -74.1308, y: -73.48} m_AnchoredPosition: {x: -74.13086, y: -73.48}
m_SizeDelta: {x: -751.06, y: 933.05} m_SizeDelta: {x: -751.06, y: 933.05}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &396921783591273839 --- !u!114 &396921783591273839

View File

@@ -521,25 +521,21 @@ namespace TcgEngine.UI
// 保存卡组 // 保存卡组
private void SaveDeck() private void SaveDeck()
{ {
// TODO 添加通知
int totalCardCount = 0; int totalCardCount = 0;
foreach (UserCardData card in deck_cards) foreach (UserCardData card in deck_cards)
{ {
totalCardCount += card.quantity; totalCardCount += card.quantity;
} }
Debug.Log("用户选择的卡牌总数量: " + totalCardCount);
Debug.Log("用户选择的卡牌种类数量: " + deck_cards.Count);
if (totalCardCount == 0) if (totalCardCount == 0)
{ {
Debug.Log("卡组为空,无法保存"); ShowNotification("卡组为空,无法保存");
return; return;
} }
if (totalCardCount != GameplayData.Get().deck_size) if (totalCardCount != GameplayData.Get().deck_size)
{ {
Debug.Log("卡组数量错误,无法保存。当前总数: " + totalCardCount + ", 需要: " + GameplayData.Get().deck_size); ShowNotification("卡组数量错误,无法保存。当前总数: " + totalCardCount + ", 需要: " + GameplayData.Get().deck_size);
return; return;
} }
@@ -664,6 +660,15 @@ namespace TcgEngine.UI
AddDeckCard(icard, variant); AddDeckCard(icard, variant);
RefreshDeckCards(); 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 ""; return "";
} }
//----- private void ShowNotification(string message)
{
WarningText.ShowText(message);
}
public override void Show(bool instant = false) public override void Show(bool instant = false)
{ {