卡组数据删减
This commit is contained in:
@@ -35,7 +35,7 @@ namespace TcgEngine
|
||||
|
||||
public UserCardData[] cards;
|
||||
public UserCardData[] packs;
|
||||
public UserDeckData[] decks;
|
||||
public UserDeckData[] decks;// 自建卡组
|
||||
public UserDeckData lastWinDeck;
|
||||
public string[] rewards;
|
||||
public string[] avatars;
|
||||
@@ -342,6 +342,7 @@ namespace TcgEngine
|
||||
{
|
||||
public string tid;
|
||||
public string title;
|
||||
public string cover;
|
||||
public UserCardData hero;
|
||||
public UserCardData[] cards;
|
||||
|
||||
@@ -367,6 +368,16 @@ namespace TcgEngine
|
||||
}
|
||||
}
|
||||
|
||||
public Sprite GetCardCover()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(cover))
|
||||
{
|
||||
CardCoverData cardCover = CardCoverData.Get(cover);
|
||||
return cardCover.GetCardCover();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int GetQuantity()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
58
Assets/TcgEngine/Scripts/Data/CardCoverData.cs
Normal file
58
Assets/TcgEngine/Scripts/Data/CardCoverData.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TcgEngine
|
||||
{
|
||||
[CreateAssetMenu(fileName = "CardCover", menuName = "TcgEngine/CardCover", order = 10)]
|
||||
public class CardCoverData : ScriptableObject
|
||||
{
|
||||
public string id;
|
||||
public string name;
|
||||
public string cardCoverPath;
|
||||
|
||||
private static List<CardCoverData> _cardCoverList = new List<CardCoverData>();
|
||||
|
||||
public static void Load(string folder = "")
|
||||
{
|
||||
if (_cardCoverList.Count==0)
|
||||
_cardCoverList.AddRange(Resources.LoadAll<CardCoverData>(folder));
|
||||
}
|
||||
|
||||
public Sprite GetCardCover()
|
||||
{
|
||||
if (_cardCoverList.Count == 0)
|
||||
Load();
|
||||
|
||||
if (!string.IsNullOrEmpty(cardCoverPath))
|
||||
{
|
||||
Sprite dynamicSprite = SpriteLoader.Get()?.LoadSprite(cardCoverPath);
|
||||
if (dynamicSprite != null)
|
||||
return dynamicSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("卡组封面地址为空!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CardCoverData Get(string id)
|
||||
{
|
||||
foreach (CardCoverData cardCover in GetAll())
|
||||
{
|
||||
if (cardCover.id == id)
|
||||
{
|
||||
return cardCover;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<CardCoverData> GetAll()
|
||||
{
|
||||
return _cardCoverList;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
3
Assets/TcgEngine/Scripts/Data/CardCoverData.cs.meta
Normal file
3
Assets/TcgEngine/Scripts/Data/CardCoverData.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc3f18e9386843beb552310c5c14f280
|
||||
timeCreated: 1759135868
|
||||
@@ -52,6 +52,7 @@ namespace TcgEngine
|
||||
public int mana;
|
||||
public int attack;
|
||||
public int hp;
|
||||
public bool isOnline = true;// 判断排序和可点击性
|
||||
|
||||
[Header("Traits")]
|
||||
public TraitData[] traits;
|
||||
|
||||
@@ -44,9 +44,13 @@ namespace TcgEngine
|
||||
AvatarData.Load();
|
||||
CardbackData.Load();
|
||||
RewardData.Load();
|
||||
|
||||
|
||||
Debug.Log("[拦截] 目前卡: " + DeckData.GetAll().Count);
|
||||
Debug.Log("[拦截] 目前卡牌数量: " + CardData.GetAll().Count);
|
||||
|
||||
Debug.Log("[拦截] PackData 数量: " + PackData.GetAll().Count);
|
||||
foreach (var p in PackData.GetAll()) Debug.Log(p.id);
|
||||
|
||||
CheckCardData();
|
||||
CheckAbilityData();
|
||||
CheckDeckData();
|
||||
|
||||
@@ -114,6 +114,7 @@ namespace TcgEngine.UI
|
||||
|
||||
string url = ApiClient.ServerURL + "/users/cards/buy/";
|
||||
string jdata = ApiTool.ToJson(req);
|
||||
Debug.Log(jdata);
|
||||
trade_error.text = "";
|
||||
|
||||
WebResponse res = await ApiClient.Get().SendPostRequest(url, jdata);
|
||||
|
||||
@@ -25,8 +25,11 @@ namespace TcgEngine.UI
|
||||
|
||||
private void Start()
|
||||
{
|
||||
card_ui.onClick += onClick;
|
||||
card_ui.onClickRight += onClickRight;
|
||||
if (card_ui.GetCard().isOnline)
|
||||
{
|
||||
card_ui.onClick += onClick;
|
||||
card_ui.onClickRight += onClickRight;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCard(CardData card, VariantData variant, int quantity)
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace TcgEngine.UI
|
||||
public IconButton[] hero_powers;
|
||||
|
||||
private TeamData filter_team = null;
|
||||
private int filter_dropdown = 0;
|
||||
public int filter_dropdown = 0;
|
||||
private string filter_search = "";
|
||||
|
||||
private List<CollectionCard> card_list = new List<CollectionCard>();
|
||||
@@ -112,6 +112,10 @@ namespace TcgEngine.UI
|
||||
hover.text += " <size=16>Mana: " + iability.mana_cost + "</size>";
|
||||
}
|
||||
}
|
||||
if (!spawned)
|
||||
{
|
||||
SpawnCards();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@@ -157,6 +161,7 @@ namespace TcgEngine.UI
|
||||
dCard.SetCard(card, variant, 0);
|
||||
dCard.onClick += OnClickCard;
|
||||
dCard.onClickRight += OnClickCardRight;
|
||||
|
||||
all_list.Add(dCard);
|
||||
nCard.SetActive(false);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace TcgEngine.UI
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
image.sprite = card.GetFullArt(variant);
|
||||
image.sprite = card.GetHorizontalArt();
|
||||
image.enabled = true;
|
||||
image.material = invalid ? disabled_mat : default_mat;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,12 @@ namespace TcgEngine
|
||||
UploadCardList(list);
|
||||
await TimeTool.Delay(200);
|
||||
}
|
||||
|
||||
foreach (CardData item in cards)
|
||||
{
|
||||
UploadCard(item);
|
||||
ShowText( "卡牌:" + item.title);
|
||||
}
|
||||
}
|
||||
|
||||
//Variants
|
||||
@@ -246,6 +252,7 @@ namespace TcgEngine
|
||||
for (int i = 0; i < req.packs.Length; i++)
|
||||
{
|
||||
req.packs[i] = card.packs[i].id;
|
||||
ShowText(+ i + "ID:" + req.tid);
|
||||
}
|
||||
|
||||
string url = ApiClient.ServerURL + "/cards/add";
|
||||
|
||||
Reference in New Issue
Block a user