コード例 #1
0
        public void DestroySpawner(RegisteredSpawner spawner)
        {
            var peer = spawner.Peer;

            if (peer != null)
            {
                var peerRooms =
                    peer.GetProperty((int)MsfPropCodes.RegisteredSpawners) as Dictionary <int, RegisteredSpawner>;

                // Remove the spawner from peer
                if (peerRooms != null)
                {
                    peerRooms.Remove(spawner.SpawnerId);
                }
            }

            // Remove the spawner from all spawners
            Spawners.Remove(spawner.SpawnerId);

            // Invoke the event
            if (SpawnerDestroyed != null)
            {
                SpawnerDestroyed.Invoke(spawner);
            }
        }
コード例 #2
0
        public void DestroySpawner(RegisteredSpawner spawner)
        {
            var peer = spawner.Peer;

            if (peer != null && peer.GetProperty((int)PeerPropertyKeys.RegisteredSpawners) is Dictionary <int, RegisteredSpawner> peerRooms)
            {
                // Remove the spawner from peer
                peerRooms.Remove(spawner.SpawnerId);
            }

            // Remove the spawner from all spawners
            Spawners.Remove(spawner.SpawnerId);

            _logger.Info($"Spawner disconnected. ID: {spawner.SpawnerId}");
            // Invoke the event
            SpawnerDestroyed?.Invoke(spawner);
        }