Esempio n. 1
0
 public virtual void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo)
 {
     if (mode.HasFlag(SerializationModeFlags.ConstantDataFromServer) ||
         mode.HasFlag(SerializationModeFlags.ConstantDataFromClient))
     {
         Name = reader.ReadString();
     }
     if (mode.HasFlag(SerializationModeFlags.VaryingDataFromServer))
     {
         var isDisconnected = reader.ReadBoolean();
         if (IsRemote && isDisconnected) ConnectionStatus = ConnectionStatusType.Disconnected;
         if (IsDisconnected && !isDisconnected) ConnectionStatus = ConnectionStatusType.Remote;
         var oldTeam = Team;
         TeamProxy = reader.ReadTeamID(FindTeam);
         if (oldTeam != Team)
         {
             // Resign from old team now while we still have a direct reference to it.
             // The new team may not exist yet, so assign to it later in Update().
             if (oldTeam != null) oldTeam.UpdateAssignment(this);
             _teamAssignmentDeserialized = true;
         }
     }
     StatsData.Deserialize(reader, mode, framesAgo);
     ArenaStatistics.Deserialize(reader, mode, framesAgo);
 }
 protected override void Deserialize(NetworkBinaryReader reader)
 {
     IsRegisteredToServer = reader.ReadBoolean();
     IsRequestingSpawnForArenaID = reader.ReadNullableByte();
     IsGameClientReadyToStartArena = reader.ReadBoolean();
     SpectatorID = reader.ReadByte();
     Subclass = (SubclassType)reader.ReadByte();
     if (!Enum.IsDefined(typeof(SubclassType), Subclass)) throw new NetworkException("Invalid value for Subclass, " + Subclass);
     int byteCount = reader.ReadUInt16();
     StreamedData = reader.ReadBytes(byteCount);
 }