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
91 lines
1.9 KiB
C#
91 lines
1.9 KiB
C#
/*
|
|
* auto generated by tools(注意:千万不要手动修改本文件)
|
|
* MusicPath
|
|
*/
|
|
using System;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace OCES.Audio
|
|
{
|
|
[Serializable]
|
|
public partial class MusicPath : IBinarySerializable
|
|
{
|
|
/// <summary>
|
|
/// 从1开始的int
|
|
/// </summary>
|
|
public uint Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// 在此定义path。格式为: TypeID1,子状态|TypeID2,子状态…… 无需判断的TypeID无需填写。
|
|
/// </summary>
|
|
public string Path { get; set; }
|
|
|
|
/// <summary>
|
|
/// 此处填写该Path要播放的ContainerID
|
|
/// </summary>
|
|
public uint ContainerId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 该条规则的优先级
|
|
/// </summary>
|
|
public int Priority { get; set; }
|
|
|
|
|
|
public void DeSerialize(BinaryReader reader)
|
|
{
|
|
Id = reader.ReadUInt32();
|
|
Path = reader.ReadString();
|
|
ContainerId = reader.ReadUInt32();
|
|
Priority = reader.ReadInt32();
|
|
}
|
|
|
|
public void Serialize(BinaryWriter writer)
|
|
{
|
|
writer.Write(Id);
|
|
writer.Write(Path);
|
|
writer.Write(ContainerId);
|
|
writer.Write(Priority);
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public partial class MusicPathConfig : IBinarySerializable
|
|
{
|
|
Dictionary<uint,MusicPath> m_musicPathInfos = new();
|
|
List<MusicPath> m_musicPathInfoList;
|
|
|
|
public List<MusicPath> MusicPathList()
|
|
{
|
|
this.m_musicPathInfoList ??= new List<MusicPath>(this.m_musicPathInfos.Values);
|
|
return this.m_musicPathInfoList;
|
|
}
|
|
|
|
public void DeSerialize(BinaryReader reader)
|
|
{
|
|
int count = reader.ReadInt32();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
MusicPath tempData = new();
|
|
tempData.DeSerialize(reader);
|
|
this.m_musicPathInfos.Add(tempData.Id, tempData);
|
|
}
|
|
}
|
|
|
|
public void Serialize(BinaryWriter writer)
|
|
{
|
|
writer.Write(this.m_musicPathInfos.Count);
|
|
foreach (MusicPath musicPath in this.m_musicPathInfos.Values)
|
|
{
|
|
musicPath.Serialize(writer);
|
|
}
|
|
}
|
|
|
|
public MusicPath QueryById(uint id)
|
|
{
|
|
return this.m_musicPathInfos.GetValueOrDefault(id);
|
|
}
|
|
}
|
|
}
|