first commit
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* auto generated by tools(注意:千万不要手动修改本文件)
|
||||
* AmbiencePath
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OCES.Audio
|
||||
{
|
||||
[Serializable]
|
||||
public partial class AmbiencePath : 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 AmbiencePathConfig : IBinarySerializable
|
||||
{
|
||||
Dictionary<uint,AmbiencePath> m_ambiencePathInfos = new();
|
||||
List<AmbiencePath> m_ambiencePathInfoList;
|
||||
|
||||
public List<AmbiencePath> AmbiencePathList()
|
||||
{
|
||||
this.m_ambiencePathInfoList ??= new List<AmbiencePath>(m_ambiencePathInfos.Values);
|
||||
return this.m_ambiencePathInfoList;
|
||||
}
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
int count = reader.ReadInt32();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
AmbiencePath tempData = new();
|
||||
tempData.DeSerialize(reader);
|
||||
this.m_ambiencePathInfos.Add(tempData.Id, tempData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(this.m_ambiencePathInfos.Count);
|
||||
foreach (AmbiencePath ambiencePath in this.m_ambiencePathInfos.Values)
|
||||
{
|
||||
ambiencePath.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public AmbiencePath QueryById(uint id)
|
||||
{
|
||||
return this.m_ambiencePathInfos.GetValueOrDefault(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a691dddb740446e2b3cdf251196e64f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* auto generated by tools(注意:千万不要手动修改本文件)
|
||||
* AmbienceTransition
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OCES.Audio
|
||||
{
|
||||
[Serializable]
|
||||
public partial class AmbienceTransition : IBinarySerializable
|
||||
{
|
||||
/// <summary>
|
||||
/// FromPathId x 1000 + ToPathId
|
||||
/// </summary>
|
||||
public uint Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 淡出总时长(s)
|
||||
/// </summary>
|
||||
public float FadeOutTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// source的段尾偏移量(s)
|
||||
/// </summary>
|
||||
public float FadeOutOffset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 淡入总时长(s)
|
||||
/// </summary>
|
||||
public float FadeInTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Destination段首偏移量(s)
|
||||
/// </summary>
|
||||
public float FadeInOffset { get; set; }
|
||||
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
Id = reader.ReadUInt32();
|
||||
FadeOutTime = reader.ReadSingle();
|
||||
FadeOutOffset = reader.ReadSingle();
|
||||
FadeInTime = reader.ReadSingle();
|
||||
FadeInOffset = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(Id);
|
||||
writer.Write(FadeOutTime);
|
||||
writer.Write(FadeOutOffset);
|
||||
writer.Write(FadeInTime);
|
||||
writer.Write(FadeInOffset);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public partial class AmbienceTransitionConfig : IBinarySerializable
|
||||
{
|
||||
Dictionary<uint,AmbienceTransition> m_ambienceTransitionInfos = new();
|
||||
List<AmbienceTransition> m_ambienceTransitionInfoList;
|
||||
|
||||
public List<AmbienceTransition> AmbienceTransitionList()
|
||||
{
|
||||
this.m_ambienceTransitionInfoList ??= new List<AmbienceTransition>(m_ambienceTransitionInfos.Values);
|
||||
return this.m_ambienceTransitionInfoList;
|
||||
}
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
int count = reader.ReadInt32();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
AmbienceTransition tempData = new();
|
||||
tempData.DeSerialize(reader);
|
||||
this.m_ambienceTransitionInfos.Add(tempData.Id, tempData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(this.m_ambienceTransitionInfos.Count);
|
||||
foreach (AmbienceTransition ambienceTransition in this.m_ambienceTransitionInfos.Values)
|
||||
{
|
||||
ambienceTransition.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public AmbienceTransition QueryById(uint id)
|
||||
{
|
||||
return this.m_ambienceTransitionInfos.GetValueOrDefault(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ad1fa2b6c6b04deeb200751afe832b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
using System.IO;
|
||||
|
||||
namespace OCES.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// 替换策略类型
|
||||
/// </summary>
|
||||
public enum KillMode : byte
|
||||
{
|
||||
Oldest, // 打断最早开始的
|
||||
Newest, // 打断最新开始的
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 混音分组
|
||||
/// </summary>
|
||||
public enum MixingType : byte
|
||||
{
|
||||
Sfx = 0,
|
||||
Music,
|
||||
Voice,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 声音容器类型
|
||||
/// </summary>
|
||||
public enum ContainerType : byte{
|
||||
Random = 0,
|
||||
Sequence,
|
||||
Blend,
|
||||
}
|
||||
|
||||
public enum BlendCrossFadeType : byte
|
||||
{
|
||||
Exponential = 0,
|
||||
Linear,
|
||||
Logarithmic,
|
||||
}
|
||||
|
||||
public enum AlignMode : byte
|
||||
{
|
||||
Immediate,
|
||||
Beat,
|
||||
Bar,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 游戏状态
|
||||
/// </summary>
|
||||
public enum GameState
|
||||
{
|
||||
Home,
|
||||
Game,
|
||||
Win,
|
||||
Lose,
|
||||
Guitar,
|
||||
Bass,
|
||||
}
|
||||
|
||||
public interface IBinarySerializable
|
||||
{
|
||||
void DeSerialize(BinaryReader reader);
|
||||
void Serialize(BinaryWriter writer);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e257121504141e794758c8e3832b1d4
|
||||
timeCreated: 1773130192
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* auto generated by tools(注意:千万不要手动修改本文件)
|
||||
* AudioGroup
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OCES.Audio
|
||||
{
|
||||
[Serializable]
|
||||
public partial class AudioGroup : IBinarySerializable
|
||||
{
|
||||
/// <summary>
|
||||
/// 唯一ID
|
||||
/// </summary>
|
||||
public uint Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组名
|
||||
/// </summary>
|
||||
public string Comment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 组发音数限制
|
||||
/// </summary>
|
||||
public ushort GroupThrottleCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打断模式
|
||||
/// 0 = 打断最早
|
||||
/// 1 = 打断最新
|
||||
/// </summary>
|
||||
public KillMode KillMode { get; set; }
|
||||
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
Id = reader.ReadUInt32();
|
||||
Comment = reader.ReadString();
|
||||
GroupThrottleCount = reader.ReadUInt16();
|
||||
KillMode = (KillMode)reader.ReadByte();
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(Id);
|
||||
writer.Write(Comment);
|
||||
writer.Write(GroupThrottleCount);
|
||||
writer.Write((byte)KillMode);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public partial class AudioGroupConfig : IBinarySerializable
|
||||
{
|
||||
Dictionary<uint,AudioGroup> m_audioGroupInfos = new();
|
||||
List<AudioGroup> m_audioGroupInfoList;
|
||||
|
||||
public List<AudioGroup> AudioGroupList()
|
||||
{
|
||||
this.m_audioGroupInfoList ??= new List<AudioGroup>(m_audioGroupInfos.Values);
|
||||
return this.m_audioGroupInfoList;
|
||||
}
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
int count = reader.ReadInt32();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
AudioGroup tempData = new();
|
||||
tempData.DeSerialize(reader);
|
||||
this.m_audioGroupInfos.Add(tempData.Id, tempData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(this.m_audioGroupInfos.Count);
|
||||
foreach (AudioGroup audioGroup in this.m_audioGroupInfos.Values)
|
||||
{
|
||||
audioGroup.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public AudioGroup QueryById(uint id)
|
||||
{
|
||||
return this.m_audioGroupInfos.GetValueOrDefault(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02bb5bce772fe40b297d105a1c6908eb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 唯一ID
|
||||
/// </summary>
|
||||
public uint Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件名
|
||||
/// </summary>
|
||||
public List<string> Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Comment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始延迟
|
||||
/// 单位秒
|
||||
/// </summary>
|
||||
public float InitialDelay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// -1 = 无限循环
|
||||
/// 0 = 不循环
|
||||
/// >= 1 按次数循环
|
||||
/// </summary>
|
||||
public short LoopCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0 = SFX
|
||||
/// 1 = Muisc
|
||||
/// 2 = Voice
|
||||
/// </summary>
|
||||
public MixingType MixingType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发音分组
|
||||
/// </summary>
|
||||
public uint Group { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 同时发音数限制
|
||||
/// </summary>
|
||||
public ushort ThrottleCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小发音间隔
|
||||
/// </summary>
|
||||
public ushort MinInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 优先级
|
||||
/// </summary>
|
||||
public byte Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打断模式
|
||||
/// 0 = 打断最早
|
||||
/// 1 = 打断最新
|
||||
/// </summary>
|
||||
public KillMode KillMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pitch Step阈值 ms
|
||||
/// </summary>
|
||||
public uint PitchStepThreshold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 阶段变化半音数
|
||||
/// </summary>
|
||||
public sbyte PitchStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// step几步后就不再继续提升音高
|
||||
/// </summary>
|
||||
public byte PitchStepLimit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 相关的触感反馈ID
|
||||
/// </summary>
|
||||
public uint Haptic { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0 = 随机播放
|
||||
/// 1 = 顺序播放
|
||||
/// 2 = 混合播放
|
||||
/// </summary>
|
||||
public ContainerType ContainerType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0 = 步进
|
||||
/// 1 = 持续
|
||||
/// </summary>
|
||||
public bool ContainerPlayMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 按段落配置每段响应范围,用|分隔不同段落
|
||||
/// </summary>
|
||||
public string BlendRanges { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0 = 指数
|
||||
/// 1 = 线形
|
||||
/// 2 = 对数
|
||||
/// </summary>
|
||||
public BlendCrossFadeType BlendCrossFadeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 指定避免重复的次数
|
||||
/// </summary>
|
||||
public byte LimitRepetition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0 = Standard
|
||||
/// 1 = Shuffle
|
||||
/// </summary>
|
||||
public bool RandomType { get; set; }
|
||||
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
Id = reader.ReadUInt32();
|
||||
var nameCount = reader.ReadInt32();
|
||||
if (nameCount > 0)
|
||||
{
|
||||
Name = new List<string>();
|
||||
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);
|
||||
for (int i = 0; i < Name.Count; i++)
|
||||
{
|
||||
writer.Write(Name[i]);
|
||||
}
|
||||
}
|
||||
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<uint,AudioObject> m_audioObjectInfos = new();
|
||||
List<AudioObject> m_audioObjectInfoList;
|
||||
|
||||
public List<AudioObject> AudioObjectList()
|
||||
{
|
||||
this.m_audioObjectInfoList ??= new List<AudioObject>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46155e8c4d2274e68afd6cace56c6a1c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,572 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace OCES.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件操作类
|
||||
/// </summary>
|
||||
public static class FileManager
|
||||
{
|
||||
public static bool CreateDir(string dirPath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dirPath))
|
||||
return false;
|
||||
if (Directory.Exists(dirPath))
|
||||
{
|
||||
Directory.Delete(dirPath, true);
|
||||
}
|
||||
Directory.CreateDirectory(dirPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将数据写入二进制文件
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="data">继承自IBinarySerialize的数据</param>
|
||||
public static bool WriteBinaryDataToFile(string filePath, IBinarySerializable data)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
return false;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
using (var fileStream = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
using (var bw = new BinaryWriter(fileStream))
|
||||
{
|
||||
data.Serialize(bw);
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
}
|
||||
fileStream.Close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将数据写入二进制文件
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="datas">类型(小写)和value的字符串键值对</param>
|
||||
/// <returns></returns>
|
||||
public static bool WriteBinaryDatasToFile(string filePath, List<Tuple<string, string>> datas)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
return false;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
using (var fileStream = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
using (var bw = new BinaryWriter(fileStream))
|
||||
{
|
||||
foreach (var data in datas)
|
||||
{
|
||||
if (data.Item1.Equals("int"))
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.Item2))
|
||||
{
|
||||
bw.Write(Convert.ToInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write(Convert.ToInt32(data.Item2));
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("uint"))
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.Item2))
|
||||
{
|
||||
bw.Write(Convert.ToUInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write(Convert.ToUInt32(data.Item2));
|
||||
}
|
||||
}else if (data.Item1.Equals("short"))
|
||||
{
|
||||
bw.Write(string.IsNullOrEmpty(data.Item2) ? Convert.ToInt16(0) : Convert.ToInt16(data.Item2));
|
||||
}
|
||||
else if (data.Item1.Equals("ushort"))
|
||||
{
|
||||
bw.Write(string.IsNullOrEmpty(data.Item2) ? Convert.ToUInt16(0) : Convert.ToUInt16(data.Item2));
|
||||
}
|
||||
else if (data.Item1.Equals("sbyte"))
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.Item2))
|
||||
{
|
||||
bw.Write(Convert.ToSByte(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write(Convert.ToSByte(data.Item2));
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("byte"))
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.Item2))
|
||||
{
|
||||
bw.Write(Convert.ToByte(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write(Convert.ToByte(data.Item2));
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("bool"))
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.Item2))
|
||||
{
|
||||
bw.Write(Convert.ToBoolean(false));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write(Convert.ToBoolean(data.Item2));
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("float"))
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.Item2))
|
||||
{
|
||||
bw.Write(Convert.ToSingle(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write(Convert.ToSingle(data.Item2));
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("double"))
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.Item2))
|
||||
{
|
||||
bw.Write(Convert.ToDouble(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write(Convert.ToDouble(data.Item2));
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("string"))
|
||||
{
|
||||
bw.Write(string.IsNullOrEmpty(data.Item2) ? "" : data.Item2.ToString());
|
||||
}
|
||||
else if (data.Item1.Equals("long"))
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.Item2))
|
||||
{
|
||||
bw.Write(Convert.ToInt64(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write(Convert.ToInt64(data.Item2));
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("vector"))
|
||||
{
|
||||
//[1.2,3.4,5.6]
|
||||
var str = data.Item2.ToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
bw.Write(Convert.ToInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
str = str.Replace("]", "").Replace("[", "");
|
||||
var numStrs = str.Split(',');
|
||||
int vectorCount = 3;
|
||||
bw.Write(vectorCount);
|
||||
for (int i = 0; i < vectorCount; i++)
|
||||
{
|
||||
float v = Convert.ToSingle(numStrs[i]);
|
||||
bw.Write(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("vectorlist")) //List<Vector>类型
|
||||
{
|
||||
//[[1.2,3.4,5.6],[2.2,3.4,5.6],[3.2,3.4,5.6]]
|
||||
string str = data.Item2.ToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
bw.Write(Convert.ToInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
str = str.Replace("]", "").Replace("[", "");
|
||||
var numStrs = str.Split(',');
|
||||
bw.Write(Convert.ToInt32(numStrs.Length / 3));
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
if (i % 3 == 0)
|
||||
bw.Write(Convert.ToInt32(3));
|
||||
bw.Write(Convert.ToSingle(numStrs[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("intlist"))
|
||||
{
|
||||
string str = data.Item2.ToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
bw.Write(Convert.ToInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
var numStrs = str.Split(',');
|
||||
bw.Write(numStrs.Length);
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToInt32(numStrs[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("floatlist"))
|
||||
{
|
||||
string str = data.Item2.ToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
bw.Write(Convert.ToInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
var numStrs = str.Split(',');
|
||||
bw.Write(numStrs.Length);
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToSingle(numStrs[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("boollist"))
|
||||
{
|
||||
string str = data.Item2.ToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
bw.Write(Convert.ToInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
var numStrs = str.Split(',');
|
||||
bw.Write(numStrs.Length);
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToBoolean(numStrs[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("stringlist"))
|
||||
{
|
||||
string str = data.Item2.ToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
bw.Write(Convert.ToInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
var numStrs = str.Split(',');
|
||||
bw.Write(numStrs.Length);
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(numStrs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Equals("longlist"))
|
||||
{
|
||||
string str = data.Item2.ToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
bw.Write(Convert.ToInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
var numStrs = str.Split(',');
|
||||
bw.Write(numStrs.Length);
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToInt64(numStrs[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.Item1.Contains("list<")) //泛型数组类型
|
||||
{
|
||||
string str = data.Item2.ToString();
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
bw.Write(Convert.ToInt32(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
var numStrs = str.Split(',');
|
||||
bw.Write(numStrs.Length);
|
||||
var tempS = data.Item1.Substring(5);
|
||||
var listType = tempS.Substring(0, tempS.Length - 1);
|
||||
if (listType.Equals("int"))
|
||||
{
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToInt32(numStrs[i]));
|
||||
}
|
||||
}
|
||||
else if (listType.Equals("uint"))
|
||||
{
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToUInt32(numStrs[i]));
|
||||
}
|
||||
}
|
||||
else if (listType.Equals("short"))
|
||||
{
|
||||
foreach (string t in numStrs)
|
||||
{
|
||||
bw.Write(Convert.ToInt16(t));
|
||||
}
|
||||
}
|
||||
else if (listType.Equals("ushort"))
|
||||
{
|
||||
foreach (string t in numStrs)
|
||||
{
|
||||
bw.Write(Convert.ToUInt16(t));
|
||||
}
|
||||
}
|
||||
else if (listType.Equals("sbyte"))
|
||||
{
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToSByte(numStrs[i]));
|
||||
}
|
||||
}
|
||||
else if (listType.Equals("byte"))
|
||||
{
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToByte(numStrs[i]));
|
||||
}
|
||||
}
|
||||
else if (listType.Equals("bool"))
|
||||
{
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToBoolean(numStrs[i]));
|
||||
}
|
||||
}
|
||||
else if (listType.Equals("float"))
|
||||
{
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToSingle(numStrs[i]));
|
||||
}
|
||||
}
|
||||
else if (listType.Equals("long"))
|
||||
{
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToInt64(numStrs[i]));
|
||||
}
|
||||
}
|
||||
else if (listType.Equals("string"))
|
||||
{
|
||||
for (int i = 0; i < numStrs.Length; i++)
|
||||
{
|
||||
bw.Write(Convert.ToString(numStrs[i]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("数组类型List<T>,T不是支持的Int,Float,String这三种类型,需要扩展类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"写入二进制文件,数据类型{data.Item1}没有适配");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
}
|
||||
fileStream.Close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError(ex.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从内存流中读取二进制
|
||||
/// </summary>
|
||||
/// <param name="bytes"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ReadBinaryDataFromBytes(byte[] bytes, ref IBinarySerializable data)
|
||||
{
|
||||
if (bytes == null)
|
||||
return false;
|
||||
using (var memoryStream = new MemoryStream(bytes))
|
||||
{
|
||||
using (var br = new BinaryReader(memoryStream))
|
||||
{
|
||||
data.DeSerialize(br);
|
||||
br.Close();
|
||||
}
|
||||
memoryStream.Close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取二进制文件
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ReadBinaryDataFromFile(string filePath, ref IBinarySerializable data)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using (var fileStream = new FileStream(filePath, FileMode.Open))
|
||||
{
|
||||
using (var br = new BinaryReader(fileStream))
|
||||
{
|
||||
data.DeSerialize(br);
|
||||
br.Close();
|
||||
}
|
||||
fileStream.Close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool WriteBytesToFile(string filePath, byte[] data)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
return false;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
var file = new FileInfo(filePath);
|
||||
using (Stream sw = file.Create())
|
||||
{
|
||||
sw.Write(data, 0, data.Length);
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将字符串写入文件
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public static bool WriteToFile(string filePath, string context)
|
||||
{
|
||||
return WriteToFile(filePath, context, Encoding.Default);
|
||||
}
|
||||
|
||||
public static bool WriteToFile(string filePath, string context, Encoding encoding)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
return false;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
var data = encoding.GetBytes(context);
|
||||
fs.Write(data, 0, data.Length);
|
||||
fs.Flush();
|
||||
fs.Close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按行读取
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReadAllByLine(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path) || !File.Exists(path))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
using (StreamReader sr = new StreamReader(path, Encoding.Default))
|
||||
{
|
||||
string line;
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
{
|
||||
sb.AppendLine(line);
|
||||
}
|
||||
sr.Close();
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static byte[] ReadAllBytes(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path) || !File.Exists(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return File.ReadAllBytes(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改文件内容
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="normalStr"></param>
|
||||
/// <param name="newStr"></param>
|
||||
public static void ReplaceContent(string path, string normalStr, string newStr)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path) || !File.Exists(path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
string strContent = File.ReadAllText(path);
|
||||
strContent = strContent.Replace(normalStr, newStr);
|
||||
File.WriteAllText(path, strContent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量修改文件内容
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="newStr"></param>
|
||||
/// <param name="normalStrs"></param>
|
||||
public static void ReplaceContent(string path, string newStr, params string[] normalStrs)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path) || !File.Exists(path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
string strContent = File.ReadAllText(path);
|
||||
for (int i = 0; i < normalStrs.Length; i++)
|
||||
{
|
||||
strContent = strContent.Replace(normalStrs[i], newStr);
|
||||
}
|
||||
File.WriteAllText(path, strContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d01f74514b28e47a185705e32b9fa967
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* auto generated by tools(注意:千万不要手动修改本文件)
|
||||
* MusicContainer
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OCES.Audio
|
||||
{
|
||||
[Serializable]
|
||||
public partial class MusicContainer : IBinarySerializable
|
||||
{
|
||||
/// <summary>
|
||||
/// 一定不要出现循环
|
||||
/// </summary>
|
||||
public uint Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 1000000以下的是musicId 以上的是ContainerId
|
||||
/// </summary>
|
||||
public List<uint> Segments { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0 = 随机播放
|
||||
/// 1 = 顺序播放
|
||||
/// 2 = 同时播放
|
||||
/// </summary>
|
||||
public ContainerType ContainerType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0 = 步进
|
||||
/// 1 = 持续
|
||||
/// </summary>
|
||||
public bool ContainerPlayMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sequence: 间隔时间(s)
|
||||
/// </summary>
|
||||
public ushort StrategyParam { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// -1 = 无限循环
|
||||
/// 0 = 不循环
|
||||
/// >= 1 按次数循环
|
||||
/// </summary>
|
||||
public short LoopCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 速度
|
||||
/// 可以是小数
|
||||
/// </summary>
|
||||
public float Bpm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拍号
|
||||
/// 采用德国体系定义
|
||||
/// </summary>
|
||||
public string TimeSig { get; set; }
|
||||
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
Id = reader.ReadUInt32();
|
||||
var segmentsCount = reader.ReadInt32();
|
||||
if (segmentsCount > 0)
|
||||
{
|
||||
Segments = new List<uint>();
|
||||
for (int i = 0; i < segmentsCount; i++)
|
||||
{
|
||||
Segments.Add(reader.ReadUInt32());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Segments = null;
|
||||
}
|
||||
ContainerType = (ContainerType)reader.ReadByte();
|
||||
ContainerPlayMode = reader.ReadBoolean();
|
||||
StrategyParam = reader.ReadUInt16();
|
||||
LoopCount = reader.ReadInt16();
|
||||
Bpm = reader.ReadSingle();
|
||||
TimeSig = reader.ReadString();
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(Id);
|
||||
if (Segments == null || Segments.Count == 0)
|
||||
{
|
||||
writer.Write(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(Segments.Count);
|
||||
for (int i = 0; i < Segments.Count; i++)
|
||||
{
|
||||
writer.Write(Segments[i]);
|
||||
}
|
||||
}
|
||||
writer.Write((byte)ContainerType);
|
||||
writer.Write(ContainerPlayMode);
|
||||
writer.Write(StrategyParam);
|
||||
writer.Write(LoopCount);
|
||||
writer.Write(Bpm);
|
||||
writer.Write(TimeSig);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public partial class MusicContainerConfig : IBinarySerializable
|
||||
{
|
||||
Dictionary<uint,MusicContainer> m_musicContainerInfos = new();
|
||||
List<MusicContainer> m_musicContainerInfoList;
|
||||
|
||||
public List<MusicContainer> MusicContainerList()
|
||||
{
|
||||
this.m_musicContainerInfoList ??= new List<MusicContainer>(m_musicContainerInfos.Values);
|
||||
return this.m_musicContainerInfoList;
|
||||
}
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
int count = reader.ReadInt32();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
MusicContainer tempData = new();
|
||||
tempData.DeSerialize(reader);
|
||||
this.m_musicContainerInfos.Add(tempData.Id, tempData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(this.m_musicContainerInfos.Count);
|
||||
foreach (MusicContainer musicContainer in this.m_musicContainerInfos.Values)
|
||||
{
|
||||
musicContainer.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public MusicContainer QueryById(uint id)
|
||||
{
|
||||
return this.m_musicContainerInfos.GetValueOrDefault(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2999fe859bb9f448aa87bbe6495ce7aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d4ef279e344b4e9eafc0b9a32edf771
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea0ddf81033174975af33f019e7ae168
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* auto generated by tools(注意:千万不要手动修改本文件)
|
||||
* MusicTransition
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OCES.Audio
|
||||
{
|
||||
[Serializable]
|
||||
public partial class MusicTransition : IBinarySerializable
|
||||
{
|
||||
/// <summary>
|
||||
/// FromPathId x 1000 + ToPathId
|
||||
/// </summary>
|
||||
public uint Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 淡出总时长(s)
|
||||
/// </summary>
|
||||
public float FadeOutTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// source的段尾偏移量(s)
|
||||
/// </summary>
|
||||
public float FadeOutOffset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 淡入总时长(s)
|
||||
/// </summary>
|
||||
public float FadeInTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Destination段首偏移量(s)
|
||||
/// </summary>
|
||||
public float FadeInOffset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0 = 立即切换
|
||||
/// 1 = 拍
|
||||
/// 2 = 小节
|
||||
/// </summary>
|
||||
public AlignMode AlignMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public uint Segment { get; set; }
|
||||
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
Id = reader.ReadUInt32();
|
||||
FadeOutTime = reader.ReadSingle();
|
||||
FadeOutOffset = reader.ReadSingle();
|
||||
FadeInTime = reader.ReadSingle();
|
||||
FadeInOffset = reader.ReadSingle();
|
||||
AlignMode = (AlignMode)reader.ReadByte();
|
||||
Segment = reader.ReadUInt32();
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(Id);
|
||||
writer.Write(FadeOutTime);
|
||||
writer.Write(FadeOutOffset);
|
||||
writer.Write(FadeInTime);
|
||||
writer.Write(FadeInOffset);
|
||||
writer.Write((byte)AlignMode);
|
||||
writer.Write(Segment);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public partial class MusicTransitionConfig : IBinarySerializable
|
||||
{
|
||||
Dictionary<uint,MusicTransition> m_musicTransitionInfos = new();
|
||||
List<MusicTransition> m_musicTransitionInfoList;
|
||||
|
||||
public List<MusicTransition> MusicTransitionList()
|
||||
{
|
||||
this.m_musicTransitionInfoList ??= new List<MusicTransition>(m_musicTransitionInfos.Values);
|
||||
return this.m_musicTransitionInfoList;
|
||||
}
|
||||
|
||||
public void DeSerialize(BinaryReader reader)
|
||||
{
|
||||
int count = reader.ReadInt32();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
MusicTransition tempData = new();
|
||||
tempData.DeSerialize(reader);
|
||||
this.m_musicTransitionInfos.Add(tempData.Id, tempData);
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(this.m_musicTransitionInfos.Count);
|
||||
foreach (MusicTransition musicTransition in this.m_musicTransitionInfos.Values)
|
||||
{
|
||||
musicTransition.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public MusicTransition QueryById(uint id)
|
||||
{
|
||||
return this.m_musicTransitionInfos.GetValueOrDefault(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00cf01c892e674363bb452327ec87e00
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user