public static Create ( Rect NodeRect, NodeType nodeType = NodeType.Object ) : ObjectNode, | ||
NodeRect | Rect | |
nodeType | NodeType | |
return | ObjectNode, |
/// <summary> /// Context Click selection. Here you'll need to register your own using a string identifier /// </summary> public void ContextCallback(object obj) { switch (obj.ToString()) { case "objectNode": ObjectNode objectNode = ObjectNode.Create(new Rect(mousePos.x, mousePos.y, 200, 100)); break; case "itemNode": ObjectNode itemNode = ObjectNode.Create(new Rect(mousePos.x, mousePos.y, 200, 100), NodeType.Item); break; case "conditionNode": ObjectNode conditionNode = ObjectNode.Create(new Rect(mousePos.x, mousePos.y, 200, 100), NodeType.Route); break; case "deleteNode": Node node = NodeAtPosition(mousePos); if (node != null) { nodeCanvas.nodes.Remove(node); node.OnDelete(); } break; } }
/// <summary> /// Put all static objects into global objects collection. /// <para> /// THIS METHOD MUST BE CALLED PRIOR TO ANY OTHER CALLS! /// </para> /// </summary> /// <param name="classes"> /// The classes where the desired importing static objects are located /// </param> public static void ImportEntryObjects(params Type[] classes) { foreach (var type in classes) { // Load all static properties foreach (var property in type.GetVisibleProperties(BindingFlags.Public | BindingFlags.Static)) { ObjectNode node = ObjectNode.Create(null, property); Roots.Add(node); } // Load all static methods foreach (var method in type.GetVisibleMethods(BindingFlags.Public | BindingFlags.Static)) { MethodNode node = MethodNode.Create(null, method); Roots.Add(node); } } }
public string ToString(out int logicalLength) { string str; string str2; lock (this._locker) { str = this._data.ToString(); str2 = this._buffer.ToString(); } logicalLength = str.Length + str2.Length; if ((str.Length <= this._headerLength) && (str2.Length == 0)) { return(""); } if (str2.Length > 0) { str = str + this.Format(ObjectNode.Create(str2.ToString(), null, null)) + "\r\n"; } return(str + this._formatter.GetFooter()); }
internal void WriteDepth(object value, int?maxDepth, Action <ClickContext> onClick) { if (!(((this._data.Length <= 0xf4240) || (this._writes <= 100)) ? (this._data.Length <= 0x4c4b40) : false)) { if (!this._limit) { this.Write("<limit of graph>"); } this._limit = true; } else if (value is string) { this.Write((string)value); } else { ObjectNode node = ObjectNode.Create(value, maxDepth, this.DCDriver); node.OnClick = onClick; if (node.HasTypeReferences) { this.HasTypeReferences = true; } Stopwatch stopwatch = Stopwatch.StartNew(); string str = this.Format(node); lock (this._locker) { this._formattingTime += stopwatch.Elapsed; if (this._buffer.Length > 0) { this._data.AppendLine(this.Format(ObjectNode.Create(this._buffer.ToString(), null, null))); this._buffer = new StringBuilder(); } this._data.AppendLine(str); this._bufferSnapshot = ""; this._writes++; } } }