2024-12-08 20:16:04 +08:00
|
|
|
|
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();
|
2024-12-09 12:00:50 +08:00
|
|
|
|
|
|
|
|
|
// ʹ<><CAB9> for ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ɾ<EFBFBD><C9BE>Ԫ<EFBFBD><D4AA>
|
|
|
|
|
for (int i = 0; i < SnailPanel.Instance.Snails.Count; i++)
|
2024-12-08 20:16:04 +08:00
|
|
|
|
{
|
2024-12-09 12:00:50 +08:00
|
|
|
|
var instanceSnail = SnailPanel.Instance.Snails[i];
|
2024-12-08 20:16:04 +08:00
|
|
|
|
if (snailid == instanceSnail.GetComponent<Snailmove>().id)
|
|
|
|
|
{
|
2024-12-09 12:00:50 +08:00
|
|
|
|
SnailPanel.Instance.Snails.RemoveAt(i); // ɾ<><C9BE>Ԫ<EFBFBD><D4AA>
|
|
|
|
|
Destroy(instanceSnail); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
i--; // ɾ<><C9BE>Ԫ<EFBFBD>غ<EFBFBD><D8BA><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-08 20:16:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (var instanceSnail in SnailPanel.Instance.Snails)
|
|
|
|
|
{
|
|
|
|
|
if (snailid == instanceSnail.GetComponent<Snailmove>().id)
|
|
|
|
|
{
|
2024-12-09 12:00:50 +08:00
|
|
|
|
instanceSnail.gameObject.transform.localPosition = new Vector3(0, 0, 0); // <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
2024-12-08 20:16:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-09 12:00:50 +08:00
|
|
|
|
|
2024-12-08 20:16:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|