/////////////////////////////////////////// public GameNetworkClient(bool entitySystemServiceEnabled) { if (instance != null) { Log.Fatal("GameNetworkClient.GameNetworkClient: instance != null."); } instance = this; //register network services //register user management service userManagementService = new UserManagementClientNetworkService(); RegisterService(userManagementService); //register custom messages service customMessagesService = new CustomMessagesClientNetworkService(); RegisterService(customMessagesService); //register chat service chatService = new ChatClientNetworkService(userManagementService); RegisterService(chatService); //register entity system service if (entitySystemServiceEnabled) { entitySystemService = new EntitySystemClientNetworkService(userManagementService); RegisterService(entitySystemService); } }
/////////////////////////////////////////// public GameNetworkClient( bool entitySystemServiceEnabled ) { if( instance != null ) Log.Fatal( "GameNetworkClient.GameNetworkClient: instance != null." ); instance = this; //register network services //register user management service userManagementService = new UserManagementClientNetworkService(); RegisterService( userManagementService ); //register custom messages service customMessagesService = new CustomMessagesClientNetworkService(); RegisterService( customMessagesService ); //register chat service chatService = new ChatClientNetworkService( userManagementService ); RegisterService( chatService ); //register entity system service if( entitySystemServiceEnabled ) { entitySystemService = new EntitySystemClientNetworkService( userManagementService ); RegisterService( entitySystemService ); } }
public void SayPrivate( string text, UserManagementClientNetworkService.UserInfo toUser ) { MessageType messageType = GetMessageType( "textToServer" ); SendDataWriter writer = BeginMessage( messageType ); writer.Write( text ); writer.WriteVariableUInt32( toUser.Identifier ); EndMessage(); }
/////////////////////////////////////////// public ChatClientNetworkService( UserManagementClientNetworkService userManagementService ) : base("Chat", 3) { this.userManagementService = userManagementService; //register message types RegisterMessageType( "textToServer", 1 ); RegisterMessageType( "textToClient", 2, ReceiveMessage_TextToClient ); }
/////////////////////////////////////////// public ChatClientNetworkService(UserManagementClientNetworkService userManagementService) : base("Chat", 3) { this.userManagementService = userManagementService; //register message types RegisterMessageType("textToServer", 1); RegisterMessageType("textToClient", 2, ReceiveMessage_TextToClient); }
/////////////////////////////////////////// public EntitySystemClientNetworkService( UserManagementClientNetworkService 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, ReceiveMessage_WorldCreateBeginToClient ); RegisterMessageType( "worldCreateEndToClient", 8, ReceiveMessage_WorldCreateEndToClient ); networkingInterface = new ClientEntitySystemNetworkingInterface( this ); }
/////////////////////////////////////////// public EntitySystemClientNetworkService(UserManagementClientNetworkService 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, ReceiveMessage_WorldCreateBeginToClient); RegisterMessageType("worldCreateEndToClient", 8, ReceiveMessage_WorldCreateEndToClient); networkingInterface = new ClientEntitySystemNetworkingInterface(this); }
void Client_ChatService_ReceiveText( ChatClientNetworkService sender, UserManagementClientNetworkService.UserInfo fromUser, string text) { string userName = fromUser != null ? fromUser.Name : "(null)"; AddScreenMessage( string.Format( "{0}: {1}", userName, text ) ); }
void Client_ChatService_ReceiveText( ChatClientNetworkService sender, UserManagementClientNetworkService.UserInfo fromUser, string text) { }
void ChatService_ReceiveText( ChatClientNetworkService sender, UserManagementClientNetworkService.UserInfo fromUser, string text ) { string userName = fromUser != null ? fromUser.Name : "(null)"; Log( "{0}: {1}", userName, text ); }
void UserManagementService_RemoveUserEvent( UserManagementClientNetworkService sender, UserManagementClientNetworkService.UserInfo user ) { listBoxUsers.Items.Remove( user ); }
public Client_Player( uint identifier, string name, bool bot, UserManagementClientNetworkService.UserInfo user ) { this.identifier = identifier; this.name = name; this.bot = bot; this.user = user; this.team = PlayerTeam.SpectatorPlayer; // Team default = 0 (spectator) }
public Client_Player Client_GetPlayer( UserManagementClientNetworkService.UserInfo user ) { //slowly. need Dictionary. foreach( Client_Player player in client_players ) { if( player.User == user ) return player; } return null; }
public Client_Player( uint identifier, string name, bool bot, UserManagementClientNetworkService.UserInfo user) { this.identifier = identifier; this.name = name; this.bot = bot; this.user = user; }