public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
    {
        int num = reader.ReadInt32();

        if (num > 0)
        {
            this.m_AudioModule.InitSources();
        }
        for (int i = 0; i < num; i++)
        {
            switch (reader.ReadInt32())
            {
            case 1:
                this.m_AudioModule.MakeHitSound((EObjectMaterial)reader.ReadInt32(), (ItemID)reader.ReadInt32());
                break;

            case 2:
                this.m_AudioModule.PlaySwingSound((ItemID)reader.ReadInt32());
                break;

            case 3:
                this.m_AudioModule.PlayGruntSound((PlayerAudioModule.GruntPriority)reader.ReadInt32(), null, 1f, false, Noise.Type.None, 0f);
                break;
            }
        }
    }
예제 #2
0
 public void Deserialize(P2PNetworkReader reader)
 {
     this.m_Position           = reader.ReadVector3();
     this.m_ItemID             = (ItemID)reader.ReadInt32();
     this.m_ActiveChildrenMask = reader.ReadInt32();
     this.m_Group = BalanceSystem20.Get().GetGroupByIndex((int)reader.ReadInt16());
 }
예제 #3
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initialState)
 {
     MainLevel.s_GameTime = reader.ReadFloat();
     MainLevel.Instance.m_TODSky.Cycle.Day   = reader.ReadInt32();
     MainLevel.Instance.m_TODSky.Cycle.Hour  = reader.ReadFloat();
     MainLevel.Instance.m_TODSky.Cycle.Month = reader.ReadInt32();
     MainLevel.Instance.m_TODSky.Cycle.Year  = reader.ReadInt32();
 }
예제 #4
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();
            }
        }
    }
예제 #5
0
 public override void OnReplicationDeserialize_CJGenerated(P2PNetworkReader reader, bool initial_state)
 {
     base.OnReplicationDeserialize_CJGenerated(reader, initial_state);
     this.m_LCInfo_m_LiquidType_Repl = (LiquidType)reader.ReadInt32();
     this.m_LCInfo_m_Capacity_Repl   = reader.ReadFloat();
     this.m_LCInfo_m_Amount_Repl     = reader.ReadFloat();
 }
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     this.m_ReplControllerType = (PlayerControllerType)reader.ReadInt32();
     if (this.m_ReplControllerType != PlayerControllerType.Unknown)
     {
         this.m_ReplItemName = reader.ReadString();
     }
 }
예제 #7
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     this.m_WeatherInterpolated = reader.ReadFloat();
     this.m_CurrentDataIndex    = reader.ReadInt32();
     if (this.m_RainData.Count > this.m_CurrentDataIndex)
     {
         this.m_CurrentRainData = this.m_RainData[this.m_CurrentDataIndex];
     }
     if (this.m_CurrentRainData != null)
     {
         this.m_CurrentRainData.m_ExecutionTime = reader.ReadFloat();
     }
     else
     {
         reader.ReadFloat();
     }
     this.m_CurrentPeriod   = reader.ReadInt32();
     this.m_PeriodStartTime = reader.ReadFloat();
     this.m_LastRainTime    = reader.ReadFloat();
 }
예제 #8
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     base.OnReplicationDeserialize(reader, initial_state);
     this.m_ReplCurrentHitsCount = reader.ReadInt32();
     DebugUtils.Assert(this.m_ReplConstructionSlots.Length == this.m_ConstructionSlots.Length, true);
     for (int i = 0; i < this.m_ReplConstructionSlots.Length; i++)
     {
         this.m_ReplConstructionSlots[i].obj         = reader.ReadReplicatedGameObject();
         this.m_ReplConstructionSlots[i].is_resolved = false;
     }
 }
    public virtual void OnReplicationDeserialize_CJGenerated(P2PNetworkReader reader, bool initial_state)
    {
        this.m_BestTriggerReplObj_Repl     = reader.ReadGameObject();
        this.m_ExecutedTriggerReplObj_Repl = reader.ReadGameObject();
        int num = (int)reader.ReadPackedUInt32();

        if (this.m_BestTriggerChildIdx_Repl == null || this.m_BestTriggerChildIdx_Repl.Count != num)
        {
            this.m_BestTriggerChildIdx_Repl = new List <int>(num);
        }
        for (int i = 0; i < num; i++)
        {
            if (this.m_BestTriggerChildIdx_Repl.Count != num)
            {
                int item = reader.ReadInt32();
                this.m_BestTriggerChildIdx_Repl.Add(item);
            }
            else
            {
                this.m_BestTriggerChildIdx_Repl[i] = reader.ReadInt32();
            }
        }
        int num2 = (int)reader.ReadPackedUInt32();

        if (this.m_ExecutedTriggerChildIdx_Repl == null || this.m_ExecutedTriggerChildIdx_Repl.Count != num2)
        {
            this.m_ExecutedTriggerChildIdx_Repl = new List <int>(num2);
        }
        for (int j = 0; j < num2; j++)
        {
            if (this.m_ExecutedTriggerChildIdx_Repl.Count != num2)
            {
                int item2 = reader.ReadInt32();
                this.m_ExecutedTriggerChildIdx_Repl.Add(item2);
            }
            else
            {
                this.m_ExecutedTriggerChildIdx_Repl[j] = reader.ReadInt32();
            }
        }
    }
