// Token: 0x06000683 RID: 1667 public bool InitializeRecordingSession(string sessionName, int randomSeed, NetworkPlayerID localPlayerID, CommanderManager commanderManager, GameModeBase gameMode) { ReplayHelpers.MostRecentReplayFile = string.Empty; if (this.mReplayMode == ReplayMode.ReplaysDisabled) { return(false); } string locationForReplay = ReplayHelpers.GetLocationForReplay(sessionName); if (BBI.Core.IO.File.Exists(locationForReplay)) { BBI.Core.IO.File.Delete(locationForReplay); // MOD: load replay files BBI.Core.IO.File.Delete(locationForReplay + "x"); } List <byte> bytes = new List <byte>(); byte[] layout = Encoding.UTF8.GetBytes(MapModManager.GetLayoutData()); byte[] patch = Encoding.UTF8.GetBytes(Subsystem.AttributeLoader.GetPatchData()); bytes.AddRange(new byte[] { (byte)((layout.Length >> 0) & 0xff), (byte)((layout.Length >> 8) & 0xff), (byte)((layout.Length >> 16) & 0xff), (byte)((layout.Length >> 24) & 0xff) }); bytes.AddRange(new byte[] { (byte)((patch.Length >> 0) & 0xff), (byte)((patch.Length >> 8) & 0xff), (byte)((patch.Length >> 16) & 0xff), (byte)((patch.Length >> 24) & 0xff) }); bytes.AddRange(new byte[] { 0x00, 0x00, 0x00, 0x00 }); bytes.AddRange(new byte[] { 0x00, 0x00, 0x00, 0x00 }); bytes.AddRange(layout); bytes.AddRange(patch); System.IO.File.WriteAllBytes(locationForReplay + "x", bytes.ToArray()); // MOD GameSessionSettings gameSessionSettings = (gameMode != null) ? gameMode.GameSessionSettings : null; this.mGameSession = new ReplayableGameSession(sessionName, this.mCurrentGameVersion, BBI.Core.IO.File.CreateText(locationForReplay, true), localPlayerID, commanderManager, randomSeed, gameSessionSettings); this.mReplayMode = ReplayMode.RecordingGame; ReplayHelpers.MostRecentReplayFile = locationForReplay; return(true); }
void Component_NetworkInformationReceived(object sender, Glib.XNA.NetworkLib.NetworkInformationReceivedEventArgs e) { string[] propComponents = e.Data.Name.Split('.'); if (!propComponents[0].Equals("MPShip", StringComparison.InvariantCultureIgnoreCase)) { return; } ships.Clear(); StateManager.SelectedShip = StateManager.NetworkData.SelectedNetworkShip.Type; StateManager.SelectedTier = StateManager.NetworkData.SelectedNetworkShip.Tier; StateManager.InitializeSingleplayerGameScreen(SelectedShips[StateManager.NetworkData.CurrentSession.LocalGamers[0].Id].Type, SelectedShips[StateManager.NetworkData.CurrentSession.LocalGamers[0].Id].Tier, false); int gamersReceived = 0; NetworkGamer infosender; //netGamer.ReceiveData(StateManager.NetworkData.DataReader, out infosender); MultiplayerTeam? mpTeam = null; if (StateManager.NetworkData.SessionMode == MultiplayerSessionType.TDM || StateManager.NetworkData.SessionMode == MultiplayerSessionType.Coop) { mpTeam = (MultiplayerTeam)Enum.Parse(typeof(MultiplayerTeam), StateManager.NetworkData.DataReader.ReadInt32().ToString(), true); } Vector4 ship = StateManager.NetworkData.DataReader.ReadVector4(); NetworkPlayerID targetPlayer = new NetworkPlayerID(Guid.NewGuid()); if (StateManager.NetworkData.DataReader.ReadBoolean()) { targetPlayer = new NetworkPlayerID(StateManager.NetworkData.DataReader.ReadByte()); } ships.Add(targetPlayer, new KeyValuePair<MultiplayerTeam?, Vector4>(mpTeam, ship)); gamersReceived++; }