public override Selectable FindSelectableOnLeft() { Selectable selectable = base.FindSelectableOnLeft(); if (selectable && Application.isPlaying) { AudioUI.PlayAudioSound(UIAudioStateEnum.OnScroll); } return(selectable); }
private void DrawSlider(Rect rect, AmbienceZone zone, AmbienceSource source) { float level = zone.GetLevel(source); float num = AudioUI.DrawHorizontalSlider(rect, 0f, 1f, 0f, level, AudioSliderType.Volume); if (level == num) { return; } if (zone.sources != null && zone.sources.Length > 0) { for (int i = 0; i < zone.sources.Length; i++) { if (zone.sources[i] == source) { if (num == 0f) { zone.sources[i] = zone.sources[zone.sources.Length - 1]; zone.volumes[i] = zone.volumes[zone.sources.Length - 1]; Array.Resize(ref zone.volumes, zone.sources.Length - 1); Array.Resize(ref zone.sources, zone.sources.Length - 1); } else { zone.volumes[i] = num; } if (activeAmbience.activeZone != null) { activeAmbience.TransitionToZone(activeAmbience.activeZone, 0.1f); } return; } } } if (zone.sources != null) { Array.Resize(ref zone.volumes, zone.sources.Length + 1); Array.Resize(ref zone.sources, zone.sources.Length + 1); } else { zone.volumes = new float[1]; zone.sources = new AmbienceSource[1]; } zone.sources[zone.sources.Length - 1] = source; zone.volumes[zone.sources.Length - 1] = num; if (activeAmbience.activeZone != null) { activeAmbience.TransitionToZone(activeAmbience.activeZone, 0.1f); } }
private void ShowReverbs() { soundScrollPos = GUILayout.BeginScrollView(soundScrollPos, GUILayout.Width(Screen.width)); for (int i = 0; i < activeReverb.zones.Length; i++) { ReverbZone reverbZone = activeReverb.zones[i]; Rect rect = GUILayoutUtility.GetRect(Screen.width, 0f); rect.height = 24f; if (ReverbManager.instance.zones.Contains(reverbZone)) { AudioUI.DrawRect(rect, new Color(0.5f, 0.25f, 0.25f, 1f)); } else if (i % 2 == 0) { AudioUI.DrawRect(rect, new Color(0.2f, 0.2f, 0.2f, 0.5f)); } else { AudioUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.5f)); } GUILayout.BeginHorizontal(GUILayout.Height(rect.height)); string name = reverbZone.name; GUILayout.Label(name, GUILayout.Width(200f)); GUILayout.Label("level", AudioUI.style, GUILayout.ExpandWidth(expand: false)); Rect rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); reverbZone.level = AudioUI.DrawHorizontalSlider(rect2, -48f, 12f, 0f, reverbZone.level, AudioSliderType.Level); GUILayout.Label("delay", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); reverbZone.delay = AudioUI.DrawHorizontalSlider(rect2, 0.1f, 3f, 0.5f, reverbZone.delay, AudioSliderType.Linear); GUILayout.Label("diffusion", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); reverbZone.diffusion = AudioUI.DrawHorizontalSlider(rect2, 0.01f, 1f, 0.5f, reverbZone.diffusion, AudioSliderType.Linear); GUILayout.Label("HP", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); reverbZone.highPass = AudioUI.DrawHorizontalSlider(rect2, 10f, 22000f, 10f, reverbZone.highPass, AudioSliderType.Log10); GUILayout.Label("LP", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); reverbZone.lowPass = AudioUI.DrawHorizontalSlider(rect2, 10f, 22000f, 22000f, reverbZone.lowPass, AudioSliderType.Log10); if (GUILayout.Button("C", GUILayout.Width(32f))) { clipboard = Reverb.Serialize(reverbZone); } if (GUILayout.Button("V", GUILayout.Width(32f)) && clipboard != null) { Reverb.Deserialize(reverbZone, clipboard); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); }
private void ShowCategories() { categoryScrollPos = GUILayout.BeginScrollView(categoryScrollPos, GUILayout.MinWidth(240f)); for (int i = 0; i < activeLibrary.library.categories.Count; i++) { SoundLibrary.SampleCategory sampleCategory = activeLibrary.library.categories[i]; Rect rect = GUILayoutUtility.GetRect(200f, 24f); AudioUI.DrawRect(rect, (sampleCategory != activeCategory) ? new Color(0.3f, 0.3f, 0.3f, 0.5f) : new Color(0f, 0.3f, 0f, 0.7f)); if (GUI.Toggle(rect, sampleCategory == activeCategory, sampleCategory.name)) { activeCategory = sampleCategory; } } GUILayout.EndScrollView(); }
private void DrawMixer(AmbienceZone zone, Func <AmbienceZone, float> get, Action <AmbienceZone, float> set) { Rect rect = GUILayoutUtility.GetRect(75f, 20f, GUILayout.ExpandWidth(expand: false)); float num = get(zone); float num2 = AudioUI.DrawHorizontalSlider(rect, -24f, 24f, 0f, get(zone), AudioSliderType.Level); if (num != num2) { set(zone, num2); if (activeAmbience.activeZone != null) { activeAmbience.TransitionToZone(activeAmbience.activeZone, 0.1f); } } }
public override void OnSubmit(BaseEventData eventData) { if (_useSound) { if (_useBackSound) { AudioUI.PlayAudioSound(UIAudioStateEnum.OnBack); } else { AudioUI.PlayAudioSound(UIAudioStateEnum.OnClick); } } OnComplexClick?.Invoke(_item); base.OnSubmit(eventData); }
public override Selectable FindSelectableOnDown() { Selectable selectable = base.FindSelectableOnDown(); if (selectable == null) { selectable = navigation.selectOnRight; } if (selectable != null && selectable.isActiveAndEnabled && selectable.GetComponent <RectTransform>().IsVisibleFrom()) { if (Application.isPlaying && useSound) { AudioUI.PlayAudioSound(UIAudioStateEnum.OnScroll); } return(selectable); } return(null); }
public override void OnPointerClick(PointerEventData eventData) { if (_useSound && interactable) { if (_useBackSound) { AudioUI.PlayAudioSound(UIAudioStateEnum.OnBack, _usePauseInSound); } else { AudioUI.PlayAudioSound(UIAudioStateEnum.OnClick, _usePauseInSound); } OnComplexClick?.Invoke(_item); } if (interactable) { base.OnPointerClick(eventData); } }
private void ShowSamples() { if (activeCategory == null) { return; } sampleScrollPos = GUILayout.BeginScrollView(sampleScrollPos, GUILayout.MinWidth(640f)); for (int i = 0; i < activeCategory.samples.Count; i++) { Rect rect = GUILayoutUtility.GetRect(600f, 0f); rect.height = 24f; if (i % 2 == 0) { AudioUI.DrawRect(rect, new Color(0.2f, 0.2f, 0.2f, 0.5f)); } else { AudioUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.5f)); } GUILayout.BeginHorizontal(GUILayout.Height(rect.height)); SoundLibrary.SerializedSample serializedSample = activeCategory.samples[i]; string text = serializedSample.name; if (serializedSample.isSwitch) { text = ((!serializedSample.isLoop) ? (text + " S") : (text + " SL")); } else if (serializedSample.isLoop) { text += " L"; } GUILayout.Label(text); GUILayout.Label("lvl", AudioUI.style, GUILayout.ExpandWidth(expand: false)); Rect rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 1f, serializedSample.vB, AudioSliderType.Volume); rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); serializedSample.vR = AudioUI.DrawHorizontalSlider(rect2, 0f, 24f, 0f, serializedSample.vR, AudioSliderType.Linear); GUILayout.Label("tune", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num2 = AudioUI.DrawHorizontalSlider(rect2, -2400f, 2400f, 1f, serializedSample.pB, AudioSliderType.Pitch); rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); serializedSample.pR = AudioUI.DrawHorizontalSlider(rect2, 0f, 2400f, 1f, serializedSample.pR, AudioSliderType.Linear); GUILayout.Label("xfade", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num3 = AudioUI.DrawHorizontalSlider(rect2, 10f, 5000f, 100f, serializedSample.crossFade * 1000f, AudioSliderType.Log2); if (serializedSample.crossFade * 1000f != num3) { serializedSample.crossFade = num3 / 1000f; } if (num != serializedSample.vB || num2 != serializedSample.pB) { serializedSample.vB = num; serializedSample.pB = num2; if (SoundManager.level != null) { SoundManager.level.RefreshSampleParameters(serializedSample); } if (SoundManager.main != null) { SoundManager.main.RefreshSampleParameters(serializedSample); } } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); }
private void Window(int id) { GUILayout.BeginHorizontal(); categoryScrollPos = GUILayout.BeginScrollView(categoryScrollPos, GUILayout.MinWidth(240f)); GUILayout.BeginVertical(); GUILayout.Label("Level Library"); for (int i = 0; i < SoundLibrary.level.library.categories.Count; i++) { SoundLibrary.SampleCategory sampleCategory = SoundLibrary.level.library.categories[i]; Rect rect = GUILayoutUtility.GetRect(200f, 24f); AudioUI.DrawRect(rect, (!(sampleCategory.name == pickCategoryName)) ? new Color(0.3f, 0.3f, 0.3f, 1f) : new Color(0f, 0.3f, 0f, 1f)); if (GUI.Toggle(rect, sampleCategory.name == pickCategoryName, sampleCategory.name)) { pickCategoryName = sampleCategory.name; pickLibrary = SoundLibrary.level; } } GUILayout.Label("Main Library"); for (int j = 0; j < SoundLibrary.main.library.categories.Count; j++) { SoundLibrary.SampleCategory sampleCategory2 = SoundLibrary.main.library.categories[j]; Rect rect2 = GUILayoutUtility.GetRect(200f, 24f); AudioUI.DrawRect(rect2, (!(sampleCategory2.name == pickCategoryName)) ? new Color(0.3f, 0.3f, 0.3f, 1f) : new Color(0f, 0.3f, 0f, 1f)); if (GUI.Toggle(rect2, sampleCategory2.name == pickCategoryName, sampleCategory2.name)) { pickCategoryName = sampleCategory2.name; pickLibrary = SoundLibrary.main; } } GUILayout.EndVertical(); GUILayout.EndScrollView(); sampleScrollPos = GUILayout.BeginScrollView(categoryScrollPos, GUILayout.MinWidth(240f)); GUILayout.BeginVertical(); SoundLibrary.SerializedSample serializedSample = null; if (pickLibrary != null) { for (int k = 0; k < pickLibrary.library.samples.Count; k++) { SoundLibrary.SerializedSample serializedSample2 = pickLibrary.library.samples[k]; if (!(serializedSample2.category != pickCategoryName)) { bool flag = pickSampleSound.master.sample == serializedSample2.name; Rect rect3 = GUILayoutUtility.GetRect(200f, 24f); AudioUI.DrawRect(rect3, (!flag) ? new Color(0.3f, 0.3f, 0.3f, 1f) : new Color(0f, 0.3f, 0f, 1f)); if (flag != GUI.Toggle(rect3, flag, serializedSample2.name)) { serializedSample = serializedSample2; } } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndHorizontal(); GUI.DragWindow(); if (serializedSample != null) { if (pickSampleSound.master.sample != serializedSample.name) { pickSampleSound.SetSample(serializedSample.name); } pickSampleSound = null; } }
private void OnGUI() { AudioUI.EnsureStyle(); GUILayout.BeginVertical(GUILayout.ExpandWidth(expand: true)); Rect rect = GUILayoutUtility.GetRect(Screen.width, 0f); rect.height = 32f; AudioUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.5f)); GUILayout.BeginHorizontal(GUILayout.Height(rect.height)); Rect rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); if (currentTab == Tab.Sounds) { AudioUI.DrawRect(rect2, new Color(0f, 0.3f, 0f, 0.7f)); } if (GUI.Toggle(rect2, currentTab == Tab.Sounds, "Sounds")) { currentTab = Tab.Sounds; } rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); if (currentTab == Tab.MenuSounds) { AudioUI.DrawRect(rect2, new Color(0f, 0.3f, 0f, 0.7f)); } if (GUI.Toggle(rect2, currentTab == Tab.MenuSounds, "Menu")) { currentTab = Tab.MenuSounds; } rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); if (currentTab == Tab.CharSounds) { AudioUI.DrawRect(rect2, new Color(0f, 0.3f, 0f, 0.7f)); } if (GUI.Toggle(rect2, currentTab == Tab.CharSounds, "Character")) { currentTab = Tab.CharSounds; } rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); if (currentTab == Tab.Ambience) { AudioUI.DrawRect(rect2, new Color(0f, 0.3f, 0f, 0.7f)); } if (GUI.Toggle(rect2, currentTab == Tab.Ambience, "Ambience")) { currentTab = Tab.Ambience; } rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); if (currentTab == Tab.Reverb) { AudioUI.DrawRect(rect2, new Color(0f, 0.3f, 0f, 0.7f)); } if (GUI.Toggle(rect2, currentTab == Tab.Reverb, "Reverb")) { currentTab = Tab.Reverb; } rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); if (currentTab == Tab.MainLibrary) { AudioUI.DrawRect(rect2, new Color(0f, 0.3f, 0f, 0.7f)); } if (GUI.Toggle(rect2, currentTab == Tab.MainLibrary, "MainSamples")) { currentTab = Tab.MainLibrary; } rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); if (currentTab == Tab.LevelLibrary) { AudioUI.DrawRect(rect2, new Color(0f, 0.3f, 0f, 0.7f)); } if (GUI.Toggle(rect2, currentTab == Tab.LevelLibrary, "Samples")) { currentTab = Tab.LevelLibrary; } rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); if (currentTab == Tab.Grain) { AudioUI.DrawRect(rect2, new Color(0f, 0.3f, 0f, 0.7f)); } if (GUI.Toggle(rect2, currentTab == Tab.Grain, "Grain")) { currentTab = Tab.Grain; } GUILayout.EndHorizontal(); switch (currentTab) { case Tab.Ambience: ambience.OnGUI(); break; case Tab.Reverb: reverb.OnGUI(); break; case Tab.LevelLibrary: library.OnGUI(); break; case Tab.MainLibrary: mainlibrary.OnGUI(); break; case Tab.Sounds: sounds.type = SoundManagerType.Level; sounds.OnGUI(); break; case Tab.MenuSounds: sounds.type = SoundManagerType.Menu; sounds.OnGUI(); break; case Tab.CharSounds: sounds.type = SoundManagerType.Character; sounds.OnGUI(); break; case Tab.Grain: grain.OnGUI(); break; default: throw new NotImplementedException(); } GUILayout.EndVertical(); picker.OnGUI(); }
private void ShowSounds(SoundManager activeSounds) { if (activeSounds == null) { return; } for (int i = 0; i < activeSounds.groups.Count; i++) { SoundManager.SoundGroup soundGroup = activeSounds.groups[i]; string text = soundGroup.name; if (string.IsNullOrEmpty(text)) { text = "none"; } bool flag = expandedGroups.Contains(text); if (flag != GUILayout.Toggle(flag, $"{text} ({soundGroup.sounds.Count})")) { if (!flag) { expandedGroups.Add(text); } else { expandedGroups.Remove(text); } } if (!flag) { continue; } for (int j = 0; j < soundGroup.sounds.Count; j++) { Rect rect = GUILayoutUtility.GetRect(Screen.width, 0f); rect.height = 24f; if (j % 2 == 0) { AudioUI.DrawRect(rect, new Color(0.2f, 0.2f, 0.2f, 0.5f)); } else { AudioUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.5f)); } GUILayout.BeginHorizontal(GUILayout.Height(rect.height)); SoundManager.SoundMaster soundMaster = soundGroup.sounds[j]; string name = soundMaster.master.name; bool flag2 = SoundManager.hasSolo && !soundMaster.isMuted; if (flag2 != GUILayout.Toggle(flag2, name, GUILayout.Width(200f))) { SoundManager.SoloSound(soundMaster, !flag2); } if (GUILayout.Button(soundMaster.master.sampleLabel, GUILayout.Width(200f))) { SamplePicker.pickSampleSound = soundMaster; if (soundMaster.master.soundSample != null) { SamplePicker.pickCategoryName = soundMaster.master.soundSample.category; } } GUILayout.Label("lvl", AudioUI.style, GUILayout.ExpandWidth(expand: false)); Rect rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 1f, soundMaster.master.baseVolume, AudioSliderType.Volume); if (num != soundMaster.master.baseVolume) { soundMaster.SetBaseVolume(num); } GUILayout.Label("tune", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num2 = AudioUI.DrawHorizontalSlider(rect2, -2400f, 2400f, 0f, soundMaster.master.basePitch, AudioSliderType.Pitch); if (num2 != soundMaster.master.basePitch) { soundMaster.SetBasePitch(num2); } GUILayout.Label("dist", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num3 = AudioUI.DrawHorizontalSlider(rect2, 10f, 300f, 30f, soundMaster.master.maxDistance, AudioSliderType.Log2); if (num3 != soundMaster.master.maxDistance) { soundMaster.SetMaxDistance(num3); soundMaster.ApplyAttenuation(); } GUILayout.Label("lp", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num4 = AudioUI.DrawHorizontalSlider(rect2, 1f, 30f, 2f, soundMaster.master.lpStart, AudioSliderType.Log2); if (num4 != soundMaster.master.lpStart) { soundMaster.SetLpStart(num4); soundMaster.ApplyAttenuation(); } rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num5 = AudioUI.DrawHorizontalSlider(rect2, 0.1f, 1f, 0.5f, soundMaster.master.lpPower, AudioSliderType.Linear); if (num5 != soundMaster.master.lpPower) { soundMaster.SetLpPower(num5); soundMaster.ApplyAttenuation(); } GUILayout.Label("att", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num6 = AudioUI.DrawHorizontalSlider(rect2, 1f, 30f, 1f, soundMaster.master.falloffStart, AudioSliderType.Log2); if (num6 != soundMaster.master.falloffStart) { soundMaster.SetFalloffStart(num6); soundMaster.ApplyAttenuation(); } rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num7 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0.5f, soundMaster.master.falloffPower, AudioSliderType.Linear); if (num7 != soundMaster.master.falloffPower) { soundMaster.SetFalloffPower(num7); soundMaster.ApplyAttenuation(); } GUILayout.Label("spread", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num8 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0.5f, soundMaster.master.spreadNear, AudioSliderType.Linear); if (num8 != soundMaster.master.spreadNear) { soundMaster.SetSpreadNear(num8); soundMaster.ApplyAttenuation(); } rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num9 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0f, soundMaster.master.spreadFar, AudioSliderType.Linear); if (num9 != soundMaster.master.spreadFar) { soundMaster.SetSpreadFar(num9); soundMaster.ApplyAttenuation(); } GUILayout.Label("3d", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num10 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0.5f, soundMaster.master.spatialNear, AudioSliderType.Linear); if (num10 != soundMaster.master.spatialNear) { soundMaster.SetSpatialNear(num10); soundMaster.ApplyAttenuation(); } if (GUILayout.Button("C", GUILayout.Width(32f))) { clipboard = SoundManager.Serialize(soundMaster); } if (GUILayout.Button("V", GUILayout.Width(32f)) && clipboard != null) { SoundManager.Deserialize(soundMaster, clipboard, pasteSample: false); } if (GUILayout.Button("S", GUILayout.Width(32f)) && clipboard != null) { SoundManager.Deserialize(soundMaster, clipboard, pasteSample: true); } bool flag3 = SoundManager.main.state.GetSoundState(soundMaster.master.fullName) != null; if (!flag3 && !soundMaster.master.useMaster && GUILayout.Button("Create Master", GUILayout.ExpandWidth(expand: false))) { soundMaster.SetUseMaster(useMaster: true); } else if ((flag3 || soundMaster.master.useMaster) && soundMaster.master.useMaster != GUILayout.Toggle(soundMaster.master.useMaster, "Master", GUILayout.ExpandWidth(expand: false))) { soundMaster.SetUseMaster(!soundMaster.master.useMaster); if (soundMaster.master.useMaster) { SoundManager.SoundState soundState = SoundManager.main.state.GetSoundState(soundMaster.master.fullName); if (soundState != null) { SoundManager.Deserialize(soundMaster, soundState, pasteSample: true); } SoundManager.GrainState grainState = SoundManager.main.state.GetGrainState(soundMaster.master.fullName); if (grainState != null) { SoundManager.Deserialize(soundMaster, grainState); } } } GUILayout.EndHorizontal(); } } }
public void OnGUI() { if (activeAmbience == null) { Rebuild(); } if (activeAmbience == null) { return; } if (GUILayout.Button("Save Ambience", GUILayout.Width(200f))) { activeAmbience.Save(); SoundManager.level.Save(saveMaster: true); } scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.Width(Screen.width)); GUILayout.BeginHorizontal(); GUILayoutUtility.GetRect(100f, 20f, GUILayout.ExpandWidth(expand: false)); for (int i = 0; i < sources.Length; i++) { Rect rect = GUILayoutUtility.GetRect(100f, 20f, GUILayout.ExpandWidth(expand: false)); if (sources[i].baseVolume * sources[i].rtVolume > 0f) { AudioUI.DrawRect(rect, new Color(0.5f, 0.25f, 0.25f, 1f)); } else { AudioUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.5f)); } GUI.Label(rect, sources[i].name); } GUILayout.EndHorizontal(); Rect rect2 = GUILayoutUtility.GetRect(600f, 0f); rect2.height = 20f; AudioUI.DrawRect(rect2, new Color(0.5f, 0.5f, 0.5f, 0.8f)); GUILayout.BeginHorizontal(GUILayout.Height(rect2.height)); GUILayoutUtility.GetRect(100f, 20f, GUILayout.ExpandWidth(expand: false)); for (int j = 0; j < sources.Length; j++) { Rect rect3 = GUILayoutUtility.GetRect(100f, 20f, GUILayout.ExpandWidth(expand: false)); if (GUI.Button(rect3, sources[j].sampleLabel, AudioUI.buttonStyle)) { SoundManager.SoundMaster soundMaster = SamplePicker.pickSampleSound = SoundManager.level.GetMaster(sources[j]); if (soundMaster.master.soundSample != null) { SamplePicker.pickCategoryName = soundMaster.master.soundSample.category; } } } GUILayout.Label(string.Empty, GUILayout.Width(100f), GUILayout.ExpandWidth(expand: false)); GUILayout.Label("Verb", GUILayout.Width(75f), GUILayout.ExpandWidth(expand: false)); GUILayout.Label("Music", GUILayout.Width(75f), GUILayout.ExpandWidth(expand: false)); GUILayout.Label("Ambience", GUILayout.Width(75f), GUILayout.ExpandWidth(expand: false)); GUILayout.Label("Effects", GUILayout.Width(75f), GUILayout.ExpandWidth(expand: false)); GUILayout.Label("Physics", GUILayout.Width(75f), GUILayout.ExpandWidth(expand: false)); GUILayout.Label("Character", GUILayout.Width(75f), GUILayout.ExpandWidth(expand: false)); GUILayout.Label("AmbienceFx", GUILayout.Width(75f), GUILayout.ExpandWidth(expand: false)); GUILayout.EndHorizontal(); for (int k = 0; k < zones.Length; k++) { rect2 = GUILayoutUtility.GetRect(600f, 0f); rect2.height = 20f; if (k % 2 == 0) { AudioUI.DrawRect(rect2, new Color(0.2f, 0.2f, 0.2f, 0.5f)); } else { AudioUI.DrawRect(rect2, new Color(0f, 0f, 0f, 0.5f)); } GUILayout.BeginHorizontal(GUILayout.Height(rect2.height)); int num = (k + 2) * 20; Rect rect4 = GUILayoutUtility.GetRect(100f, 20f, GUILayout.ExpandWidth(expand: false)); bool flag = activeAmbience.activeZone == zones[k]; if (flag) { AudioUI.DrawRect(rect4, new Color(0.5f, 0.25f, 0.25f, 1f)); } bool flag2 = flag & (activeAmbience.forcedZone != null); if (flag2 != GUI.Toggle(rect4, flag2, zones[k].name)) { if (!flag2) { activeAmbience.ForceZone(zones[k]); } else { activeAmbience.ForceZone(null); } } for (int l = 0; l < sources.Length; l++) { rect4 = GUILayoutUtility.GetRect(100f, 20f, GUILayout.ExpandWidth(expand: false)); DrawSlider(rect4, zones[k], sources[l]); } rect4 = GUILayoutUtility.GetRect(100f, 20f, GUILayout.ExpandWidth(expand: false)); GUI.Label(rect4, zones[k].name); DrawMixer(zones[k], (AmbienceZone zone) => zone.mainVerbLevel, delegate(AmbienceZone zone, float v) { zone.mainVerbLevel = v; }); DrawMixer(zones[k], (AmbienceZone zone) => zone.musicLevel, delegate(AmbienceZone zone, float v) { zone.musicLevel = v; }); DrawMixer(zones[k], (AmbienceZone zone) => zone.ambienceLevel, delegate(AmbienceZone zone, float v) { zone.ambienceLevel = v; }); DrawMixer(zones[k], (AmbienceZone zone) => zone.effectsLevel, delegate(AmbienceZone zone, float v) { zone.effectsLevel = v; }); DrawMixer(zones[k], (AmbienceZone zone) => zone.physicsLevel, delegate(AmbienceZone zone, float v) { zone.physicsLevel = v; }); DrawMixer(zones[k], (AmbienceZone zone) => zone.characterLevel, delegate(AmbienceZone zone, float v) { zone.characterLevel = v; }); DrawMixer(zones[k], (AmbienceZone zone) => zone.ambienceFxLevel, delegate(AmbienceZone zone, float v) { zone.ambienceFxLevel = v; }); GUILayout.Label("x", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect4 = GUILayoutUtility.GetRect(100f, 20f, GUILayout.ExpandWidth(expand: false)); float num2 = AudioUI.DrawHorizontalSlider(rect4, 500f, 10000f, 3000f, zones[k].transitionDuration * 1000f, AudioSliderType.Log2); if (num2 != zones[k].transitionDuration * 1000f) { zones[k].transitionDuration = num2 / 1000f; } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); }
private void Update() { //OnScroll(); if (!content || !pivot || items == null || !_isMovement) { return; } float currentPosition = GetRightAxis(content.anchoredPosition); _currentSpeed = Mathf.Abs(currentPosition - _pastPosition); _pastPosition = currentPosition; if (!_isStopping) { if (_isDrag || Mathf.Abs(_currentSpeed) >= maxSpeedForMagnetic) { float distance = Mathf.Infinity; int _pastIndex = _currentIndex; for (int i = 0; i < items.Count; i++) { var item = items[i]; if (item == null) { continue; } var aux = Mathf.Abs(GetRightAxis(pivot.position) - GetRightAxis(item.position)); if (aux < distance) { distance = aux; _currentIndex = i; } } if (_pastIndex != _currentIndex) { ScrollEvent(); AudioUI.PlayAudioSound(UIAudioStateEnum.OnScroll); } } float absoluteSpeed = Mathf.Abs(_currentSpeed); if (!_isDrag && absoluteSpeed < maxSpeedForMagnetic) { InitLerpMovement(); } } if (!_isDrag && _isStopping) { _currentTime += Time.unscaledDeltaTime; float valueLerp = Mathf.Clamp(_currentTime / timeForDeceleration, 0, 1); float newPosition = Mathf.Lerp(GetRightAxis(_initVectorLerp), _stopValue, valueLerp); content.anchoredPosition = _isVertical ? new Vector2(_initVectorLerp.x, newPosition) : new Vector2(newPosition, _initVectorLerp.y); if (newPosition == _stopValue && _currentIndex >= 0 && _currentIndex < items.Count) { FinishMovement(); } } }
private void ShowGrains() { soundScrollPos = GUILayout.BeginScrollView(soundScrollPos, GUILayout.Width(Screen.width)); int num = 0; for (int i = 0; i < activeSounds.sounds.Count; i++) { SoundManager.SoundMaster soundMaster = activeSounds.sounds[i]; Grain grain = soundMaster.master as Grain; if (grain == null) { continue; } Rect rect = GUILayoutUtility.GetRect(Screen.width, 0f); rect.height = 24f; if (num % 2 == 0) { AudioUI.DrawRect(rect, new Color(0.2f, 0.2f, 0.2f, 0.5f)); } else { AudioUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.5f)); } num++; GUILayout.BeginHorizontal(GUILayout.Height(rect.height)); string name = soundMaster.master.name; GUILayout.Label(name, GUILayout.Width(200f)); if (GUILayout.Button(soundMaster.master.sampleLabel, GUILayout.Width(200f))) { SamplePicker.pickSampleSound = soundMaster; if (soundMaster.master.soundSample != null) { SamplePicker.pickCategoryName = soundMaster.master.soundSample.category; } } GUILayout.Label("freq", AudioUI.style, GUILayout.ExpandWidth(expand: false)); Rect rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num2 = AudioUI.DrawHorizontalSlider(rect2, 0.5f, 50f, 30f, grain.frequencyAtMaxIntensity, AudioSliderType.Linear); if (num2 != grain.frequencyAtMaxIntensity) { soundMaster.SetGrainFrequency(num2); } GUILayout.Label("lvl", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num3 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0f, soundMaster.master.baseVolume, AudioSliderType.Volume); if (num3 != soundMaster.master.baseVolume) { soundMaster.SetBaseVolume(num3); } GUILayout.Label("slow", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); num3 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 1f, grain.slowVolume, AudioSliderType.Volume); if (num3 != grain.slowVolume) { soundMaster.SetGrainSlowVolume(num3); } GUILayout.Label("tune", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num4 = AudioUI.DrawHorizontalSlider(rect2, -2400f, 2400f, 1f, soundMaster.master.basePitch, AudioSliderType.Pitch); if (num4 != soundMaster.master.basePitch) { soundMaster.SetBasePitch(num4); } GUILayout.Label("slow", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); num4 = AudioUI.DrawHorizontalSlider(rect2, -2400f, 2400f, 1f, grain.slowPitch, AudioSliderType.Pitch); if (num4 != grain.slowPitch) { soundMaster.SetGrainSlowTune(num4); } GUILayout.Label("jitter", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num5 = AudioUI.DrawHorizontalSlider(rect2, 0f, 10f, 0f, grain.fastJitter, AudioSliderType.Linear); if (num5 != grain.fastJitter) { soundMaster.SetGrainFastJitter(num5); } GUILayout.Label("slow", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); num5 = AudioUI.DrawHorizontalSlider(rect2, 0f, 10f, 5f, grain.slowJitter, AudioSliderType.Linear); if (num5 != grain.slowJitter) { soundMaster.SetGrainSlowJitter(num5); } if (GUILayout.Button("C", GUILayout.Width(32f))) { clipFrequency = grain.frequencyAtMaxIntensity; clipVol = grain.baseVolume; clipSlowVol = grain.slowVolume; clipTune = grain.basePitch; clipSlowTune = grain.slowPitch; clipFastJitter = grain.fastJitter; clipSlowJitter = grain.slowJitter; } if (GUILayout.Button("V", GUILayout.Width(32f))) { soundMaster.SetGrainFrequency(clipFrequency); soundMaster.SetBaseVolume(clipVol); soundMaster.SetGrainSlowVolume(clipSlowVol); soundMaster.SetBasePitch(clipTune); soundMaster.SetGrainSlowTune(clipSlowTune); soundMaster.SetGrainFastJitter(clipFastJitter); soundMaster.SetGrainSlowJitter(clipSlowJitter); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); }