Пример #1
0
 public void ProcessPacket(DysonSphereRemoveNodePacket packet, NebulaConnection conn)
 {
     Log.Info($"Processing DysonSphere Remove Node notification for system {GameMain.data.galaxy.stars[packet.StarIndex].name} (Index: {GameMain.data.galaxy.stars[packet.StarIndex].index})");
     using (DysonSphere_Manager.IncomingDysonSpherePacket.On())
     {
         DysonSphereLayer dsl = GameMain.data.dysonSpheres[packet.StarIndex]?.GetLayer(packet.LayerId);
         if (dsl != null)
         {
             int       num       = 0;
             DysonNode dysonNode = dsl.nodePool[packet.NodeId];
             //Remove all frames that are part of the node
             while (dysonNode.frames.Count > 0)
             {
                 dsl.RemoveDysonFrame(dysonNode.frames[0].id);
                 if (num++ > 4096)
                 {
                     Assert.CannotBeReached();
                     break;
                 }
             }
             //Remove all shells that are part of the node
             while (dysonNode.shells.Count > 0)
             {
                 dsl.RemoveDysonShell(dysonNode.shells[0].id);
                 if (num++ > 4096)
                 {
                     Assert.CannotBeReached();
                     break;
                 }
             }
             dsl.RemoveDysonNode(packet.NodeId);
         }
     }
 }
        public override void ProcessPacket(DysonSphereRemoveFramePacket packet, NebulaConnection conn)
        {
            DysonSphereLayer layer = GameMain.data.dysonSpheres[packet.StarIndex]?.GetLayer(packet.LayerId);

            if (layer == null)
            {
                return;
            }
            using (Multiplayer.Session.DysonSpheres.IsIncomingRequest.On())
            {
                if (!Check(layer, packet))
                {
                    Log.Warn($"Cannnot remove frame[{packet.FrameId}] on layer[{layer.id}], starIndex[{packet.StarIndex}]");
                    Multiplayer.Session.DysonSpheres.HandleDesync(packet.StarIndex, conn);
                    return;
                }
                //No need to remove if the frame is already null
                if (layer.framePool[packet.FrameId] != null)
                {
                    layer.RemoveDysonFrame(packet.FrameId);
                    NebulaWorld.Universe.DysonSphereManager.ClearSelection(packet.StarIndex, layer.id);
                }
            }
            if (IsHost)
            {
                Multiplayer.Session.DysonSpheres.SendPacketToDysonSphereExcept(packet, packet.StarIndex, conn);
            }
        }
Пример #3
0
 public void ProcessPacket(DysonSphereRemoveFramePacket packet, NebulaConnection conn)
 {
     using (DysonSphere_Manager.IncomingDysonSpherePacket.On())
     {
         DysonSphereLayer dsl = GameMain.data.dysonSpheres[packet.StarIndex]?.GetLayer(packet.LayerId);
         if (DysonSphere_Manager.CanRemoveFrame(packet.FrameId, dsl))
         {
             dsl.RemoveDysonFrame(packet.FrameId);
         }
     }
 }
Пример #4
0
 public void ProcessPacket(DysonSphereRemoveFramePacket packet, NebulaConnection conn)
 {
     Log.Info($"Processing DysonSphere Remove Frame notification for system {GameMain.data.galaxy.stars[packet.StarIndex].name} (Index: {GameMain.data.galaxy.stars[packet.StarIndex].index})");
     using (DysonSphere_Manager.IncomingDysonSpherePacket.On())
     {
         DysonSphereLayer dsl = GameMain.data.dysonSpheres[packet.StarIndex]?.GetLayer(packet.LayerId);
         if (DysonSphere_Manager.CanRemoveFrame(packet.FrameId, dsl))
         {
             dsl.RemoveDysonFrame(packet.FrameId);
         }
     }
 }
        public override void ProcessPacket(DysonSphereRemoveNodePacket packet, NebulaConnection conn)
        {
            bool valid = true;

            if (IsHost)
            {
                Player player = playerManager.GetPlayer(conn);
                if (player != null)
                {
                    playerManager.SendPacketToOtherPlayers(packet, player);
                }
                else
                {
                    valid = false;
                }
            }

            if (valid)
            {
                using (DysonSphereManager.IsIncomingRequest.On())
                {
                    DysonSphereLayer dsl = GameMain.data.dysonSpheres[packet.StarIndex]?.GetLayer(packet.LayerId);
                    if (dsl != null)
                    {
                        int       num       = 0;
                        DysonNode dysonNode = dsl.nodePool[packet.NodeId];
                        //Remove all frames that are part of the node
                        while (dysonNode.frames.Count > 0)
                        {
                            dsl.RemoveDysonFrame(dysonNode.frames[0].id);
                            if (num++ > 4096)
                            {
                                Assert.CannotBeReached();
                                break;
                            }
                        }
                        //Remove all shells that are part of the node
                        while (dysonNode.shells.Count > 0)
                        {
                            dsl.RemoveDysonShell(dysonNode.shells[0].id);
                            if (num++ > 4096)
                            {
                                Assert.CannotBeReached();
                                break;
                            }
                        }
                        dsl.RemoveDysonNode(packet.NodeId);
                    }
                }
            }
        }
Пример #6
0
        public void ProcessPacket(DysonSphereRemoveFramePacket packet, NebulaConnection conn)
        {
            Log.Info($"Processing DysonSphere Remove Frame notification for system {GameMain.data.galaxy.stars[packet.StarIndex].name} (Index: {GameMain.data.galaxy.stars[packet.StarIndex].index})");
            Player player = playerManager.GetPlayer(conn);

            if (player != null)
            {
                playerManager.SendPacketToOtherPlayers(packet, player);
                DysonSphere_Manager.IncomingDysonSpherePacket = true;
                DysonSphereLayer dsl = GameMain.data.dysonSpheres[packet.StarIndex]?.GetLayer(packet.LayerId);
                if (DysonSphere_Manager.CanRemoveFrame(packet.FrameId, dsl))
                {
                    dsl.RemoveDysonFrame(packet.FrameId);
                }
                DysonSphere_Manager.IncomingDysonSpherePacket = false;
            }
        }
        public void ProcessPacket(DysonSphereRemoveFramePacket packet, NebulaConnection conn)
        {
            Player player = playerManager.GetPlayer(conn);

            if (player != null)
            {
                playerManager.SendPacketToOtherPlayers(packet, player);
                using (DysonSphere_Manager.IncomingDysonSpherePacket.On())
                {
                    DysonSphereLayer dsl = GameMain.data.dysonSpheres[packet.StarIndex]?.GetLayer(packet.LayerId);
                    if (DysonSphere_Manager.CanRemoveFrame(packet.FrameId, dsl))
                    {
                        dsl.RemoveDysonFrame(packet.FrameId);
                    }
                }
            }
        }
        public override void ProcessPacket(DysonSphereRemoveFramePacket packet, NebulaConnection conn)
        {
            bool valid = true;
            if (IsHost)
            {
                Player player = playerManager.GetPlayer(conn);
                if (player != null)
                    playerManager.SendPacketToOtherPlayers(packet, player);
                else
                    valid = false;
            }

            if (valid)
            {
                using (DysonSphereManager.IsIncomingRequest.On())
                {
                    DysonSphereLayer dsl = GameMain.data.dysonSpheres[packet.StarIndex]?.GetLayer(packet.LayerId);
                    if (DysonSphereManager.CanRemoveFrame(packet.FrameId, dsl))
                    {
                        dsl.RemoveDysonFrame(packet.FrameId);
                    }
                }
            }
        }