Wwise Audio Integration
This commit is contained in:
parent
e7e305e6a0
commit
7d67d7ec2c
72 changed files with 4551 additions and 11819 deletions
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.Mathematics;
|
||||
using UnityEditor;
|
||||
|
|
@ -110,7 +112,56 @@ public class ShapeInspector : BaseInspector<Shape>
|
|||
|
||||
public override Shape Inspect(string label, Shape value, object parent, DatabaseInspector inspectorWindow)
|
||||
{
|
||||
var hull = parent as HullData;
|
||||
if(value == null)
|
||||
{
|
||||
value = new Shape(1, 1);
|
||||
value[int2(0)] = true;
|
||||
}
|
||||
using (new VerticalScope())
|
||||
{
|
||||
using (new HorizontalScope())
|
||||
{
|
||||
GUILayout.Label(label, GUILayout.Width(width));
|
||||
GUILayout.Label("Size", GUILayout.ExpandWidth(false));
|
||||
GUILayout.Label("X", GUILayout.Width(labelWidth));
|
||||
value.Width = DelayedIntField(value.Width);
|
||||
GUILayout.Label("Y", GUILayout.Width(labelWidth));
|
||||
value.Height = DelayedIntField(value.Height);
|
||||
}
|
||||
|
||||
using (new HorizontalScope())
|
||||
{
|
||||
GUILayout.Label("", GUILayout.Width(width));
|
||||
using (new VerticalScope())
|
||||
{
|
||||
for (var y = value.Height - 1; y >= 0; y--)
|
||||
{
|
||||
using (new HorizontalScope())
|
||||
{
|
||||
for (var x = 0; x < value.Width; x++)
|
||||
{
|
||||
var oldColor = GUI.backgroundColor;
|
||||
value[int2(x, y)] = Toggle(value[int2(x, y)], GUILayout.Width(toggleWidth));
|
||||
GUI.backgroundColor = oldColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public class ShapeSchematicInspector : BaseInspector<Shape, InspectableSchematicShapeAttribute>
|
||||
{
|
||||
private Material _schematicMat = new Material(Shader.Find("Legacy Shaders/Particles/Additive"));
|
||||
|
||||
public override Shape Inspect(string label, Shape value, object parent, DatabaseInspector inspectorWindow, InspectableSchematicShapeAttribute attribute)
|
||||
{
|
||||
var item = parent as EquippableItemData;
|
||||
if(value == null)
|
||||
{
|
||||
value = new Shape(1, 1);
|
||||
|
|
@ -119,8 +170,8 @@ public class ShapeInspector : BaseInspector<Shape>
|
|||
using (new VerticalScope())
|
||||
{
|
||||
Texture2D schematic = null;
|
||||
if(hull != null && !string.IsNullOrEmpty(hull.Schematic))
|
||||
schematic = AssetDatabase.LoadAssetAtPath<Texture2D>(hull.Schematic);
|
||||
if(item != null && !string.IsNullOrEmpty(item.Schematic))
|
||||
schematic = AssetDatabase.LoadAssetAtPath<Texture2D>(item.Schematic);
|
||||
using (new HorizontalScope())
|
||||
{
|
||||
GUILayout.Label(label, GUILayout.Width(width));
|
||||
|
|
@ -158,7 +209,7 @@ public class ShapeInspector : BaseInspector<Shape>
|
|||
for (var x = 0; x < value.Width; x++)
|
||||
{
|
||||
var oldColor = GUI.backgroundColor;
|
||||
if(hull != null)
|
||||
if(item is HullData hull)
|
||||
{
|
||||
var hardpoint = hull.Hardpoints
|
||||
.FirstOrDefault(hp =>
|
||||
|
|
@ -180,4 +231,93 @@ public class ShapeInspector : BaseInspector<Shape>
|
|||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public class WwiseSoundBankInspector : BaseInspector<uint, InspectableSoundBankAttribute>
|
||||
{
|
||||
public override uint Inspect(string label, uint value, object parent, DatabaseInspector inspectorWindow, InspectableSoundBankAttribute attribute)
|
||||
{
|
||||
using (new HorizontalScope())
|
||||
{
|
||||
GUILayout.Label(label, GUILayout.Width(width));
|
||||
|
||||
var item = parent as EquippableItemData;
|
||||
if (item == null)
|
||||
{
|
||||
using (new HorizontalScope(GUI.skin.box))
|
||||
{
|
||||
GUILayout.Label("Unsupported Parent Type!");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<WwiseMetaSoundBank> soundBanks = ActionGameManager.SoundBanksInfo.SoundBanks;
|
||||
|
||||
if (item.Behaviors.Any(b => b is WeaponData))
|
||||
soundBanks = soundBanks.Where(s => s.GetEvent(WeaponAudioEvent.Fire) != null);
|
||||
|
||||
if (item.Behaviors.Any(b => b is ChargedWeaponData))
|
||||
soundBanks = soundBanks.Where(s => s.GetEvent(ChargedWeaponAudioEvent.Start) != null);
|
||||
|
||||
if (item.Behaviors.Any(b => b is ReactorData || b is ThrusterData || b is AetherDriveData))
|
||||
soundBanks = soundBanks.Where(s =>
|
||||
s.GetEvent(LoopingAudioEvent.Play) != null &&
|
||||
s.GetEvent(LoopingAudioEvent.Stop) != null &&
|
||||
s.GetParameter(SpecialAudioParameter.Intensity) != null);
|
||||
|
||||
var soundBanksArray = soundBanks.ToArray();
|
||||
|
||||
if (soundBanksArray.Length==0)
|
||||
{
|
||||
using (new HorizontalScope(GUI.skin.box))
|
||||
{
|
||||
GUILayout.Label("Sound bank not found!");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
var selected = Array.FindIndex(soundBanksArray, o=>o.Id==value);
|
||||
if (selected == -1) selected = 0;
|
||||
|
||||
value = soundBanksArray[Popup(selected, soundBanksArray.Select(p => p.ShortName).ToArray())].Id;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class WwiseParameterBindingInspector : BaseInspector<uint, InspectableAudioParameterAttribute>
|
||||
{
|
||||
public override uint Inspect(string label, uint value, object parent, DatabaseInspector inspectorWindow, InspectableAudioParameterAttribute attribute)
|
||||
{
|
||||
using (new HorizontalScope())
|
||||
{
|
||||
GUILayout.Label(label, GUILayout.Width(width));
|
||||
|
||||
var item = parent as EquippableItemData;
|
||||
if (item == null)
|
||||
{
|
||||
using (new HorizontalScope(GUI.skin.box))
|
||||
{
|
||||
GUILayout.Label("Unsupported Parent Type!");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
var soundbank = ActionGameManager.SoundBanksInfo.SoundBanks.FirstOrDefault(s => s.Id == item.SoundBank);
|
||||
if (soundbank == null)
|
||||
{
|
||||
using (new HorizontalScope(GUI.skin.box))
|
||||
{
|
||||
GUILayout.Label("Sound bank not found!");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
var selected = Array.FindIndex(soundbank.GameParameters, o=>o.Id==value);
|
||||
if (selected == -1) selected = 0;
|
||||
|
||||
value = soundbank.GameParameters[Popup(selected, soundbank.GameParameters.Select(p => p.Name).ToArray())].Id;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue