com.esotericsoftware.kryonet.EndPoint Java Examples

The following examples show how to use com.esotericsoftware.kryonet.EndPoint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Network.java    From rpc-bench with Apache License 2.0 5 votes vote down vote up
public static void register(final EndPoint endPoint) {
  final Kryo kryo = endPoint.getKryo();
  kryo.setReferences(false);
  kryo.register(Ping.class);
  kryo.register(Pong.class);
  kryo.register(Size.class);
  kryo.register(Price.class);
}
 
Example #2
Source File: Network.java    From kryonet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
static public void register (EndPoint endPoint) {
	Kryo kryo = endPoint.getKryo();
	kryo.register(Login.class);
	kryo.register(RegistrationRequired.class);
	kryo.register(Register.class);
	kryo.register(AddCharacter.class);
	kryo.register(UpdateCharacter.class);
	kryo.register(RemoveCharacter.class);
	kryo.register(Character.class);
	kryo.register(MoveCharacter.class);
}
 
Example #3
Source File: Network.java    From kryonet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
static public void register (EndPoint endPoint) {
	Kryo kryo = endPoint.getKryo();
	// This must be called in order to use ObjectSpaces.
	ObjectSpace.registerClasses(kryo);
	// The interfaces that will be used as remote objects must be registered.
	kryo.register(IPlayer.class);
	kryo.register(IChatFrame.class);
	// The classes of all method parameters and return values
	// for remote objects must also be registered.
	kryo.register(String[].class);
}
 
Example #4
Source File: Network.java    From kryonet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
static public void register (EndPoint endPoint) {
	Kryo kryo = endPoint.getKryo();
	kryo.register(RegisterName.class);
	kryo.register(String[].class);
	kryo.register(UpdateNames.class);
	kryo.register(ChatMessage.class);
}
 
Example #5
Source File: NetworkRegisterer.java    From killingspree with MIT License 4 votes vote down vote up
static public void register (EndPoint endPoint) {
    Registration registration;
    Kryo kryo = endPoint.getKryo();
    registration = kryo.register(ConnectMessage.class);
    registration.setInstantiator(new ObjectInstantiator<ConnectMessage>() {
        @Override
        public ConnectMessage newInstance() {
            return MessageObjectPool.instance.connectMessagePool.obtain();
        }
    });
    
    registration = kryo.register(ControlsMessage.class);
    registration.setInstantiator(new 
            ObjectInstantiator<ControlsMessage>() {
        
        @Override
        public ControlsMessage newInstance() {
            return MessageObjectPool.instance.controlsMessagePool.obtain();
        }
        
    });
    
    registration = kryo.register(EntityState.class);
    registration.setInstantiator(new 
            ObjectInstantiator<EntityState>() {
        
        @Override
        public EntityState newInstance() {
            return MessageObjectPool.instance.entityStatePool.obtain();
        }
        
    });
    
    registration = kryo.register(GameStateMessage.class);
    registration.setInstantiator(new 
            ObjectInstantiator<GameStateMessage>() {
        
        @Override
        public GameStateMessage newInstance() {
            return MessageObjectPool.instance.gameStateMessagePool.obtain();
        }
        
    });
    
    registration = kryo.register(AudioMessage.class);
    registration.setInstantiator(new 
            ObjectInstantiator<AudioMessage>() {
        
        @Override
        public AudioMessage newInstance() {
            return MessageObjectPool.instance.audioMessagePool.obtain();
        }
        
    });
    
    kryo.register(PlayerNamesMessage.class);
    kryo.register(ClientDetailsMessage.class);
    kryo.register(ServerStatusMessage.class);
    kryo.register(ServerStatusMessage.Status.class);
    kryo.register(ArrayList.class);
    kryo.register(Vector2.class);
    kryo.register(String.class);
    kryo.register(HashMap.class);
}