Esempio n. 1
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 Deserialize(P2PNetworkReader reader)
 {
     this.guid_bytes = reader.ReadGuidBytesTemporary();
     this.assetId    = reader.ReadNetworkHash128();
     this.position   = reader.ReadVector3();
     this.payload    = reader.ReadBytesAndSize();
 }
Esempio n. 3
0
    public bool InvokeHandler(short msgType, P2PNetworkReader reader, int channelId)
    {
        if (!this.m_MessageHandlersDict.ContainsKey(msgType))
        {
            return(false);
        }
        this.m_MessageInfo.m_MsgType    = msgType;
        this.m_MessageInfo.m_Connection = this;
        this.m_MessageInfo.m_Reader     = reader;
        this.m_MessageInfo.m_ChannelId  = channelId;
        List <P2PNetworkMessageDelegate> list = this.m_MessageHandlersDict[msgType];

        if (list == null)
        {
            if (P2PLogFilter.logError)
            {
                Debug.LogError("NetworkConnection InvokeHandler no handler for " + msgType);
            }
            return(false);
        }
        for (int i = 0; i < list.Count; i++)
        {
            list[i](this.m_MessageInfo);
        }
        return(true);
    }
Esempio n. 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();
            }
        }
    }
    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;
            }
        }
    }
Esempio n. 6
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());
 }
    public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
    {
        switch (reader.ReadChar())
        {
        case '\0':
            return;

        case '\u0001':
            this.UnserializeModeTransform(reader, initial_state);
            break;

        case '\u0002':
            this.UnserializeMode2D(reader, initial_state);
            break;

        case '\u0003':
            this.UnserializeMode3D(reader, initial_state);
            break;

        case '\u0004':
            this.UnserializeModeCharacterController(reader, initial_state);
            break;
        }
        this.m_LastSyncTime = Time.time;
    }
Esempio n. 8
0
    private void LogSend(byte[] bytes)
    {
        P2PNetworkReader p2PNetworkReader = new P2PNetworkReader(bytes);
        ushort           num           = p2PNetworkReader.ReadUInt16();
        ushort           num2          = p2PNetworkReader.ReadUInt16();
        StringBuilder    stringBuilder = new StringBuilder();

        for (int i = 4; i < (int)(4 + num); i++)
        {
            stringBuilder.AppendFormat("{0:X2}", bytes[i]);
            if (i > 150)
            {
                break;
            }
        }
        Debug.Log(string.Concat(new object[]
        {
            "ConnectionSend con:",
            this.m_ConnectionId,
            " bytes:",
            num,
            " msgId:",
            num2,
            " ",
            stringBuilder
        }));
    }
 private void UnserializeModeCharacterController(P2PNetworkReader reader, bool initial_state)
 {
     if (this.m_MoveCallback3D != null)
     {
         Vector3    targetSyncPosition   = reader.ReadVector3();
         Quaternion targetSyncRotation3D = Quaternion.identity;
         if (this.syncRotationAxis != ReplicatedTransform.AxisSyncMode.None)
         {
             targetSyncRotation3D = ReplicatedTransform.UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
         }
         Vector3 targetSyncVelocity = (this.m_CharacterController != null) ? this.m_CharacterController.velocity : Vector3.zero;
         if (!this.m_MoveCallback3D(ref targetSyncPosition, ref targetSyncVelocity, ref targetSyncRotation3D))
         {
             return;
         }
         this.m_TargetSyncPosition = targetSyncPosition;
         this.m_TargetSyncVelocity = targetSyncVelocity;
         if (this.syncRotationAxis != ReplicatedTransform.AxisSyncMode.None)
         {
             this.m_TargetSyncRotation3D = targetSyncRotation3D;
         }
     }
     else
     {
         this.m_TargetSyncPosition = reader.ReadVector3();
         if (this.syncRotationAxis != ReplicatedTransform.AxisSyncMode.None)
         {
             this.m_TargetSyncRotation3D = ReplicatedTransform.UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
         }
     }
     if (this.m_CharacterController != null)
     {
         if (initial_state || this.ReplGetReplicationInterval() <= 0f)
         {
             base.transform.position = this.m_TargetSyncPosition;
             if (this.syncRotationAxis != ReplicatedTransform.AxisSyncMode.None)
             {
                 base.transform.rotation = this.m_TargetSyncRotation3D;
             }
             this.m_FixedPosDiff = Vector3.zero;
             return;
         }
         Vector3 a = (this.m_TargetSyncPosition - base.transform.position) / this.ReplGetReplicationInterval();
         this.m_FixedPosDiff = a * Time.fixedDeltaTime;
         if ((base.transform.position - this.m_TargetSyncPosition).magnitude > this.snapThreshold)
         {
             base.transform.position = this.m_TargetSyncPosition;
             this.m_FixedPosDiff     = Vector3.zero;
         }
         if (this.interpolateRotation == 0f && this.syncRotationAxis != ReplicatedTransform.AxisSyncMode.None)
         {
             base.transform.rotation = this.m_TargetSyncRotation3D;
         }
         if (this.m_InterpolateMovement == 0f)
         {
             base.transform.position = this.m_TargetSyncPosition;
         }
     }
 }
 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();
     }
 }
