// Token: 0x06003FC9 RID: 16329 RVA: 0x001403EC File Offset: 0x0013E7EC private void OnEnable() { if (this.AudioSets.Count <= 0) { return; } this.audioSetDic = new Dictionary <int, PhysSoundAudioSet>(); foreach (PhysSoundAudioSet physSoundAudioSet in this.AudioSets) { if (this.audioSetDic.ContainsKey(physSoundAudioSet.Key)) { Debug.LogError(string.Concat(new string[] { "PhysSound Material ", base.name, " has duplicate audio set for Material Type \"", PhysSoundTypeList.GetKey(physSoundAudioSet.Key), "\". It will not be used during runtime." })); } else { this.audioSetDic.Add(physSoundAudioSet.Key, physSoundAudioSet); } } if (this.FallbackTypeIndex == 0) { this.FallbackTypeKey = -1; } else { this.FallbackTypeKey = this.AudioSets[this.FallbackTypeIndex - 1].Key; } }
// Token: 0x06003FCF RID: 16335 RVA: 0x00140860 File Offset: 0x0013EC60 public string[] GetFallbackAudioSets() { string[] array = new string[this.AudioSets.Count + 1]; array[0] = "None"; for (int i = 0; i < this.AudioSets.Count; i++) { array[i + 1] = PhysSoundTypeList.GetKey(this.AudioSets[i].Key); } return(array); }
/// <summary> /// Gets the list of audio set names. (Used by the editor to display the list of potential fallback audio sets). /// </summary> public string[] GetFallbackAudioSets() { string[] names = new string[AudioSets.Count + 1]; names[0] = "None"; for (int i = 0; i < AudioSets.Count; i++) { names[i + 1] = PhysSoundTypeList.GetKey(AudioSets[i].Key); } return(names); }
public override void OnInspectorGUI() { mat = target as PhysSoundMaterial; bool dupeFound = false; bool nullFound = false; pitchRand = serializedObject.FindProperty("PitchRandomness"); scaleMod = serializedObject.FindProperty("ScaleMod"); slidePitchMod = serializedObject.FindProperty("SlidePitchMod"); slideVolMult = serializedObject.FindProperty("SlideVolMultiplier"); useColVel = serializedObject.FindProperty("UseCollisionVelocity"); scImpVol = serializedObject.FindProperty("ScaleImpactVolume"); relVelThr = serializedObject.FindProperty("RelativeVelocityThreshold"); impNormBias = serializedObject.FindProperty("ImpactNormalBias"); collMask = serializedObject.FindProperty("CollisionMask"); serializedObject.Update(); EditorGUILayout.LabelField("General Properties:", EditorStyles.boldLabel); mat.MaterialTypeKey = EditorGUILayout.Popup("Material Type", mat.MaterialTypeKey, PhysSoundTypeList.PhysSoundTypes); EditorGUILayout.Separator(); EditorGUILayout.PropertyField(relVelThr, true); EditorGUILayout.Separator(); EditorGUILayout.PropertyField(pitchRand); EditorGUILayout.Slider(scaleMod, 0, 1, "Object Scale Mod"); EditorGUILayout.Slider(impNormBias, 0, 1, "Impact Normal Bias"); EditorGUILayout.Separator(); EditorGUILayout.PropertyField(slidePitchMod); EditorGUILayout.PropertyField(slideVolMult); EditorGUILayout.Separator(); EditorGUILayout.PropertyField(collMask); EditorGUILayout.Separator(); EditorGUILayout.PropertyField(useColVel); EditorGUILayout.PropertyField(scImpVol); EditorGUILayout.Separator(); GUILayout.Box("", GUILayout.MaxWidth(Screen.width - 25f), GUILayout.Height(dividerHeight)); EditorGUILayout.LabelField("Audio Sets:", EditorStyles.boldLabel); if (mat.AudioSets.Count == 0) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("The Audio Set List is Empty.", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } else { mat.FallbackTypeIndex = EditorGUILayout.Popup("Fallback Audio Set", mat.FallbackTypeIndex, mat.GetFallbackAudioSets()); if (mat.UseCollisionVelocity) { EditorGUILayout.HelpBox("You are using Collision Velocity. Remember that Impact clips must be ordered from least forceful to most forceful.", MessageType.Info); } EditorGUILayout.Separator(); audioSetFoldout.Update(mat.AudioSets.Count, false); impactsFoldout.Update(mat.AudioSets.Count, false); for (int i = 0; i < mat.AudioSets.Count; i++) { PhysSoundAudioSet aud = mat.AudioSets[i]; Color c = GUI.color; if (hasDuplicate(aud)) { dupeFound = true; GUI.color = new Color(1, 0.5f, 0.5f); } if (!PhysSoundTypeList.HasKey(aud.Key)) { nullFound = true; GUI.color = new Color(1, 0.5f, 0.5f); } EditorGUILayout.BeginHorizontal(); audioSetFoldout[i] = EditorGUILayout.Foldout(audioSetFoldout[i], "Material Type:"); GUILayout.Space(35); aud.Key = EditorGUILayout.Popup(aud.Key, PhysSoundTypeList.PhysSoundTypes); GUILayout.FlexibleSpace(); GUI.color = c * new Color(1, 1, 0.5f); if (GUILayout.Button("Remove", GUILayout.MaxWidth(75), GUILayout.MaxHeight(17))) { mat.AudioSets.RemoveAt(i); i--; continue; } GUI.color = c; EditorGUILayout.EndHorizontal(); if (audioSetFoldout[i]) { GUILayout.BeginVertical(EditorStyles.textField); GUILayout.Space(3); EditorGUI.indentLevel++; impactsFoldout[i] = EditorGUILayout.Foldout(impactsFoldout[i], "Impact Clips"); if (impactsFoldout[i]) { AudioClip newClip = null; newClip = EditorGUILayout.ObjectField("Add Clip", newClip, typeof(AudioClip), true) as AudioClip; if (newClip != null) { aud.Impacts.Add(newClip); } for (int j = 0; j < aud.Impacts.Count; j++) { GUILayout.BeginHorizontal(); aud.Impacts[j] = EditorGUILayout.ObjectField(aud.Impacts[j], typeof(AudioClip), true) as AudioClip; if (GUILayout.Button("X", GUILayout.MaxWidth(18), GUILayout.MaxHeight(15))) { aud.Impacts.RemoveAt(j); i--; } GUILayout.EndHorizontal(); } EditorGUILayout.Separator(); } EditorGUI.indentLevel--; aud.Slide = EditorGUILayout.ObjectField("Slide Clip", aud.Slide, typeof(AudioClip), true) as AudioClip; GUILayout.Space(3); GUILayout.EndVertical(); } GUILayout.Space(2); } } GUILayout.Space(2); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add New Audio Set", GUILayout.MaxWidth(150), GUILayout.Height(25))) { mat.AudioSets.Add(new PhysSoundAudioSet()); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); if (dupeFound) { EditorGUILayout.HelpBox("You have multiple Audio Sets with for the same Material Type! Any duplicate sets will not be used during runtime.", MessageType.Error); } if (nullFound) { EditorGUILayout.HelpBox("You have Audio Sets with invalid material types!", MessageType.Error); } EditorUtility.SetDirty(mat); serializedObject.ApplyModifiedProperties(); }
void OnEnable() { if (AudioSets.Count <= 0) { return; } audioSetDic = new Dictionary <int, PhysSoundAudioSet>(); foreach (PhysSoundAudioSet audSet in AudioSets) { if (audioSetDic.ContainsKey(audSet.Key)) { Debug.LogError("PhysSound Material " + name + " has duplicate audio set for Material Type \"" + PhysSoundTypeList.GetKey(audSet.Key) + "\". It will not be used during runtime."); continue; } audioSetDic.Add(audSet.Key, audSet); } if (FallbackTypeIndex == 0) { FallbackTypeKey = -1; } else { FallbackTypeKey = AudioSets[FallbackTypeIndex - 1].Key; } }
public override void OnInspectorGUI() { obj = target as PhysSoundObject; mat = serializedObject.FindProperty("SoundMaterial"); impactAudio = serializedObject.FindProperty("ImpactAudio"); autoCreate = serializedObject.FindProperty("AutoCreateSources"); serializedObject.Update(); EditorGUILayout.Separator(); EditorGUILayout.LabelField("PhysSound Material:", EditorStyles.boldLabel); EditorGUILayout.PropertyField(mat, true); if (obj.SoundMaterial == null) { EditorGUILayout.HelpBox("No PhysSound Material is assigned!", MessageType.Warning); serializedObject.ApplyModifiedProperties(); return; } if (obj.SoundMaterial.AudioSets.Count > 0) { //EditorGUILayout.Separator(); GUILayout.Box("", GUILayout.MaxWidth(Screen.width - 25f), GUILayout.Height(dividerHeight)); EditorGUILayout.LabelField("Audio Sources:", EditorStyles.boldLabel); EditorGUILayout.PropertyField(autoCreate); if (obj.AutoCreateSources) { EditorGUILayout.PropertyField(impactAudio, new GUIContent("Template Audio"), true); } else { EditorGUILayout.PropertyField(impactAudio, true); EditorGUILayout.Separator(); //Update the audio container list with new objects foreach (PhysSoundAudioSet audSet in obj.SoundMaterial.AudioSets) { if (!obj.HasAudioContainer(audSet.Key)) { obj.AddAudioContainer(audSet.Key); } } //Remove any audio containers that don't match with the material. for (int i = 0; i < obj.AudioContainers.Count; i++) { PhysSoundAudioContainer audCont = obj.AudioContainers[i]; if (!obj.SoundMaterial.HasAudioSet(audCont.KeyIndex)) { obj.RemoveAudioContainer(audCont.KeyIndex); i--; } audCont.SlideAudio = EditorGUILayout.ObjectField(PhysSoundTypeList.GetKey(audCont.KeyIndex) + " Slide Audio", audCont.SlideAudio, typeof(AudioSource), true) as AudioSource; } } } EditorGUILayout.Separator(); EditorUtility.SetDirty(obj); serializedObject.ApplyModifiedProperties(); }