public void OnDrag(PointerEventData eventData) { NDLineLeap leap = GetComponent <NDLineLeap>(); if (leap != null && leap.Link != null) { if (m_lineAction.m_line != null) { m_lineAction.SetControling(); leap.Link.BreakLinkLine(m_lineAction.m_line.LabObjID); } } if (leap != null) { leap.ShowCanLinkLeap(); } Vector3 globalMousePos; if (LabEnv.NodeLab.transform != null && m_camera != null) { RectTransform m_DraggingPlane = LabEnv.NodeLab.transform as RectTransform; if (m_camera.ScreenPointToWorldPointInRectangle(m_DraggingPlane, eventData.position, out globalMousePos)) { if (m_lineAction != null) { m_lineAction.SetControling(); transform.position = globalMousePos; } } } }
public void BeakLinkLeap(NDCircuitLeap leap) { if (leap != null) { NDLineLeap l = null; if (leap == StartLineLeap.Link) { StartLineLeap.SetBreakPos(leap.transform); StartLineLeap.Link = null; } else if (leap == EndLineLeap.Link) { EndLineLeap.SetBreakPos(leap.transform); EndLineLeap.Link = null; } leap.RemoveLinkLine(this); m_LineAction.SetControling(); } }
public void OnPointerClick(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Right) { return; } NDlabObject obj = GetComponent <NDlabObject>(); if (obj != null) { if (obj is EleLine) { LineAction action = obj.gameObject.GetComponent <LineAction>(); if (action) { action.SetControling(); } } if (eventData.clickCount == 2)//show the Menu UI { if (obj != null && obj.PlayerState == false) { ClickMenuWnd wnd = WndManager.GetWnd <ClickMenuWnd>(); if (wnd != null) { wnd.SetCurCircuitObject(obj as NDCircuitObject); wnd.BtnDel.transform.position = new Vector3(eventData.position.x, eventData.position.y, 0); } } } else if (eventData.clickCount == 1 && eventData.dragging == false && eventData.delta.x < 0.1f && eventData.delta.y < 0.1f) { LabEnv.AddHighlightLabObj(obj, ControlButtonDown); } } }