@ -39,6 +39,8 @@ import com.jme3.network.message.SerializerRegistrationsMessage;
import com.jme3.network.serializing.Serializer ;
import com.jme3.network.serializing.Serializer ;
import com.jme3.network.service.AbstractClientService ;
import com.jme3.network.service.AbstractClientService ;
import com.jme3.network.service.ClientServiceManager ;
import com.jme3.network.service.ClientServiceManager ;
import java.util.logging.Level ;
import java.util.logging.Logger ;
/ * *
/ * *
@ -48,14 +50,21 @@ import com.jme3.network.service.ClientServiceManager;
* /
* /
public class ClientSerializerRegistrationsService extends AbstractClientService
public class ClientSerializerRegistrationsService extends AbstractClientService
implements MessageListener < Client > {
implements MessageListener < Client > {
static final Logger log = Logger . getLogger ( SerializerRegistrationsMessage . class . getName ( ) ) ;
@Override
@Override
protected void onInitialize ( ClientServiceManager serviceManager ) {
protected void onInitialize ( ClientServiceManager serviceManager ) {
// Make sure our message type is registered
// This is the minimum we'd need just to be able to register
// Make sure our message type is registered if it isn't already
// the rest... otherwise we can't even receive this message.
if ( Serializer . getSerializer ( SerializerRegistrationsMessage . class , false ) = = null ) {
Serializer . registerClass ( SerializerRegistrationsMessage . class ) ;
// This is the minimum we'd need just to be able to register
Serializer . registerClass ( SerializerRegistrationsMessage . Registration . class ) ;
// the rest... otherwise we can't even receive this message.
Serializer . registerClass ( SerializerRegistrationsMessage . class ) ;
Serializer . registerClass ( SerializerRegistrationsMessage . Registration . class ) ;
} else {
log . log ( Level . INFO , "Skipping registration of SerializerRegistrationsMessage." ) ;
}
// Add our listener for that message type
// Add our listener for that message type
serviceManager . getClient ( ) . addMessageListener ( this , SerializerRegistrationsMessage . class ) ;
serviceManager . getClient ( ) . addMessageListener ( this , SerializerRegistrationsMessage . class ) ;