/*
 * 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>(this.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);
	}
}
}
