Ejemplo n.º 1
0
    public virtual void OnReplicationDeserialize_CJGenerated(P2PNetworkReader reader, bool initial_state)
    {
        int num = (int)reader.ReadPackedUInt32();

        if (this.m_ReplActiveElements_Repl == null || this.m_ReplActiveElements_Repl.Length != num)
        {
            this.m_ReplActiveElements_Repl = new bool[num];
        }
        for (int i = 0; i < num; i++)
        {
            this.m_ReplActiveElements_Repl[i] = reader.ReadBoolean();
        }
        if (initial_state)
        {
            int num2 = (int)reader.ReadPackedUInt32();
            if (this.m_ReplActiveElementsHash == null || this.m_ReplActiveElementsHash.Length != num2)
            {
                this.m_ReplActiveElementsHash = new int[num2];
            }
            for (int j = 0; j < num2; j++)
            {
                this.m_ReplActiveElementsHash[j] = reader.ReadInt32();
            }
        }
    }
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     this.m_PlantDestroyed = reader.ReadBoolean();
     if (this.m_PlantDestroyed)
     {
         this.m_ActivateScripts = reader.ReadBoolean();
         this.m_DontDestroy     = reader.ReadBoolean();
         this.m_Layer           = reader.ReadInt32();
         uint num = reader.ReadPackedUInt32();
         if (num > 0u && this.m_DestroyOnReplace == null)
         {
             this.m_DestroyOnReplace = new List <ReplicatedGameObject>((int)num);
         }
         int num2 = 0;
         while ((long)num2 < (long)((ulong)num))
         {
             this.m_DestroyOnReplace.Add(reader.ReadReplicatedGameObject());
             num2++;
         }
     }
 }
Ejemplo n.º 3
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     this.m_IsRunningInternal          = reader.ReadBoolean();
     this.m_IsInWaterInternal          = reader.ReadBoolean();
     this.m_IsSwimmingInternal         = reader.ReadBoolean();
     this.m_IsSleepingInternal         = reader.ReadBoolean();
     this.m_LastCollisionFlagsInternal = reader.ReadInt32();
     this.m_WantedSpeed2dInternal      = reader.ReadFloat();
     this.m_IsDeadInternal             = reader.ReadBoolean();
     this.m_IsInSafeZoneInternal       = reader.ReadBoolean();
     this.m_HealthInternal             = reader.ReadFloat();
     this.m_MaxHealthInternal          = reader.ReadFloat();
 }
Ejemplo n.º 4
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     this.m_ReplBurning     = reader.ReadBoolean();
     this.m_BurningDuration = reader.ReadFloat();
 }
Ejemplo n.º 5
0
 public virtual void OnReplicationDeserialize_CJGenerated(P2PNetworkReader reader, bool initial_state)
 {
     this.m_AnimationStopped_Repl   = reader.ReadBoolean();
     this.m_AnimationStopFrame_Repl = reader.ReadFloat();
     this.m_StateHash_Repl          = reader.ReadInt32();
 }
 public override void Deserialize(P2PNetworkReader reader)
 {
     this.SetNetValue(reader.ReadBoolean());
 }
 public virtual void OnReplicationDeserialize_CJGenerated(P2PNetworkReader reader, bool initial_state)
 {
     this.m_PauseGame_Repl = reader.ReadBoolean();
 }
Ejemplo n.º 8
0
    public void ReplicationReceive(P2PNetworkReader reader, bool initial_state)
    {
        if (P2PLogFilter.logPedantic)
        {
            Debug.Log(string.Format("ReplicationReceive called for {0} with guid {1}", base.name, this.GetGuidComponent.GetGuid()), this);
        }
        int num = reader.ReadInt32();

        if (num <= this.m_Revision && !initial_state)
        {
            return;
        }
        ReplicationComponent.s_DeserializedComponent = this;
        this.m_Revision                = num;
        this.m_LastReplicationTime     = Time.time;
        this.m_LastReplicationTimeReal = Time.realtimeSinceStartup;
        short num2 = reader.ReadInt16();

        if (this.m_OwnerPeer.GetHostId() != num2)
        {
            this.ReplOnChangedOwner(ReplTools.GetPeerById(num2));
            if (this.m_OwnerPeer == ReplTools.GetLocalPeer())
            {
                this.ReplRequestOwnership();
            }
        }
        this.ReplBlockChangeOwnership(!reader.ReadBoolean());
        for (int i = 0; i < this.GetReplBehaviours.Length; i++)
        {
            IReplicatedBehaviour replicatedBehaviour = this.GetReplBehaviours[i];
            if (replicatedBehaviour as UnityEngine.Object == null)
            {
                if (reader.ReadBoolean())
                {
                    ReplicationComponent.s_DeserializedComponent = null;
                    return;
                }
                this.m_ReplBehavioursFlag[i] = false;
            }
            else if (reader.ReadBoolean())
            {
                int uniqueIdForType = replicatedBehaviour.GetUniqueIdForType();
                int num3            = reader.ReadInt32();
                if (uniqueIdForType != num3)
                {
                    ReplicationComponent.s_DeserializedComponent = null;
                    return;
                }
                replicatedBehaviour.OnReplicationDeserialize(reader, initial_state);
                this.CallReplicationDeserialize_Gen(replicatedBehaviour, reader, initial_state);
                this.m_ReplBehavioursFlag[i] = true;
            }
            else
            {
                this.m_ReplBehavioursFlag[i] = false;
            }
        }
        for (int j = 0; j < this.GetReplBehaviours.Length; j++)
        {
            if (this.m_ReplBehavioursFlag[j])
            {
                IReplicatedBehaviour replicatedBehaviour2 = this.GetReplBehaviours[j];
                replicatedBehaviour2.OnReplicationResolve();
                this.CallReplicationResolve_Gen(replicatedBehaviour2);
            }
        }
        if (P2PConnection.s_Size > reader.Position && !initial_state)
        {
            Debug.LogError(string.Format("Didn't read whole buffer! (number of bytes unread: {0})", P2PConnection.s_Size - reader.Position), this);
        }
        ReplicationComponent.s_DeserializedComponent = null;
    }