Inheritance: ServerNetworkService
        //
        public GameNetworkServer( string serverName, string serverVersion, int maxConnections,
            bool entitySystemServiceEnabled)
            : base(serverName, serverVersion, maxConnections)
        {
            if( instance != null )
                Log.Fatal( "GameNetworkServer.GameNetworkServer: instance != null." );
            instance = this;

            //register network services

            //register user management service
            userManagementService = new UserManagementServerNetworkService();
            RegisterService( userManagementService );

            //register custom messages service
            customMessagesService = new CustomMessagesServerNetworkService();
            RegisterService( customMessagesService );

            //register chat service
            chatService = new ChatServerNetworkService( userManagementService );
            RegisterService( chatService );

            //register entity system service
            if( entitySystemServiceEnabled )
            {
                entitySystemService = new EntitySystemServerNetworkService( userManagementService );
                RegisterService( entitySystemService );
            }
        }
Exemplo n.º 2
0
        //

        public GameNetworkServer(string serverName, string serverVersion, int maxConnections,
                                 bool entitySystemServiceEnabled)
            : base(serverName, serverVersion, maxConnections)
        {
            if (instance != null)
            {
                Log.Fatal("GameNetworkServer.GameNetworkServer: instance != null.");
            }
            instance = this;

            //register network services

            //register user management service
            userManagementService = new UserManagementServerNetworkService();
            RegisterService(userManagementService);

            //register custom messages service
            customMessagesService = new CustomMessagesServerNetworkService();
            RegisterService(customMessagesService);

            //register chat service
            chatService = new ChatServerNetworkService(userManagementService);
            RegisterService(chatService);

            //register entity system service
            if (entitySystemServiceEnabled)
            {
                entitySystemService = new EntitySystemServerNetworkService(userManagementService);
                RegisterService(entitySystemService);
            }
        }
Exemplo n.º 3
0
 void ChatService_ReceiveText( ChatServerNetworkService sender,
     UserManagementServerNetworkService.UserInfo fromUser,
     string text, UserManagementServerNetworkService.UserInfo privateToUser)
 {
     string userName = fromUser != null ? fromUser.Name : "(null)";
     string toUserName = privateToUser != null ? privateToUser.Name : "All";
     Log( "Chat: {0} -> {1}: {2}", userName, toUserName, text );
 }
Exemplo n.º 4
0
 void Server_ChatService_ReceiveText( ChatServerNetworkService sender,
     UserManagementServerNetworkService.UserInfo fromUser, string text,
     UserManagementServerNetworkService.UserInfo privateToUser)
 {
     string userName = fromUser != null ? fromUser.Name : "(null)";
     AddScreenMessage( string.Format( "{0}: {1}", userName, text ) );
 }