public void ClickOnJanela() { if(modoMouse==ModoMouse.Connecting) { if (Input.GetMouseButton(1)) { if (PortaSelecionadaAtualmente == null) Debug.Log("estava no modo connecting com porta !! null"); modoMouse = ModoMouse.Idle; CancelarPortaSelecionada(); if (PortaSelecionadaAtualmente != null) Debug.Log("!! era pra dar null null"); } return; } if(Input.GetMouseButton(0)) { modoMouse = ModoMouse.Idle; PrefabNodoMenu.SetActive(false); PrefabJanelaMenu.SetActive(false); PrefabLinkMenu.SetActive(false); Propriedades.SetActive(false); CancelarNodoSelecionado(); } if (Input.GetMouseButton(1)) { /* if (MenuLink()==true) { Debug.Log("não liga menu janela pq menu link já tá ligado"); return; } */ PrefabNodoMenu.SetActive(false); PrefabJanelaMenu.SetActive(true); PrefabLinkMenu.SetActive(false); Vector3 mouse = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0); Vector3 canvasV = new Vector3(canvas.rect.width / 2, canvas.rect.height / 2, 0); Vector3 nodoV = new Vector3(-PrefabJanelaMenu.GetComponent<RectTransform>().rect.width * 1.2f, -PrefabJanelaMenu.GetComponent<RectTransform>().rect.height * 1.7f, 0); PrefabJanelaMenu.GetComponent<RectTransform>().anchoredPosition3D = mouse - canvasV; //- nodoV; CancelarNodoSelecionado(); } }
void MovendoNodo() { if(modoMouse==ModoMouse.MovingNodo) { if(nodoSelecionadoAtualmente==null) { modoMouse = ModoMouse.Idle; return; } nodoSelecionadoAtualmente.transform.position = nodoSelecionadoAtualmente.transform.position - new Vector3(xMovement,yMovement)*2; nodoSelecionadoAtualmente.AtualizarLinks(); } }
void Connecting() { if (memoria != modoMouse) { if (modoMouse == ModoMouse.Connecting) { LinkConnecting.SetActive(true); BezierLinkConnecting.lineRenderer.SetColors(Color.green, Color.green); } if (modoMouse == ModoMouse.Idle) { LinkConnecting.SetActive(false); } memoria = modoMouse; } if (modoMouse == ModoMouse.Connecting) { var v3 = Input.mousePosition; v3.z = -Camera.main.transform.position.z; v3 = Camera.main.ScreenToWorldPoint(v3); BezierLinkConnecting.Render(PortaSelecionadaAtualmente.transform.position, v3); } }
void InputAtalhos() { if (Input.GetKey("left shift") ) { if (Input.GetKeyDown("c")) MoverNodoParaOCentro(); if (Input.GetKeyDown("d")) DuplicarNodo(); if (Input.GetKeyDown("p")) nodoSelecionadoAtualmente.AdicionarPorta(); if (Input.GetKeyDown("x")) RemoverNodo(); if (Input.GetKeyDown("f")) FocusOnNodoSelecionado(); if (Input.GetKeyDown("w")) AdicionarNodo(); if (Input.GetKeyDown("r")) OrganizarNodosEmArvore(); if (Input.GetKeyDown("g")) if (modoMouse == ModoMouse.Idle) modoMouse = ModoMouse.MovingNodo; else if (modoMouse == ModoMouse.MovingNodo) modoMouse = ModoMouse.Idle; } }