抽卡卡包图片
This commit is contained in:
@@ -34,10 +34,12 @@ MonoBehaviour:
|
|||||||
probability: 90
|
probability: 90
|
||||||
- variant: {fileID: 11400000, guid: 3a827aeeaca139641a4b8ad0c3c74f52, type: 2}
|
- variant: {fileID: 11400000, guid: 3a827aeeaca139641a4b8ad0c3c74f52, type: 2}
|
||||||
probability: 10
|
probability: 10
|
||||||
title: 黄金卡包
|
title: "\u9EC4\u91D1\u5361\u5305"
|
||||||
pack_img: {fileID: 21300000, guid: e400c282187e5f54dab6aacfd8adae20, type: 3}
|
pack_img: {fileID: 21300000, guid: e400c282187e5f54dab6aacfd8adae20, type: 3}
|
||||||
cardback_img: {fileID: 21300000, guid: 96d8dad709a2729419f19d1d4633a0ef, type: 3}
|
cardback_img: {fileID: 21300000, guid: 96d8dad709a2729419f19d1d4633a0ef, type: 3}
|
||||||
desc: 精英卡包,内含5张卡牌。更有机会获得稀有卡牌和神话卡牌。.
|
pack_img_path: Cardbacks/pack_gold.png
|
||||||
|
cardback_img_path: Cardbacks/cardback_gold.png
|
||||||
|
desc: "\u7CBE\u82F1\u5361\u5305\uFF0C\u5185\u542B5\u5F20\u5361\u724C\u3002\u66F4\u6709\u673A\u4F1A\u83B7\u5F97\u7A00\u6709\u5361\u724C\u548C\u795E\u8BDD\u5361\u724C\u3002."
|
||||||
sort_order: 1
|
sort_order: 1
|
||||||
available: 1
|
available: 1
|
||||||
cost: 250
|
cost: 250
|
||||||
|
|||||||
@@ -36,10 +36,12 @@ MonoBehaviour:
|
|||||||
probability: 96
|
probability: 96
|
||||||
- variant: {fileID: 11400000, guid: 3a827aeeaca139641a4b8ad0c3c74f52, type: 2}
|
- variant: {fileID: 11400000, guid: 3a827aeeaca139641a4b8ad0c3c74f52, type: 2}
|
||||||
probability: 4
|
probability: 4
|
||||||
title: 白银卡包
|
title: "\u767D\u94F6\u5361\u5305"
|
||||||
pack_img: {fileID: 21300000, guid: b2c2a8efa1f7d7b4593a512e2c8cd61a, type: 3}
|
pack_img: {fileID: 0}
|
||||||
cardback_img: {fileID: 21300000, guid: 0e839bd6251bf9a4697b9cb18c1565a4, type: 3}
|
cardback_img: {fileID: 21300000, guid: 0e839bd6251bf9a4697b9cb18c1565a4, type: 3}
|
||||||
desc: 白银卡包,内含5张卡牌.
|
pack_img_path: Cardbacks/pack_silver.png
|
||||||
|
cardback_img_path: Cardbacks/cardback_silver.png
|
||||||
|
desc: "\u767D\u94F6\u5361\u5305\uFF0C\u5185\u542B5\u5F20\u5361\u724C."
|
||||||
sort_order: 0
|
sort_order: 0
|
||||||
available: 1
|
available: 1
|
||||||
cost: 100
|
cost: 100
|
||||||
|
|||||||
@@ -22,8 +22,11 @@ namespace TcgEngine
|
|||||||
|
|
||||||
[Header("Display")]
|
[Header("Display")]
|
||||||
public string title;
|
public string title;
|
||||||
public Sprite pack_img;
|
|
||||||
public Sprite cardback_img;
|
[Header("Dynamic Art Paths")]
|
||||||
|
public string pack_img_path;
|
||||||
|
public string cardback_img_path;
|
||||||
|
|
||||||
[TextArea(5, 10)]
|
[TextArea(5, 10)]
|
||||||
public string desc;
|
public string desc;
|
||||||
public int sort_order;
|
public int sort_order;
|
||||||
@@ -56,6 +59,54 @@ namespace TcgEngine
|
|||||||
{
|
{
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取Pack图片,优先使用动态路径
|
||||||
|
/// </summary>
|
||||||
|
public Sprite GetPackImage()
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(pack_img_path))
|
||||||
|
{
|
||||||
|
Sprite dynamicSprite = SpriteLoader.Get()?.LoadSprite(pack_img_path);
|
||||||
|
if (dynamicSprite != null)
|
||||||
|
{
|
||||||
|
return dynamicSprite;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"Pack {id} 图片加载失败: {pack_img_path}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"Pack {id} pack_img_path为空");
|
||||||
|
}
|
||||||
|
return pack_img;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取卡背图片,优先使用动态路径
|
||||||
|
/// </summary>
|
||||||
|
public Sprite GetCardbackImage()
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(cardback_img_path))
|
||||||
|
{
|
||||||
|
Sprite dynamicSprite = SpriteLoader.Get()?.LoadSprite(cardback_img_path);
|
||||||
|
if (dynamicSprite != null)
|
||||||
|
{
|
||||||
|
return dynamicSprite;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"Pack {id} 卡背图片加载失败: {cardback_img_path}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"Pack {id} cardback_img_path为空");
|
||||||
|
}
|
||||||
|
return cardback_img;
|
||||||
|
}
|
||||||
|
|
||||||
public static PackData Get(string id)
|
public static PackData Get(string id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace TcgEngine.Client
|
|||||||
PackData ipack = PackData.Get(pack.tid);
|
PackData ipack = PackData.Get(pack.tid);
|
||||||
if (ipack)
|
if (ipack)
|
||||||
{
|
{
|
||||||
pack_sprite.sprite = ipack.pack_img;
|
pack_sprite.sprite = ipack.GetPackImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace TcgEngine.Client
|
|||||||
this.variant = variant;
|
this.variant = variant;
|
||||||
|
|
||||||
if (cardback != null)
|
if (cardback != null)
|
||||||
cardback.sprite = pack.cardback_img;
|
cardback.sprite = pack.GetCardbackImage();
|
||||||
|
|
||||||
card_ui.SetCard(card, variant);
|
card_ui.SetCard(card, variant);
|
||||||
new_card?.SetActive(false);
|
new_card?.SetActive(false);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace TcgEngine.UI
|
|||||||
pack_title.text = pack.title;
|
pack_title.text = pack.title;
|
||||||
}
|
}
|
||||||
pack_img.enabled = true;
|
pack_img.enabled = true;
|
||||||
pack_img.sprite = pack.pack_img;
|
pack_img.sprite = pack.GetPackImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pack_quantity != null)
|
if (pack_quantity != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user