void DrawDragOutlines(BaseNode node) { DrawChildOutlines(node); var rect = dragNode.rect; rect.position = mousePosition; ReactEditorUtility.DrawOutline(rect, Color.yellow / 2, Color.yellow / 2); }
void DrawChildOutlines(BaseNode node) { ReactEditorUtility.DrawOutline(node.rect, Color.yellow / 2, Color.yellow / 2); var p = node as IParentNode; if (p != null) { foreach (var c in p.GetChildren()) { DrawChildOutlines(c); } } }
void OnGUIHasBeenDrawn() { var e = Event.current; if (e.type == EventType.MouseDrag && e.delta.sqrMagnitude > 1 && reactor.hotNode != null && reactor.hotNode.rect.Contains(mousePosition) && e.button == 0) { StartDrag(); e.Use(); } if (e.type == EventType.DragUpdated) { UpdateDrag(); e.Use(); } if (e.type == EventType.DragExited) { ExitDrag(); e.Use(); } if (e.type == EventType.DragPerform) { PerformDrag(); e.Use(); } if (dragNode != null) { DrawDragOutlines(dragNode); } if (dropZone != null) { if (dropZone.parent != null) { var rect = dropZone.rect; if (dropZone.last) { rect.y = rect.yMax; } else { rect.y -= 1; } rect.height = 1; ReactEditorUtility.DrawOutline(dropZone.parent.rect, Color.cyan, Color.cyan / 2); ReactEditorUtility.DrawOutline(rect, Color.white, Color.white / 2); } } }
void DrawExecutionState(BaseNode node) { var stateColor = new Color(1, 1, 1, 0); if (Application.isPlaying) { switch (node.lastState) { case NodeState.Aborted: stateColor = Color.magenta; break; case NodeState.Success: stateColor = Color.green; break; case NodeState.Failure: stateColor = Color.red; break; case NodeState.NoResult: stateColor = Color.white; break; } if (node.lastState != NodeState.None) { stateColor.a = 0.7f * Mathf.Clamp01(1 - ((Time.time - node.lastExecuteTime))); } ReactEditorUtility.DrawOutline(node.rect, stateColor, stateColor / 2); } }