修复开始游戏无法点击和UI增加
This commit is contained in:
@@ -10,7 +10,10 @@ namespace TcgEngine.UI
|
||||
{
|
||||
public class PresetDeck : UIPanel
|
||||
{
|
||||
[Header("展示面板")]
|
||||
public Button start_game_button;
|
||||
public TabButton close;
|
||||
|
||||
[Header("卡组面板")]
|
||||
public UIPanel preset_lineup;
|
||||
public Button preset_lineup_button;
|
||||
public UIPanel hide_panel;
|
||||
@@ -24,7 +27,6 @@ namespace TcgEngine.UI
|
||||
[Header("预设面板")]
|
||||
public Button deleteDeckButton;
|
||||
public DeckSelector deckSelector;
|
||||
public DropdownValue dropdownValue;
|
||||
|
||||
private Button hide_panel_button;
|
||||
|
||||
@@ -35,9 +37,10 @@ namespace TcgEngine.UI
|
||||
|
||||
// 卡组展示管理
|
||||
public int card_lines_size = 12;
|
||||
public List<CardUI> card_pool = new List<CardUI>();
|
||||
public List<CardUI> card_lines = new List<CardUI>();
|
||||
|
||||
private List<CardUI> card_pool = new List<CardUI>();
|
||||
private List<CardUI> card_lines = new List<CardUI>();
|
||||
|
||||
private bool _isRankData;
|
||||
|
||||
private UserData lastUserData;
|
||||
private int currIndex = 0;
|
||||
@@ -80,6 +83,9 @@ namespace TcgEngine.UI
|
||||
hide_panel_button.onClick.AddListener(OffPresetLineupPanle);
|
||||
|
||||
deleteDeckButton.onClick.AddListener(OnDeleteDeck);
|
||||
start_game_button.onClick.AddListener(OnStartGame);
|
||||
|
||||
close.onClick += HidePanel;
|
||||
}
|
||||
|
||||
#region 卡组
|
||||
@@ -161,24 +167,63 @@ namespace TcgEngine.UI
|
||||
card_lines.Clear();
|
||||
|
||||
UserDeckData udeck = active_lines[GetCurrIndex()].GetUserDeck();
|
||||
Debug.Log("卡组数量:"+udeck.cards.Length);
|
||||
for (int i = 0; i < udeck.cards.Length; i++)
|
||||
int index = 0; // 对象池索引
|
||||
foreach (var ucard in udeck.cards)
|
||||
{
|
||||
UserCardData ucard = udeck.cards[i];
|
||||
CardUI line = card_pool[i];
|
||||
for (int q = 0; q < ucard.quantity; q++)
|
||||
{
|
||||
if (index >= card_pool.Count)
|
||||
break;
|
||||
|
||||
CardData cdata = CardData.Get(ucard.tid);
|
||||
VariantData variant = VariantData.Get(ucard.variant);
|
||||
CardUI line = card_pool[index++];
|
||||
CardData cdata = CardData.Get(ucard.tid);
|
||||
VariantData variant = VariantData.Get(ucard.variant);
|
||||
|
||||
line.Refresh(cdata, variant);
|
||||
line.gameObject.SetActive(true);
|
||||
card_lines.Add(line);
|
||||
line.Refresh(cdata, variant);
|
||||
line.gameObject.SetActive(true);
|
||||
card_lines.Add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 天梯排行榜使用
|
||||
/// </summary>
|
||||
public void SetupUserCardList(UserDeckData udeck, string name)
|
||||
{
|
||||
_isRankData = true;
|
||||
Show();
|
||||
foreach (var line in card_pool)
|
||||
line.ResetLine();
|
||||
|
||||
card_lines.Clear();
|
||||
|
||||
int index = 0; // 对象池索引
|
||||
foreach (var ucard in udeck.cards)
|
||||
{
|
||||
for (int q = 0; q < ucard.quantity; q++)
|
||||
{
|
||||
if (index >= card_pool.Count)
|
||||
break;
|
||||
|
||||
CardUI line = card_pool[index++];
|
||||
CardData cdata = CardData.Get(ucard.tid);
|
||||
VariantData variant = VariantData.Get(ucard.variant);
|
||||
|
||||
line.Refresh(cdata, variant);
|
||||
line.gameObject.SetActive(true);
|
||||
card_lines.Add(line);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private void OnStartGame()
|
||||
{
|
||||
MainMenu.Get().OnClickPvP();
|
||||
}
|
||||
/// <summary>
|
||||
/// 打开预设面板
|
||||
/// </summary>
|
||||
@@ -200,13 +245,38 @@ namespace TcgEngine.UI
|
||||
{
|
||||
base.Show(instant);
|
||||
|
||||
SetupUserDeckList();
|
||||
|
||||
if (!_isRankData)
|
||||
{
|
||||
SetupUserDeckList();
|
||||
preset_lineup_button.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
preset_lineup_button.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
if (currIndex != 0)
|
||||
{
|
||||
SetupUserCardList();
|
||||
}
|
||||
preset_lineup.Hide();
|
||||
hide_panel.Hide();
|
||||
}
|
||||
|
||||
private void HidePanel()
|
||||
{
|
||||
if (_isRankData)
|
||||
{
|
||||
LeaderboardPanel.Get().Show();
|
||||
_isRankData = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Hide(bool instant = false)
|
||||
{
|
||||
base.Hide(instant);
|
||||
}
|
||||
|
||||
public static PresetDeck Get()
|
||||
{
|
||||
return instance;
|
||||
|
||||
Reference in New Issue
Block a user