private void CreateNode(Type type, UniqueIDCalculator content, Vector3 pos) { object o = ReflectionHelper.Asm.CreateInstance(type.FullName); if (o != null) { Runtime.DialogNode node = o as Runtime.DialogNode; if (node == null) { return; } node._name = type.Name; node._position = pos; node.SetID(content.GenerateID()); Runtime.NodeModifier.SetContent(node, content); _currentNode = node; } }
protected void DuplicateNode(NodeModifier targetNode) { NodeModifier node = ReflectionHelper.CreateInstance <NodeModifier>(targetNode.GetType().FullName); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(targetNode), node); node._position = new Vector2(node._position.x + 10, node._position.y + 10); if (targetNode.Parent != null) { NodeModifier.SetParent(node, targetNode.Parent); } else if (targetNode.Content != null) { NodeModifier.SetContent(node, targetNode.Content); } UniqueIDCalculator d = node.GetContent() as UniqueIDCalculator; node.SetID(d.GenerateID()); }