void Destroy() { if (m_labObject != null && !(m_labObject is EleLine)) { LabObjectOperateCenter.UnRegeditMove(this, m_labObject); } }
public void OnDrag(PointerEventData eventData) { Vector3 globalMousePos; RectTransform m_DraggingPlane = LabEnv.NodeLab.transform as RectTransform; if (m_labCamera != null && m_labCamera.ScreenPointToWorldPointInRectangle(m_DraggingPlane, eventData.position, out globalMousePos)) { if (PickupPos != globalMousePos) { Vector3 offset = globalMousePos - PickupPos; PickupPos = globalMousePos; bool result = CheckPositionInCamera(offset + transform.position); if (result) { List <NDlabObject> l = LabEnv.GetHighLightCircuitObject(); List <NDlabObject> list = new List <NDlabObject>(); list.AddRange(l); if (list.Count < 1) { list.Add(m_labObject); } LabObjectOperateCenter.NoticeObjToMove(list, offset); } } } }
void Start() { if (m_labObject == null) { m_labObject = GetComponent <NDlabObject>(); } if (m_labObject != null) { LabObjectOperateCenter.RegeditMove(this, m_labObject); if (m_labObject is EleLine) { m_labCamera = LabEnv.GetCameraByType(CameraType.WireCamera); } else { m_labCamera = LabEnv.GetCameraByType(CameraType.LabCamera); } } }