Пример #1
0
        public void writeGUID(Guid GUID)
        {
            GuidBuffer guidBuffer = new GuidBuffer(GUID);

            guidBuffer.Write(GuidBuffer.GUID_BUFFER, 0);
            this.writeBytes(GuidBuffer.GUID_BUFFER);
        }
Пример #2
0
        // Token: 0x06000CE4 RID: 3300 RVA: 0x0005EE24 File Offset: 0x0005D224
        public virtual void writeInstances()
        {
            string path = string.Concat(new object[]
            {
                Level.info.path,
                "/Foliage/Tile_",
                this.coord.x,
                "_",
                this.coord.y,
                ".foliage"
            });
            string directoryName = Path.GetDirectoryName(path);

            if (!Directory.Exists(directoryName))
            {
                Directory.CreateDirectory(directoryName);
            }
            using (FileStream fileStream = new FileStream(path, FileMode.OpenOrCreate))
            {
                BinaryWriter binaryWriter = new BinaryWriter(fileStream);
                binaryWriter.Write(FoliageTile.FOLIAGE_FILE_VERSION);
                binaryWriter.Write(this.instances.Count);
                foreach (KeyValuePair <AssetReference <FoliageInstancedMeshInfoAsset>, FoliageInstanceList> keyValuePair in this.instances)
                {
                    GuidBuffer guidBuffer  = new GuidBuffer(keyValuePair.Key.GUID);
                    object     guid_BUFFER = GuidBuffer.GUID_BUFFER;
                    lock (guid_BUFFER)
                    {
                        guidBuffer.Write(GuidBuffer.GUID_BUFFER, 0);
                        fileStream.Write(GuidBuffer.GUID_BUFFER, 0, 16);
                    }
                    int num = 0;
                    foreach (List <Matrix4x4> list in keyValuePair.Value.matrices)
                    {
                        num += list.Count;
                    }
                    binaryWriter.Write(num);
                    for (int i = 0; i < keyValuePair.Value.matrices.Count; i++)
                    {
                        List <Matrix4x4> list2 = keyValuePair.Value.matrices[i];
                        List <bool>      list3 = keyValuePair.Value.clearWhenBaked[i];
                        for (int j = 0; j < list2.Count; j++)
                        {
                            Matrix4x4 matrix4x = list2[j];
                            for (int k = 0; k < 16; k++)
                            {
                                binaryWriter.Write(matrix4x[k]);
                            }
                            bool value = list3[j];
                            binaryWriter.Write(value);
                        }
                    }
                }
            }
            this.canSafelyClear = true;
        }