public void OnGraphGUI() { this.BeginWindows(); using (List <Node> .Enumerator enumerator = stateMachineGraph.nodes.GetEnumerator()) { while (enumerator.MoveNext()) { Node current = enumerator.Current; Node n2 = current; bool on = false; //this.selection.Contains (current); Styles.Color color = (!current.nodeIsInvalid) ? current.color : Styles.Color.Red; current.position = GUILayout.Window(current.GetInstanceID(), current.position, delegate { stateMachineGraphGUI.NodeGUI(n2); }, current.title, Styles.GetNodeStyle(current.style, color, on), new GUILayoutOption[] { GUILayout.Width(0f), GUILayout.Height(0f) }); } } this.EndWindows(); (stateMachineGraphGUI.edgeGUI as UnityEditor.Graphs.EdgeGUI) .DoEdges(); // stateMachineGraphGUI.edgeGUI.DoDraggedEdge (); // stateMachineGraphGUI.DragSelection (new Rect (-5000f, -5000f, 10000f, 10000f)); // stateMachineGraphGUI.ShowContextMenu (); // stateMachineGraphGUI.HandleMenuEvents (); }
// public void Log(object s, Styles.Color color) { if (IsLog) { s = string.Format("<color={0}>{1}</color>", color.ToString(), s); UnityEngine.Debug.Log(s); } }
private static Rectangle CreateBackground(Styles.Color color, int size) { return(new Rectangle { Fill = color == null ? new SolidColorBrush(Colors.Transparent) : new SolidColorBrush(GetColor(color)), Width = size, Height = size }); }
private static void DrawRectangle(Canvas canvas, RectF destination, Styles.Color outlineColor) { var paint = new Paint(); paint.SetStyle(Paint.Style.Stroke); paint.Color = new AndroidColor(outlineColor.R, outlineColor.G, outlineColor.B, outlineColor.A); paint.StrokeWidth = 4; canvas.DrawRect(destination, paint); }
public static GUIStyle GetNodeStyle(string styleName, Styles.Color color, bool on) { string text = string.Format("flow {0} {1}{2}", styleName, (int)color, (!on) ? string.Empty : " on"); if (!Styles.m_NodeStyleCache.ContainsKey(text)) { Styles.m_NodeStyleCache[text] = text; } return(Styles.m_NodeStyleCache[text]); }
public static Styles.Color GetStyleColorByState(MachineStateUIStateEnum state) { Styles.Color c = Styles.Color.Gray; switch (state) { case MachineStateUIStateEnum.Normal: c = Styles.Color.Gray; break; case MachineStateUIStateEnum.Running: c = Styles.Color.Green; break; case MachineStateUIStateEnum.select: c = Styles.Color.Blue; break; } return(c); }
public virtual void OnGraphGUI() { this.m_Host.BeginWindows(); foreach (Node current in this.m_Graph.nodes) { Node n2 = current; bool on = this.selection.Contains(current); Styles.Color color = (!current.nodeIsInvalid) ? current.color : Styles.Color.Red; current.position = GUILayout.Window(current.GetInstanceID(), current.position, delegate { this.NodeGUI(n2); }, current.title, Styles.GetNodeStyle(current.style, color, on), new GUILayoutOption[] { GUILayout.Width(0f), GUILayout.Height(0f) }); } this.m_Host.EndWindows(); this.edgeGUI.DoEdges(); this.edgeGUI.DoDraggedEdge(); this.DragSelection(new Rect(-5000f, -5000f, 10000f, 10000f)); this.ShowContextMenu(); this.HandleMenuEvents(); }
private void DrawEntryNode(DialogueEntry entry) { bool isSelected = multinodeSelection.nodes.Contains(entry); Styles.Color nodeColor = (entry.id == 0) ? Styles.Color.Orange : database.IsPlayerID(entry.ActorID) ? Styles.Color.Blue : Styles.Color.Gray; if (entry == currentRuntimeEntry) { nodeColor = Styles.Color.Green; } string nodeLabel = GetDialogueEntryNodeText(entry); if (showActorNames) { GUIStyle nodeStyle = new GUIStyle(Styles.GetNodeStyle("node", nodeColor, isSelected)); nodeStyle.padding.top = 23; nodeStyle.padding.bottom = 0; GUI.Box(entry.canvasRect, nodeLabel, nodeStyle); } else { GUI.Box(entry.canvasRect, nodeLabel, Styles.GetNodeStyle("node", nodeColor, isSelected)); } }
private static XamlColor GetColor(Styles.Color color) { return(color == null ? Colors.Black : color.ToXaml()); }
/// <summary> /// Renders a label to the map. /// </summary> /// <param name="graphics">Graphics reference</param> /// <param name="labelPoint">Label placement</param> /// <param name="offset">Offset of label in screen coordinates</param> /// <param name="font">Font used for rendering</param> /// <param name="forecolor">Font forecolor</param> /// <param name="backcolor">Background color</param> /// <param name="halo">Color of halo</param> /// <param name="rotation">Text rotation in degrees</param> /// <param name="text">Text to render</param> /// <param name="viewport"></param> public static void DrawLabel(Graphics graphics, Point labelPoint, Styles.Offset offset, Styles.Font font, Styles.Color forecolor, Styles.Brush backcolor, Styles.Pen halo, double rotation, string text, IViewport viewport) { SizeF fontSize = graphics.MeasureString(text, font.Convert()); //Calculate the size of the text labelPoint.X += offset.X; labelPoint.Y += offset.Y; //add label offset if (rotation != 0 && !double.IsNaN(rotation)) { graphics.TranslateTransform((float)labelPoint.X, (float)labelPoint.Y); graphics.RotateTransform((float)rotation); graphics.TranslateTransform(-fontSize.Width / 2, -fontSize.Height / 2); if (backcolor != null && backcolor.Convert() != Brushes.Transparent) { graphics.FillRectangle(backcolor.Convert(), 0, 0, fontSize.Width * 0.74f + 1f, fontSize.Height * 0.74f); } var path = new GraphicsPath(); path.AddString(text, new FontFamily(font.FontFamily), (int)font.Convert().Style, font.Convert().Size, new System.Drawing.Point(0, 0), null); if (halo != null) { graphics.DrawPath(halo.Convert(), path); } graphics.FillPath(new SolidBrush(forecolor.Convert()), path); //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), 0, 0); } else { if (backcolor != null && backcolor.Convert() != Brushes.Transparent) { graphics.FillRectangle(backcolor.Convert(), (float)labelPoint.X, (float)labelPoint.Y, fontSize.Width * 0.74f + 1, fontSize.Height * 0.74f); } var path = new GraphicsPath(); //Arial hack path.AddString(text, new FontFamily("Arial"), (int)font.Convert().Style, (float)font.Size, new System.Drawing.Point((int)labelPoint.X, (int)labelPoint.Y), null); if (halo != null) { graphics.DrawPath(halo.Convert(), path); } graphics.FillPath(new SolidBrush(forecolor.Convert()), path); //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), LabelPoint.X, LabelPoint.Y); } }
/// <summary> /// Convert Mapsui.Styles.Color to Xamarin.Forms.Color /// </summary> /// <param name="color">Color in Mapsui format</param> /// <returns>Color in Xamarin.Forms.Maps format</returns> public static Xamarin.Forms.Color ToForms(this Styles.Color color) { return(new Xamarin.Forms.Color(color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0)); }
public MemoryStream RenderToBitmapStream(IViewport viewport, IEnumerable <ILayer> layers, Styles.Color background = null) { return(RenderToBitmapStreamPrivate(viewport, layers)); }
public void Render(object target, IViewport viewport, IEnumerable <ILayer> layers, Styles.Color background = null) { Render((Canvas)target, viewport, layers, ShowDebugInfoInMap); }
/// <summary> /// Convert Mapsui.Styles.Color to Xamarin.Forms.Color /// </summary> /// <param name="color">Color in Mapsui format</param> /// <returns>Color in Xamarin.Forms.Maps format</returns> public static Xamarin.Forms.Color ToForms(this Styles.Color color) { return(color.ToNative()); }
public static Microsoft.Maui.Graphics.Color ToNative(this Styles.Color color) { return(new Microsoft.Maui.Graphics.Color(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f)); }
/// <summary> /// Convert Mapsui.Styles.Color to Microsoft.Maui.Graphics.Color /// </summary> /// <param name="color">Color in Mapsui format</param> /// <returns>Color in Microsoft.Maui.Graphics format</returns> public static Microsoft.Maui.Graphics.Color ToMaui(this Styles.Color color) { return(color.ToNative()); }