Aetheria/Assets/Wwise/Editor/WwiseComponents/AkBankInspector.cs
Reinier Vens db8c3c7779 Initial Wwise Integration
Created wwise project
Integrated inventory UI sounds
Improved projectile weapon behavior (randomized start position, stopped them from self-destructing at target range when airburst is disabled)
2021-02-27 20:53:36 +00:00

61 lines
2.2 KiB
C#

#if UNITY_EDITOR
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
[UnityEditor.CanEditMultipleObjects]
[UnityEditor.CustomEditor(typeof(AkBank))]
public class AkBankInspector : AkBaseInspector
{
private readonly AkUnityEventHandlerInspector m_LoadBankEventHandlerInspector = new AkUnityEventHandlerInspector();
private readonly AkUnityEventHandlerInspector m_UnloadBankEventHandlerInspector = new AkUnityEventHandlerInspector();
private UnityEditor.SerializedProperty decode;
private UnityEditor.SerializedProperty loadAsync;
private UnityEditor.SerializedProperty saveDecoded;
private void OnEnable()
{
m_LoadBankEventHandlerInspector.Init(serializedObject, "triggerList", "Load On: ", false);
m_UnloadBankEventHandlerInspector.Init(serializedObject, "unloadTriggerList", "Unload On: ", false);
loadAsync = serializedObject.FindProperty("loadAsynchronous");
decode = serializedObject.FindProperty("decodeBank");
saveDecoded = serializedObject.FindProperty("saveDecodedBank");
}
public override void OnChildInspectorGUI()
{
m_LoadBankEventHandlerInspector.OnGUI();
m_UnloadBankEventHandlerInspector.OnGUI();
using (new UnityEditor.EditorGUILayout.VerticalScope("box"))
{
UnityEditor.EditorGUILayout.PropertyField(loadAsync, new UnityEngine.GUIContent("Asynchronous:"));
UnityEditor.EditorGUILayout.PropertyField(decode, new UnityEngine.GUIContent("Decode compressed data:"));
if (!decode.boolValue)
return;
var oldSaveDecodedValue = saveDecoded.boolValue;
UnityEditor.EditorGUILayout.PropertyField(saveDecoded, new UnityEngine.GUIContent("Save decoded bank:"));
if (!oldSaveDecodedValue || saveDecoded.boolValue)
return;
var bank = target as AkBank;
AkBasePathGetter.EvaluateGamePaths();
var decodedBankPath = System.IO.Path.Combine(AkBasePathGetter.DecodedBankFullPath, bank.data.Name + ".bnk");
try
{
System.IO.File.Delete(decodedBankPath);
}
catch (System.Exception e)
{
UnityEngine.Debug.Log("WwiseUnity: Could not delete existing decoded SoundBank. Please delete it manually. " + e);
}
}
}
}
#endif