Esempio n. 11
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();
 }
Esempio n. 12
0
 protected void HandleReader(P2PNetworkReader reader, int received_size, int channel_id)
 {
     while ((ulong)reader.Position < (ulong)((long)received_size))
     {
         ushort num      = reader.ReadUInt16();
         short  num2     = reader.ReadInt16();
         uint   position = reader.Position;
         reader.SetGuard(position + (uint)num);
         P2PConnection.s_Size = position + (uint)num;
         if (this.m_LogNetworkMessages)
         {
             Debug.Log(string.Concat(new object[]
             {
                 "ConnectionRecv con:",
                 this.m_ConnectionId,
                 " bytes:",
                 num,
                 " msgId:",
                 num2
             }));
         }
         List <P2PNetworkMessageDelegate> list = null;
         if (this.m_MessageHandlersDict.ContainsKey(num2))
         {
             list = this.m_MessageHandlersDict[num2];
         }
         if (list != null)
         {
             this.m_NetMsg.m_MsgType    = num2;
             this.m_NetMsg.m_Reader     = reader;
             this.m_NetMsg.m_Connection = this;
             this.m_NetMsg.m_ChannelId  = channel_id;
             for (int i = 0; i < list.Count; i++)
             {
                 list[i](this.m_NetMsg);
             }
             this.m_LastMessageTime = Time.time;
         }
         else if (P2PLogFilter.logError)
         {
             Debug.LogError(string.Format("Unknown message type {0} connection id: {1}", P2PMsgType.MsgTypeToString(num2), this.m_ConnectionId));
         }
         if (position + (uint)num != reader.Position)
         {
             int num3 = (int)(position + (uint)num - reader.Position);
             if (num3 > 0 && P2PLogFilter.logInfo)
             {
                 Debug.Log(string.Format("Message {0} conn_id: {1} was not fully read, performing seek by {2} bytes", P2PMsgType.MsgTypeToString(num2), this.m_ConnectionId, num3));
             }
             if (num3 < 0 && P2PLogFilter.logError)
             {
                 Debug.LogError(string.Format("Message {0} conn_id: {1} reading over the buffer limit (this is really bad), performing seek by {2} bytes", P2PMsgType.MsgTypeToString(num2), this.m_ConnectionId, num3));
             }
             reader.Seek(num3);
         }
         reader.RemoveGuard();
     }
 }
Esempio n. 13
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;
     }
 }
Esempio n. 14
0
    public override void Deserialize(P2PNetworkReader reader)
    {
        int num = (int)reader.ReadUInt16();

        this.scripts = new P2PCRCMessageEntry[num];
        for (int i = 0; i < this.scripts.Length; i++)
        {
            P2PCRCMessageEntry p2PCRCMessageEntry = default(P2PCRCMessageEntry);
            p2PCRCMessageEntry.name    = reader.ReadString();
            p2PCRCMessageEntry.channel = reader.ReadByte();
            this.scripts[i]            = p2PCRCMessageEntry;
        }
    }
    public virtual void OnReplicationDeserialize_CJGenerated(P2PNetworkReader reader, bool initial_state)
    {
        int num = (int)reader.ReadPackedUInt32();

        if (this.m_Rotation_Repl == null || this.m_Rotation_Repl.Length != num)
        {
            this.m_Rotation_Repl = new float[num];
        }
        for (int i = 0; i < num; i++)
        {
            this.m_Rotation_Repl[i] = reader.ReadFloat();
        }
    }
