public Button SetData(ParamInfos p) { paramName.text = p.Name; if (p.Direction == ParamInfos.ParamDirection.ParamIn) { outputButton.gameObject.SetActive(false); inputButton.gameObject.SetActive(true); return(inputButton); } else { outputButton.gameObject.SetActive(true); inputButton.gameObject.SetActive(false); return(outputButton); } }
private void Update() { if (null != _currentLink) { _currentLink.SetOutputPosition(Input.mousePosition); } if (Input.GetKeyDown(KeyCode.Escape)) { if (null != _currentLink) { Destroy(_currentLink.gameObject); _currentLink = null; _currentFromParam = null; _currentFromNode = null; } } }
public void EditTargetLink(NodeLink l) { _currentLink = l; Node target = _nodes[l.infos.ToID]; target.RemoveLink(l); _currentFromNode = _nodes[l.infos.FromID]; foreach (ParamInfos p in _currentFromNode.NodePrefabInfos.outputs) { if (p.Name == l.infos.FromParam) { _currentFromParam = p; break; } } SetActiveLink(null); SetActiveNode(null); }
public void ParamClic(Node node, ParamInfos infos, Vector2 attachPoint) { switch (infos.Direction) { case ParamInfos.ParamDirection.ParamOut: if (_currentFromNode == null && node.IsParamFree(infos.Name)) { _currentFromNode = node; _currentFromParam = infos; _currentLink = Instantiate(nodeLinkPrefab, modelZone.transform); _currentLink.Editor = this; _currentLink.transform.SetAsFirstSibling(); _currentLink.SetInputPosition(attachPoint); _currentLink.SetOutputPosition(Input.mousePosition); _currentLink.SetColor(ColorFromType(infos.Type)); } break; case ParamInfos.ParamDirection.ParamIn: if (_currentLink != null && node != _currentFromNode && node.IsParamFree(infos.Name) && _currentFromParam.Type == infos.Type) { LinkInfo linkInfo = new LinkInfo(_currentFromNode.NodeInfos.id, _currentFromParam.Name, node.NodeInfos.id, infos.Name, infos.Type); _currentLink.infos = linkInfo; _currentFromNode.SetLinkToParam(_currentLink); node.SetLinkToParam(_currentLink); _currentFromNode = null; _currentLink = null; _currentFromParam = null; } break; } }
public Vector2 GetParamAttachPoint(ParamInfos p) { return(_buttons[p.Name].transform.position); }