//

		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);
            }
        }
        //

        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);
            }
        }
示例#3
0
文件: ServerForm.cs 项目: whztt07/SDK
        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 );
        }
 private 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));
 }