Пример #1
0
            public static bool Prefix(ElectricalUtilityNetwork __instance, List <Wire> ___allWires, UtilityNetworkGridNode[] grid, float ___timeOverloaded, List <Wire>[] ___wireGroups)
            {
                for (int i = 0; i < ___wireGroups.Length; i++)
                {
                    List <Wire> wires = ___wireGroups[i];
                    if (wires == null)
                    {
                        continue;
                    }
                    for (int j = 0; j < wires.Count; j++)
                    {
                        Wire wire = wires[j];
                        if (wire != null)
                        {
                            wire.circuitOverloadTime = ___timeOverloaded;
                            int cell = Grid.PosToCell(wire.transform.GetPosition());
                            UtilityNetworkGridNode utilityNetworkGridNode = grid[cell];
                            utilityNetworkGridNode.networkIdx = -1;
                            grid[cell] = utilityNetworkGridNode;
                        }
                    }
                    wires.Clear();
                }

                ___allWires.Clear();
                Traverse.Create(__instance).Method("RemoveOverloadedNotification").GetValue();

                return(false);
            }
 public override void Reset(UtilityNetworkGridNode[] grid)
 {
     for (int i = 0; i < sinks.Count; i++)
     {
         IItem item = sinks[i];
         item.Network = null;
         UtilityNetworkGridNode utilityNetworkGridNode = grid[item.Cell];
         utilityNetworkGridNode.networkIdx = -1;
         grid[item.Cell] = utilityNetworkGridNode;
     }
     for (int j = 0; j < sources.Count; j++)
     {
         IItem item2 = sources[j];
         item2.Network = null;
         UtilityNetworkGridNode utilityNetworkGridNode2 = grid[item2.Cell];
         utilityNetworkGridNode2.networkIdx = -1;
         grid[item2.Cell] = utilityNetworkGridNode2;
     }
     for (int k = 0; k < conduits.Count; k++)
     {
         IItem item3 = conduits[k];
         item3.Network = null;
         UtilityNetworkGridNode utilityNetworkGridNode3 = grid[item3.Cell];
         utilityNetworkGridNode3.networkIdx = -1;
         grid[item3.Cell] = utilityNetworkGridNode3;
     }
 }
 public override void Reset(UtilityNetworkGridNode[] grid)
 {
     resetting     = true;
     previousValue = -1;
     outputValue   = 0;
     for (int i = 0; i < wires.Count; i++)
     {
         LogicWire logicWire = wires[i];
         if ((Object)logicWire != (Object)null)
         {
             int num = Grid.PosToCell(logicWire.transform.GetPosition());
             UtilityNetworkGridNode utilityNetworkGridNode = grid[num];
             utilityNetworkGridNode.networkIdx = -1;
             grid[num] = utilityNetworkGridNode;
         }
     }
     wires.Clear();
     senders.Clear();
     receivers.Clear();
     resetting = false;
 }
 public override void Reset(UtilityNetworkGridNode[] grid)
 {
     for (int i = 0; i < 5; i++)
     {
         List <Wire> list = wireGroups[i];
         if (list != null)
         {
             for (int j = 0; j < list.Count; j++)
             {
                 Wire wire = list[j];
                 if ((Object)wire != (Object)null)
                 {
                     wire.circuitOverloadTime = timeOverloaded;
                     int num = Grid.PosToCell(wire.transform.GetPosition());
                     UtilityNetworkGridNode utilityNetworkGridNode = grid[num];
                     utilityNetworkGridNode.networkIdx = -1;
                     grid[num] = utilityNetworkGridNode;
                 }
             }
             list.Clear();
         }
     }
     RemoveOverloadedNotification();
 }