简体   繁体   English

如何通过KryoNet发送用户信息?

[英]How do I send user information over KryoNet?

I've created a gameserver containing an ArrayList of players (Player). 我创建了一个包含玩家ArrayList(玩家)的游戏服务器。 However, as far as i've been able to read, Kryonet can't send objects with a constructor in it to the client (Player have that), so i need to find an alternate way of transferring the ArrayList. 但是,据我所知,Kryonet不能将带有构造函数的对象发送到客户端(Player拥有),因此我需要找到一种替代方法来传输ArrayList。

What would be a proper way to accomplish this? 什么是完成此任务的合适方法?

您可以使用JMS实现(在我的情况下为ActiveMq)并发送对象消息。

You just need to make the object have a default constructor with no arguments. 您只需要使对象具有不带参数的默认构造函数即可。 you can still create the object with a constructor that takes in parameters. 您仍然可以使用带有参数的构造函数来创建对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM