Exemplo n.º 1
0
        ///////////////////////////////////////////

        public EntitySystemServerNetworkService(
            UserManagementServerNetworkService userManagementService)
            : base("EntitySystem", 4)
        {
            this.userManagementService = userManagementService;

            //register message types
            for (int n = 0; n < 6; n++)
            {
                entitySystemInternalMessageTypes[n] = RegisterMessageType(
                    string.Format("entitySystemInternal{0}", n), (byte)(n + 1),
                    ReceiveMessage_EntitySystemInternal);
            }
            RegisterMessageType("worldCreateBeginToClient", 7);
            RegisterMessageType("worldCreateEndToClient", 8);

            networkingInterface = new ServerEntitySystemNetworkingInterface(this);

            userManagementService.AddUserEvent    += UserManagementService_AddUserEvent;
            userManagementService.RemoveUserEvent += UserManagementService_RemoveUserEvent;
        }
Exemplo n.º 2
0
        protected override void Dispose()
        {
            if (EntitySystemWorld.Instance != null && networkingInterface != null)
            {
                while (clientRemoteEntityWorlds.Count != 0)
                {
                    ClientRemoteEntityWorld remoteEntityWorld = clientRemoteEntityWorlds[0];

                    networkingInterface.DisconnectRemoteEntityWorld(remoteEntityWorld);
                    clientRemoteEntityWorlds.Remove(remoteEntityWorld);
                }
            }

            if (userManagementService != null)
            {
                userManagementService.AddUserEvent    -= UserManagementService_AddUserEvent;
                userManagementService.RemoveUserEvent -= UserManagementService_RemoveUserEvent;
            }

            networkingInterface = null;

            base.Dispose();
        }
        protected override void Dispose()
        {
            if( EntitySystemWorld.Instance != null && networkingInterface != null )
            {
                while( clientRemoteEntityWorlds.Count != 0 )
                {
                    ClientRemoteEntityWorld remoteEntityWorld = clientRemoteEntityWorlds[ 0 ];

                    networkingInterface.DisconnectRemoteEntityWorld( remoteEntityWorld );
                    clientRemoteEntityWorlds.Remove( remoteEntityWorld );
                }
            }

            if( userManagementService != null )
            {
                userManagementService.AddUserEvent -= UserManagementService_AddUserEvent;
                userManagementService.RemoveUserEvent -= UserManagementService_RemoveUserEvent;
            }

            networkingInterface = null;

            base.Dispose();
        }
        ///////////////////////////////////////////
        public EntitySystemServerNetworkService(
			UserManagementServerNetworkService userManagementService )
            : base("EntitySystem", 4)
        {
            this.userManagementService = userManagementService;

            //register message types
            for( int n = 0; n < 6; n++ )
            {
                entitySystemInternalMessageTypes[ n ] = RegisterMessageType(
                    string.Format( "entitySystemInternal{0}", n ), (byte)( n + 1 ),
                    ReceiveMessage_EntitySystemInternal );
            }
            RegisterMessageType( "worldCreateBeginToClient", 7 );
            RegisterMessageType( "worldCreateEndToClient", 8 );

            networkingInterface = new ServerEntitySystemNetworkingInterface( this );

            userManagementService.AddUserEvent += UserManagementService_AddUserEvent;
            userManagementService.RemoveUserEvent += UserManagementService_RemoveUserEvent;
        }