public class EntityDataHostedService extends com.jme3.network.service.AbstractHostedService implements EntityHostSettings
It is up to the game server to periodically call sendUpdates() to flush any pending EntitySet changes to clients.
Constructor and Description |
---|
EntityDataHostedService(int channel,
com.simsilica.es.ObservableEntityData ed)
Creates a new EntityDataHostedService for the specified EntityData that will
communicate over the specified channel.
|
EntityDataHostedService(int channel,
com.simsilica.es.ObservableEntityData ed,
boolean autoHost)
Creates a new EntityDataHostedService for the specified EntityData that will
communicate over the specified channel and will automatically host for new connections
depending on the specified autoHost value.
|
Modifier and Type | Method and Description |
---|---|
void |
connectionAdded(com.jme3.network.Server server,
com.jme3.network.HostedConnection hc) |
void |
connectionRemoved(com.jme3.network.Server server,
com.jme3.network.HostedConnection hc) |
boolean |
getAutoHost() |
int |
getChannel() |
com.simsilica.es.EntityData |
getEntityData() |
HostedEntityData |
getHostedEntityData(com.jme3.network.HostedConnection hc)
Returns the HostedEntityData for the specified connection.
|
int |
getMaxChangeBatchSize() |
int |
getMaxEntityBatchSize() |
protected void |
onInitialize(com.jme3.network.service.HostedServiceManager services) |
void |
sendUpdates()
Must be called by the game server to send pending updates
to the relevant clients.
|
void |
setAutoHost(boolean b)
Set to true to have new connections automatically 'hosted'
by this entity service.
|
void |
setMaxChangeBatchSize(int i)
Sets the maximum number of EntityChanges that will be sent back
in a single batched results message.
|
void |
setMaxEntityBatchSize(int i)
Sets the maximum number of entities that will be sent back
in a single batched results message.
|
void |
start() |
void |
startHostingOnConnection(com.jme3.network.HostedConnection hc)
Sets up the specified connection for hosting remote
entity data commands.
|
void |
stop() |
void |
stopHostingOnConnection(com.jme3.network.HostedConnection hc)
Terminates the specified connection for hosting remote
entity data commands.
|
void |
terminate(com.jme3.network.service.HostedServiceManager hsm) |
public EntityDataHostedService(int channel, com.simsilica.es.ObservableEntityData ed)
public EntityDataHostedService(int channel, com.simsilica.es.ObservableEntityData ed, boolean autoHost)
public com.simsilica.es.EntityData getEntityData()
public int getChannel()
getChannel
in interface EntityHostSettings
public void sendUpdates()
public void startHostingOnConnection(com.jme3.network.HostedConnection hc)
public void stopHostingOnConnection(com.jme3.network.HostedConnection hc)
public HostedEntityData getHostedEntityData(com.jme3.network.HostedConnection hc)
public void setMaxEntityBatchSize(int i)
public int getMaxEntityBatchSize()
getMaxEntityBatchSize
in interface EntityHostSettings
public void setMaxChangeBatchSize(int i)
public int getMaxChangeBatchSize()
getMaxChangeBatchSize
in interface EntityHostSettings
public void setAutoHost(boolean b)
public boolean getAutoHost()
protected void onInitialize(com.jme3.network.service.HostedServiceManager services)
onInitialize
in class com.jme3.network.service.AbstractService<com.jme3.network.service.HostedServiceManager>
public void start()
start
in interface com.jme3.network.service.HostedService
start
in interface com.jme3.network.service.Service<com.jme3.network.service.HostedServiceManager>
start
in class com.jme3.network.service.AbstractService<com.jme3.network.service.HostedServiceManager>
public void stop()
stop
in interface com.jme3.network.service.HostedService
stop
in interface com.jme3.network.service.Service<com.jme3.network.service.HostedServiceManager>
stop
in class com.jme3.network.service.AbstractService<com.jme3.network.service.HostedServiceManager>
public void terminate(com.jme3.network.service.HostedServiceManager hsm)
terminate
in interface com.jme3.network.service.HostedService
terminate
in interface com.jme3.network.service.Service<com.jme3.network.service.HostedServiceManager>
terminate
in class com.jme3.network.service.AbstractHostedService
public void connectionAdded(com.jme3.network.Server server, com.jme3.network.HostedConnection hc)
connectionAdded
in interface com.jme3.network.ConnectionListener
connectionAdded
in class com.jme3.network.service.AbstractHostedService
public void connectionRemoved(com.jme3.network.Server server, com.jme3.network.HostedConnection hc)
connectionRemoved
in interface com.jme3.network.ConnectionListener
connectionRemoved
in class com.jme3.network.service.AbstractHostedService