本文整理汇总了Java中lt.ekgame.bancho.api.packets.server.PacketRoomUpdate类的典型用法代码示例。如果您正苦于以下问题:Java PacketRoomUpdate类的具体用法?Java PacketRoomUpdate怎么用?Java PacketRoomUpdate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PacketRoomUpdate类属于lt.ekgame.bancho.api.packets.server包,在下文中一共展示了PacketRoomUpdate类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handlePacket
import lt.ekgame.bancho.api.packets.server.PacketRoomUpdate; //导入依赖的package包/类
@Override
public void handlePacket(Packet packet) {
if (packet instanceof PacketRoomUpdate && isHost()) {
PacketRoomUpdate update = (PacketRoomUpdate) packet;
if (update.room.matchId == getMatchId()) {
currentRoom = update.room;
}
}
if (packet instanceof PacketRoomJoined) {
PacketRoomJoined roomUpdate = (PacketRoomJoined) packet;
currentRoom = roomUpdate.room;
clientHandler.changeStatus().setStatus(UserState.MULTIPLAYER).send();
}
if (packet instanceof PacketRoomEveryoneLoaded) {
bancho.sendPacket(new PacketRoomFinishMap());
clientHandler.changeStatus().setStatus(UserState.MULTIPLAYING).send();
}
if (packet instanceof PacketRoomEveryoneFinished) {
clientHandler.changeStatus().setStatus(UserState.MULTIPLAYER).send();
setReady(false);
}
}
示例2: handle
import lt.ekgame.bancho.api.packets.server.PacketRoomUpdate; //导入依赖的package包/类
@Override
public void handle(Packet packet) {
if (packet instanceof PacketRoomUpdate && isHost()) {
PacketRoomUpdate update = (PacketRoomUpdate) packet;
if (update.room.matchId == getMatchId()) {
currentRoom = update.room;
}
}
if (packet instanceof PacketRoomJoined) {
PacketRoomJoined roomUpdate = (PacketRoomJoined) packet;
currentRoom = roomUpdate.room;
clientHandler.setStatus(UserStatus.MULTIPLAYER);
clientHandler.sendStatusUpdate();
}
if (packet instanceof PacketRoomEveryoneLoaded) {
bancho.sendPacket(new PacketRoomFinishMap());
clientHandler.setStatus(UserStatus.MULTIPLAYING);
clientHandler.sendStatusUpdate();
}
if (packet instanceof PacketRoomEveryoneFinished) {
clientHandler.setStatus(UserStatus.MULTIPLAYER);
clientHandler.sendStatusUpdate();
setReady(false);
}
}
示例3: handle
import lt.ekgame.bancho.api.packets.server.PacketRoomUpdate; //导入依赖的package包/类
@Override
public void handle(Packet packet) {
MultiplayerHandler mp = bot.bancho.getMultiplayerHandler();
if (packet instanceof PacketRoomJoined) {
bot.beatmaps.reset();
mp.setBeatmap(bot.beatmaps.nextBeatmap());
timer = new TimerThread(this);
timer.start();
}
if (packet instanceof PacketRoomUpdate && mp.isHost()) {
PacketRoomUpdate update = (PacketRoomUpdate) packet;
if (update.room.matchId == mp.getMatchId()) {
byte[] status = update.room.slotStatus;
String statuses = "";
slotsTaken = 0;
int slotsReady = 0;
for (int i = 0; i < 16; i++) {
statuses += status[i] + " ";
if (status[i] != 1 && status[i] != 2) {
if (update.room.slotId[i] != bot.bancho.getClientHandler().getUserId()) {
slotsTaken++;
if (status[i] == 8)
slotsReady++;
}
}
}
//System.out.println(statuses);
if (slotsTaken > 0 && slotsTaken == slotsReady) {
startGame();
timer.skipEvents();
}
}
}
if (packet instanceof PacketRoomEveryoneFinished) {
resetVoteSkip();
mp.setBeatmap(bot.beatmaps.nextBeatmap());
onBeatmapChange();
}
}