示例#1
0
 /// <inheritdoc />
 public object Clone()
 {
     return(new MarkCollection()
     {
         ShowMarkBar = ShowMarkBar,
         ShowGridLines = ShowGridLines,
         Level = Level,
         Name = Name,
         _marks = new ObservableCollection <IMark>(Marks.Select(x => (IMark)x.Clone())),
         Decorator = (MarkDecorator)Decorator.Clone(),
         CollectionType = CollectionType
     });
 }
示例#2
0
 private void ApplyDecoratorToObject(Decorator decorator, GraphElement element)
 {
     if (decorator is null)
     {
         GraphEditManager.BeforePreformEdit(Graph, "Remove Decorator");
         element.Decorator = null;
         return;
     }
     if (decorator.IsDecorableFor(element))
     {
         GraphEditManager.BeforePreformEdit(Graph, "Apply Decorator");
         element.Decorator = decorator.Clone() as Decorator;
     }
 }
示例#3
0
        public EditorAINode LoadDecorator(Decorator node)
        {
            EditorAIDecoratorNode output = Node.Create(EditorAIDecoratorNode.ID, Vector3.zero) as EditorAIDecoratorNode;

            output.dataType = node.GetType().ToString();
            var clone = node.Clone() as Decorator;

            clone.subNode = null;
            output.data   = new GenericSerializable(output.dataType);
            output.data.SetObject(clone, nodeTypes);

            //load child
            EditorAINode child = LoadNode(node.subNode);

            //attach children
            child.Parent.ApplyConnection(output.child);

            return(output);
        }
示例#4
0
 internal bool CombineDecorators(Decorator decorator, GraphElement graphElement)
 {
     if (graphElement.Decorator == null || decorator == null)
     {
         return(false);
     }
     PuzzleGraph.Decorators.CombinedDecorator combinedDecorator = new PuzzleGraph.Decorators.CombinedDecorator();
     combinedDecorator.Second = decorator.Clone() as Decorator;
     combinedDecorator.First  = graphElement.Decorator.Clone() as Decorator;
     if (combinedDecorator.IsDecorableFor(graphElement))
     {
         GraphEditManager.BeforePreformEdit(Graph, "Combine Decorators");
         graphElement.Decorator = combinedDecorator;
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#5
0
 internal void ChooseSampleDecorator(Decorator decorator, bool alwaysImportTetris)
 {
     SelectedObjects.Clear();
     if (decorator is null)
     {
         SampleDecorator = null;
     }
     else
     {
         SampleDecorator = decorator.Clone() as Decorator;
         bool importTetris = alwaysImportTetris || TetrisTransferHelper.TetrisCompatible(Graph, decorator);
         if (importTetris)
         {
             TetrisIndexToTemplateView(SampleDecorator);
         }
         else
         {
             SelectedTetrisShapes = new bool[SelectedTetrisShapes.Length];
             TetrisTransferHelper.ClearTetrisIndex(SampleDecorator);
         }
     }
     PasteMode         = true;
     ColorPaintingMode = false;
 }