예제 #1
0
        private void LoadAudio()
        {
            foreach (var path in AudioPath)
            {
                AudioClip obj = Resources.Load <AudioClip>(path);

                if (AudioContainers.ContainsKey(obj.name))
                {
                    throw new System.Exception($"存在重名文件{obj.name}!");
                }

                AudioContainers.Add(obj.name, obj);
            }
        }
예제 #2
0
        public override int Deserialize(byte[] data)
        {
            var bytesRead = base.Deserialize(data);

            using (var reader = new IOBinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                ContainerName = new audHashString(parent, reader.ReadUInt32());

                AudioContainers.Add(new audHashDesc(ContainerName,
                                                    bytesRead + ((int)reader.BaseStream.Position - 4)));

                FileName = new audHashString(parent, reader.ReadUInt32());

                WaveSlotNum = reader.ReadByte();
            }
            return(data.Length);
        }
예제 #3
0
        public override int Deserialize(byte[] data)
        {
            var bytesRead = base.Deserialize(data);

            using (BinaryReader reader =
                       new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                WaveSlotIndex = reader.ReadInt32();

                WaveA = new audWaveFile(
                    new audHashString(parent, reader.ReadUInt32()),
                    new audHashString(parent, reader.ReadUInt32()));

                AudioContainers.Add(WaveA.ContainerName, bytesRead + ((int)reader.BaseStream.Position - 8));

                WaveB = new audWaveFile(
                    new audHashString(parent, reader.ReadUInt32()),
                    new audHashString(parent, reader.ReadUInt32()));

                AudioContainers.Add(WaveB.ContainerName, bytesRead + ((int)reader.BaseStream.Position - 8));

                WaveC = new audWaveFile(
                    new audHashString(parent, reader.ReadUInt32()),
                    new audHashString(parent, reader.ReadUInt32()));

                AudioContainers.Add(WaveC.ContainerName, bytesRead + ((int)reader.BaseStream.Position - 8));

                WaveD = new audWaveFile(
                    new audHashString(parent, reader.ReadUInt32()),
                    new audHashString(parent, reader.ReadUInt32()));

                AudioContainers.Add(WaveD.ContainerName, bytesRead + ((int)reader.BaseStream.Position - 8));

                WaveE = new audWaveFile(
                    new audHashString(parent, reader.ReadUInt32()),
                    new audHashString(parent, reader.ReadUInt32()));

                AudioContainers.Add(WaveE.ContainerName, bytesRead + ((int)reader.BaseStream.Position - 8));

                WaveF = new audWaveFile(
                    new audHashString(parent, reader.ReadUInt32()),
                    new audHashString(parent, reader.ReadUInt32()));

                AudioContainers.Add(WaveF.ContainerName, bytesRead + ((int)reader.BaseStream.Position - 8));

                DataItem1 = new audGranularSoundData(reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadSingle());

                DataItem2 = new audGranularSoundData(reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadSingle());

                DataItem3 = new audGranularSoundData(reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadSingle());

                DataItem4 = new audGranularSoundData(reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadSingle());

                DataItem5 = new audGranularSoundData(reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadSingle());

                DataItem6 = new audGranularSoundData(reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadByte(),
                                                     reader.ReadSingle());

                UnkInt6 = reader.ReadInt32();

                UnkInt7 = reader.ReadInt32();

                UnkShort = reader.ReadUInt16();

                UnkShort1 = reader.ReadUInt16();

                UnkShort2 = reader.ReadUInt16();

                UnkShort3 = reader.ReadUInt16();

                UnkShort4 = reader.ReadUInt16();

                UnkShort5 = reader.ReadUInt16();

                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                var itemCount = reader.ReadByte();

                UnkFloatData = new Pair <float, float> [itemCount];

                for (int i = 0; i < itemCount; i++)
                {
                    UnkFloatData[i] = new Pair <float, float>(reader.ReadSingle(),
                                                              reader.ReadSingle());
                }

                return(data.Length);
            }
        }