public static ResourcePoolItemList <SyncedData> Decode(byte[] data) { ResourcePoolItemList <SyncedData> @new = SyncedData.poolList.GetNew(); @new.Clear(); int i = 0; int num = BitConverter.ToInt32(data, i); i += 4; byte ownerID = data[i++]; byte b = data[i++]; bool flag = data[i++] == 1; int num2 = num; while (i < data.Length) { SyncedData new2 = SyncedData.pool.GetNew(); new2.Init(ownerID, num2--); new2.inputData.Deserialize(data, ref i); @new.Add(new2); } bool flag2 = @new.Count > 0; if (flag2) { @new[0].dropPlayer = flag; @new[0].dropFromPlayerId = b; } return(@new); }
private void OnEventDataReceived(byte eventCode, object content) { bool flag = eventCode == 199; if (flag) { byte[] data = content as byte[]; ResourcePoolItemList <SyncedData> list = SyncedData.Decode(data); bool flag2 = list.Count > 0; if (flag2) { TSPlayer tSPlayer = this.players[list[0].inputData.ownerID]; bool flag3 = !tSPlayer.dropped; if (flag3) { this.OnSyncedDataReceived(tSPlayer, list); bool flag4 = list[0].dropPlayer && tSPlayer.ID != this.localPlayer.ID && !this.players[list[0].dropFromPlayerId].dropped; if (flag4) { tSPlayer.dropCount++; } } else { int i = 0; int count = list.Count; while (i < count) { SyncedData.pool.GiveBack(list[i]); i++; } } SyncedData.poolList.GiveBack(list); } } else { bool flag5 = eventCode == 198; if (flag5) { byte[] infoBytes = content as byte[]; this.OnChecksumReceived(SyncedInfo.Decode(infoBytes)); } else { bool flag6 = eventCode == 197; if (flag6) { byte[] array = content as byte[]; bool flag7 = array.Length != 0; if (flag7) { bool flag8 = array[0] == 0; if (flag8) { this.Pause(); } else { bool flag9 = array[0] == 1; if (flag9) { this.Run(); } else { bool flag10 = array[0] == 3; if (flag10) { this.End(); } } } } } else { bool flag11 = eventCode == 196; if (flag11) { byte[] infoBytes2 = content as byte[]; SyncedInfo syncedInfo = SyncedInfo.Decode(infoBytes2); this.players[syncedInfo.playerId].sentSyncedStart = true; } } } } }