Пример #1
0
        private void readFingers(ZPackage pkg)
        {
            for (int i = 0; i < 20; i++)
            {
                leftFingerRotations[i] = pkg.ReadQuaternion();
            }
            for (int i = 0; i < 20; i++)
            {
                rightFingerRotations[i] = pkg.ReadQuaternion();
            }

            fingersUpdated = true;
        }
Пример #2
0
        private void extractAndUpdate(ZPackage pkg, ref GameObject obj, ref Vector3 tempRelPos, bool hasTempRelPos)
        {
            // Extract package data
            var position = pkg.ReadVector3();
            var rotation = pkg.ReadQuaternion();
            var velocity = pkg.ReadVector3();

            // Update position based on last written position, velocity, and elapsed time since last data revision
            position += velocity * deltaTimeCounter;

            if (!hasTempRelPos)
            {
                tempRelPos = position;
            }

            if (Vector3.Distance(tempRelPos, position) > MIN_CHANGE)
            {
                tempRelPos = Vector3.Lerp(tempRelPos, position, 0.2f);
                position   = tempRelPos;
            }

            // Update the object position with new calculated position
            updatePosition(obj, position);

            // Update the rotation
            updateRotation(obj, rotation);
        }
Пример #3
0
    // Token: 0x06000793 RID: 1939 RVA: 0x0003BE94 File Offset: 0x0003A094
    public void Load(ZPackage pkg, int version)
    {
        this.m_ownerRevision = pkg.ReadUInt();
        this.m_dataRevision  = pkg.ReadUInt();
        this.m_persistent    = pkg.ReadBool();
        this.m_owner         = pkg.ReadLong();
        this.m_timeCreated   = pkg.ReadLong();
        this.m_pgwVersion    = pkg.ReadInt();
        if (version >= 16 && version < 24)
        {
            pkg.ReadInt();
        }
        if (version >= 23)
        {
            this.m_type = (ZDO.ObjectType)pkg.ReadSByte();
        }
        if (version >= 22)
        {
            this.m_distant = pkg.ReadBool();
        }
        if (version < 13)
        {
            pkg.ReadChar();
            pkg.ReadChar();
        }
        if (version >= 17)
        {
            this.m_prefab = pkg.ReadInt();
        }
        this.m_sector   = pkg.ReadVector2i();
        this.m_position = pkg.ReadVector3();
        this.m_rotation = pkg.ReadQuaternion();
        int num = (int)pkg.ReadChar();

        if (num > 0)
        {
            this.InitFloats();
            for (int i = 0; i < num; i++)
            {
                int key = pkg.ReadInt();
                this.m_floats[key] = pkg.ReadSingle();
            }
        }
        else
        {
            this.ReleaseFloats();
        }
        int num2 = (int)pkg.ReadChar();

        if (num2 > 0)
        {
            this.InitVec3();
            for (int j = 0; j < num2; j++)
            {
                int key2 = pkg.ReadInt();
                this.m_vec3[key2] = pkg.ReadVector3();
            }
        }
        else
        {
            this.ReleaseVec3();
        }
        int num3 = (int)pkg.ReadChar();

        if (num3 > 0)
        {
            this.InitQuats();
            for (int k = 0; k < num3; k++)
            {
                int key3 = pkg.ReadInt();
                this.m_quats[key3] = pkg.ReadQuaternion();
            }
        }
        else
        {
            this.ReleaseQuats();
        }
        int num4 = (int)pkg.ReadChar();

        if (num4 > 0)
        {
            this.InitInts();
            for (int l = 0; l < num4; l++)
            {
                int key4 = pkg.ReadInt();
                this.m_ints[key4] = pkg.ReadInt();
            }
        }
        else
        {
            this.ReleaseInts();
        }
        int num5 = (int)pkg.ReadChar();

        if (num5 > 0)
        {
            this.InitLongs();
            for (int m = 0; m < num5; m++)
            {
                int key5 = pkg.ReadInt();
                this.m_longs[key5] = pkg.ReadLong();
            }
        }
        else
        {
            this.ReleaseLongs();
        }
        int num6 = (int)pkg.ReadChar();

        if (num6 > 0)
        {
            this.InitStrings();
            for (int n = 0; n < num6; n++)
            {
                int key6 = pkg.ReadInt();
                this.m_strings[key6] = pkg.ReadString();
            }
        }
        else
        {
            this.ReleaseStrings();
        }
        if (version < 17)
        {
            this.m_prefab = this.GetInt("prefab", 0);
        }
    }
