/* * auto generated by tools(注意:千万不要手动修改本文件) * AudioObject */ using System; using System.IO; using System.Collections.Generic; using System.Text; namespace OCES.Audio { [Serializable] public partial class AudioObject : IBinarySerializable { /// /// 唯一ID /// public uint Id { get; set; } /// /// 文件名 /// public List Name { get; set; } /// /// 备注 /// public string Comment { get; set; } /// /// 初始延迟 /// 单位秒 /// public float InitialDelay { get; set; } /// /// -1 = 无限循环 /// 0 = 不循环 /// >= 1 按次数循环 /// public short LoopCount { get; set; } /// /// 0 = SFX /// 1 = Muisc /// 2 = Voice /// 3 = Accent /// public MixingType MixingType { get; set; } /// /// 发音分组 /// public uint Group { get; set; } /// /// 同时发音数限制 /// public ushort ThrottleCount { get; set; } /// /// 最小发音间隔 /// public ushort MinInterval { get; set; } /// /// 优先级 /// public byte Priority { get; set; } /// /// 打断模式 /// 0 = 打断最早 /// 1 = 打断最新 /// public KillMode KillMode { get; set; } /// /// Pitch Step阈值 ms /// public uint PitchStepThreshold { get; set; } /// /// 阶段变化半音数 /// public sbyte PitchStep { get; set; } /// /// step几步后就不再继续提升音高 /// public byte PitchStepLimit { get; set; } /// /// 相关的触感反馈ID /// public uint Haptic { get; set; } /// /// 0 = 随机播放 /// 1 = 顺序播放 /// 2 = 混合播放 /// public ContainerType ContainerType { get; set; } /// /// 0 = 步进 /// 1 = 持续 /// public bool ContainerPlayMode { get; set; } /// /// 按段落配置每段响应范围,用|分隔不同段落 /// public string BlendRanges { get; set; } /// /// 0 = 指数 /// 1 = 线形 /// 2 = 对数 /// public BlendCrossFadeType BlendCrossFadeType { get; set; } /// /// 指定避免重复的次数 /// public byte LimitRepetition { get; set; } /// /// 0 = Standard /// 1 = Shuffle /// public bool RandomType { get; set; } public void DeSerialize(BinaryReader reader) { Id = reader.ReadUInt32(); var nameCount = reader.ReadInt32(); if (nameCount > 0) { Name = new List(); for (int i = 0; i < nameCount; i++) { Name.Add(reader.ReadString()); } } else { Name = null; } Comment = reader.ReadString(); InitialDelay = reader.ReadSingle(); LoopCount = reader.ReadInt16(); MixingType = (MixingType)reader.ReadByte(); Group = reader.ReadUInt32(); ThrottleCount = reader.ReadUInt16(); MinInterval = reader.ReadUInt16(); Priority = reader.ReadByte(); KillMode = (KillMode)reader.ReadByte(); PitchStepThreshold = reader.ReadUInt32(); PitchStep = reader.ReadSByte(); PitchStepLimit = reader.ReadByte(); Haptic = reader.ReadUInt32(); ContainerType = (ContainerType)reader.ReadByte(); ContainerPlayMode = reader.ReadBoolean(); BlendRanges = reader.ReadString(); BlendCrossFadeType = (BlendCrossFadeType)reader.ReadByte(); LimitRepetition = reader.ReadByte(); RandomType = reader.ReadBoolean(); } public void Serialize(BinaryWriter writer) { writer.Write(Id); if (Name == null || Name.Count == 0) { writer.Write(0); } else { writer.Write(Name.Count); foreach (var t in Name) { writer.Write(t); } } writer.Write(Comment); writer.Write(InitialDelay); writer.Write(LoopCount); writer.Write((byte)MixingType); writer.Write(Group); writer.Write(ThrottleCount); writer.Write(MinInterval); writer.Write(Priority); writer.Write((byte)KillMode); writer.Write(PitchStepThreshold); writer.Write(PitchStep); writer.Write(PitchStepLimit); writer.Write(Haptic); writer.Write((byte)ContainerType); writer.Write(ContainerPlayMode); writer.Write(BlendRanges); writer.Write((byte)BlendCrossFadeType); writer.Write(LimitRepetition); writer.Write(RandomType); } } [Serializable] public partial class AudioObjectConfig : IBinarySerializable { Dictionary m_audioObjectInfos = new(); List m_audioObjectInfoList; public List AudioObjectList() { this.m_audioObjectInfoList ??= new List(this.m_audioObjectInfos.Values); return this.m_audioObjectInfoList; } public void DeSerialize(BinaryReader reader) { int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { AudioObject tempData = new(); tempData.DeSerialize(reader); this.m_audioObjectInfos.Add(tempData.Id, tempData); } } public void Serialize(BinaryWriter writer) { writer.Write(this.m_audioObjectInfos.Count); foreach (AudioObject audioObject in this.m_audioObjectInfos.Values) { audioObject.Serialize(writer); } } public AudioObject QueryById(uint id) { return this.m_audioObjectInfos.GetValueOrDefault(id); } } }