_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/snailFactory/NoSnailCard.cs
2024-12-08 20:16:04 +08:00

58 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NoSnailCard : MonoBehaviour
{
public FactoryItem FactoryItem;
// Start is called before the first frame update
void Start()
{
}
public async void SnailBindCard(long snailid)
{
//9.4
bindSlot bindSlot = new bindSlot();
BindSlot Bs=await bindSlot.QueryUserSnailCount(snailid, FactoryItem.id);
if (Bs.code == 200)
{
SnaolHouse.Instance.InitItem();
foreach (var instanceSnail in SnailPanel.Instance.Snails)
{
if (snailid == instanceSnail.GetComponent<Snailmove>().id)
{
SnailPanel.Instance.Snails.Remove(instanceSnail);
Destroy(instanceSnail);
}
}
}
else
{
foreach (var instanceSnail in SnailPanel.Instance.Snails)
{
if (snailid == instanceSnail.GetComponent<Snailmove>().id)
{
instanceSnail.gameObject.transform.localPosition = new Vector3(0, 0, 0);
}
}
}
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.name == "Snail(Clone)")
{
Snailmove sm = other.gameObject.GetComponent<Snailmove>();
SnailBindCard(sm.id);
}
}
// Update is called once per frame
void Update()
{
this.transform.localScale = new Vector3(1, 1, 1);
}
}