当前位置: 首页>>代码示例>>Java>>正文


Java HostedConnection.send方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:ObjectStore.java

示例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());
	}
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:9,代码来源:GameServer.java

示例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));
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:12,代码来源:GameServer.java

示例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());
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:7,代码来源:TestMessages.java

示例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);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:10,代码来源:GameServer.java


注:本文中的com.jme3.network.HostedConnection.send方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。