89c024e781
- Add AudioObjectDefinitions.cs with name-to-ID mappings and ambiguity detection - Update AudioSystem.cs to support Play(uint) and deprecated Play(string) with warnings - Rename PitchStepManager to PitchStepResolver and update all references - Refactor generated code to use 'this.' prefix and foreach loops - Remove TestEnum from audio enums and IDs - Update SampleScene.unity to use new AudioSystem namespace and rain sound parameter - Optimize binary serialization in generated audio classes
77 lines
1.5 KiB
C#
77 lines
1.5 KiB
C#
/*
|
|
* auto generated by tools(注意:千万不要手动修改本文件)
|
|
* MusicSegment
|
|
*/
|
|
using System;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace OCES.Audio
|
|
{
|
|
[Serializable]
|
|
public partial class MusicSegment : IBinarySerializable
|
|
{
|
|
/// <summary>
|
|
/// 唯一ID
|
|
/// </summary>
|
|
public uint Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// 指向的文件名
|
|
/// </summary>
|
|
public string Name { get; set; }
|
|
|
|
|
|
public void DeSerialize(BinaryReader reader)
|
|
{
|
|
Id = reader.ReadUInt32();
|
|
Name = reader.ReadString();
|
|
}
|
|
|
|
public void Serialize(BinaryWriter writer)
|
|
{
|
|
writer.Write(Id);
|
|
writer.Write(Name);
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public partial class MusicSegmentConfig : IBinarySerializable
|
|
{
|
|
Dictionary<uint,MusicSegment> m_musicSegmentInfos = new();
|
|
List<MusicSegment> m_musicSegmentInfoList;
|
|
|
|
public List<MusicSegment> MusicSegmentList()
|
|
{
|
|
this.m_musicSegmentInfoList ??= new List<MusicSegment>(this.m_musicSegmentInfos.Values);
|
|
return this.m_musicSegmentInfoList;
|
|
}
|
|
|
|
public void DeSerialize(BinaryReader reader)
|
|
{
|
|
int count = reader.ReadInt32();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
MusicSegment tempData = new();
|
|
tempData.DeSerialize(reader);
|
|
this.m_musicSegmentInfos.Add(tempData.Id, tempData);
|
|
}
|
|
}
|
|
|
|
public void Serialize(BinaryWriter writer)
|
|
{
|
|
writer.Write(this.m_musicSegmentInfos.Count);
|
|
foreach (MusicSegment musicSegment in this.m_musicSegmentInfos.Values)
|
|
{
|
|
musicSegment.Serialize(writer);
|
|
}
|
|
}
|
|
|
|
public MusicSegment QueryById(uint id)
|
|
{
|
|
return this.m_musicSegmentInfos.GetValueOrDefault(id);
|
|
}
|
|
}
|
|
}
|