示例#1
0
        public virtual void CreateConnectors()
        {
            InputConnectors.Clear();
            OutputConnectors.Clear();
            var rect = OccupiedRect().ExpandedBy(1);

            foreach (var cell in rect.EdgeCells)
            {
                if (cell.x == rect.minX && cell.z == rect.minZ)
                {
                    continue;
                }

                if (cell.x == rect.minX && cell.z == rect.maxZ)
                {
                    continue;
                }

                if (cell.x == rect.maxX && cell.z == rect.minZ)
                {
                    continue;
                }

                if (cell.x == rect.maxX && cell.z == rect.maxZ)
                {
                    continue;
                }

                InputConnectors.Add(cell);
                OutputConnectors.Add(cell);
            }
        }
示例#2
0
        public override void CreateConnectors()
        {
            InputConnectors.Clear();
            OutputConnectors.Clear();

            InputConnectors.Add(Position + Rotation.FacingCell);
            OutputConnectors.Add(Position + Rotation.FacingCell);
        }
示例#3
0
 public NodeViewModel(ChatNode chatNode, Point?location)
 {
     ChatNode = chatNode;
     InputConnectors.Add(new ConnectorViewModel(""));
     if (location != null)
     {
         X = location.Value.X;
         Y = location.Value.Y;
     }
 }
示例#4
0
        public ModuleViewModel(Module m)
        {
            Module = m;
            var instance = m.Launch(false);

            InputConnectors.AddRange(instance.ReceiverContract?.Entries.Select(e => new EntryViewModel(e)) ?? new EntryViewModel[] { });
            OutputConnectors.AddRange(instance.MessageContract?.Entries.Select(e => new EntryViewModel(e)) ?? new EntryViewModel[] { });

            //m.Kill(instance);
            //wasteful, i know, but we'll figure out a better solution later
        }
 private void ExecuteGate()
 {
     InternalConnectors.Clear();
     foreach (var r in SelectedGate.Execute(InputConnectors.Select(i => (i.Key, i.Value)).ToArray()))
     {
         if (OutputConnectors.ContainsKey(r.Key))
         {
             OutputConnectors[r.Key] = r.Value;
         }
         else if (!InputConnectors.ContainsKey(r.Key))
         {
             InternalConnectors[r.Key] = r.Value;
         }
     }
     ResetDataContext();
 }
示例#6
0
        public NodeViewModel(ChatNode chatNode, Point?location)
        {
            ChatNode = chatNode;

            ChatNode.PropertyChanged -= ChatNode_PropertyChanged;
            ChatNode.PropertyChanged += ChatNode_PropertyChanged;

            ChatNode.Buttons.CollectionChanged -= Buttons_CollectionChanged;
            ChatNode.Buttons.CollectionChanged += Buttons_CollectionChanged;

            InputConnectors.Add(new ConnectorViewModel(""));
            InvalidateNode();
            if (location != null)
            {
                X = location.Value.X;
                Y = location.Value.Y;
            }
        }
示例#7
0
        protected void AddInputConnector(string name, Color color)
        {
            var inputConnector = new InputConnectorViewModel(this, name, color);

            InputConnectors.Add(inputConnector);
        }