public void SetUpData()
        {
            List <GUI_HackingOutputAndInput.PortData> portToSet = new List <GUI_HackingOutputAndInput.PortData>();

            foreach (var localPortData in hackProcess.PanelInputCurrentPorts)
            {
                var Port = new GUI_HackingOutputAndInput.PortData();
                Port.Colour.SetColour(localPortData.Colour);
                Port.ID = localPortData.LocalID;
                Port.IsInputInToPanel = true;
                portToSet.Add(Port);
            }

            Inputs.Replace(portToSet);
            portToSet = new List <GUI_HackingOutputAndInput.PortData>();

            foreach (var localPortData in hackProcess.PanelOutputCurrentPorts)
            {
                var Port = new GUI_HackingOutputAndInput.PortData();
                Port.Colour.SetColour(localPortData.Colour);
                Port.ID = localPortData.LocalID;
                Port.IsInputInToPanel = false;
                portToSet.Add(Port);
            }

            Outputs.Replace(portToSet);

            List <GUI_CablePanel.CableData> addElements = new List <GUI_CablePanel.CableData>();

            foreach (var cable in hackProcess.Cables)
            {
                GUI_CablePanel.CableData NetCable = new GUI_CablePanel.CableData();
                NetCable.CableNetuID = cable.cableCoil.GetComponent <NetworkIdentity>().netId;
                if (hackProcess.DictionaryCurrentPorts.ContainsKey(cable.PanelOutput))
                {
                    NetCable.IDConnectedFrom = hackProcess.DictionaryCurrentPorts[cable.PanelOutput].LocalID;
                }
                else
                {
                    Logger.LogError("Caught KeyNotFound Exception for hackProcess.DictionaryCurrentPorts[cable.PanelOutput] ln 76 GUI_Hacking.cs", Category.Interaction);
                    continue;
                }

                if (hackProcess.DictionaryCurrentPorts.ContainsKey(cable.PanelInput))
                {
                    NetCable.IDConnectedTo = hackProcess.DictionaryCurrentPorts[cable.PanelInput].LocalID;
                }
                else
                {
                    Logger.LogError("Caught KeyNotFound Exception for hackProcess.DictionaryCurrentPorts[cable.PanelOutput] ln 86 GUI_Hacking.cs", Category.Interaction);
                    continue;
                }

                addElements.Add(NetCable);
            }

            GUI_CablePanel.Replace(addElements);
        }
Example #2
0
        public void SetUpData()
        {
            List <GUI_HackingOutputAndInput.PortData> portToSet = new List <GUI_HackingOutputAndInput.PortData>();

            foreach (var localPortData in hackProcess.PanelInputCurrentPorts)
            {
                var Port = new GUI_HackingOutputAndInput.PortData();
                Port.Colour.SetColour(localPortData.Colour);
                Port.ID = localPortData.LocalID;
                Port.IsInputInToPanel = true;
                portToSet.Add(Port);
            }

            Inputs.Replace(portToSet);
            portToSet = new List <GUI_HackingOutputAndInput.PortData>();

            foreach (var localPortData in hackProcess.PanelOutputCurrentPorts)
            {
                var Port = new GUI_HackingOutputAndInput.PortData();
                Port.Colour.SetColour(localPortData.Colour);
                Port.ID = localPortData.LocalID;
                Port.IsInputInToPanel = false;
                portToSet.Add(Port);
            }

            Outputs.Replace(portToSet);

            List <GUI_CablePanel.CableData> addElements = new List <GUI_CablePanel.CableData>();

            foreach (var cable in hackProcess.Cables)
            {
                GUI_CablePanel.CableData NetCable = new GUI_CablePanel.CableData();
                NetCable.CableNetuID     = cable.cableCoil.GetComponent <NetworkIdentity>().netId;
                NetCable.IDConnectedFrom = hackProcess.DictionaryCurrentPorts[cable.PanelOutput].LocalID;
                NetCable.IDConnectedTo   = hackProcess.DictionaryCurrentPorts[cable.PanelInput].LocalID;
                addElements.Add(NetCable);
            }

            GUI_CablePanel.Replace(addElements);
        }