Пример #4
0
    // Token: 0x06000791 RID: 1937 RVA: 0x0003B918 File Offset: 0x00039B18
    public void Deserialize(ZPackage pkg)
    {
        this.m_persistent  = pkg.ReadBool();
        this.m_distant     = pkg.ReadBool();
        this.m_timeCreated = pkg.ReadLong();
        this.m_pgwVersion  = pkg.ReadInt();
        this.m_type        = (ZDO.ObjectType)pkg.ReadSByte();
        this.m_prefab      = pkg.ReadInt();
        this.m_rotation    = pkg.ReadQuaternion();
        int num = pkg.ReadInt();

        if ((num & 1) != 0)
        {
            this.InitFloats();
            int num2 = (int)pkg.ReadByte();
            for (int i = 0; i < num2; i++)
            {
                int key = pkg.ReadInt();
                this.m_floats[key] = pkg.ReadSingle();
            }
        }
        else
        {
            this.ReleaseFloats();
        }
        if ((num & 2) != 0)
        {
            this.InitVec3();
            int num3 = (int)pkg.ReadByte();
            for (int j = 0; j < num3; j++)
            {
                int key2 = pkg.ReadInt();
                this.m_vec3[key2] = pkg.ReadVector3();
            }
        }
        else
        {
            this.ReleaseVec3();
        }
        if ((num & 4) != 0)
        {
            this.InitQuats();
            int num4 = (int)pkg.ReadByte();
            for (int k = 0; k < num4; k++)
            {
                int key3 = pkg.ReadInt();
                this.m_quats[key3] = pkg.ReadQuaternion();
            }
        }
        else
        {
            this.ReleaseQuats();
        }
        if ((num & 8) != 0)
        {
            this.InitInts();
            int num5 = (int)pkg.ReadByte();
            for (int l = 0; l < num5; l++)
            {
                int key4 = pkg.ReadInt();
                this.m_ints[key4] = pkg.ReadInt();
            }
        }
        else
        {
            this.ReleaseInts();
        }
        if ((num & 64) != 0)
        {
            this.InitLongs();
            int num6 = (int)pkg.ReadByte();
            for (int m = 0; m < num6; m++)
            {
                int key5 = pkg.ReadInt();
                this.m_longs[key5] = pkg.ReadLong();
            }
        }
        else
        {
            this.ReleaseLongs();
        }
        if ((num & 16) != 0)
        {
            this.InitStrings();
            int num7 = (int)pkg.ReadByte();
            for (int n = 0; n < num7; n++)
            {
                int key6 = pkg.ReadInt();
                this.m_strings[key6] = pkg.ReadString();
            }
            return;
        }
        this.ReleaseStrings();
    }
