7 namespace HKI.Core.Audio.Editor
12 [CustomEditor(typeof(AudioSystem))]
16 const string useMusicAudioPlayerSPName =
"UseMusicAudioPlayer";
17 const string musicAudioPlayerSettingsSPName =
"MusicAudioPlayerSettings";
18 const string useAmbientAudioPlayerSPName =
"UseAmbientAudioPlayer";
19 const string ambientAudioPlayerSettingsSPName =
"AmbientAudioPlayerSettings";
20 const string useFxAudioPlayerSPName =
"UseFxAudioPlayer";
21 const string fxAudioPlayerSettingsSPName =
"FxAudioPlayerSettings";
22 const string useUiFxAudioPlayerSPName =
"UseUiFxAudioPlayer";
23 const string uiFxAudioPlayerSettingsSPName =
"UiFxAudioPlayerSettings";
24 const string useVoicesAudioPlayerSPName =
"UseVoicesAudioPlayer";
25 const string voicesAudioPlayerSettingsSPName =
"VoicesAudioPlayerSettings";
34 [MenuItem(
"HKI/Core/Subsystems/Audio System")]
52 if (!
string.IsNullOrEmpty(rootFolder))
55 if (
string.IsNullOrEmpty(folder))
57 folder =
EditorHelper.
GetFolderFromUser(
"Select folder for audio system to be saved in",
"The given path for the audio system is null or empty");
58 if (
string.IsNullOrEmpty(folder))
62 EditorUtility.DisplayProgressBar(
"Create audio system",
"Create audio system", 0.0f);
65 EditorUtility.DisplayProgressBar(
"Create audio system",
"Set settings", 0.5f);
67 SerializedObject audioSystemSO =
new SerializedObject(audioSystem);
69 audioSystemSO.Update();
73 string playlistFolder = folder +
"Playlist/";
76 audioMixer == null ? null : audioMixer.FindMatchingGroups(
"Master/Music")[0], null,
true);
79 audioMixer == null ? null : audioMixer.FindMatchingGroups(
"Master/Ambient")[0], null,
true);
82 audioMixer == null ? null : audioMixer.FindMatchingGroups(
"Master/Fx")[0], null,
true);
85 audioMixer == null ? null : audioMixer.FindMatchingGroups(
"Master/Ui Fx")[0], null,
true);
88 audioMixer == null ? null : audioMixer.FindMatchingGroups(
"Master/Voices")[0], FindAudioLanguage(),
true);
90 audioSystemSO.ApplyModifiedProperties();
92 EditorUtility.DisplayProgressBar(
"Create audio system",
"Create audio system", 1.0f);
97 Selection.activeObject = audioSystem;
99 EditorUtility.ClearProgressBar();
106 ambientAPS =
new ASEAudioPlayerSettingsEditor(serializedObject,
"ambient", useAmbientAudioPlayerSPName, ambientAudioPlayerSettingsSPName);
115 serializedObject.Update();
119 EditorGUILayout.Space();
123 EditorGUILayout.Space();
127 EditorGUILayout.Space();
131 EditorGUILayout.Space();
135 serializedObject.ApplyModifiedProperties();
140 string[] GUIDs = AssetDatabase.FindAssets(
"t:" + typeof(
Language).Name);
143 for (
int i = 0; i < GUIDs.Length; i++)
145 string assetPath = AssetDatabase.GUIDToAssetPath(GUIDs[i]);
146 Object[] objs = AssetDatabase.LoadAllAssetsAtPath(assetPath);
147 string filename =
"Audio Language";
148 foreach(Object obj
in objs)
150 if (obj.name == filename)
This ScriptableObject contains the data of a playlist for the AudioPlayer.
static void CreateAudioSystemMenu()
static void AddScriptableObjectToInitializer(ScriptableObject obj)
This function adds a scriptable object as a subasset to the initializer asset.
Custom inspector for the AudioSystem class.
static bool FindAndSelectIfExists(string filter, string fileEnding=".asset")
static void Setup(SerializedProperty property, AudioPlayer.AudioPlayerSettings.Playmodes playmode, float fadingTimeInSeconds, bool atSetupStartPlayingPlaylist, Playlist startPlaylist, AudioMixerGroup audioMixerGroup, Language localizationLanguage, bool dontGetDestroyedOnLoad)
This class containes helper functions for editor scripts.
static string GetFolderFromUser(string panelText, string errorMsg)
The AudioSystem is responsble of the creation and access of the general purpose AudioPlayers.
Special Variable enables the use of the SystemLanguage data type as a variable of the settings system...
This class contains the creation function of the menu for all HKI Core systems.
static Object FindAndLoad(string objectType, string fileEnding=".asset")
This is an extention of the SimpleAudioPlayer. It allows the automatic Setup of the SimpleAudioPlayer...
static Language FindAudioLanguage()
This class is for code seperation. It's for drawing the AudioPlayerSettings editor GUI...
override void OnInspectorGUI()
static void CreateAudioSystem(string rootFolder=null)
This function creates audio systems and all the other required assets like playlists for the HKI Core...