示例#1
0
        public void SetStartUINode(GUI_HackingPort startNode)
        {
            this.startNode = startNode;
            RectTransform nodeRectTransform      = startNode.GetComponent <RectTransform>();
            RectTransform wireStartRectTransform = wireStart.GetComponent <RectTransform>();

            wireStartRectTransform.position = nodeRectTransform.position;
            PositionWireBody();
        }
        public void SetPortSelected(GUI_HackingPort inSelectedHackingPort)
        {
            if (SelectedHackingPort != null)
            {
                SelectedHackingPort.UnSelect(false);
            }

            SelectedHackingPort = inSelectedHackingPort;
            GUI_Hacking.GUI_CablePanel.CheckSelected();
        }
示例#3
0
        public void SetEndUINode(GUI_HackingPort endNode)
        {
            if (endNode == null)
            {
                return;
            }

            this.endNode = endNode;
            RectTransform nodeRectTransform    = endNode.GetComponent <RectTransform>();
            RectTransform wireEndRectTransform = wireEnd.GetComponent <RectTransform>();

            wireEndRectTransform.position = nodeRectTransform.position;
            PositionWireBody();
        }
        public override void ElementsChanged(List <PortData> NewList, List <PortData> OldList)
        {
            List <PortData> remove = new List <PortData>();
            List <PortData> add    = new List <PortData>();

            foreach (var newOne in NewList)
            {
                bool Has = false;
                foreach (var Oldone in OldList)
                {
                    if (newOne.ID == Oldone.ID)
                    {
                        Has = true;
                    }
                }

                if (Has == false)
                {
                    add.Add(newOne);
                }
            }

            foreach (var oldOne in OldList)
            {
                bool Has = false;
                foreach (var Newone in NewList)
                {
                    if (Newone.ID == oldOne.ID)
                    {
                        Has = true;
                    }
                }

                if (Has == false)
                {
                    remove.Add(oldOne);
                }
            }


            foreach (var PD in add)
            {
                var Port = Instantiate(Prefab, parent.transform);
                Port.SetUp(PD, this);
                OpenPorts.Add(Port);
                IDtoPort[Port.PortData.ID] = Port;
            }

            foreach (var PD in remove)
            {
                GUI_HackingPort GUIHackingPort = null;
                foreach (var GUI in OpenPorts)
                {
                    if (GUI.PortData.ID == PD.ID)
                    {
                        GUIHackingPort = GUI;
                        break;
                    }
                }

                OpenPorts.Remove(GUIHackingPort);
                IDtoPort.Remove(GUIHackingPort.PortData.ID);
                Destroy(GUIHackingPort.gameObject);
            }
        }