public static void SelectNodo(TDrawNodo Nodo) { if (Nodo != null) { NodoSelecionado = Nodo.InfoNodo; string NomeD = NodoSelecionado.Nome; if (NomeD != null) { NSTextPos = Vector2.Transform(Nodo.Pos, AppGraphics.Camera.get_transformation()); NSTextSize = new Vector2(0, 0); NSTextPos.Y += (AppGraphics.DefaultNodeSize * 0.5f * AppGraphics.Camera.Zoom); NSTexts = new List<string>(); string[] NomeDSS = NomeD.Split(' '); NSTexts.Add(""); int NomeDSA = 0; NSTextSize.Y += GUI.Fonts[2].MeasureString(NomeD).Y; int i = 0; bool há = false; int max = 3; while ((!há) && (max > 0)) { i = 0; while ((i < NomeDSS.Length)) { if (NomeDSS[i].Length >= max) { NSTexts[NomeDSA] += NomeDSS[i] + " "; Vector2 sSize = GUI.Fonts[2].MeasureString(NSTexts[NomeDSA]); if (sSize.X > NSTextSize.X) NSTextSize.X = sSize.X; if (i < NomeDSS.Length - 1) if ((GUI.Fonts[2].MeasureString(NSTexts[NomeDSA] + NomeDSS[i + 1]).X > (AppGraphics.ScreenCenter.X * 2) - NSTextPos.X - Renderer.RightPanel.Size.X) || (GUI.Fonts[2].MeasureString(NSTexts[NomeDSA] + NomeDSS[i + 1]).X > Constants.MaxSelectedNodeSizeAlwaysText)) { NomeDSA++; NSTexts.Add(""); há = true; } } i++; if ((NSTexts.Count >= Constants.MaxSelectedNodeLinesAlwaysText)) { i = NomeDSS.Length + 1; } } max--; } NSTextSize.Y = 0; for (int j = 0; j < NSTexts.Count; j++) if ((NSTexts[j] != "") && (NSTexts[j] != " ")) NSTextSize.Y += GUI.Fonts[2].MeasureString(NSTexts[j]).Y; NSTextPos.X -= NSTextSize.X * 0.5f; } else MouseNodeHandler.NSTexts = new List<string>(); } }
public Vector2 Size; // Tamanho (em worldSize) #endregion Fields #region Constructors // Inicializador de um maxNodo, automaticamente colocando todos os nodos ligados public TDrawMaxNodo(TPNodo Nodo, Vector2 Pos, TInfoNodo nodoAnterior) { MainNodo = Program.GetNodoFromLists(Nodo); Ligações = new List<int>(); Nodos = new List<TDrawNodo>(); Lines = new List<int>(); Loops = 0; Size = new Vector2(0, 0); this.Pos = Pos; Drawable = true; this.nodoAnterior = nodoAnterior; }
public TDrawNodo(TInfoNodo InfoNodo) { Pos = new Vector2(0f, 0f); Color = Color.White * 0.8f; Selected = false; RotAngle = 0f; this.InfoNodo = InfoNodo; }