public void OnBGClick(BaseEventData eventData) { PointerEventData pointerData = eventData as PointerEventData; if (OutputVisual.status == OutputVisual.LINKING) { OutputVisual.CancelLink(); } for (int i = 0; i < allNodes.Count; i++) { allNodes[i].GetComponent <NodeVisual>().CloseRightClickMenu(); } if (tabMenu != null && tabMenu.gameObject.activeSelf) { tabMenu.gameObject.SetActive(false); } //right click menu if (splatRightClick != null) { Destroy(splatRightClick.gameObject); } if (pointerData.button == PointerEventData.InputButton.Right) { if (selectedNodes.Count != 0) { StartCoroutine(SplatMenuRightClick()); } } }
void Update() { if (hidden) { return; } if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.C)) { CopySelectedNodes(); } if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.X)) { CopySelectedNodes(); DeleteSelectedNodes(); } if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.V)) { Paste(); } if (groupMode && !IsInputFieldFocused() && Input.GetKeyDown(KeyCode.Backspace)) { OnClickBack(); } #region shiftClick if (wasInShiftingLink && !(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))) { if (OutputVisual.linkInitiator != null && OutputVisual.linkInitiator.pendingLink != null) { OutputVisual.linkInitiator.pendingLink.FollowMouse(OutputVisual.linkInitiator.gameObject); OutputVisual.linkInitiator.pendingLink.keepAlive = false; } wasInShiftingLink = false; bufferInputs = null; if (oldTarget != null) { oldTarget.HideName(); } oldTarget = null; } if (wasInShiftingLink && (Input.GetMouseButtonDown(0) || Input.GetMouseButtonUp(0))) { if (oldTarget != null && OutputVisual.linkInitiator != null && OutputVisual.linkInitiator.pendingLink != null) { OutputVisual.linkInitiator.pendingLink.keepAlive = false; OutputVisual.CompleteLink(OutputVisual.linkInitiator.pendingLink.inputDestination); } wasInShiftingLink = false; bufferInputs = null; if (oldTarget != null) { oldTarget.HideName(); } oldTarget = null; } if (OutputVisual.status == OutputVisual.LINKING && (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Vector2.Distance(Input.mousePosition, oldMousePos) > 10) { if (!wasInShiftingLink) { wasInShiftingLink = true; bufferInputs = FindObjectsOfType <InputVisual>(); } oldMousePos = Input.mousePosition; InputVisual closest = null; for (int i = 0; i < bufferInputs.Length; i++) { if (VisualEditor.BackEnd.Output.ContainsType(bufferInputs[i].inputAttachedTo.GetAllowedDataTypes(), OutputVisual.linkInitiator.outputAttachedTo.GetDataType()) // bufferInputs[i].inputAttachedTo.GetAllowedDataTypes().Contains(OutputVisual.linkInitiator.outputAttachedTo.GetDataType()) && bufferInputs[i].host != OutputVisual.linkInitiator.host && bufferInputs[i].inputAttachedTo.outputConnectedTo == null) { if (closest == null) { closest = bufferInputs[i]; } else { if (Vector2.Distance(bufferInputs[i].transform.position, Input.mousePosition) < Vector2.Distance(closest.transform.position, Input.mousePosition)) { closest = bufferInputs[i]; } } } } if (oldTarget != closest) { if (oldTarget != null) { oldTarget.HideName(); } if (closest != null) { closest.ShowName(); } } oldTarget = closest; if (closest != null) { OutputVisual.linkInitiator.pendingLink.keepAlive = true; OutputVisual.linkInitiator.pendingLink.FinishFollowingMouse(closest.gameObject); } } #endregion //en mode pro : quand on clique dans le vide ca ouvre la liste //en mode debutant : quand on clique and drag dans le vide ca bouge tous les swag if (proMode) { if (Input.GetMouseButtonDown(2)) { lastMousePos = Input.mousePosition; SetNodesAnchorAtMousePos(); } else if (Input.GetMouseButton(2)) { Vector2 newMPos = Input.mousePosition; MoveBy(newMPos - lastMousePos); lastMousePos = newMPos; } } else {//debutant mode } if ((Input.GetKeyDown(KeyCode.Tab) || Input.GetKeyDown(KeyCode.Space)) && !IsInputFieldFocused()) { //TODO open list of possible nodes based on if you click on an input, an ouput or nothing PopTabMenu(); } if (Input.mouseScrollDelta.y != 0f && (tabMenu == null || !tabMenu.gameObject.activeSelf)) { ZoomBy(Input.mouseScrollDelta.y); } if (scaler.scaleFactor != targetScaleFactor) { scaler.scaleFactor = Mathf.Lerp(scaler.scaleFactor, targetScaleFactor, 0.1f); } }