Пример #5
0
    public void Load(ZPackage pkg, int version)
    {
        this.m_ownerRevision = pkg.ReadUInt();
        this.m_dataRevision  = pkg.ReadUInt();
        this.m_persistent    = pkg.ReadBool();
        this.m_owner         = pkg.ReadLong();
        this.m_timeCreated   = pkg.ReadLong();
        this.m_pgwVersion    = pkg.ReadInt();
        if (version >= 16 && version < 24)
        {
            pkg.ReadInt();
        }
        if (version >= 23)
        {
            this.m_type = (ZDO.ObjectType)pkg.ReadSByte();
        }
        if (version >= 22)
        {
            this.m_distant = pkg.ReadBool();
        }
        if (version < 13)
        {
            int num1 = (int)pkg.ReadChar();
            int num2 = (int)pkg.ReadChar();
        }
        if (version >= 17)
        {
            this.m_prefab = pkg.ReadInt();
        }
        this.m_sector   = pkg.ReadVector2i();
        this.m_position = pkg.ReadVector3();
        this.m_rotation = pkg.ReadQuaternion();
        int num3 = (int)pkg.ReadChar();

        if (num3 > 0)
        {
            this.InitFloats();
            for (int index = 0; index < num3; ++index)
            {
                this.m_floats[pkg.ReadInt()] = pkg.ReadSingle();
            }
        }
        else
        {
            this.ReleaseFloats();
        }
        int num4 = (int)pkg.ReadChar();

        if (num4 > 0)
        {
            this.InitVec3();
            for (int index = 0; index < num4; ++index)
            {
                this.m_vec3[pkg.ReadInt()] = pkg.ReadVector3();
            }
        }
        else
        {
            this.ReleaseVec3();
        }
        int num5 = (int)pkg.ReadChar();

        if (num5 > 0)
        {
            this.InitQuats();
            for (int index = 0; index < num5; ++index)
            {
                this.m_quats[pkg.ReadInt()] = pkg.ReadQuaternion();
            }
        }
        else
        {
            this.ReleaseQuats();
        }
        int num6 = (int)pkg.ReadChar();

        if (num6 > 0)
        {
            this.InitInts();
            for (int index = 0; index < num6; ++index)
            {
                this.m_ints[pkg.ReadInt()] = pkg.ReadInt();
            }
        }
        else
        {
            this.ReleaseInts();
        }
        int num7 = (int)pkg.ReadChar();

        if (num7 > 0)
        {
            this.InitLongs();
            for (int index = 0; index < num7; ++index)
            {
                this.m_longs[pkg.ReadInt()] = pkg.ReadLong();
            }
        }
        else
        {
            this.ReleaseLongs();
        }
        int num8 = (int)pkg.ReadChar();

        if (num8 > 0)
        {
            this.InitStrings();
            for (int index = 0; index < num8; ++index)
            {
                this.m_strings[pkg.ReadInt()] = pkg.ReadString();
            }
        }
        else
        {
            this.ReleaseStrings();
        }
        if (version >= 17)
        {
            return;
        }
        this.m_prefab = this.GetInt("prefab", 0);
    }
Пример #6
0
    public void Deserialize(ZPackage pkg)
    {
        this.m_persistent  = pkg.ReadBool();
        this.m_distant     = pkg.ReadBool();
        this.m_timeCreated = pkg.ReadLong();
        this.m_pgwVersion  = pkg.ReadInt();
        this.m_type        = (ZDO.ObjectType)pkg.ReadSByte();
        this.m_prefab      = pkg.ReadInt();
        this.m_rotation    = pkg.ReadQuaternion();
        int num1 = pkg.ReadInt();

        if ((num1 & 1) != 0)
        {
            this.InitFloats();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_floats[pkg.ReadInt()] = pkg.ReadSingle();
            }
        }
        else
        {
            this.ReleaseFloats();
        }
        if ((num1 & 2) != 0)
        {
            this.InitVec3();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_vec3[pkg.ReadInt()] = pkg.ReadVector3();
            }
        }
        else
        {
            this.ReleaseVec3();
        }
        if ((num1 & 4) != 0)
        {
            this.InitQuats();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_quats[pkg.ReadInt()] = pkg.ReadQuaternion();
            }
        }
        else
        {
            this.ReleaseQuats();
        }
        if ((num1 & 8) != 0)
        {
            this.InitInts();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_ints[pkg.ReadInt()] = pkg.ReadInt();
            }
        }
        else
        {
            this.ReleaseInts();
        }
        if ((num1 & 64) != 0)
        {
            this.InitLongs();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_longs[pkg.ReadInt()] = pkg.ReadLong();
            }
        }
        else
        {
            this.ReleaseLongs();
        }
        if ((num1 & 16) != 0)
        {
            this.InitStrings();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_strings[pkg.ReadInt()] = pkg.ReadString();
            }
        }
        else
        {
            this.ReleaseStrings();
        }
    }