切换牌组封面
This commit is contained in:
@@ -6,8 +6,8 @@ using UnityEngine.UI;
|
||||
namespace TcgEngine.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// CollectionPanel is the panel where players can see all the cards they own
|
||||
/// Also the panel where they can use the deckbuilder
|
||||
/// CollectionPanel 玩家可以看到他们拥有的所有卡片的面板
|
||||
/// 还有他们可以使用甲板建造者的面板
|
||||
/// </summary>
|
||||
|
||||
public class CollectionPanel : UIPanel
|
||||
@@ -64,6 +64,7 @@ namespace TcgEngine.UI
|
||||
private List<DeckLine> deck_card_lines = new List<DeckLine>();
|
||||
|
||||
private string current_deck_tid;
|
||||
private Image current_deck_image;
|
||||
private bool editing_deck = false;
|
||||
private bool saving = false;
|
||||
private bool spawned = false;
|
||||
@@ -72,8 +73,6 @@ namespace TcgEngine.UI
|
||||
|
||||
private List<UserCardData> deck_cards = new List<UserCardData>();
|
||||
|
||||
// [SerializeField] private Text cardFragmentsText;
|
||||
|
||||
private static CollectionPanel instance;
|
||||
|
||||
protected override void Awake()
|
||||
@@ -122,11 +121,6 @@ namespace TcgEngine.UI
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (ApiClient.Get() != null)
|
||||
{
|
||||
UserData udata = ApiClient.Get().UserData;
|
||||
// cardFragmentsText.text = udata.cardfragments.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
@@ -187,6 +181,11 @@ namespace TcgEngine.UI
|
||||
RefreshCardsQuantities();
|
||||
}
|
||||
|
||||
public void RefreshCover(Image cover)
|
||||
{
|
||||
current_deck_image.sprite = cover.sprite;
|
||||
}
|
||||
|
||||
public async void ReloadUserDecks()
|
||||
{
|
||||
await Authenticator.Get().LoadUserData();
|
||||
@@ -381,7 +380,7 @@ namespace TcgEngine.UI
|
||||
RefreshCardsQuantities();
|
||||
}
|
||||
|
||||
private void RefreshDeck(UserDeckData deck)
|
||||
public void RefreshDeck(UserDeckData deck)
|
||||
{
|
||||
deck_title.text = "Deck Name";
|
||||
current_deck_tid = GameTool.GenerateRandomID(7);
|
||||
@@ -558,8 +557,7 @@ namespace TcgEngine.UI
|
||||
ShowNotification("卡组数量错误,无法保存。当前总数: " + totalCardCount + ", 需要: " + GameplayData.Get().deck_size);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
UserData udata = Authenticator.Get().UserData;
|
||||
UserDeckData udeck = new UserDeckData();
|
||||
udeck.tid = current_deck_tid;
|
||||
@@ -568,6 +566,10 @@ namespace TcgEngine.UI
|
||||
udeck.hero.tid = GetSelectedHeroId();
|
||||
udeck.hero.variant = VariantData.GetDefault().id;
|
||||
udeck.cards = deck_cards.ToArray();
|
||||
if (string.IsNullOrEmpty(udeck.cover))
|
||||
{
|
||||
udeck.cover = "wind";
|
||||
}
|
||||
saving = true;
|
||||
|
||||
if (Authenticator.Get().IsTest())
|
||||
@@ -586,7 +588,7 @@ namespace TcgEngine.UI
|
||||
ReloadUserDecks();
|
||||
}
|
||||
|
||||
private async void SaveDeckAPI(UserData udata, UserDeckData udeck)
|
||||
public async void SaveDeckAPI(UserData udata, UserDeckData udeck)
|
||||
{
|
||||
string url = ApiClient.ServerURL + "/users/deck/" + udeck.tid;
|
||||
string jdata = ApiTool.ToJson(udeck);
|
||||
@@ -763,6 +765,7 @@ namespace TcgEngine.UI
|
||||
|
||||
public void OnChangeCover(DeckLine line)
|
||||
{
|
||||
current_deck_image = line.image;
|
||||
ChangeCoverPanel.Get().OpenPanel(line);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user