本文整理汇总了Java中com.jme3.network.HostedConnection.send方法的典型用法代码示例。如果您正苦于以下问题:Java HostedConnection.send方法的具体用法?Java HostedConnection.send怎么用?Java HostedConnection.send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.network.HostedConnection
的用法示例。
在下文中一共展示了HostedConnection.send方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConnection
import com.jme3.network.HostedConnection; //导入方法依赖的package包/类
private void onConnection(HostedConnection conn) {
if (localObjects.size() > 0){
// send a object definition message
ObjectDef[] defs = new ObjectDef[localObjects.size()];
int i = 0;
for (Entry<LocalObject> entry : localObjects){
defs[i] = makeObjectDef(entry.getValue());
i++;
}
RemoteObjectDefMessage defMsg = new RemoteObjectDefMessage();
defMsg.objects = defs;
if (this.client != null){
this.client.send(defMsg);
logger.log(Level.INFO, "Client: Sending {0}", defMsg);
} else{
conn.send(defMsg);
logger.log(Level.INFO, "Server: Sending {0}", defMsg);
}
}
}
示例2: onAddEntity
import com.jme3.network.HostedConnection; //导入方法依赖的package包/类
@Override
public void onAddEntity(World w, Entity e) {
// send both add entity and finish add entity messages to ensure order
for(HostedConnection conn : connections.values()) {
conn.send(new AddEntityMessage(e));
conn.send(new AddEntityFinishMessage());
}
}
示例3: handleMessage
import com.jme3.network.HostedConnection; //导入方法依赖的package包/类
@Override
public void handleMessage(PlayerJoinedMessage m) {
// Player has their player set, send them some ping messages and
// day/night. Store their connection.
conIDToPlayerID.put(m.connection, m.eid);
playerIDtoConID.put(m.eid, m.connection);
HostedConnection c = connections.get(m.connection);
c.send(new DayNightMessage(world.getTime()));
c.send(new PingMessage(m.eid));
}
示例4: messageReceived
import com.jme3.network.HostedConnection; //导入方法依赖的package包/类
public void messageReceived(HostedConnection source, com.jme3.network.Message message) {
if (message instanceof PingMessage){
System.out.println("Server: Received ping message!");
source.send(new PongMessage());
}
}
示例5: send
import com.jme3.network.HostedConnection; //导入方法依赖的package包/类
/**
* 发送给指定的客户端
* @param conn
* @param message
*/
public final void send(HostedConnection conn, BaseMess message) {
message.setTime(time);
conn.send(message);
}