完善抽卡界面以及根据优化意见和功能缺失做出调整

This commit is contained in:
YiHan0621
2025-10-13 01:41:20 +08:00
parent 2e4a318ca3
commit f14b8d6ac6
14 changed files with 702 additions and 304 deletions

View File

@@ -19,6 +19,8 @@ namespace TcgEngine.Client
public float card_angle = 10f;
public float card_offset_y = 10f;
public UIPanel buyButton;
private List<HandPack> packs = new List<HandPack>();
private Vector3 start_pos;
@@ -66,6 +68,7 @@ namespace TcgEngine.Client
public void RefreshPacks()
{
UserData udata = Authenticator.Get().UserData;
Debug.Log("玩家卡包有:"+udata.packs.Length+"种");
foreach (UserCardData pack in udata.packs)
{
Debug.Log("服务器返回的卡包tid" + pack.tid+",");
@@ -75,9 +78,10 @@ namespace TcgEngine.Client
PackData dpack = PackData.Get(pack.tid);
if (dpack != null && !HasPack(pack.tid))
SpawnNewPack(pack);
Debug.Log($"其中有{pack.tid}:{pack.quantity}个");
}
//Remove removed cards
// 移除已移除的卡片
for (int i = packs.Count - 1; i >= 0; i--)
{
HandPack pack = packs[i];
@@ -88,6 +92,15 @@ namespace TcgEngine.Client
pack.Remove();
}
}
if (udata.packs==null || udata.packs.Length == 0)
{
buyButton.Show();
}
else
{
buyButton.Hide();
}
}
void Update()

View File

@@ -37,6 +37,8 @@ namespace TcgEngine.Client
private bool removed = false;
private bool is_new = false;
private float timer = 0f;
private bool hasOpenedStandardPack = false;
private static List<PackCard> card_list = new List<PackCard>();
@@ -61,12 +63,9 @@ namespace TcgEngine.Client
transform.rotation = Quaternion.Slerp(transform.rotation, rtarget, flip_speed * Time.deltaTime);
}
if (removed && timer > 4f)
Destroy(gameObject);
if (card_list.Count==5)
if (removed && timer > 1f)
{
Destroy(gameObject);
}
}