public override void OnEndDrag(PointerEventData eventData) { base.OnEndDrag(eventData); //slotIndex已经在drop逻辑内重新赋值 transform.SetParent(KnapsackManager.GetInstance().slotBagList[slotIndex].transform); transform.position = transform.parent.position; GetComponent <CanvasGroup>().blocksRaycasts = true; }
void IPointerExitHandler.OnPointerExit(PointerEventData eventData) { if (this.transform.childCount > 0) { isEnter = false; KnapsackManager.GetInstance().HideToolTilePanel(); } }
public override void OnBeginDrag(PointerEventData eventData) { base.OnBeginDrag(eventData); if (itemData != null) { transform.SetParent(transform.parent.parent); transform.position = eventData.position; GetComponent <CanvasGroup>().blocksRaycasts = false; //如果描述界面显示 就把他关闭 KnapsackManager.GetInstance().HideToolTilePanel(); KnapsackManager.GetInstance().slotBagList[slotIndex].GetComponent <BagSlot>().isEnter = false; } }
private void Update() { if (isEnter) { //鼠标悬停0.5f秒钟显示描述界面 temp -= Time.deltaTime; if (temp <= 0) { string text = inv.GetDescribe(inv.itemBagList[slotID]); KnapsackManager.GetInstance().ShowToolTilePanel(text); temp = 0.5f; } } }
// Use this for initialization void Start() { inv = KnapsackManager.GetInstance(); }