////////////////////////////////////////////////////////////////////////////////////////////////// public static INetworkCommand[] GetCommandsFromStream(MyBitStream stream) { int count = (int)(stream.ReadByte()); INetworkCommand[] commands = new INetworkCommand[count]; for (int i = 0; i < count; i++) { byte commandType = stream.ReadByte(); switch ((CommandTypes)commandType) { case CommandTypes.disconnectRequest: commands[i] = new DisconnectRequestCommand(); break; default: break; } } return(commands); }
public void UnPackAll(MyBitStream stream) { //I guess I aggregate everything? //Since this never changes in size, I don't have to add indexes... for (int i = 0; i < NetObjs.Count; i++) { NetObjs[i].FreshPush(stream); } //UnPack the number of players //TODO fix number of player discrepancy if (PlayerObjs.Count != (int)stream.ReadByte()) { throw new Exception("Wow you managed to have the wrong number of players..."); } for (int i = 0; i < PlayerObjs.Count; i++) { PlayerObjs[i].FreshPush(stream); } }