本文整理汇总了Java中net.dlogic.kryonet.common.manager.RoomManagerInstance类的典型用法代码示例。如果您正苦于以下问题:Java RoomManagerInstance类的具体用法?Java RoomManagerInstance怎么用?Java RoomManagerInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RoomManagerInstance类属于net.dlogic.kryonet.common.manager包,在下文中一共展示了RoomManagerInstance类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import net.dlogic.kryonet.common.manager.RoomManagerInstance; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
manager = RoomManagerInstance.manager;
Room room = new Room();
room.name = "Test";
room.maxUsers = 2;
manager.map.put(room.name, room);
Room room2 = new Room();
room2.name = "Test2";
room2.maxUsers = 32;
manager.map.put(room2.name, room2);
Room room3 = new Room();
room3.name = "Lobby";
room3.maxUsers = 32;
manager.map.put(room3.name, room3);
}
示例2: setUp
import net.dlogic.kryonet.common.manager.RoomManagerInstance; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
listener = new KryonetClientListener();
listener.setConnectionEventCallback(new MockConnectionEventCallback());
listener.setRoomEventCallback(new MockRoomEventCallback());
RoomManagerInstance.manager.map.clear();
UserManagerInstance.manager.map.clear();
initializeMyself();
connection = new MockConnection();
}
示例3: testConnected
import net.dlogic.kryonet.common.manager.RoomManagerInstance; //导入依赖的package包/类
@Test
public void testConnected() {
listener.connected(connection);
assertEquals(connection.getID(), MyselfInstance.myself.id);
assertFalse(MyselfInstance.myself.isAdmin);
assertTrue(MyselfInstance.myself.isItMe);
assertFalse(MyselfInstance.myself.isPlayer);
assertEquals(0, RoomManagerInstance.manager.map.size());
assertEquals(1, UserManagerInstance.manager.map.size());
assertTrue(UserManagerInstance.manager.map.containsKey(MyselfInstance.myself.id));
}
示例4: testDisconnected
import net.dlogic.kryonet.common.manager.RoomManagerInstance; //导入依赖的package包/类
@Test
public void testDisconnected() {
testConnected();
listener.disconnected(connection);
assertEquals(0, MyselfInstance.myself.id);
assertNull(MyselfInstance.myself.username);
assertFalse(MyselfInstance.myself.isAdmin);
assertFalse(MyselfInstance.myself.isItMe);
assertFalse(MyselfInstance.myself.isPlayer);
assertEquals(0, RoomManagerInstance.manager.map.size());
assertEquals(0, UserManagerInstance.manager.map.size());
assertFalse(UserManagerInstance.manager.map.containsKey(MyselfInstance.myself.id));
}
示例5: sendLeaveRoomResponse
import net.dlogic.kryonet.common.manager.RoomManagerInstance; //导入依赖的package包/类
public void sendLeaveRoomResponse() {
RoomManagerInstance.manager.forEachRoom(new IForEach<Room>() {
public void exec(Room entity) {
if (entity.users.containsKey(sender.id)) {
sendLeaveRoomResponse(entity);
}
}
});
}
示例6: onJoinRoomFailure
import net.dlogic.kryonet.common.manager.RoomManagerInstance; //导入依赖的package包/类
@Override
public void onJoinRoomFailure(String errorMessage) {
Log.info(errorMessage);
Room room = RoomManagerInstance.manager.map.get("Game");
Log.info(room.users.toString());
}
示例7: KryonetServerListener
import net.dlogic.kryonet.common.manager.RoomManagerInstance; //导入依赖的package包/类
public KryonetServerListener() {
Log.debug("KryonetServerListener()");
userManager = UserManagerInstance.manager;
roomManager = RoomManagerInstance.manager;
}