x修改拖拽

This commit is contained in:
wulongxiao 2025-01-09 17:10:32 +08:00
parent 0018005456
commit a22c1771f3

View File

@ -18,7 +18,9 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD
[Header("遮罩")]
public GameObject mask;
[Header("高亮")]
public GameObject gaoliang;
//生成物体的预制体
//public GameObject PrefabParent;
@ -33,7 +35,7 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD
{
this.cardIconImage.sprite = cardicon;
mask.SetActive(false);
//mask.SetActive(false);
}
@ -42,10 +44,17 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD
// 拖拽开始
public void OnBeginDrag(PointerEventData eventData)
{
// mask.SetActive(true);
if (mY==null)
{
mY = Instantiate(mengyaoPrefab);
cardBox.instance.card.Add(mY);
mY.GetComponent<enemy>().enemyId = transform.GetComponent<CardInfo>().mengyaoid;
}
mY = Instantiate(mengyaoPrefab);
cardBox.instance.card.Add(mY);
mY.GetComponent<enemy>().enemyId = transform.GetComponent<CardInfo>().mengyaoid;
Vector3 mousePosition = Input.mousePosition;
@ -92,9 +101,9 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD
}
this.enabled = false;
//this.enabled = false;
cardBox.instance.ChangeInPlaceNumber(1);
mask.SetActive(true);
this.GetComponent<Toggle>().isOn = false;
if (mY.GetComponent<enemy>().bulletAttackType==BulletAttackType.Zhuan)
{
@ -104,8 +113,9 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD
else
{
Destroy(mY);
}
}
//mask.SetActive(false);
}
}