public override void Draw() { EditorDrawingHelper.DrawCircle(Owner.Position, Owner.BoundingBox.width / 2f, CurrentColor); Rect iconBoundingBox = new Rect(Owner.Position.x - (iconSize / 2f), Owner.Position.y - (iconSize / 2f), iconSize, iconSize); EditorDrawingHelper.DrawTexture(iconBoundingBox, plusIcon.Texture, Color.gray); }
/// <inheritdoc /> public override void Draw() { EditorDrawingHelper.DrawCircle(Owner.BoundingBox.center, Owner.BoundingBox.size.x / 2f, CurrentColor); Rect StartLabelRect = new Rect(Owner.BoundingBox.center.x - LabelWidth / 2f, Owner.BoundingBox.center.y, LabelWidth, LabelHeight); EditorGUI.LabelField(StartLabelRect, "Start", EditorStyles.label); }
private Rect DrawFoldable(Rect rect, MetadataWrapper wrapper, Action <object> changeValueCallback, GUIContent label, bool isPartOfHeader) { if (wrapper.Metadata[foldableName] == null) { wrapper.Metadata[foldableName] = true; changeValueCallback(wrapper); } bool oldIsFoldedOutValue = (bool)wrapper.Metadata[foldableName]; GUIStyle foldoutStyle = new GUIStyle(EditorStyles.foldout) { fontStyle = FontStyle.Bold, fontSize = 12 }; GUIStyle labelStyle = new GUIStyle(EditorStyles.label) { fontStyle = FontStyle.Bold, fontSize = 12 }; Rect foldoutRect = new Rect(rect.x, rect.y, rect.width, EditorDrawingHelper.HeaderLineHeight); if (isPartOfHeader) { EditorGUI.DrawRect(new Rect(0, foldoutRect.y, foldoutRect.width + foldoutRect.x + 8, foldoutRect.height), new Color(62f / 256f, 62f / 256f, 62f / 256f)); EditorGUI.DrawRect(new Rect(0, foldoutRect.y, foldoutRect.width + foldoutRect.x + 8, 1), new Color(26f / 256f, 26f / 256f, 26f / 256f)); EditorGUI.DrawRect(new Rect(0, foldoutRect.y + foldoutRect.height, foldoutRect.width + foldoutRect.x + 8, 1), new Color(48f / 256f, 48f / 256f, 48f / 256f)); } bool newIsFoldedOutValue = EditorDrawingHelper.DrawFoldoutWithReducedFocusArea(foldoutRect, oldIsFoldedOutValue, oldIsFoldedOutValue ? new GUIContent() : label, foldoutStyle, labelStyle); if (newIsFoldedOutValue != oldIsFoldedOutValue) { wrapper.Metadata[foldableName] = newIsFoldedOutValue; changeValueCallback(wrapper); } // Collapsed if (newIsFoldedOutValue == false) { rect.height = EditorDrawingHelper.HeaderLineHeight; return(rect); } rect.height = 0f; Rect wrappedRect = rect; wrappedRect.x += EditorDrawingHelper.IndentationWidth; wrappedRect.width -= EditorDrawingHelper.IndentationWidth; return(DrawRecursively(wrappedRect, wrapper, foldableName, (newWrapper) => { // We want the user to be aware that value has changed even if the foldable was collapsed (for example, undo/redo). wrapper.Metadata[foldableName] = true; changeValueCallback(wrapper); }, label)); }
public override void Draw() { EditorDrawingHelper.DrawCircle(Owner.Position, Owner.BoundingBox.width / 4f, CurrentColor); Rect iconRect = new Rect(Owner.Position.x - iconSize / 2f, Owner.Position.y - iconSize / 2f, iconSize, iconSize); EditorDrawingHelper.DrawTexture(iconRect, ingoingIcon.Texture, Color.gray); }
/// <inheritdoc /> public override Rect Draw(Rect rect, object currentValue, Action <object> changeValueCallback, GUIContent label) { EditorGUI.BeginDisabledGroup(EditorConfigurator.Instance.AllowedMenuItemsSettings.GetBehaviorMenuOptions().Any() == false); if (EditorDrawingHelper.DrawAddButton(ref rect, "Add Behavior")) { IList <TestableEditorElements.MenuOption> options = ConvertFromConfigurationOptionsToGenericMenuOptions(EditorConfigurator.Instance.BehaviorsMenuContent.ToList(), currentValue, changeValueCallback); TestableEditorElements.DisplayContextMenu(options); } EditorGUI.EndDisabledGroup(); if (EditorDrawingHelper.DrawHelpButton(ref rect)) { Application.OpenURL("https://developers.innoactive.de/documentation/creator/latest/articles/innoactive-creator/default-behaviors.html"); } if (EditorConfigurator.Instance.AllowedMenuItemsSettings.GetBehaviorMenuOptions().Any() == false) { rect.y += rect.height + EditorDrawingHelper.VerticalSpacing; rect.width -= EditorDrawingHelper.IndentationWidth; EditorGUI.HelpBox(rect, "Your project does not contain any Behaviors. Either create one or import an Innoactive Creator Component.", MessageType.Error); rect.height += rect.height + EditorDrawingHelper.VerticalSpacing; } return(rect); }
public override void Draw() { EditorDrawingHelper.DrawCircle(Owner.Position, Owner.BoundingBox.width / 2f, CurrentColor); if (Owner.DragDelta.magnitude > Owner.BoundingBox.width / 2f) { EditorDrawingHelper.DrawArrow(Owner.Position, Owner.Position + Owner.DragDelta, CurrentColor, 40f, 10f); } }
/// <inheritdoc /> public override Rect Draw(Rect rect, object currentValue, Action <object> changeValueCallback, GUIContent label) { if (EditorDrawingHelper.DrawAddButton(ref rect, "Add Transition")) { ChangeValue(() => new Transition(), () => currentValue, changeValueCallback); } return(rect); }
/// <inheritdoc /> public override Rect Draw(Rect rect, object currentValue, Action <object> changeValueCallback, GUIContent label) { if (EditorDrawingHelper.DrawAddButton(ref rect, "Add Behavior")) { IList <TestableEditorElements.MenuOption> options = ConvertFromConfigurationOptionsToGenericMenuOptions(EditorConfigurator.Instance.BehaviorsMenuContent.ToList(), currentValue, changeValueCallback); TestableEditorElements.DisplayContextMenu(options); } return(rect); }
/// <inheritdoc /> public override Rect Draw(Rect rect, object currentValue, Action <object> changeValueCallback, GUIContent label) { EditorGUI.DrawRect(new Rect(0, rect.y, rect.width + 8, 1), new Color(26f / 256f, 26f / 256f, 26f / 256f)); rect = new Rect(rect.x, rect.y - 5, rect.width, rect.height); if (EditorDrawingHelper.DrawAddButton(ref rect, "Add Transition")) { ChangeValue(() => EntityFactory.CreateTransition(), () => currentValue, changeValueCallback); } return(rect); }
/// <inheritdoc /> public override void Draw() { Color drawColor; int lineCount = 0; float yPosTop = 0; float yPosBot = 0; float width = BoundingBox.x + BoundingBox.width; float height = BoundingBox.y + BoundingBox.height; // Draw horizontal lines starting from (0, 0). while (yPosTop > BoundingBox.y || yPosBot <= height) { drawColor = lineCount % 10 == 0 ? SecondaryColor : MainColor; lineCount++; if (yPosTop > BoundingBox.y) { EditorDrawingHelper.DrawHorizontalLine(new Vector3(BoundingBox.x, yPosTop), BoundingBox.width, drawColor); yPosTop -= CellSize; } if (yPosBot <= height) { EditorDrawingHelper.DrawHorizontalLine(new Vector3(BoundingBox.x, yPosBot), BoundingBox.width, drawColor); yPosBot += CellSize; } } lineCount = 0; float xPosLeft = 0; float xPosRight = 0; // Draw vertical lines starting from (0, 0). while (xPosLeft > BoundingBox.x || xPosRight <= width) { drawColor = lineCount % 10 == 0 ? SecondaryColor : MainColor; lineCount++; if (xPosLeft > BoundingBox.x) { EditorDrawingHelper.DrawVerticalLine(new Vector3(xPosLeft, BoundingBox.y), BoundingBox.height, drawColor); xPosLeft -= CellSize; } if (xPosRight <= width) { EditorDrawingHelper.DrawVerticalLine(new Vector3(xPosRight, BoundingBox.y), BoundingBox.height, drawColor); xPosRight += CellSize; } } }
public override void Draw() { EditorDrawingHelper.DrawCircle(Owner.Position, Owner.BoundingBox.width / 2f, CurrentColor); GUIStyle labelStyle = new GUIStyle { alignment = TextAnchor.MiddleCenter, normal = { textColor = TextColor }, wordWrap = false, }; GUI.Label(Owner.BoundingBox, "+", labelStyle); }
public override void Draw() { EditorDrawingHelper.DrawCircle(Owner.Position, Owner.BoundingBox.width / 2f, CurrentColor); if (Owner.DragDelta.magnitude > Owner.BoundingBox.width / 2f) { EditorDrawingHelper.DrawArrow(Owner.Position, Owner.Position + Owner.DragDelta, CurrentColor, 40f, 10f); } Rect iconRect = new Rect(Owner.Position.x - iconSize / 2f, Owner.Position.y - iconSize / 2f, iconSize, iconSize); EditorDrawingHelper.DrawTexture(iconRect, outgoingIcon.Texture, Color.gray); }
public override void Draw() { Rect drawInRect = new Rect(Owner.Position - Owner.BoundingBox.size / 4f, Owner.BoundingBox.size / 2f); EditorDrawingHelper.DrawCircle(Owner.Position, drawInRect.width / 2f, CurrentColor); GUIStyle labelStyle = new GUIStyle { alignment = TextAnchor.MiddleCenter, normal = { textColor = TextColor }, wordWrap = false, }; GUI.Label(drawInRect, ">", labelStyle); }
public override void Draw() { EditorDrawingHelper.DrawRoundedRect(Owner.BoundingBox, CurrentColor, 10f); IValidationHandler validation = EditorConfigurator.Instance.Validation; if (validation.IsAllowedToValidate()) { IContextResolver resolver = validation.ContextResolver; IContext context = resolver.FindContext(Owner.Step.Data, GlobalEditorHandler.GetCurrentCourse()); if (validation.LastReport != null) { List <EditorReportEntry> errors = validation.LastReport.GetEntriesFor(context); if (errors.Count > 0) { string tooltip = ValidationTooltipGenerator.CreateStepTooltip(errors, resolver.FindContext(Owner.ActiveChapter.Data, GlobalEditorHandler.GetCurrentCourse())); GUIContent content = new GUIContent("", null, tooltip); Rect rect = new Rect(Owner.BoundingBox.x + Owner.BoundingBox.width * 0.70f, Owner.BoundingBox.y - 8, 16, 16); // Label icons are too small so we draw a label for the tool tip and icon separated. GUI.Label(rect, content); GUI.DrawTexture(rect, EditorGUIUtility.IconContent("Warning").image); } } } float labelX = Owner.BoundingBox.x + labelBorderOffsetInwards; float labelY = Owner.BoundingBox.y + labelBorderOffsetInwards; float labelWidth = Owner.BoundingBox.width - labelBorderOffsetInwards * 2f; float labelHeight = Owner.BoundingBox.height - labelBorderOffsetInwards * 2f; Rect labelPosition = new Rect(labelX, labelY, labelWidth, labelHeight); GUIStyle labelStyle = new GUIStyle { alignment = TextAnchor.MiddleCenter, normal = { textColor = TextColor }, wordWrap = false, }; string name = EditorDrawingHelper.TruncateText(Owner.Step.Data.Name, labelStyle, labelPosition.width); GUIContent labelContent = new GUIContent(name); GUI.Label(labelPosition, labelContent, labelStyle); }
private Rect DrawSeparated(Rect rect, MetadataWrapper wrapper, Action <object> changeValueCallback, GUIContent label) { EditorDrawingHelper.DrawRect(new Rect(0f, rect.y - 1f, rect.x + rect.width, 1f), Color.grey); Rect wrappedRect = rect; wrappedRect.y += EditorDrawingHelper.VerticalSpacing; wrappedRect = DrawRecursively(wrappedRect, wrapper, separatedName, changeValueCallback, label); wrappedRect.height += EditorDrawingHelper.VerticalSpacing; EditorDrawingHelper.DrawRect(new Rect(0f, wrappedRect.y + wrappedRect.height - 1f, wrappedRect.x + wrappedRect.width, 1f), Color.grey); rect.height = wrappedRect.height; return(rect); }
private void OnGUI() { if (activeCourse == null) { return; } SetTabName(); DrawUnsavedChangesIndicator(); float width = chapterMenu.IsExtended ? TrainingMenuView.ExtendedMenuWidth : TrainingMenuView.MinimizedMenuWidth; Rect scrollRect = EditorDrawingHelper.GetNextLineRect(new Rect(width, 0f, position.size.x - width, position.size.y)); chapterMenu.Draw(); DrawChapterWorkflow(scrollRect); Repaint(); }
///<inheritdoc /> public override void Draw() { Rect rect = Owner.BoundingBox; rect.x = Mathf.Round(rect.x); rect.y = Mathf.Round(rect.y); rect.height = Mathf.Round(rect.height); rect.width = Mathf.Round(rect.width); EditorDrawingHelper.DrawRoundedRect(rect, CurrentColor, 4f); GUIStyle style = new GUIStyle() { alignment = TextAnchor.MiddleCenter, normal = new GUIStyleState() { textColor = TextColor } }; GUI.Label(rect, "+", style); }
public override void Draw() { EditorDrawingHelper.DrawRoundedRect(Owner.BoundingBox, CurrentColor, 10f); float labelX = Owner.BoundingBox.x + labelBorderOffsetInwards; float labelY = Owner.BoundingBox.y + labelBorderOffsetInwards; float labelWidth = Owner.BoundingBox.width - labelBorderOffsetInwards * 2f; float labelHeight = Owner.BoundingBox.height - labelBorderOffsetInwards * 2f; Rect labelPosition = new Rect(labelX, labelY, labelWidth, labelHeight); GUIStyle labelStyle = new GUIStyle { alignment = TextAnchor.MiddleCenter, normal = { textColor = TextColor }, wordWrap = false, }; string name = EditorDrawingHelper.TruncateText(Owner.Step.Data.Name, labelStyle, labelPosition.width); GUIContent labelContent = new GUIContent(name); GUI.Label(labelPosition, labelContent, labelStyle); }
/// <inheritdoc /> public override void Draw() { EditorDrawingHelper.DrawCircle(Owner.BoundingBox.center, Owner.BoundingBox.size.x / 2f, CurrentColor); }
///<inheritdoc /> public override void Draw() { EditorDrawingHelper.DrawPolyline(Owner.PolylinePoints, CurrentColor); EditorDrawingHelper.DrawTriangle(Owner.PolylinePoints, CurrentColor); }