public void Init() { if (initialised) { return; } initialised = true; isOpen = false; EventSystem = GameObject.FindObjectOfType <EventSystem>(); if (EventSystem == null) { throw new Exception("No EventSystem found"); } SetupEventHandlers(); if (EventOptions.StartedDragging == null) { EventOptions.StartedDragging = new UnityEvent(); } if (EventOptions.EndedDragging == null) { EventOptions.EndedDragging = new UnityEvent(); } ScrollRect = GetComponentInChildren <ScrollRect>(); if (ScrollRect != null) { EventOptions.StartedDragging.AddListener(() => ScrollRect.enabled = false); EventOptions.EndedDragging.AddListener(() => ScrollRect.enabled = true); } Buttons.AddNode.GraphEditor = this; Buttons.Remove.GraphEditor = this; Buttons.AutoLayout.GraphEditor = this; Buttons.Run.GraphEditor = this; Buttons.Debug.GraphEditor = this; results = new List <RaycastResult>(); isDragging = false; if (Manager == null) { Manager = gameObject.AddComponent <LinePointManager>(); } }
public void SetupWithEdge(Edge Edge, LinePointManager manager) { this.Edge = Edge; OutPort = Edge.Source.Visualisation; InPort = Edge.Target.Visualisation; LinePoint startPoint = new LinePoint(); LinePoint endPoint = new LinePoint(); Line.points.Clear(); Line.points.Add(startPoint); Line.points.Add(endPoint); OutPort.gameObject.AddComponent <LinePointUpdater>().Setup(Line, 0, Vector3.zero, Line.transform, manager); InPort.gameObject.AddComponent <LinePointUpdater>().Setup(Line, 1, Vector3.zero, Line.transform, manager); RectTransform rect = transform as RectTransform; rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.anchoredPosition = Vector2.zero; rect.sizeDelta = Vector2.zero; }
public void Setup(UIMeshLine Line, int index, Vector3 StaticOffset, Transform DynamicOffset, LinePointManager manager) { this.Line = Line; this.Index = index; this.StaticOffset = StaticOffset; this.DynamicOffset = DynamicOffset; manager.RegisterUpdater(this); }