예제 #1
0
        public static SandboxLayoutData DeserializeLayoutBytes(byte[] bytes, ref int offset)
        {
            SandboxLayoutData layoutData = new SandboxLayoutData();

            layoutData.m_Version = ByteSerializer.DeserializeInt(bytes, ref offset);
            if (layoutData.m_Version < 0)
            {
                layoutData.m_Version *= -1;
            }
            layoutData.m_ThemeStubKey = ByteSerializer.DeserializeString(bytes, ref offset);
            if (layoutData.m_Version >= 19)
            {
                int num1 = ByteSerializer.DeserializeInt(bytes, ref offset);
                for (int i = 0; i < num1; i++)
                {
                    layoutData.m_Anchors.Add(new BridgeJointProxy(layoutData.m_Version, bytes, ref offset));
                }
            }
            if (layoutData.m_Version >= 5)
            {
                int num2 = ByteSerializer.DeserializeInt(bytes, ref offset);
                for (int i = 0; i < num2; i++)
                {
                    layoutData.m_HydraulicsPhases.Add(new HydraulicsPhaseProxy(bytes, ref offset));
                }
            }
            if (layoutData.m_Version > 4)
            {
                layoutData.m_Bridge.DeserializeBinary(bytes, ref offset);
                goto LABEL;
            }
            int num3 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num3; i++)
            {
                layoutData.m_BridgeJoints.Add(new BridgeJointProxy(1, bytes, ref offset));
            }
            int num4 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num4; i++)
            {
                layoutData.m_BridgeEdges.Add(new BridgeEdgeProxy(bytes, ref offset));
            }
            int num5 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num5; i++)
            {
                layoutData.m_Pistons.Add(new PistonProxy(layoutData.m_Version, bytes, ref offset));
            }
LABEL:
            if (layoutData.m_Version >= 7)
            {
                int num6 = ByteSerializer.DeserializeInt(bytes, ref offset);
                for (int i = 0; i < num6; i++)
                {
                    layoutData.m_ZedAxisVehicles.Add(new ZedAxisVehicleProxy(layoutData.m_Version, bytes, ref offset));
                }
            }
            int num7 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num7; i++)
            {
                layoutData.m_Vehicles.Add(new VehicleProxy(bytes, ref offset));
            }
            int num8 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num8; i++)
            {
                layoutData.m_VehicleStopTriggers.Add(new VehicleStopTriggerProxy(bytes, ref offset));
            }
            if (layoutData.m_Version < 20)
            {
                int num9 = ByteSerializer.DeserializeInt(bytes, ref offset);
                for (int i = 0; i < num9; i++)
                {
                    ByteSerializer.DeserializeVector2(bytes, ref offset);
                    ByteSerializer.DeserializeString(bytes, ref offset);
                    ByteSerializer.DeserializeBool(bytes, ref offset);
                }
            }
            int num10 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num10; i++)
            {
                layoutData.m_EventTimelines.Add(new EventTimelineProxy(layoutData.m_Version, bytes, ref offset));
            }
            int num11 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num11; i++)
            {
                layoutData.m_Checkpoints.Add(new CheckpointProxy(bytes, ref offset));
            }
            int num12 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num12; i++)
            {
                layoutData.m_TerrainStretches.Add(new TerrainIslandProxy(layoutData.m_Version, bytes, ref offset));
            }
            int num13 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num13; i++)
            {
                layoutData.m_Platforms.Add(new PlatformProxy(layoutData.m_Version, bytes, ref offset));
            }
            int num14 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num14; i++)
            {
                layoutData.m_Ramps.Add(new RampProxy(layoutData.m_Version, bytes, ref offset));
            }
            if (layoutData.m_Version < 5)
            {
                int num15 = ByteSerializer.DeserializeInt(bytes, ref offset);
                for (int i = 0; i < num15; i++)
                {
                    layoutData.m_HydraulicsPhases.Add(new HydraulicsPhaseProxy(bytes, ref offset));
                }
            }
            int num16 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num16; i++)
            {
                layoutData.m_VehicleRestartPhases.Add(new VehicleRestartPhaseProxy(bytes, ref offset));
            }
            int num17 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num17; i++)
            {
                layoutData.m_FlyingObjects.Add(new FlyingObjectProxy(bytes, ref offset));
            }
            int num18 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num18; i++)
            {
                layoutData.m_Rocks.Add(new RockProxy(bytes, ref offset));
            }
            int num19 = ByteSerializer.DeserializeInt(bytes, ref offset);

            for (int i = 0; i < num19; i++)
            {
                layoutData.m_WaterBlocks.Add(new WaterBlockProxy(layoutData.m_Version, bytes, ref offset));
            }
            if (layoutData.m_Version < 5)
            {
                int num20 = ByteSerializer.DeserializeInt(bytes, ref offset);
                for (int i = 0; i < num20; i++)
                {
                    ByteSerializer.DeserializeString(bytes, ref offset);
                    int num21 = ByteSerializer.DeserializeInt(bytes, ref offset);
                    for (int j = 0; j < num21; j++)
                    {
                        ByteSerializer.DeserializeString(bytes, ref offset);
                    }
                }
            }
            layoutData.m_Budget.DeserializeBinary(bytes, ref offset);
            layoutData.m_Settings.DeserializeBinary(bytes, ref offset);
            if (layoutData.m_Version >= 9)
            {
                int num22 = ByteSerializer.DeserializeInt(bytes, ref offset);
                for (int i = 0; i < num22; i++)
                {
                    layoutData.m_CustomShapes.Add(new CustomShapeProxy(layoutData.m_Version, bytes, ref offset));
                }
            }
            if (layoutData.m_Version >= 15)
            {
                layoutData.m_Workshop.DeserializeBinary(layoutData.m_Version, bytes, ref offset);
            }
            if (layoutData.m_Version >= 17)
            {
                int num23 = ByteSerializer.DeserializeInt(bytes, ref offset);
                for (int i = 0; i < num23; i++)
                {
                    layoutData.m_SupportPillars.Add(new SupportPillarProxy(bytes, ref offset));
                }
            }
            if (layoutData.m_Version >= 18)
            {
                int num24 = ByteSerializer.DeserializeInt(bytes, ref offset);
                for (int i = 0; i < num24; i++)
                {
                    layoutData.m_Pillars.Add(new PillarProxy(bytes, ref offset));
                }
            }
            return(layoutData);
        }