Esempio n. 16
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();
 }
Esempio n. 17
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initialState)
 {
     if (!initialState)
     {
         uint num  = reader.ReadPackedUInt32();
         int  num2 = 0;
         while ((long)num2 < (long)((ulong)num))
         {
             StaticObjectsManager.Get().ObjectDestroyed(reader.ReadVector3());
             num2++;
         }
     }
 }
    private static float ReadAngle(P2PNetworkReader reader, ReplicatedTransform.CompressionSyncMode compression)
    {
        switch (compression)
        {
        case ReplicatedTransform.CompressionSyncMode.None:
            return(reader.ReadFloat());

        case ReplicatedTransform.CompressionSyncMode.Low:
            return((float)reader.ReadInt16());

        case ReplicatedTransform.CompressionSyncMode.High:
            return((float)reader.ReadInt16());

        default:
            return(0f);
        }
    }
Esempio n. 19
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     if (initial_state)
     {
         foreach (GameObject obj in this.m_ReplacedMap.Values)
         {
             UnityEngine.Object.Destroy(obj);
         }
         this.m_ReplacedMap.Clear();
         this.m_ObjectsRemovedFromStatic.Clear();
         this.EnableObjectsInQuadTree();
         List <Vector3> allPoints = this.m_DestroyedObjects.GetAllPoints();
         for (int i = 0; i < allPoints.Count; i++)
         {
             StaticObjectClass objectsInPos = this.m_QuadTree.GetObjectsInPos(allPoints[i]);
             if (objectsInPos != null && objectsInPos.m_GameObject != null)
             {
                 objectsInPos.m_GameObject.SetActive(true);
                 if (objectsInPos.m_GameObject.transform.parent != null)
                 {
                     objectsInPos.m_GameObject.transform.parent.gameObject.SetActive(true);
                 }
                 objectsInPos.m_State = 0;
             }
         }
         this.m_DestroyedObjects.Clear();
         ushort num = reader.ReadUInt16();
         for (int j = 0; j < (int)num; j++)
         {
             Vector3           vector        = reader.ReadVector3();
             StaticObjectClass objectsInPos2 = this.m_QuadTree.GetObjectsInPos(vector);
             if (objectsInPos2 != null && objectsInPos2.m_GameObject != null)
             {
                 objectsInPos2.m_GameObject.SetActive(false);
                 if (objectsInPos2.m_GameObject.transform.parent != null)
                 {
                     objectsInPos2.m_GameObject.transform.parent.gameObject.SetActive(false);
                 }
             }
             this.m_DestroyedObjects.InsertPoint(vector, false);
         }
         ObjectWithTrunk.OnLoad();
         this.OnLoaded();
     }
 }
    public static Quaternion UnserializeRotation3D(P2PNetworkReader reader, ReplicatedTransform.AxisSyncMode mode, ReplicatedTransform.CompressionSyncMode compression)
    {
        Quaternion identity = Quaternion.identity;
        Vector3    zero     = Vector3.zero;

        switch (mode)
        {
        case ReplicatedTransform.AxisSyncMode.AxisX:
            zero.Set(ReplicatedTransform.ReadAngle(reader, compression), 0f, 0f);
            identity.eulerAngles = zero;
            break;

        case ReplicatedTransform.AxisSyncMode.AxisY:
            zero.Set(0f, ReplicatedTransform.ReadAngle(reader, compression), 0f);
            identity.eulerAngles = zero;
            break;

        case ReplicatedTransform.AxisSyncMode.AxisZ:
            zero.Set(0f, 0f, ReplicatedTransform.ReadAngle(reader, compression));
            identity.eulerAngles = zero;
            break;

        case ReplicatedTransform.AxisSyncMode.AxisXY:
            zero.Set(ReplicatedTransform.ReadAngle(reader, compression), ReplicatedTransform.ReadAngle(reader, compression), 0f);
            identity.eulerAngles = zero;
            break;

        case ReplicatedTransform.AxisSyncMode.AxisXZ:
            zero.Set(ReplicatedTransform.ReadAngle(reader, compression), 0f, ReplicatedTransform.ReadAngle(reader, compression));
            identity.eulerAngles = zero;
            break;

        case ReplicatedTransform.AxisSyncMode.AxisYZ:
            zero.Set(0f, ReplicatedTransform.ReadAngle(reader, compression), ReplicatedTransform.ReadAngle(reader, compression));
            identity.eulerAngles = zero;
            break;

        case ReplicatedTransform.AxisSyncMode.AxisXYZ:
            zero.Set(ReplicatedTransform.ReadAngle(reader, compression), ReplicatedTransform.ReadAngle(reader, compression), ReplicatedTransform.ReadAngle(reader, compression));
            identity.eulerAngles = zero;
            break;
        }
        return(identity);
    }
