您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
43 行
908 B
43 行
908 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
#endif
|
|
|
|
[System.Serializable]
|
|
public class WeakSoundDef : Weak<SoundDef>
|
|
{
|
|
public bool IsValid() { return guid != ""; }
|
|
}
|
|
|
|
[CreateAssetMenu(fileName = "Sound", menuName = "A2/Audio/SoundBank", order = 10000)]
|
|
public class SoundBank : ScriptableObject
|
|
{
|
|
public List<SoundDef> soundDefs;
|
|
|
|
public List<string> soundDefGuids;
|
|
|
|
public SoundDef FindByName(string name)
|
|
{
|
|
foreach (var s in soundDefs)
|
|
{
|
|
if (s.name == name)
|
|
return s;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
void OnValidate()
|
|
{
|
|
soundDefGuids.Clear();
|
|
foreach (var s in soundDefs)
|
|
{
|
|
var p = AssetDatabase.GetAssetPath(s);
|
|
soundDefGuids.Add(AssetDatabase.AssetPathToGUID(p));
|
|
}
|
|
}
|
|
|
|
#endif
|
|
}
|