예제 #10
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();
 }
    public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
    {
        base.OnReplicationDeserialize(reader, initial_state);
        this.Initialize();
        foreach (ReplicatedPlayerInjuries.ReplicatedWoundSlot replicatedWoundSlot in this.m_WoundSlots)
        {
            replicatedWoundSlot.m_IsValid = false;
        }
        int num = (int)reader.ReadPackedUInt32();

        for (int i = 0; i < num; i++)
        {
            InjuryType  injury_type  = (InjuryType)reader.ReadInt32();
            InjuryState injury_state = (InjuryState)reader.ReadInt32();
            int         num2         = reader.ReadInt32();
            this.m_WoundSlots[num2].m_IsValid = true;
            if (num2 >= 0 && num2 < this.m_WoundSlots.Count)
            {
                this.m_WoundSlots[num2].SetInjury(injury_type, injury_state);
            }
        }
    }
예제 #12
0
    public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initialState)
    {
        int num = reader.ReadInt32();

        if (num > 0)
        {
            if (num == this.m_AnimatorParams.Count)
            {
                for (int i = 0; i < this.m_AnimatorParams.Count; i++)
                {
                    this.m_AnimatorParams[i].Deserialize(reader);
                }
            }
            else if (P2PLogFilter.logError)
            {
                Debug.LogError("AnimatorReplicator: Wrong animation parameter count");
            }
        }
        int num2 = reader.ReadInt32();

        if (num2 > 0)
        {
            if (num2 == this.m_LayeredAnimationStringHashes.Length)
            {
                for (int j = 0; j < this.m_LayeredAnimationStringHashes.Length; j++)
                {
                    this.m_LayeredAnimationStringHashes[j] = reader.ReadInt32();
                }
                return;
            }
            if (P2PLogFilter.logError)
            {
                Debug.LogError("AnimatorReplicator: Wrong animation count");
            }
        }
    }
예제 #13
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     if (initial_state)
     {
         foreach (string key in this.m_Groups.Keys)
         {
             this.m_ObjectsInArea[key].Clear();
         }
         this.m_QuadTree.Clear();
         int num = reader.ReadInt32();
         for (int i = 0; i < num; i++)
         {
             BalanceSystemObject balanceSystemObject = new BalanceSystemObject();
             reader.ReadVector3();
             balanceSystemObject.Deserialize(reader);
             this.m_QuadTree.InsertObject(balanceSystemObject, balanceSystemObject.m_Position);
         }
         this.SpawnObjectsIfNeeded();
     }
 }
 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++;
         }
     }
 }
예제 #15
0
        public virtual void OnReplicationDeserialize_CJGenerated(P2PNetworkReader reader, bool initial_state)
        {
            this.m_WeaponType_Repl = (HumanAI.WeaponType)reader.ReadInt32();
            GameObject gameObject         = reader.ReadGameObject();
            int        repl_behaviour_idx = reader.ReadInt32();

            this.m_PrimaryWeapon_Repl = (gameObject ? ((Item)gameObject.GetComponent <ReplicationComponent>().GetComponentFromIndex(repl_behaviour_idx)) : null);
            GameObject gameObject2         = reader.ReadGameObject();
            int        repl_behaviour_idx2 = reader.ReadInt32();

            this.m_AdditionalWeapon_Repl = (gameObject2 ? ((Item)gameObject2.GetComponent <ReplicationComponent>().GetComponentFromIndex(repl_behaviour_idx2)) : null);
            GameObject gameObject3         = reader.ReadGameObject();
            int        repl_behaviour_idx3 = reader.ReadInt32();

            this.m_SecondaryWeapon_Repl = (gameObject3 ? ((Item)gameObject3.GetComponent <ReplicationComponent>().GetComponentFromIndex(repl_behaviour_idx3)) : null);
            GameObject gameObject4         = reader.ReadGameObject();
            int        repl_behaviour_idx4 = reader.ReadInt32();

            this.m_CurrentWeapon_Repl = (gameObject4 ? ((Item)gameObject4.GetComponent <ReplicationComponent>().GetComponentFromIndex(repl_behaviour_idx4)) : null);
            GameObject gameObject5         = reader.ReadGameObject();
            int        repl_behaviour_idx5 = reader.ReadInt32();

            this.m_CurrentAdditionalWeapon_Repl = (gameObject5 ? ((Item)gameObject5.GetComponent <ReplicationComponent>().GetComponentFromIndex(repl_behaviour_idx5)) : null);
        }
예제 #16
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 virtual void OnReplicationDeserialize_CJGenerated(P2PNetworkReader reader, bool initial_state)
 {
     this.m_SaveRequests_Repl = reader.ReadInt32();
 }
 public override void Deserialize(P2PNetworkReader reader)
 {
     this.SetNetValue(reader.ReadInt32());
 }
예제 #19
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;
    }
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initialState)
 {
     this.m_ReplAttachmentIdx = reader.ReadInt32();
     this.m_ReplParent        = reader.ReadGameObject();
 }