横竖版展示逻辑
This commit is contained in:
@@ -76,6 +76,82 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &2774569064048018860
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6614259274112242672}
|
||||
- component: {fileID: 4187143977185933321}
|
||||
- component: {fileID: 5214752265709509606}
|
||||
m_Layer: 5
|
||||
m_Name: Type
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6614259274112242672
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2774569064048018860}
|
||||
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: 7172856987813669152}
|
||||
m_RootOrder: 1
|
||||
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: 78.4}
|
||||
m_SizeDelta: {x: 55, y: 55}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4187143977185933321
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2774569064048018860}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &5214752265709509606
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2774569064048018860}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 21300000, guid: d9c34e3dd92c08d479c93826f3ad9a01, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &4713012568771279549
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -253,8 +329,8 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7172856987813669152}
|
||||
- component: {fileID: 4683757632758843183}
|
||||
- component: {fileID: 3845838344019372043}
|
||||
- component: {fileID: 316568859121491266}
|
||||
- component: {fileID: 1420246400403005356}
|
||||
m_Layer: 5
|
||||
m_Name: DeckCardColumn
|
||||
@@ -276,6 +352,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5933140501553923211}
|
||||
- {fileID: 6614259274112242672}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -284,27 +361,6 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: -368}
|
||||
m_SizeDelta: {x: 160, y: 760}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &4683757632758843183
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7172856987813669151}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a983e14bd852ed04c8139d01f5db1451, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
image: {fileID: 7172856987766537991}
|
||||
frame: {fileID: 2681265788105309984}
|
||||
title: {fileID: 0}
|
||||
value: {fileID: 0}
|
||||
cost: {fileID: 0}
|
||||
delete_btn: {fileID: 0}
|
||||
click_audio: {fileID: 0}
|
||||
disabled_mat: {fileID: 2100000, guid: 4f48bef4a205519449e166c2d47e4337, type: 2}
|
||||
default_mat: {fileID: 2100000, guid: 2578a245d0a9f3e43b7b77aff6cf9df0, type: 2}
|
||||
--- !u!222 &3845838344019372043
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -313,6 +369,31 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7172856987813669151}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &316568859121491266
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7172856987813669151}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 943be08264f3555448cac48ac16c1e8c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
card_image: {fileID: 7172856987766537991}
|
||||
frame_image: {fileID: 0}
|
||||
team_icon: {fileID: 5214752265709509606}
|
||||
rarity_icon: {fileID: 0}
|
||||
attack_icon: {fileID: 0}
|
||||
hp_icon: {fileID: 0}
|
||||
cost_icon: {fileID: 0}
|
||||
attack: {fileID: 0}
|
||||
hp: {fileID: 0}
|
||||
cost: {fileID: 0}
|
||||
card_title: {fileID: 0}
|
||||
card_text: {fileID: 0}
|
||||
stats: []
|
||||
--- !u!114 &1420246400403005356
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u7070\u70EC\u86C7"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/5.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u70ED\u529B\u516C\u725B"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/6.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u6D1E\u7A74"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/7.png
|
||||
type: 30
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u6697\u9ED1\u6218\u9A6C"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/8.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u7EA2\u9F99"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/5.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u5251"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/6.png
|
||||
type: 50
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u706B\u9E21"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/7.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u706B\u5143\u7D20"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/8.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u706B\u72D0"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/5.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 8e4b9ddb3f79d4ac9bc510c5bdc9e576, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u5730\u72F1\u72AC"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/5.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u5C0F\u9B3C"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/8.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u7194\u5CA9\u517D"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/5.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u51E4\u51F0"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/5.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u7EA2\u8272\u836F\u6C34"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/6.png
|
||||
type: 20
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u6536\u5272\u8005"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/5.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u7A7A\u88AD"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/6.png
|
||||
type: 20
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u672B\u65E5\u5BA1\u5224"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/7.png
|
||||
type: 20
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u71C3\u70E7"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/5.png
|
||||
type: 20
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u6295\u5C04\u7269"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/6.png
|
||||
type: 20
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u5206\u88C2"
|
||||
art_full_path: Cards/fire_chicken.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/8.png
|
||||
type: 20
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u77F3\u5934"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/5.png
|
||||
type: 20
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u706B\u5C71"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/7.png
|
||||
type: 30
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u7206\u70B8\u9677\u9631"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/6.png
|
||||
type: 40
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -16,6 +16,8 @@ MonoBehaviour:
|
||||
title: "\u72C2\u6012\u72FC"
|
||||
art_full_path: Cards/imp.png
|
||||
art_board_path: CardsBoard/imp_board.png
|
||||
art_horizontal_path:
|
||||
art_vertical_path: zhanshi/8.png
|
||||
type: 10
|
||||
camp: 0
|
||||
team: {fileID: 11400000, guid: 6bbb96863ece0314fb318c0fce569afc, type: 2}
|
||||
|
||||
@@ -40,6 +40,9 @@ namespace TcgEngine
|
||||
[Header("Dynamic Art Paths")]
|
||||
public string art_full_path;
|
||||
public string art_board_path;
|
||||
public string art_horizontal_path;
|
||||
public string art_vertical_path;
|
||||
|
||||
|
||||
[Header("Stats")]
|
||||
public CardType type;
|
||||
@@ -127,6 +130,48 @@ namespace TcgEngine
|
||||
return null;
|
||||
}
|
||||
|
||||
public Sprite GetHorizontalArt()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(art_horizontal_path))
|
||||
{
|
||||
Sprite dynamicSprite = SpriteLoader.Get()?.LoadSprite(art_horizontal_path);
|
||||
if (dynamicSprite != null)
|
||||
{
|
||||
return dynamicSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"卡牌{id} 图片加载失败: {art_horizontal_path}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"卡牌{id} art_horizontal_path为空");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Sprite GetVerticalArt()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(art_vertical_path))
|
||||
{
|
||||
Sprite dynamicSprite = SpriteLoader.Get()?.LoadSprite(art_vertical_path);
|
||||
if (dynamicSprite != null)
|
||||
{
|
||||
return dynamicSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"卡牌{id} 图片加载失败: {art_vertical_path}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"卡牌{id} art_vertical_path为空");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetTitle()
|
||||
{
|
||||
return title;
|
||||
|
||||
@@ -128,16 +128,6 @@ namespace TcgEngine.UI
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void SetLine(CardData card, UserData udata, UserDeckData deck)
|
||||
{
|
||||
this.card = null;
|
||||
this.deck = null;
|
||||
this.udeck = deck;
|
||||
hidden = false;
|
||||
if(this.title!=null)
|
||||
this.title.text = deck.title;
|
||||
}
|
||||
|
||||
public void SetLine(string title)
|
||||
{
|
||||
this.card = null;
|
||||
|
||||
@@ -74,8 +74,11 @@ namespace TcgEngine.UI
|
||||
|
||||
if (!isSameCard)
|
||||
{
|
||||
if(card_image != null)
|
||||
if (card_image != null)
|
||||
{
|
||||
card_image.enabled = true;
|
||||
card_image.sprite = card.GetFullArt(variant);
|
||||
}
|
||||
if (frame_image != null)
|
||||
frame_image.sprite = (variant != null) ? variant.frame : frame_image.sprite;
|
||||
if (card_title != null)
|
||||
@@ -139,6 +142,31 @@ namespace TcgEngine.UI
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void SetCard(CardData card)
|
||||
{
|
||||
if (card == null)
|
||||
return;
|
||||
|
||||
bool isSameCard = (this.card == card);
|
||||
|
||||
this.card = card;
|
||||
|
||||
if (!isSameCard)
|
||||
{
|
||||
if (card_image != null)
|
||||
{
|
||||
card_image.enabled = true;
|
||||
card_image.sprite = card.GetVerticalArt();
|
||||
}
|
||||
if (team_icon != null)
|
||||
{
|
||||
Sprite teamSprite = (card.team != null) ? card.team.icon : null;
|
||||
team_icon.sprite = teamSprite;
|
||||
team_icon.enabled = teamSprite != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetHP(int hp_value)
|
||||
{
|
||||
if (hp != null)
|
||||
@@ -190,7 +218,31 @@ namespace TcgEngine.UI
|
||||
if (card_text != null)
|
||||
card_text.color = new Color(card_text.color.r, card_text.color.g, card_text.color.b, opacity);
|
||||
}
|
||||
#region ================== 对象池友好接口 ==================
|
||||
|
||||
/// <summary>
|
||||
/// 重置数据并隐藏
|
||||
/// </summary>
|
||||
public void ResetLine()
|
||||
{
|
||||
card = null;
|
||||
variant = null;
|
||||
|
||||
if (card_image) card_image.enabled = false;
|
||||
if (frame_image) frame_image.enabled = false;
|
||||
if (team_icon) team_icon.enabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 展开用户卡组信息
|
||||
/// </summary>
|
||||
public void Refresh(CardData card, VariantData variant)
|
||||
{
|
||||
SetCard(card);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
public void Hide()
|
||||
{
|
||||
if (gameObject.activeSelf)
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace TcgEngine.UI
|
||||
|
||||
// 卡组展示管理
|
||||
public int card_lines_size = 12;
|
||||
public List<DeckLine> card_pool = new List<DeckLine>();
|
||||
public List<DeckLine> card_lines = new List<DeckLine>();
|
||||
public List<CardUI> card_pool = new List<CardUI>();
|
||||
public List<CardUI> card_lines = new List<CardUI>();
|
||||
|
||||
|
||||
private UserData lastUserData;
|
||||
@@ -65,7 +65,7 @@ namespace TcgEngine.UI
|
||||
for (int i = 0; i < card_lines_size; i++)
|
||||
{
|
||||
GameObject card = Instantiate(card_lines_prefab, deck_display_grid.transform);
|
||||
DeckLine line = card.GetComponent<DeckLine>();
|
||||
CardUI line = card.GetComponent<CardUI>();
|
||||
line.gameObject.SetActive(false);
|
||||
card_pool.Add(line);
|
||||
}
|
||||
@@ -165,12 +165,12 @@ namespace TcgEngine.UI
|
||||
for (int i = 0; i < udeck.cards.Length; i++)
|
||||
{
|
||||
UserCardData ucard = udeck.cards[i];
|
||||
DeckLine line = card_pool[i];
|
||||
CardUI line = card_pool[i];
|
||||
|
||||
CardData cdata = CardData.Get(ucard.tid);
|
||||
VariantData variant = VariantData.Get(ucard.variant);
|
||||
|
||||
line.Refresh(cdata, variant, ucard.quantity);
|
||||
line.Refresh(cdata, variant);
|
||||
line.gameObject.SetActive(true);
|
||||
card_lines.Add(line);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user