-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSoundGroup.cs
More file actions
61 lines (53 loc) · 2.21 KB
/
SoundGroup.cs
File metadata and controls
61 lines (53 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections.Generic;
using Newtonsoft.Json;
namespace CustomSound;
/// <summary>
/// 声音组数据模型类,用于存储一组相关的声音文件、文本和属性
/// </summary>
/// <remarks>
/// 此类用于从JSON配置文件中反序列化声音组数据,每个声音组包含:
/// <list type="number">
/// <item>名称(可选,用于标识和调试)</item>
/// <item>声音文件路径列表</item>
/// <item>气泡文本列表</item>
/// <item>声音传播半径</item>
/// </list>
/// </remarks>
class SoundGroup
{
/// <summary>
/// 声音组的名称,用于标识和调试(可选)
/// </summary>
/// <value>默认值为空字符串</value>
public string? Name { get; set; }
/// <summary>
/// 声音文件路径列表,存储该组所有可用的声音文件
/// </summary>
/// <value>默认值为空列表</value>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public List<string?> Sounds { get; set; } = [];
/// <summary>
/// 气泡文本列表,存储与该声音组关联的显示文本
/// </summary>
/// <value>默认值为空列表</value>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public List<string?> Texts { get; set; } = [];
/// <summary>
/// 声音类型,定义该组声音的类型
/// </summary>
/// <value>默认值为unknowNoise,表示未知噪声类型</value>
public string? SoundType { get; set; } // 声音类型,避免反序列化异常
public SoundTypes SoundTypeEnum { get; set; } = SoundTypes.unknowNoise; // 声音类型枚举,用于代码处理
/// <summary>
/// 声音传播半径,定义该组声音能传播的距离
/// </summary>
/// <value>默认值为15f,表示声音传播半径为15个单位</value>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public float Radius { get; set; } = 15f;
/// <summary>
/// 权重,定义该声音组的播放优先级或概率
/// </summary>
/// <value>默认值为-1,表示未设置,默认将由声音和文本的总数计算得到</value>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public int Weight { get; set; } = -1;
}