Esempio n. 21
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();
 }
Esempio n. 22
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 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();
            }
        }
    }
 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++;
         }
     }
 }
    private void UnserializeModeTransform(P2PNetworkReader reader, bool initial_state)
    {
        if (initial_state)
        {
            this.m_TargetSyncPosition = (base.transform.position = reader.ReadVector3());
            if (this.syncRotationAxis != ReplicatedTransform.AxisSyncMode.None)
            {
                this.m_TargetSyncRotation3D = (base.transform.rotation = ReplicatedTransform.UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression));
            }
            this.m_FixedPosDiff = Vector3.zero;
            return;
        }
        this.m_TargetSyncPosition = reader.ReadVector3();
        if (this.syncRotationAxis != ReplicatedTransform.AxisSyncMode.None)
        {
            this.m_TargetSyncRotation3D = ReplicatedTransform.UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
        }
        Vector3 a = (this.m_TargetSyncPosition - base.transform.position) / this.ReplGetReplicationInterval();

        this.m_FixedPosDiff = a * Time.fixedDeltaTime;
    }
    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);
            }
        }
    }
Esempio n. 27
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     if (!initial_state)
     {
         uint num  = reader.ReadPackedUInt32();
         int  num2 = 0;
         while ((long)num2 < (long)((ulong)num))
         {
             ReplicatedBalanceObjects.s_TmpObjHolder.Deserialize(reader);
             BalanceSystem20.Get().OnBalanceSystemObjectReplReceived(ReplicatedBalanceObjects.s_TmpObjHolder, false);
             num2++;
         }
         num = reader.ReadPackedUInt32();
         int num3 = 0;
         while ((long)num3 < (long)((ulong)num))
         {
             ReplicatedBalanceObjects.s_TmpObjHolder.Deserialize(reader);
             BalanceSystem20.Get().OnBalanceSystemObjectReplReceived(ReplicatedBalanceObjects.s_TmpObjHolder, true);
             num3++;
         }
     }
 }
    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");
            }
        }
    }
Esempio n. 29
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);
        }
    public static Vector3 UnserializeSpin3D(P2PNetworkReader reader, ReplicatedTransform.AxisSyncMode mode, ReplicatedTransform.CompressionSyncMode compression)
    {
        Vector3 zero = Vector3.zero;

        switch (mode)
        {
        case ReplicatedTransform.AxisSyncMode.AxisX:
            zero.Set(ReplicatedTransform.ReadAngle(reader, compression), 0f, 0f);
            break;

        case ReplicatedTransform.AxisSyncMode.AxisY:
            zero.Set(0f, ReplicatedTransform.ReadAngle(reader, compression), 0f);
            break;

        case ReplicatedTransform.AxisSyncMode.AxisZ:
            zero.Set(0f, 0f, ReplicatedTransform.ReadAngle(reader, compression));
            break;

        case ReplicatedTransform.AxisSyncMode.AxisXY:
            zero.Set(ReplicatedTransform.ReadAngle(reader, compression), ReplicatedTransform.ReadAngle(reader, compression), 0f);
            break;

        case ReplicatedTransform.AxisSyncMode.AxisXZ:
            zero.Set(ReplicatedTransform.ReadAngle(reader, compression), 0f, ReplicatedTransform.ReadAngle(reader, compression));
            break;

        case ReplicatedTransform.AxisSyncMode.AxisYZ:
            zero.Set(0f, ReplicatedTransform.ReadAngle(reader, compression), ReplicatedTransform.ReadAngle(reader, compression));
            break;

        case ReplicatedTransform.AxisSyncMode.AxisXYZ:
            zero.Set(ReplicatedTransform.ReadAngle(reader, compression), ReplicatedTransform.ReadAngle(reader, compression), ReplicatedTransform.ReadAngle(reader, compression));
            break;
        }
        return(zero);
    }