using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class DragWindowCtrl : DragIcon,IPointerDownHandler { public void OnPointerDown(PointerEventData eventData) { if (eventData.button == 0) { isOnMap = !isOnMap;//放下/拾起图标 } if (!isOnMap)//再次拾起 { offsetPos = (Vector2)Input.mousePosition - (Vector2)transform.position; this.transform.SetSiblingIndex(this.transform.parent.childCount - 1);//保持最前面位置 } } private void OnEnable() { isOnMap = true; } }