public void AddToMessage(NetOutgoingMessage msg) { songSelected = selectedSong != null && roomState != RoomState.SelectingSong; msg.Write(roomId); msg.Write(name); msg.Write(usePassword); msg.Write(perPlayerDifficulty); msg.Write(songSelected); msg.Write(noHost); msg.WritePadBits(); msg.Write((byte)roomState); msg.Write((byte)songSelectionType); if (!noHost) { roomHost.AddToMessage(msg); } msg.Write(players); msg.Write(maxPlayers); if (startLevelInfo == null) { startLevelInfo = new LevelOptionsInfo(BeatmapDifficulty.Hard, new GameplayModifiers(), "Standard"); } startLevelInfo.AddToMessage(msg); if (songSelected) { selectedSong.AddToMessage(msg); } }
public RoomInfo(NetIncomingMessage msg) { roomId = msg.ReadUInt32(); name = msg.ReadString(); usePassword = msg.ReadBoolean(); perPlayerDifficulty = msg.ReadBoolean(); songSelected = msg.ReadBoolean(); noHost = msg.ReadBoolean(); msg.SkipPadBits(); roomState = (RoomState)msg.ReadByte(); songSelectionType = (SongSelectionType)msg.ReadByte(); if (!noHost) { roomHost = new PlayerInfo(msg); } players = msg.ReadInt32(); maxPlayers = msg.ReadInt32(); startLevelInfo = new LevelOptionsInfo(msg); try { if (songSelected) { selectedSong = new SongInfo(msg); } else { selectedSong = null; } } catch { } }
public PlayerInfo(NetIncomingMessage msg) { playerName = msg.ReadString(); playerId = msg.ReadUInt64(); playerIdString = playerId.ToString(); playerNameColor = new Color32(msg.ReadByte(), msg.ReadByte(), msg.ReadByte()); playerState = (PlayerState)msg.ReadByte(); fullBodyTracking = msg.ReadBoolean(); playerScore = msg.ReadVariableUInt32(); playerCutBlocks = msg.ReadVariableUInt32(); playerComboBlocks = msg.ReadVariableUInt32(); playerTotalBlocks = msg.ReadVariableUInt32(); msg.ReadPadBits(); playerEnergy = msg.ReadFloat(); playerProgress = msg.ReadFloat(); playerLevelOptions = new LevelOptionsInfo(msg); avatarData = msg.ReadBytes(84 * (fullBodyTracking ? 2 : 1) + 16); byte hitsCount = msg.ReadByte(); if (hitsCount > 0) { hitsLastUpdate = msg.ReadBytes(hitsCount * 5); } }
public PlayerUpdate(NetIncomingMessage msg) { playerNameColor = new Color32(msg.ReadByte(), msg.ReadByte(), msg.ReadByte()); playerState = (PlayerState)msg.ReadByte(); fullBodyTracking = (msg.ReadByte() == 1); playerScore = msg.ReadVariableUInt32(); playerCutBlocks = msg.ReadVariableUInt32(); playerComboBlocks = msg.ReadVariableUInt32(); playerTotalBlocks = msg.ReadVariableUInt32(); playerEnergy = msg.ReadFloat(); playerProgress = msg.ReadFloat(); playerLevelOptions = new LevelOptionsInfo(msg); avatarData = msg.ReadBytes(fullBodyTracking ? 168 : 84); }
public ChannelInfo(NetIncomingMessage msg) { channelId = msg.ReadInt32(); name = msg.ReadString(); iconUrl = msg.ReadString(); state = (ChannelState)msg.ReadByte(); if (state != ChannelState.Voting) { currentSong = new SongInfo(msg); currentLevelOptions = new LevelOptionsInfo(msg); if (currentSong.songName == "Selecting song..." && currentSong.levelId == "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") { currentSong = null; currentLevelOptions = default; } } playerCount = msg.ReadInt32(); }