From 380d9ec6048663b0e497e2437222d783236b864f Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Fri, 15 Jun 2018 09:58:24 +0200 Subject: Added Properties Class auto load last settings removed sound enumerable moved Sonds to properties moved Commands to properties --- DiscoBot/Audio/AudioModule.cs | 2 +- DiscoBot/Audio/Sound.cs | 21 +++++++++++++++++++++ DiscoBot/Audio/Soundeffects.cs | 26 +++++++++++++------------- DiscoBot/Audio/Voice.cs | 4 ++-- 4 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 DiscoBot/Audio/Sound.cs (limited to 'DiscoBot/Audio') diff --git a/DiscoBot/Audio/AudioModule.cs b/DiscoBot/Audio/AudioModule.cs index f2097b7..f8834f3 100644 --- a/DiscoBot/Audio/AudioModule.cs +++ b/DiscoBot/Audio/AudioModule.cs @@ -71,7 +71,7 @@ namespace DiscoBot.Audio await _service.SendAudioAsync(Context.Guild, Context.Channel, song); } - SoundEffects.Play(tSound); + SoundEffects.Play(song); } } } \ No newline at end of file diff --git a/DiscoBot/Audio/Sound.cs b/DiscoBot/Audio/Sound.cs new file mode 100644 index 0000000..174c076 --- /dev/null +++ b/DiscoBot/Audio/Sound.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiscoBot.Audio +{ + public class Sound + { + public Sound(string name, string url) + { + Name = name; + Url = url; + } + + public string Name { get; } + + public string Url { get; } + } +} diff --git a/DiscoBot/Audio/Soundeffects.cs b/DiscoBot/Audio/Soundeffects.cs index 1e6dda1..317d0ff 100644 --- a/DiscoBot/Audio/Soundeffects.cs +++ b/DiscoBot/Audio/Soundeffects.cs @@ -5,7 +5,7 @@ using DiscoBot.Commands; - public enum Sound + /*public enum Sound { Bell, Ding, @@ -17,45 +17,45 @@ Stupid, Police, Roblox - } + }*/ public static class SoundEffects { public static int Volume { get; set; } = 50; - public static void Play(Sound s) + public static void Play(string s) { string url = string.Empty; int volume = 255; switch (s) { - case Sound.Bell: - case Sound.Ding: + case "Bell": + case "Ding": url = "https://www.myinstants.com/media/sounds/boxing-bell.mp3"; break; - case Sound.Finish: + case "Finish": url = "https://www.myinstants.com/media/sounds/finishhim.swf.mp3"; break; - case Sound.Magic: + case "Magic": url = "https://www.myinstants.com/media/sounds/dream-harp-sound-effect.mp3"; break; - case Sound.Monsterkill: + case "Monsterkill": url = "https://www.myinstants.com/media/sounds/announcer_kill_monster_01.mp3"; break; - case Sound.Nooo: + case "Nooo": url = "https://www.myinstants.com/media/sounds/nooo.swf.mp3"; break; - case Sound.Roblox: + case "Roblox": url = "https://www.myinstants.com/media/sounds/roblox-death-sound_ytkBL7X.mp3"; break; - case Sound.Stupid: + case "Stupid": url = "https://www.myinstants.com/media/sounds/stupid_dum_03.mp3"; volume = 10; break; - case Sound.Police: + case "Police": url = "https://www.myinstants.com/media/sounds/sound-of-the-police.mp3"; break; - case Sound.Wrong: + case "Wrong": url = "https://www.myinstants.com/media/sounds/wrong-answer-sound-effect.mp3"; volume = 50; break; diff --git a/DiscoBot/Audio/Voice.cs b/DiscoBot/Audio/Voice.cs index 2c8f75e..5417560 100644 --- a/DiscoBot/Audio/Voice.cs +++ b/DiscoBot/Audio/Voice.cs @@ -66,7 +66,7 @@ if (Client != null) { - SoundEffects.Play(Sound.Nooo); + SoundEffects.Play("Nooo"); await Client.StopAsync(); Client = null; } @@ -105,7 +105,7 @@ await Task.Run(() => Voice.Send(path)); } - await Task.Run(() => SoundEffects.Play(tSound)); + await Task.Run(() => SoundEffects.Play(path)); } private static Process CreateStream(string path, int vol = 256) -- cgit v1.2.3-54-g00ecf