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


Java PacketRoomUpdate类代码示例

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

示例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);
	}
}
 
开发者ID:ekgame,项目名称:bancho-client,代码行数:29,代码来源:MultiplayerHandler.java

示例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();
	}
}
 
开发者ID:ekgame,项目名称:osu-auto-host,代码行数:43,代码来源:RoomHandler.java


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