コード例 #1
0
        public override bool AddAdjacent(Side side, Node node)
        {
            bool added = false;

            if (Adjacents[side] == null)
            {
                added           = true;
                Adjacents[side] = node;
                node.AddAdjacent(Sides.GetInverse(side), this);
                if (node is ContainerNode)
                {
                    AddConnectedContainer(node);
                }
            }
            else if (Adjacents[side] != null &&
                     Adjacents[side].Adjacents[Sides.GetInverse(side)] != null &&
                     Adjacents[side].Adjacents[Sides.GetInverse(side)].ParentNetwork != null &&
                     Adjacents[side].ParentNetwork != null &&
                     Adjacents[side].Adjacents[Sides.GetInverse(side)].ParentNetwork != Adjacents[side].ParentNetwork)
            {
                //Printer.Info($"ADDING ADJ adj: {Adjacents[side].Adjacents[Sides.GetInverse(side)].Print()} of {Adjacents[side].Print()}");
                //Printer.Info($"in wrong network of {Adjacents[side].Print()}");

                added = true;
                Adjacents[side].Adjacents[Sides.GetInverse(side)] = this;
                //Printer.Info($"ADDING ADJ adj: {Adjacents[side].Adjacents[Sides.GetInverse(side)].Print()} of {Adjacents[side].Print()}");
            }
            return(added);
        }
コード例 #2
0
ファイル: Node.cs プロジェクト: Pathoschild/smapi-mod-dump
        public virtual bool AddAdjacent(Side side, Node node)
        {
            //Printer.Info($"ADDING ADJ: {node.Print()} to {Print()}");
            bool added = false;

            if (Adjacents[side] == null)
            {
                added           = true;
                Adjacents[side] = node;
                node.AddAdjacent(Sides.GetInverse(side), this);
            }
            else if (Adjacents[side] != null &&
                     Adjacents[side].Adjacents[Sides.GetInverse(side)] != null &&
                     Adjacents[side].Adjacents[Sides.GetInverse(side)].ParentNetwork != null &&
                     Adjacents[side].ParentNetwork != null &&
                     Adjacents[side].Adjacents[Sides.GetInverse(side)].ParentNetwork != Adjacents[side].ParentNetwork)
            {
                //Printer.Info($"ADDING ADJ adj: {Adjacents[side].Adjacents[Sides.GetInverse(side)].Print()} of {Adjacents[side].Print()}");
                //Printer.Info($"in wrong network of {Adjacents[side].Print()}");

                added = true;
                Adjacents[side].Adjacents[Sides.GetInverse(side)] = this;
                //Printer.Info($"ADDING ADJ adj: {Adjacents[side].Adjacents[Sides.GetInverse(side)].Print()} of {Adjacents[side].Print()}");
            }
            return(added);
        }
コード例 #3
0
        public override bool AddAdjacent(Side side, Node node)
        {
            //Printer.Info($"ADDING ADJ: {node.Print()} to {Print()}");
            //Printer.Info($"IS SIDE NULL?" + (Adjacents[side] == null).ToString());
            if (Adjacents[side] != null)
            {
                //Printer.Info($"SIDE: {side.Name} is {Adjacents[side].Print()}");
            }
            bool added = false;

            if (Adjacents[side] == null)
            {
                if (!(node is ConnectorPipeNode) || (node is ConnectorPipeNode && node.GetType().Equals(this.GetType())))
                {
                    added           = true;
                    Adjacents[side] = node;
                    node.AddAdjacent(Sides.GetInverse(side), this);
                }
            }
            else if (Adjacents[side] != null &&
                     Adjacents[side].Adjacents[Sides.GetInverse(side)] != null &&
                     Adjacents[side].Adjacents[Sides.GetInverse(side)].ParentNetwork != null &&
                     Adjacents[side].ParentNetwork != null &&
                     Adjacents[side].Adjacents[Sides.GetInverse(side)].ParentNetwork != Adjacents[side].ParentNetwork)
            {
                //Printer.Info($"ADDING ADJ adj: {Adjacents[side].Adjacents[Sides.GetInverse(side)].Print()} of {Adjacents[side].Print()}");
                //Printer.Info($"in wrong network of {Adjacents[side].Print()}");

                added = true;
                Adjacents[side].Adjacents[Sides.GetInverse(side)] = this;
                //Printer.Info($"ADDING ADJ adj: {Adjacents[side].Adjacents[Sides.GetInverse(side)].Print()} of {Adjacents[side].Print()}");
            }
            return(added);
        }
コード例 #4
0
ファイル: Node.cs プロジェクト: Pathoschild/smapi-mod-dump
        public virtual bool RemoveAdjacent(Side side, Node node)
        {
            //Printer.Info($"removing ADJ: {node.Print()} from {Print()}");
            bool removed = false;

            if (Adjacents[side] != null)
            {
                removed         = true;
                Adjacents[side] = null;
                node.RemoveAdjacent(Sides.GetInverse(side), this);
            }
            return(removed);
        }
コード例 #5
0
        public override bool RemoveAdjacent(Side side, Node node)
        {
            //Printer.Info($"removing ADJ: {node.Print()} from {Print()}");

            bool removed = false;

            if (Adjacents[side] != null)
            {
                removed         = true;
                Adjacents[side] = null;
                node.RemoveAdjacent(Sides.GetInverse(side), this);
                if (node is ContainerNode)
                {
                    RemoveConnectedContainer(node);
                }
            }
            return(removed);
        }
コード例 #6
0
        public override bool AddAdjacent(Side side, Node node)
        {
            bool added = false;

            if (Adjacents[side] == null)
            {
                added           = true;
                Adjacents[side] = node;
                node.AddAdjacent(Sides.GetInverse(side), this);
                if (node is PipeNode && node.ParentNetwork != null)
                {
                    PipeNode pipeNode = (PipeNode)node;
                    AdjNetworks.Add(pipeNode.ParentNetwork);
                    pipeNode.ParentNetwork.AddNode(this);
                }
            }
            return(added);
        }
コード例 #7
0
        public override bool AddAdjacent(Side side, Node node)
        {
            //Printer.Info($"ADDING ADJ: {node.Print()} to {Print()}");

            bool added = false;

            if (Adjacents[side] == null)
            {
                added           = true;
                Adjacents[side] = node;
                node.AddAdjacent(Sides.GetInverse(side), this);
                if (node is IOPipeNode)
                {
                    IOPipeNode iOPipeNode = (IOPipeNode)node;
                    iOPipeNode.AddConnectedContainer(this);
                }
            }
            return(added);
        }
コード例 #8
0
        public override bool RemoveAdjacent(Side side, Node node)
        {
            bool removed = false;

            if (Adjacents[side] != null)
            {
                removed         = true;
                Adjacents[side] = null;
                node.RemoveAdjacent(Sides.GetInverse(side), this);
                if (node != null && node is PipeNode)
                {
                    PipeNode pipeNode = (PipeNode)node;
                    AdjNetworks.Remove(pipeNode.ParentNetwork);
                    if (pipeNode.ParentNetwork != null)
                    {
                        pipeNode.ParentNetwork.RemoveNode(this);
                    }
                }
            }
            return(removed);
        }